From d3dadb6b5400005b2334defedbd0a540b6baf14d Mon Sep 17 00:00:00 2001 From: Philippe Houdoin Date: Wed, 28 Aug 2002 19:53:43 +0000 Subject: [PATCH] Forgot to move select.h and sockio.h from old /net_kit tree git-svn-id: file:///srv/svn/repos/haiku/trunk/current@915 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/sys/select.h | 50 +++++++++++++++++++++++++++++ headers/posix/sys/sockio.h | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 headers/posix/sys/select.h create mode 100644 headers/posix/sys/sockio.h diff --git a/headers/posix/sys/select.h b/headers/posix/sys/select.h new file mode 100644 index 0000000000..e55afb01c1 --- /dev/null +++ b/headers/posix/sys/select.h @@ -0,0 +1,50 @@ +/* select.h */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H + +#include /* for struct timeval */ +/* + * You can define your own FDSETSIZE if you want more bits + */ + +#ifndef FD_SETSIZE +#define FD_SETSIZE 1024 +#endif /* FD_SETSIZE */ + +/* compatability with BSD */ +#define NBBY 8 /* number of bits in a byte */ + +typedef unsigned long fd_mask; + +#ifndef howmany +#define howmany(x, y) (((x) + ((y) - 1)) / (y)) +#endif + +/* + * Compatibily only: use FD_SETSIZE instead + */ +#ifndef FDSETSIZE +#define FDSETSIZE FD_SETSIZE +#endif /* FDSETSIZE */ + +#define NFDBITS 32 + +typedef struct fd_set { + unsigned mask[FDSETSIZE / NFDBITS]; +} fd_set; + +#define _FDMSKNO(fd) ((fd) / NFDBITS) +#define _FDBITNO(fd) ((fd) % NFDBITS) + +#define FD_ZERO(setp) memset((setp)->mask, 0, sizeof((setp)->mask)) +#define FD_SET(fd, setp) ((setp)->mask[_FDMSKNO(fd)] |= (1 << (_FDBITNO(fd)))) +#define FD_CLR(fd, setp) ((setp)->mask[_FDMSKNO(fd)] &= ~(1 << (_FDBITNO(fd)))) +#define FD_ISSET(fd, setp) ((setp)->mask[_FDMSKNO(fd)] & (1 << (_FDBITNO(fd)))) + +int select(int nbits, struct fd_set *rbits, + struct fd_set *wbits, + struct fd_set *ebits, + struct timeval *timeout); + +#endif /* _SYS_SELECT_H */ diff --git a/headers/posix/sys/sockio.h b/headers/posix/sys/sockio.h new file mode 100644 index 0000000000..a9b6f55327 --- /dev/null +++ b/headers/posix/sys/sockio.h @@ -0,0 +1,65 @@ +/* net_ioctl.h */ + +#ifndef SYS_NET_IOCTL_H +#define SYS_NET_IOCTL_H + +#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ + +#define IOC_OUT (unsigned long)0x40000000 + /* copy parameters in */ +#define IOC_IN (unsigned long)0x80000000 + /* copy paramters in and out */ +#define IOC_INOUT (IOC_IN|IOC_OUT) + /* mask for IN/OUT/VOID */ + +#define _IOC(inout,group,num,len) \ + (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) + +#define IOCGROUP(x) (((x) >> 8) & 0xff) + +#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) +#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) +#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ +#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ + +#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ + +#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ +#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ + +#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ +#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ +#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ +#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ +#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ +#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ +#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ +#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ +#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ +#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ +#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ +#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ +#define SIOCGIFDATA _IOWR('i', 27, struct ifreq) /* get if_data */ + +#define SIOCGIFMTU _IOWR('i', 126, struct ifreq) /* get ifnet MTU */ +#define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set ifnet MTU */ + +#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ + +#endif /* SYS_NET_IOCTL_H */ +