免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 13979 | 回复: 1
打印 上一主题 下一主题

[函数] 请问FD_SET,FD_ISSET这些函数是什么意思 [复制链接]

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
1 [报告]
发表于 2003-04-29 15:08 |显示全部楼层

请问FD_SET,FD_ISSET这些函数是什么意思

FD_SET 打开类型fd_set的某一位
FD_ZERO初始化fd_set
FD_ISSET测试结构fd_set中的描述字

论坛徽章:
1
荣誉版主
日期:2011-11-23 16:44:17
2 [报告]
发表于 2003-04-29 15:35 |显示全部楼层

请问FD_SET,FD_ISSET这些函数是什么意思

typedef int32_t __fd_mask;

#define _NFDBITS (sizeof(__fd_mask) *      /* 8 bits per byte */

#define __howmany(x,y)  (((x)+((y)-1))/(y))

#ifndef _FD_SET

#  define _FD_SET
   typedef struct __fd_set {
     long fds_bits[__howmany(FD_SETSIZE, (sizeof(long) * )];
     } fd_set;

#  ifndef _KERNEL
#    ifdef __cplusplus
        extern "C" {
#    endif /* __cplusplus */

#ifdef _INCLUDE_HPUX_SOURCE
#    define FD_SET(n,p)  (((__fd_mask *)((p)->;fds_bits))[(n)/_NFDBITS] |= (1 <<
((n) % _NFDBITS)))
#    define FD_CLR(n,p) (((__fd_mask *)((p)->;fds_bits))[(n)/_NFDBITS] &= ~(1 <<
((n) % _NFDBITS)))

#    define FD_ISSET(n,p) (((__fd_mask *)((p)->;fds_bits))[(n)/_NFDBITS] & (1 <<
((n) % _NFDBITS)))
#    define FD_ZERO(p)     memset((void *)(p), (int) 0, sizeof(*(p)))
#else
#    define FD_SET(n,p) (__fd_set1(n, p))
#    define FD_CLR(n,p) (__fd_clr(n, p))
#    define FD_ISSET(n,p) (__fd_isset(n, p))
#    define FD_ZERO(p)     memset((void *)(p), (int) 0, sizeof(fd_set))
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP