📄 select.h
字号:
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2001/09/26 10:21:50 $* $Source: M:/psisrc/stack/incl/rcs/select.h $* $Revision: 1.14 $*************************************************************************** File Description: Network select definitions***************************************************************************/#ifndef _SELECT_#define _SELECT_#include "config.h"#include "ccdep.h"#include "fns_mem.h"typedef struct sel { u16 se_inflags; /* input/request flags */ u16 se_outflags; /* output/reply flags */ i16 se_fd; /* holds process local file id */ i16 se_1reserved; /* reserved */ u32 se_user; /* user-definable value */ u32 se_2reserved; /* reserved */} sel;#define se_dev se_2reserved /* holds kernel file id within the kernel *//* switch needed to avoid def clashes in files that include rpc_typ.h */#ifndef __TYPES_RPC_HEADER__#define NFDBITS 32#define FD_SETSIZE ((MAX_SOCKETS) + 1)/* Berkeley type */typedef struct fd_set{ /* To handle more than 32 sockets we MUST have enough long words. */ u32 fds_bits[((FD_SETSIZE)/(NFDBITS) + 1)];} fd_set;#define FD_SET(n, p) ((p)->fds_bits[(n)/(NFDBITS)] |= (1 << ((n) % (NFDBITS))))#define FD_CLR(n, p) ((p)->fds_bits[(n)/(NFDBITS)] &= ~(1 << ((n) % (NFDBITS))))#define FD_ISSET(n, p) ((p)->fds_bits[(n)/(NFDBITS)] & (1 << ((n) % (NFDBITS))))#define FD_ZERO(p) OS_MEMSET((char *)(p), '\0', sizeof(*(p)))#endif/* * synchronous (via nselect) or asynchronous (via nselect or notify) * notification values. */#define READ_NOTIFY ((u16)0x1) /* read data available */#define WRITE_NOTIFY ((u16)0x2) /* write data space available */#define ACCEPT_NOTIFY ((u16)0x4) /* connection request awaits */#define CLOSE_NOTIFY ((u16)0x8) /* close down completed */#define CONNECT_NOTIFY ((u16)0x10) /* connection completed */#define EXCEPT_NOTIFY ((u16)0x20) /* exception has occurred */#define RSHUTDOWN_NOTIFY ((u16)0x40) /* read direction shutdown by peer */#define TIMEOUT_NOTIFY ((u16)0x80) /* request has timed out */#define WSHUTDOWN_NOTIFY ((u16)0x100) /* write direction shutdown by peer */#define URGENT_NOTIFY ((u16)0x200) /* urgent data available */#define OOB_NOTIFY ((u16)0x400) /* out of bounds data */#define NRCSHD_NOTIFY ((u16)0x800) /* NRC-reserved -- shutdown */#define SENDQFULL_NOTIFY ((u16)0x1000)#define SENDQEMPTY_NOTIFY ((u16)0x2000)/* The following is a special internal Fusion code -- not meant to be used by applications. */#define DEADMAN_NOTIFY ((u16)0x8000)/* everything except read and write -- mainly for other mask in select() */#define OTHER_NOTIFY ((u16)(~(READ_NOTIFY | WRITE_NOTIFY | SENDQEMPTY_NOTIFY)))typedef struct usel_t { u32 usel_1reserved; /* Reserved to NRC */ int (*usel_upfi)(struct usel_t *); u32 usel_user; /* user-defined value */ u32 usel_wait; /* time to wait */ u32 usel_rwait; /* time remaining */ i16 usel_cnt; /* # of sels */ i16 usel_hit; /* # of fd's with events pending */ u16 usel_errno; /* reason why request failed */ u16 usel_1pad; int (*usel_pfi)(struct sel * selp, int cnt, u32 time, void * arg);/* user pfi to call asynchronously */ void * usel_arg; /* argument to usel_pfi */ sel usel_sels[1]; /* variable len sel array */} usel_t;#define usel_nilpfi ((int(*)(sel* selp, int cnt ,u32 time, void * arg)) 0)#define usel_unilpfi ((int(*)(struct usel_t* up)) 0)/* macro to yield size of usel structure in bytes */#define usel_bytes(n) (sizeof(usel_t) - sizeof(sel) + sizeof(sel)*(n))#endif /*_SELECT_*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -