Ignore:
Timestamp:
May 19, 2003, 4:41:00 AM (22 years ago)
Author:
bird
Message:

#434: Initial tcpip header merges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/sys/select.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    33#ifndef _SYS_SELECT_H
    44#define _SYS_SELECT_H
     5#define _SYS_SELECT_H_
    56
    67#if defined (__cplusplus)
     
    89#endif
    910
     11#include <sys/cdefs.h>
     12
     13/** Define sigset_t here for pselect(). */
     14#if !defined (_SIGSET_T)
     15#define _SIGSET_T
     16typedef unsigned long sigset_t;
     17#endif
     18
     19/** Define the number of file handles in the select buffer.
     20 * @remark we might wanna bump this one up a bit... */
    1021#if !defined (FD_SETSIZE)
    11 #define FD_SETSIZE      256
     22#define FD_SETSIZE 256
    1223#elif FD_SETSIZE < 256
    1324#error FD_SETSIZE must be at least 256
    1425#endif
    1526
     27/** BSD thingy to figure out the size of a bitmap array. */
     28#ifndef _howmany
     29#define _howmany(a,b)       (((a) + ((b) - 1)) / (b))
     30#endif
     31#if defined(TCPV40HDRS) && !defined(howmany)
     32#define howmany(a,b)        (((a) + ((b) - 1)) / (b))
     33#endif
     34
    1635#if !defined (_FD_SET_T)
    1736#define _FD_SET_T
     37/** The base type for the select file descriptor bitmap. */
     38typedef unsigned long   __fd_mask;
     39/** Number of bits in a byte. */
     40#define NBBY        8
     41/** Number of bits in a byte. */
     42#define _NFDBITS    (sizeof(__fd_mask) * 8)     /* bits per mask */
     43/** Select set. */
     44typedef struct fd_set
     45{
     46    __fd_mask   __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
     47} fd_set;
    1848
    19 typedef struct _fd_set
    20 {
    21   unsigned long fds_bits[(FD_SETSIZE+31) / 32];
    22 } fd_set;
     49#if defined(__BSD_VISIBLE) || defined(TCPV40HDRS)
     50typedef __fd_mask   fd_mask;
     51#define fds_bits    __fds_bits
     52#define NFDBITS     _NFDBITS
     53#endif
    2354
    2455#endif
    2556
    26 #define FD_SET(n,s)    ((s)->fds_bits[(n)/32] |=  (1L << ((n) & 0x1f)))
    27 #define FD_CLR(n,s)    ((s)->fds_bits[(n)/32] &= ~(1L << ((n) & 0x1f)))
    28 #define FD_ISSET(n,s)  ((s)->fds_bits[(n)/32] &   (1L << ((n) & 0x1f)))
    29 #define FD_ZERO(s)     (void)memset (s, 0, sizeof (*(s)))
     57#ifndef FD_SET
     58/** Set a bit in the select file descriptor bitmap. */
     59#define FD_SET(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] |=  (1L << ((n) & (_NFDBITS - 1))))
     60/** Clear a bit in the select file descriptor bitmap. */
     61#define FD_CLR(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] &= ~(1L << ((n) & (_NFDBITS - 1))))
     62/** Test if a bit in the select file descriptor bitmap is set. */
     63#define FD_ISSET(n,s)  ((s)->__fds_bits[(n)/_NFDBITS] &   (1L << ((n) & (_NFDBITS - 1))))
     64/** Initialize the select file descriptor bitmap clearing all bits. */
     65#define FD_ZERO(s)     (void)memset(s, 0, sizeof(*(s)))
     66#if __BSD_VISIBLE
     67/** Copy a select file descriptor bitmap. */
     68#define FD_COPY(src,trg) (void)(*(trg) = *(src))
     69#endif
     70#endif /* !FD_SET */
    3071
    3172struct timeval;
     73int select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
     74int _select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
     75void *memset (void *, int, size_t); /* Used by FD_ZERO */
     76#ifdef _LIBC_TODO
     77/** A slightly different select call which have better time precision and signal support. */
     78#warning int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *);
     79#endif
    3280
    33 int select (int, struct _fd_set *, struct _fd_set *, struct _fd_set *,
    34     struct timeval *);
     81#ifdef TCPV40HDRS
     82/** This is the TCPIP v4.0 bsd styled select.
     83 * Normally it's mapped to select(), but since we don't want any such
     84 * confusion we don't.
     85 * @remark The normal select() doesn't have socket capabilities int the sys style libc.
     86 */
     87int _System bsdselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
     88#define os2_select  tcpip40_os2_select
     89#endif
     90/** This is the TCPIP OS/2 styled select. */
     91int _System os2_select(int *, int, int, int, long);
    3592
    36 int _select (int, struct _fd_set *, struct _fd_set *, struct _fd_set *,
    37     struct timeval *);
    38 
    39 void *memset (void *, int, size_t); /* Used by FD_ZERO */
     93/* toolkit BSD pollution: */
     94#ifndef TCPV40HDRS
     95/*
     96 * Used to maintain information about processes that wish to be
     97 * notified when I/O becomes possible.
     98 */
     99#pragma pack(1)
     100struct selinfo {
     101        pid_t   si_pid;         /* process to be notified */
     102        short   si_flags;       /* see below */
     103};
     104#pragma pack()
     105#define SI_COLL 0x0001          /* collision occurred */
     106#endif /* !TCPV40HDRS */
    40107
    41108#if defined (__cplusplus)
Note: See TracChangeset for help on using the changeset viewer.