2009年9月25日 星期五

gettimeofday

struct timeval now, last;


正確用法:gettimeofday(&now, NULL);


錯誤:缺少參數,gettimeofday(&now); ,這會影響其他的timeval資料,可能會寫到 last 變數裡(寫入值可能是:20 FE FF FF)。

2009年9月24日 星期四

sizeof timeval

Tested:


sizeof(struct timeval) =16 bytes on CentOS 64-bit


sizeof(struct timeval) = 8 bytes on Fedora 9 32-bit

2009年9月22日 星期二

FreeBSD ipfw 欄位

FreeBSD ipfw column.



ipfw show



Index Packets Bytes Rule


----- ------- -------- ----------------------------------------------------------


00050 464266 61021795 count udp from any to any via 192.168.1.99


00051 56582 79785701 count tcp from 192.168.1.99 80 to any via 192.168.1.99


65533 3 144 count tcp from 192.168.1.95 to 192.168.1.99 dst-port 23 in



  • Packets: How many packets counted.

  • Bytes: How many bytes counted. (e.g. The index 65533, 20bytes(IP)+28bytes(TCP)=48bytes, 48*3=144bytes)

2009年9月19日 星期六

to increase PJSUA_MAX_CALLS, PJ_IOQUEUE_MAX_HANDLES

centos 5.3


compiling "pjproject-1.4": (PJSUA_MAX_CALLS, PJ_IOQUEUE_MAX_HANDLES)


cp pjproject-1.4/pjlib/include/pj/config_site.sample.h pjproject-1.4/pjlib/include/pj/config_site.h


vim pjproject-1.4/pjlib/include/pj/config_site.h


#define PJ_CONFIG_MAXIMUM_SPEED 1




Compiling Error:


PJ_IOQUEUE_MAX_HANDLES cannot be greater than FD_SETSIZE


/etc/security/limits.conf


* soft nofile 99999


* soft nofile 99999


[root@ip172 i686-pc-linux-gnu]# grep -R FD_SETSIZE /usr/include/* |grep 1024


/usr/include/bits/typesizes.h:#define __FD_SETSIZE 1024


/usr/include/linux/posix_types.h:#define __FD_SETSIZE 1024


/usr/include/valgrind/vki-linux.h:#define __VKI_FD_SETSIZE 1024




vim /usr/include/bits/typesizes.h


/usr/include/bits/typesizes.h:#define __FD_SETSIZE 10240