//#define FD_CLR(n, p) ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7))) public static void FD_CLR(int fd, ref FDSET set) { int index = fd / 8; byte mask = (byte)(1 << (fd & 7)); var newValue = set.fd_bits[index] & ~mask; set.fd_bits[index] = (byte)newValue; }
//#define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] & (1 << ((n) & 7))) public static int FD_ISSET(int fd, ref FDSET set) { int index = fd / 8; byte mask = (byte)(1 << (fd & 7)); var rv = set.fd_bits[index] & mask; return(rv); }
//#define FD_ZERO(p) memset((void*)(p),0,sizeof(*(p))) public static void FD_ZERO(ref FDSET set) { if (set.fd_bits == null) { set.fd_bits = new byte[4]; } else { Array.Clear(set.fd_bits, 0, set.fd_bits.Length); } }
public static extern int zts_select(int nfds, [In, Out] ref FDSET readfds, [In, Out] ref FDSET writefds, [In, Out] ref FDSET exceptfds, ref TIMEVAL timeout);