select()使用中对FD_SETSIZE考虑

/*
  malloc a fd_set on the heap, to make it dependent from FD_SETSIZE.
  make sure fd_count > FD_SETSIZE.
*/
#define NEW_FD_SET( fd_count ) \
        (struct fd_set*) malloc( sizeof( struct fd_set ) + sizeof( int ) * ( \
        fd_count - FD_SETSIZE > 0 ? fd_count - FD_SETSIZE : 0 ) )

posted @ 2011-02-09 17:17  lxgeek  阅读(1025)  评论(2编辑  收藏  举报