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

#434: Initial tcpip header merges.

Location:
trunk/src/emx/include/sys
Files:
12 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/*- modified for gcc/os2 by bird 2003
     2 *
    23 * Copyright (c) 1991, 1993
    34 *      The Regents of the University of California.  All rights reserved.
     
    3435 * SUCH DAMAGE.
    3536 *
    36  *      @(#)cdefs.h     8.7 (Berkeley) 1/21/94
    37  */
    38 
    39 #ifndef _CDEFS_H_
    40 #define _CDEFS_H_
     37 *      @(#)cdefs.h     8.8 (Berkeley) 1/9/95
     38 * $FreeBSD: src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $
     39 */
     40
     41#ifndef _SYS_CDEFS_H_
     42#define _SYS_CDEFS_H_
     43#define _CDEFS_H_ /* compatability */
    4144
    4245#if defined(__cplusplus)
    4346#define __BEGIN_DECLS   extern "C" {
    44 #define __END_DECLS     };
     47#define __END_DECLS     }
    4548#else
    4649#define __BEGIN_DECLS
     
    5154 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
    5255 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
    53  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
    54  * in between its arguments.  __CONCAT can also concatenate double-quoted
    55  * strings produced by the __STRING macro, but this only works with ANSI C.
     56 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
     57 * mode -- there must be no spaces between its arguments, and for nested
     58 * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
     59 * concatenate double-quoted strings produced by the __STRING macro, but
     60 * this only works with ANSI C.
     61 *
     62 * __XSTRING is like __STRING, but it expands any macros in its argument
     63 * first.  It is only available with ANSI C.
    5664 */
    5765#if defined(__STDC__) || defined(__cplusplus)
    5866#define __P(protos)     protos          /* full-blown ANSI C */
    59 #define __CONCAT(x,y)   x ## y
    60 #define __STRING(x)     #x
     67#define __CONCAT1(x,y)  x ## y
     68#define __CONCAT(x,y)   __CONCAT1(x,y)
     69#define __STRING(x)     #x              /* stringify without expanding x */
     70#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
    6171
    6272#define __const         const           /* define reserved names to standard */
     
    94104#define signed
    95105#define volatile
    96 #endif
     106#endif  /* !NO_ANSI_KEYWORDS */
    97107#endif  /* !__GNUC__ */
    98108#endif  /* !(__STDC__ || __cplusplus) */
    99109
    100110/*
    101  * GCC1 and some versions of GCC2 declare dead (non-returning) and
    102  * pure (no side effects) functions using "volatile" and "const";
    103  * unfortunately, these then cause warnings under "-ansi -pedantic".
    104  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
    105  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
    106  * in the distribution version of 2.5.5).
    107  */
    108 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
    109 #define __attribute__(x)        /* delete __attribute__ if non-gcc or gcc1 */
    110 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    111 #define __dead          __volatile
    112 #define __pure          __const
    113 #endif
    114 #endif
    115 
    116 /* Delete pseudo-keywords wherever they are not available or needed. */
    117 #ifndef __dead
    118 #define __dead
    119 #define __pure
    120 #endif
    121 
    122 #endif /* !_CDEFS_H_ */
     111 * Compiler-dependent macros to help declare dead (non-returning) and
     112 * pure (no side effects) functions, and unused variables.  They are
     113 * null except for versions of gcc that are known to support the features
     114 * properly (old versions of gcc-2 supported the dead and pure features
     115 * in a different (wrong) way).  If we do not provide an implementation
     116 * for a given compiler, let the compile fail if it is told to use
     117 * a feature that we cannot live without.
     118 */
     119#ifdef lint
     120#define __dead2
     121#define __pure2
     122#define __unused
     123#define __packed
     124#define __aligned(x)
     125#define __section(x)
     126#else
     127#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
     128#define __dead2
     129#define __pure2
     130#define __unused
     131#endif
     132#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
     133#define __dead2         __attribute__((__noreturn__))
     134#define __pure2         __attribute__((__const__))
     135#define __unused
     136/* XXX Find out what to do for __packed, __aligned and __section */
     137#endif
     138#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
     139#define __dead2         __attribute__((__noreturn__))
     140#define __pure2         __attribute__((__const__))
     141#define __unused        __attribute__((__unused__))
     142#define __packed        __attribute__((__packed__))
     143#define __aligned(x)    __attribute__((__aligned__(x)))
     144#define __section(x)    __attribute__((__section__(x)))
     145#endif
     146#endif
     147
     148/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
     149#if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3)
     150#define __func__        NULL
     151#endif
     152
     153#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
     154#define __LONG_LONG_SUPPORTED
     155#endif
     156
     157/*
     158 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
     159 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
     160 * a way to define the `restrict' type qualifier without disturbing older
     161 * software that is unaware of C99 keywords.
     162 */
     163#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
     164#if __STDC_VERSION__ < 199901
     165#define __restrict
     166#else
     167#define __restrict      restrict
     168#endif
     169#endif
     170
     171/*
     172 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
     173 * require it.
     174 */
     175#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
     176
     177/*
     178 * Compiler-dependent macros to declare that functions take printf-like
     179 * or scanf-like arguments.  They are null except for versions of gcc
     180 * that are known to support the features properly (old versions of gcc-2
     181 * didn't permit keeping the keywords out of the application namespace).
     182 */
     183#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7
     184#define __printflike(fmtarg, firstvararg)
     185#define __scanflike(fmtarg, firstvararg)
     186#else
     187#define __printflike(fmtarg, firstvararg) \
     188            __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
     189#define __scanflike(fmtarg, firstvararg) \
     190            __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
     191#endif
     192
     193/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
     194#if __FreeBSD_cc_version >= 300001 && __FreeBSD_cc_version < 500003
     195#define __printf0like(fmtarg, firstvararg) \
     196            __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
     197#else
     198#define __printf0like(fmtarg, firstvararg)
     199#endif
     200
     201#if 0 /* def __GNUC__ - ELF specific, so skip everything */
     202#define __strong_reference(sym,aliassym)        \
     203        extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
     204#ifdef __STDC__
     205#define __weak_reference(sym,alias)     \
     206        __asm__(".weak " #alias);       \
     207        __asm__(".equ "  #alias ", " #sym)
     208#define __warn_references(sym,msg)      \
     209        __asm__(".section .gnu.warning." #sym); \
     210        __asm__(".asciz \"" msg "\"");  \
     211        __asm__(".previous")
     212#else
     213#define __weak_reference(sym,alias)     \
     214        __asm__(".weak alias");         \
     215        __asm__(".equ alias, sym")
     216#define __warn_references(sym,msg)      \
     217        __asm__(".section .gnu.warning.sym"); \
     218        __asm__(".asciz \"msg\"");      \
     219        __asm__(".previous")
     220#endif  /* __STDC__ */
     221#endif  /* __GNUC__ */
     222
     223#if 0 /*def __GNUC__ - ELF specific. */
     224#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
     225#else
     226/*
     227 * This doesn't work in header files. But it may be better than nothing.
     228 * The alternative is: #define __IDSTRING(name,string)  [nothing]
     229 */
     230#define __IDSTRING(name,string) static const char name[] __unused = string
     231#endif
     232
     233/*
     234 * Embed the rcs id of a source file in the resulting library.  Note that in
     235 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
     236 * Usage:
     237 *      __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $");
     238 */
     239#ifndef __FBSDID
     240#if !defined(lint) && !defined(STRIP_FBSDID)
     241#define __FBSDID(s)     __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     242#else
     243#define __FBSDID(s)     struct __hack
     244#endif
     245#endif
     246
     247#ifndef __RCSID
     248#ifndef NO__RCSID
     249#define __RCSID(s)      __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     250#else
     251#define __RCSID(s)
     252#endif
     253#endif
     254
     255#ifndef __RCSID_SOURCE
     256#ifndef NO__RCSID_SOURCE
     257#define __RCSID_SOURCE(s)       __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
     258#else
     259#define __RCSID_SOURCE(s)
     260#endif
     261#endif
     262
     263#ifndef __SCCSID
     264#ifndef NO__SCCSID
     265#define __SCCSID(s)     __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
     266#else
     267#define __SCCSID(s)
     268#endif
     269#endif
     270
     271#ifndef __COPYRIGHT
     272#ifndef NO__COPYRIGHT
     273#define __COPYRIGHT(s)  __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
     274#else
     275#define __COPYRIGHT(s)
     276#endif
     277#endif
     278
     279#ifndef __DECONST
     280#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
     281#endif
     282
     283#ifndef __DEVOLATILE
     284#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
     285#endif
     286
     287#ifndef __DEQUALIFY
     288#define __DEQUALIFY(type, var)  ((type)(uintptr_t)(const volatile void *)(var))
     289#endif
     290
     291/*-
     292 * The following definitions are an extension of the behavior originally
     293 * implemented in <sys/_posix.h>, but with a different level of granularity.
     294 * POSIX.1 requires that the macros we test be defined before any standard
     295 * header file is included.
     296 *
     297 * Here's a quick run-down of the versions:
     298 *  defined(_POSIX_SOURCE)              1003.1-1988
     299 *  _POSIX_C_SOURCE == 1                1003.1-1990
     300 *  _POSIX_C_SOURCE == 2                1003.2-1992 C Language Binding Option
     301 *  _POSIX_C_SOURCE == 199309           1003.1b-1993
     302 *  _POSIX_C_SOURCE == 199506           1003.1c-1995, 1003.1i-1995,
     303 *                                      and the omnibus ISO/IEC 9945-1: 1996
     304 *  _POSIX_C_SOURCE == 200112           1003.1-2001
     305 *
     306 * In addition, the X/Open Portability Guide, which is now the Single UNIX
     307 * Specification, defines a feature-test macro which indicates the version of
     308 * that specification, and which subsumes _POSIX_C_SOURCE.
     309 *
     310 * Our macros begin with two underscores to avoid namespace screwage.
     311 */
     312
     313/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
     314#if _POSIX_C_SOURCE == 1
     315#undef _POSIX_C_SOURCE          /* Probably illegal, but beyond caring now. */
     316#define _POSIX_C_SOURCE         199009
     317#endif
     318
     319/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
     320#if _POSIX_C_SOURCE == 2
     321#undef _POSIX_C_SOURCE
     322#define _POSIX_C_SOURCE         199209
     323#endif
     324
     325/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
     326#ifdef _XOPEN_SOURCE
     327#if _XOPEN_SOURCE - 0 >= 600
     328#define __XSI_VISIBLE           600
     329#undef _POSIX_C_SOURCE
     330#define _POSIX_C_SOURCE         200112
     331#elif _XOPEN_SOURCE - 0 >= 500
     332#define __XSI_VISIBLE           500
     333#undef _POSIX_C_SOURCE
     334#define _POSIX_C_SOURCE         199506
     335#endif
     336#endif
     337
     338/*
     339 * Deal with all versions of POSIX.  The ordering relative to the tests above is
     340 * important.
     341 */
     342#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
     343#define _POSIX_C_SOURCE         198808
     344#endif
     345#ifdef _POSIX_C_SOURCE
     346#if _POSIX_C_SOURCE >= 200112
     347#define __POSIX_VISIBLE         200112
     348#define __ISO_C_VISIBLE         1999
     349#elif _POSIX_C_SOURCE >= 199506
     350#define __POSIX_VISIBLE         199506
     351#define __ISO_C_VISIBLE         1990
     352#elif _POSIX_C_SOURCE >= 199309
     353#define __POSIX_VISIBLE         199309
     354#define __ISO_C_VISIBLE         1990
     355#elif _POSIX_C_SOURCE >= 199209
     356#define __POSIX_VISIBLE         199209
     357#define __ISO_C_VISIBLE         1990
     358#elif _POSIX_C_SOURCE >= 199009
     359#define __POSIX_VISIBLE         199009
     360#define __ISO_C_VISIBLE         1990
     361#else
     362#define __POSIX_VISIBLE         198808
     363#define __ISO_C_VISIBLE         0
     364#endif /* _POSIX_C_SOURCE */
     365#else
     366/*-
     367 * Deal with _ANSI_SOURCE:
     368 * If it is defined, and no other compilation environment is explicitly
     369 * requested, then define our internal feature-test macros to zero.  This
     370 * makes no difference to the preprocessor (undefined symbols in preprocessing
     371 * expressions are defined to have value zero), but makes it more convenient for
     372 * a test program to print out the values.
     373 *
     374 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
     375 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
     376 * environment (and in fact we will never get here).
     377 */
     378#if defined(_ANSI_SOURCE)       /* Hide almost everything. */
     379#define __POSIX_VISIBLE         0
     380#define __XSI_VISIBLE           0
     381#define __BSD_VISIBLE           0
     382#define __ISO_C_VISIBLE         1990
     383#elif defined(_C99_SOURCE)      /* Localism to specify strict C99 env. */
     384#define __POSIX_VISIBLE         0
     385#define __XSI_VISIBLE           0
     386#define __BSD_VISIBLE           0
     387#define __ISO_C_VISIBLE         1999
     388#else                           /* Default environment: show everything. */
     389#define __POSIX_VISIBLE         200112
     390#define __XSI_VISIBLE           600
     391#define __BSD_VISIBLE           1
     392#define __ISO_C_VISIBLE         1999
     393#endif
     394#endif
     395
     396/* toolkit pollution */
     397#define __TCPPROTO(args) __P(args)
     398
     399#endif /* !_SYS_CDEFS_H_ */
  • trunk/src/emx/include/sys/ioctl.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    88#endif
    99
    10 #if defined (_EMX_TCPIP)
    11 #include <sys/so_ioctl.h>
    12 #endif
     10#include <sys/ioccom.h>
     11#include <sys/sockio.h>
     12#include <sys/filio.h>
    1313
    1414#if !defined (TCGETA)
     
    2626#define _TCSADRAIN  10          /* Used internally for tcsetattr() */
    2727#define _TCSAFLUSH  11          /* Used internally for tcsetattr() */
    28 
    29 #if !defined (FIONREAD)
    30 #define FIONREAD   16
    31 #endif
    3228
    3329#if !defined (FGETHTYPE)
     
    4743#endif
    4844
    49 int ioctl (int, int, ...);
    50 
    51 int _ioctl (int, int, ...);
    52 
    5345#if defined (__cplusplus)
    5446}
  • trunk/src/emx/include/sys/param.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* sys/param.h (emx+gcc) */
     1/** @file sys/param.h
     2 * BSD like sys\param.h file.
     3 *
     4 * TCPV40HDRS does include this file, but as we don't need to be
     5 * 100% compatible we don't care.
     6 */
    27
    38#ifndef _SYS_PARAM_H
    49#define _SYS_PARAM_H
     10#define _SYS_PARAM_H_ /* toolkit */
    511
    612#if defined (__cplusplus)
     
    814#endif
    915
    10 #if !defined (PAGE_SIZE)
    11 #define PAGE_SIZE 0x1000
     16
     17#if !defined (NULL)
     18#if defined (__cplusplus)
     19#define NULL    0
     20#else
     21#define NULL    ((void*)0)
     22#endif
    1223#endif
    1324
    14 #if !defined (HZ)
     25
     26/** @group BSD version defines.
     27 * OS2: The toolkit headers define these. Resent FreeBSD release does too.
     28 * Warning! Be aware that config scripts and programs may check for these and
     29 *          assume they're running on BSD. We might have to take out these
     30 *          defines.
     31 * @{
     32 */
     33/** System version - year and month */
     34#ifdef TCPV40HDRS
     35#define BSD     43
     36#else
     37#define BSD     199506
     38#endif
     39#ifndef TCPV40HDRS
     40/** Indicate BSD4.3 features present. */
     41#define BSD4_3  1
     42/** Indicate BSD4.4 features present. */
     43#define BSD4_4  1
     44#endif
     45/** @} */
     46
     47
     48#ifndef LOCORE
     49#include <types.h>
     50#endif
     51#include <sys/syslimits.h>
     52#include <sys/signal.h>
     53#include <machine/param.h>
     54#include <machine/limits.h>
     55
     56
     57/** @group  System Parameters (BSD flavored)
     58 *
     59 * @{ */
     60#ifndef MAXCOMLEN
     61/** Max command name remembered. */
     62#define MAXCOMLEN       19
     63#endif
     64
     65#ifndef MAXINTERP
     66/** Max interpreter file name length (ELF?).
     67 * OS2: Have no meaning. */
     68#define MAXINTERP       12
     69#endif
     70
     71#ifndef MAXLOGNAME
     72/** Max login name length including terminating NULL. */
     73#define MAXLOGNAME      LOGIN_NAME_MAX
     74#endif
     75
     76#ifndef MAXUPRC
     77/** Maximum simultaneous processes. */
     78#define MAXUPRC         CHILD_MAX
     79#endif
     80
     81#ifndef NCARGS
     82/** Max argument size for an exec function.
     83 * OS2: Assuming at least 4KB of environment gives us 0xf000 at the very best.
     84 *      However we set it to 32KB which should be a safe max. */
     85#define NCARGS          ARG_MAX
     86#endif
     87#ifndef NGROUPS
     88/** Max supplemental group id's.
     89 * OS2: doesn't make much sens just set it high. */
     90#define NGROUPS         NGROUPS_MAX
     91#endif
     92
     93#ifndef NOFILE
     94/** Max number of open files per process.
     95 * OS2: Using DosSetMaxFH the theoretical maximum should be 0xfff0 I believe.
     96 */
     97#define NOFILE          OPEN_MAX
     98#endif
     99
     100#ifndef NOGROUP
     101/** Marker for empty group set member.
     102 * OS2: no meaning currently. */
     103#define NOGROUP         0xffff
     104#endif
     105
     106#ifndef MAXHOSTNAMELEN
     107/** Max number of bytes in a hostname. */
     108#define MAXHOSTNAMELEN  256
     109#endif
     110
     111#ifndef SPECNAMELEN
     112/** Max number of bytes in a devicename.
     113 * OS2: no real meaning. */
     114#define SPECNAMELEN     16
     115#endif
     116
     117#ifndef MAXNAMLEN
     118/** Max number of chars in a file name.
     119 * BSD name for posix NAME_MAX. */
     120#define MAXNAMLEN       NAME_MAX
     121#endif
     122
     123#ifndef MAXPATHLEN
     124/** Max number of chars in a path name.
     125 * BSD name for posix PATH_MAX.
     126 * @remark Very strict BSD kernel/user code may expect it to be a number which
     127 *         is the power of two an. The OS/2 number is not a power of 2. */
     128#define MAXPATHLEN      PATH_MAX
     129#endif
     130/** @} */
     131
     132
     133/** @group EMX defines
     134 * @{
     135 */
     136#ifndef HZ
     137/** Frequencey of something but have no clue of what...
     138 * Freebsd isn't defining this, linux is but only for the kernel sources.
     139 * Considered EMX specific. */
    15140#define HZ        100
    16141#endif
     142/** @} */
    17143
    18 #if !defined (MAXNAMLEN)
    19 #define MAXNAMLEN  260
     144
     145/** @group Bitmap Access
     146 * The bitmaps in question is arrays if integer.
     147 * @{ */
     148/** number of bytes in an int */
     149#define NBPW sizeof(int)
     150/** Set a bit in the bitmap */
     151#define setbit(Bitmap,iBit)   ( (Bitmap)[(i)/NBBY] |=   1 << ((i) % NBBY)  )
     152/** Clear a bit in the bitmap */
     153#define clrbit(Bitmap,iBit)   ( (Bitmap)[(i)/NBBY] &= ~(1 << ((i) % NBBY)) )
     154/** Test if a bit in a bitmap is set. */
     155#define isset(Bitmap,iBit)    ( (Bitmap)[(i)/NBBY]  &  (1 << ((i) % NBBY)) )
     156/** Test if a bit in a bitmap is clear. */
     157#define isclr(Bitmap,iBit)    (((Bitmap)[(i)/NBBY]  & 1 << ((i) % NBBY)) == 0 )
     158/** @} */
     159
     160
     161/* Handle flags of some kind... Toolkit defines it here.
     162 * Freebsd headers indicates that these are KERNEL flags, but
     163 * there is a chance one or two tcpip ioctls are using them. */
     164#ifndef _POSIX_SOURCE
     165#define FREAD   1
     166#define FWRITE  2
    20167#endif
    21168
    22 #if !defined (MAXPATHLEN)
    23 #define MAXPATHLEN 260
    24 #endif
    25 
    26 /* Don't try to do this inline for now */
    27 
     169#if 0 /* we don't need it, endian takes care of this */
     170/* Basic byte order conversion (non-inline).
     171 * Note that freebsd only does this when KERNEL is defined. */
    28172#if !defined (htonl)
    29173#define htonl(X) _swapl(X)
     
    32176#define ntohs(X) _swaps(X)
    33177#endif
    34 
    35178unsigned short _swaps (unsigned short _x);
    36179unsigned long _swapl (unsigned long _x);
     180#endif
     181
    37182
    38183#if defined (__cplusplus)
  • 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)
  • trunk/src/emx/include/sys/so_ioctl.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* so_ioctl.h derived from BSD's ioctl.h by hv and em 1994,1996
    2  *
    3  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
    10  *    notice, this list of conditions and the following disclaimer.
    11  * 2. Redistributions in binary form must reproduce the above copyright
    12  *    notice, this list of conditions and the following disclaimer in the
    13  *    documentation and/or other materials provided with the distribution.
    14  * 3. All advertising materials mentioning features or use of this software
    15  *    must display the following acknowledgement:
    16  *      This product includes software developed by the University of
    17  *      California, Berkeley and its contributors.
    18  * 4. Neither the name of the University nor the names of its contributors
    19  *    may be used to endorse or promote products derived from this software
    20  *    without specific prior written permission.
    21  *
    22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    32  * SUCH DAMAGE.
    33  *
    34  *      from: @(#)ioctl.h       7.19 (Berkeley) 6/26/91
    35  */
     1/* backward compatibility */
     2#warning sys/so_ioctl.h is outdated, use sys/ioctl.h or sys/sockio.h.
     3#include <sys/sockio.h>
    364
    37 #if !defined (_SYS_SO_IOCTL_H)
    38 #define _SYS_SO_IOCTL_H
    39 
    40 #define _IOC(a,b) ((a<<8)|b)
    41 #define _IOW(a,b,c) _IOC(a,b)
    42 #define _IOR(a,b,c) _IOC(a,b)
    43 #define _IOWR(a,b,c) _IOC(a,b)
    44 
    45 #define _TCPIP_FIONREAD  _IOC('f', 127)
    46 #define FIONBIO         _IOC('f', 126)
    47 #define FIOASYNC        _IOC('f', 125)
    48 #define FIOTCPCKSUM     _IOC('f', 128)
    49 #define FIONSTATUS      _IOC('f', 120)
    50 #define FIONURG         _IOC('f', 121)
    51 #define FIOBSTATUS      _IOC('f', 122)
    52 
    53 /* socket i/o controls */
    54 #define SIOCSHIWAT      _IOW('s',  0, int)      /* set high watermark */
    55 #define SIOCGHIWAT      _IOR('s',  1, int)      /* get high watermark */
    56 #define SIOCSLOWAT      _IOW('s',  2, int)      /* set low watermark */
    57 #define SIOCGLOWAT      _IOR('s',  3, int)      /* get low watermark */
    58 #define SIOCATMARK      _IOR('s',  7, int)      /* at oob mark? */
    59 #define SIOCSPGRP       _IOW('s',  8, int)      /* set process group */
    60 #define SIOCGPGRP       _IOR('s',  9, int)      /* get process group */
    61 #define SIOCSHOSTID     _IOW('s', 10, int)      /* set hostid */
    62 
    63 /*hv Netbios IOCtls excluded here - no docs about them */
    64 
    65 #define SIOCADDRT       _IOW('r', 10, struct ortentry)  /* add route */
    66 #define SIOCDELRT       _IOW('r', 11, struct ortentry)  /* delete route */
    67 
    68 /* hv SIOMETRIC*RT excluded here - no docs about them (routing, nonportable) */
    69 /* hv SIOCREG* excluded here - no docs about them (routing, nonportable) */
    70 
    71 #define SIOCSIFADDR     _IOW('i', 12, struct ifreq)     /* set ifnet address */
    72 #define SIOCGIFADDR     _IOWR('i',13, struct ifreg)     /* get ifnet addres */
    73 #define OSIOCGIFADDR    SIOCGIFADDR
    74 #define SIOCSIFDSTADDR  _IOW('i', 14, struct ifreq)     /* set p-p address */
    75 #define SIOCGIFDSTADDR  _IOWR('i',15, struct ifreq)     /* get p-p address */
    76 #define OSIOCGIFDSTADDR SIOCGIFDSTADDR
    77 #define SIOCSIFFLAGS    _IOW('i', 16, struct ifreq)     /* set ifnet flags */
    78 #define SIOCGIFFLAGS    _IOWR('i',17, struct ifreq)     /* get ifnet flags */
    79 #define SIOCGIFBRDADDR  _IOWR('i',18, struct ifreq)     /* get broadcast addr */
    80 #define OSIOCGIFBRDADDR SIOCGIFBRDADDR
    81 #define SIOCSIFBRDADDR  _IOW('i', 19, struct ifreq)     /* set broadcast addr */
    82 #define SIOCGIFCONF     _IOWR('i',20, struct ifreq)     /* get ifnet list */
    83 #define OSIOCGIFCONF    SIOCGIFCONF
    84 #define SIOCGIFNETMASK  _IOWR('i',21, struct ifreq)     /* get net addr mask */
    85 #define OSIOCGIFNETMASK SIOCGIFNETMASK
    86 #define SIOCSIFNETMASK  _IOW('i', 22, struct ifreq)     /* set net addr mask */
    87 #define SIOCGIFMETRIC   _IOWR('i',23, struct ifreq)     /* get if metric */
    88 #define SIOCSIFMETRIC   _IOW('i', 24, struct ifreq)     /* set if metric */
    89 
    90 #define SIOCSARP        _IOW('i', 30, struct arpreq)    /* set arp entry */
    91 #define SIOCGARP        _IOWR('i',31, struct arpreq)    /* get arp entry */
    92 #define OSIOCGARP       SIOCGARP
    93 #define SIOCDARP        _IOW('i', 32, struct arpreq)    /* delete arp entry */
    94 
    95 /*hv: several SIOC* excluded - no docs, nonportable */
    96 
    97 #define SIOCADDMULTI    _IOW('i', 51, struct ifreq)     /* add m'cast addr */
    98 #define SIOCDELMULTI    _IOW('i', 52, struct ifreq)     /* del m'cast addr */
    99 #define SIOCMULTISBC    _IOC('i', 61)                   /* use broadcast for MC */
    100 #define SIOCMULTISFA    _IOC('i', 62)                   /* use functional addr for MC */
    101 
    102 /* various more ioctls (netstat, slstat, iptrace) excluded, no docs */
    103 
    104 #endif /* !defined (_SYS_SO_IOCTL_H) */
  • trunk/src/emx/include/sys/socket.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv and em 1994-1997
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982,1985,1986,1988 Regents of the University of California.
     
    3940#define _SYS_SOCKET_H_
    4041
    41 #if !defined (_SYS_TYPES_H)
    42 #warning <sys/socket.h> requires <sys/types.h>
     42#include <machine/ansi.h>
     43#define _NO_NAMESPACE_POLLUTION
     44#include <machine/param.h>
     45#undef _NO_NAMESPACE_POLLUTION
     46
     47
     48/* toolkit stuff */
    4349#include <sys/types.h>
    44 #endif
    45 
    4650#include <sys/uio.h>
     51#include <sys/cdefs.h>
    4752
    4853#if defined (__cplusplus)
     
    8287#define SO_RCV_SHUTDOWN 0x0400          /* set if shut down called for rcv */
    8388#define SO_SND_SHUTDOWN 0x0800          /* set if shutdown called for send */
     89#ifndef TCPV40HDRS
     90#define SO_REUSEPORT    0x1000          /* allow local address & port reuse */
     91#define SO_TTCP         0x2000          /* allow t/tcp on socket */
     92#endif
    8493
    8594/*
     
    9099#define SO_SNDLOWAT     0x1003          /* send low-water mark */
    91100#define SO_RCVLOWAT     0x1004          /* receive low-water mark */
     101#ifndef TCPV40HDRS
    92102#define SO_SNDTIMEO     0x1005          /* send timeout */
    93103#define SO_RCVTIMEO     0x1006          /* receive timeout */
     104#endif
    94105#define SO_ERROR        0x1007          /* get error status and clear */
    95106#define SO_TYPE         0x1008          /* get socket type */
     
    119130#define AF_UNSPEC       0               /* unspecified */
    120131#define AF_UNIX         1               /* local to host (pipes, portals) */
     132#ifndef TCPV40HDRS
     133#define AF_LOCAL        AF_UNIX
     134#endif
     135#define AF_OS2          AF_UNIX
    121136#define AF_INET         2               /* internetwork: UDP, TCP, etc. */
    122137#define AF_IMPLINK      3               /* arpanet imp addresses */
     
    124139#define AF_CHAOS        5               /* mit CHAOS protocols */
    125140#define AF_NS           6               /* XEROX NS protocols */
     141#ifdef TCPV40HDRS
    126142#define AF_NBS          7               /* IBM: nbs protocols */
    127143                                        /* (hv: I think IBM is outdated here */
     144#endif
    128145#define AF_ISO          7               /* ISO protocols */
    129146#define AF_OSI          AF_ISO
     
    140157#define AF_NETBIOS      AF_NB
    141158
    142 #define AF_OS2          AF_UNIX
    143 
     159#ifdef TCPV40HDRS
    144160#define AF_MAX          18
     161#else
     162#define AF_LINK         18              /* Link layer interface */
     163#define pseudo_AF_XTP   19              /* eXpress Transfer Protocol (no AF) */
     164#define AF_COIP         20              /* connection-oriented IP, aka ST II */
     165#define AF_CNT          21              /* Computer Network Technology */
     166#define pseudo_AF_RTIP  22              /* Help Identify RTIP packets */
     167#define AF_IPX          23              /* Novell Internet Protocol */
     168#define AF_SIP          24              /* Simple Internet Protocol */
     169#define AF_INET6        24
     170#define pseudo_AF_PIP   25              /* Help Identify PIP packets */
     171#define AF_ROUTE        39              /* Internal Routing Protocol */
     172#define AF_FWIP         40              /* firewall support */
     173#define AF_IPSEC        41              /* IPSEC and encryption techniques */
     174#define AF_DES          42              /* DES */
     175#define AF_MD5          43
     176#define AF_CDMF         44
     177
     178#define AF_MAX          45
     179#endif
     180
    145181
    146182/*
     
    150186 */
    151187struct sockaddr {
     188#ifdef TCPV40HDRS
    152189        u_short sa_family;              /* address family */
    153190        char    sa_data[14];            /* up to 14 bytes of direct address */
     191#else
     192        u_char  sa_len;                 /* total length */
     193        u_char  sa_family;              /* address family */
     194        char    sa_data[14];            /* actually longer; address value */
     195#endif
    154196};
    155197
     
    168210#define PF_UNSPEC       AF_UNSPEC
    169211#define PF_UNIX         AF_UNIX
     212#ifndef TCPV40HDRS
     213#define PF_LOCAL        AF_LOCAL
     214#endif
     215#define PF_OS2          AF_UNIX
    170216#define PF_INET         AF_INET
    171217#define PF_IMPLINK      AF_IMPLINK
     
    173219#define PF_CHAOS        AF_CHAOS
    174220#define PF_NS           AF_NS
     221#ifdef TCPV40HDRS
    175222#define PF_NBS          AF_NBS
     223#endif
    176224#define PF_ISO          AF_ISO
    177 #define PF_OSI          AF_ISO
     225#define PF_OSI          AF_OSI
    178226#define PF_ECMA         AF_ECMA
    179227#define PF_DATAKIT      AF_DATAKIT
     
    185233#define PF_HYLINK       AF_HYLINK
    186234#define PF_APPLETALK    AF_APPLETALK
     235#define PF_NETBIOS      AF_NB
    187236#define PF_NB           AF_NB
    188 #define PF_NETBIOS      AF_NB
    189 #define PF_OS2          AF_UNIX
     237#ifndef TCPV40HDRS
     238#define PF_ROUTE        AF_ROUTE
     239#define PF_LINK         AF_LINK
     240#define PF_XTP          pseudo_AF_XTP   /* really just proto family, no AF */
     241#define PF_COIP         AF_COIP
     242#define PF_CNT          AF_CNT
     243#define PF_SIP          AF_SIP
     244#define PF_INET6        AF_INET6
     245#define PF_IPX          AF_IPX          /* same format as AF_NS */
     246#define PF_RTIP         pseudo_AF_FTIP  /* same format as AF_INET */
     247#define PF_PIP          pseudo_AF_PIP
     248#endif /* !TCPV40HDRS */
     249
    190250#define PF_MAX          AF_MAX
    191251
     252
     253#ifndef TCPV40HDRS
     254/*
     255 * Definitions for network related sysctl, CTL_NET.
     256 *
     257 * Second level is protocol family.
     258 * Third level is protocol number.
     259 *
     260 * Further levels are defined by the individual families below.
     261 */
     262#define NET_MAXID       AF_MAX
     263
     264#define CTL_NET_NAMES { \
     265        { 0, 0 }, \
     266        { "local", CTLTYPE_NODE }, \
     267        { "inet", CTLTYPE_NODE }, \
     268        { "implink", CTLTYPE_NODE }, \
     269        { "pup", CTLTYPE_NODE }, \
     270        { "chaos", CTLTYPE_NODE }, \
     271        { "xerox_ns", CTLTYPE_NODE }, \
     272        { "iso", CTLTYPE_NODE }, \
     273        { "emca", CTLTYPE_NODE }, \
     274        { "datakit", CTLTYPE_NODE }, \
     275        { "ccitt", CTLTYPE_NODE }, \
     276        { "ibm_sna", CTLTYPE_NODE }, \
     277        { "decnet", CTLTYPE_NODE }, \
     278        { "dec_dli", CTLTYPE_NODE }, \
     279        { "lat", CTLTYPE_NODE }, \
     280        { "hylink", CTLTYPE_NODE }, \
     281        { "appletalk", CTLTYPE_NODE }, \
     282        { "netbios", CTLTYPE_NODE }, \
     283        { "route", CTLTYPE_NODE }, \
     284        { "link_layer", CTLTYPE_NODE }, \
     285        { "xtp", CTLTYPE_NODE }, \
     286        { "coip", CTLTYPE_NODE }, \
     287        { "cnt", CTLTYPE_NODE }, \
     288        { "rtip", CTLTYPE_NODE }, \
     289        { "ipx", CTLTYPE_NODE }, \
     290        { "sip", CTLTYPE_NODE }, \
     291        { "pip", CTLTYPE_NODE }, \
     292}
     293
     294/*
     295 * PF_ROUTE - Routing table
     296 *
     297 * Three additional levels are defined:
     298 *      Fourth: address family, 0 is wildcard
     299 *      Fifth: type of info, defined below
     300 *      Sixth: flag(s) to mask with for NET_RT_FLAGS
     301 */
     302#define NET_RT_DUMP     1               /* dump; may limit to a.f. */
     303#define NET_RT_FLAGS    2               /* by flags, e.g. RESOLVING */
     304#define NET_RT_IFLIST   3               /* survey interface list */
     305#define NET_RT_MAXID    4
     306
     307#define CTL_NET_RT_NAMES { \
     308        { 0, 0 }, \
     309        { "dump", CTLTYPE_STRUCT }, \
     310        { "flags", CTLTYPE_STRUCT }, \
     311        { "iflist", CTLTYPE_STRUCT }, \
     312}
     313
     314#endif /* !TCPV40HDRS */
     315
     316
    192317/*
    193318 * Maximum queue length specifiable by listen.
    194319 */
     320#ifdef TCPV40HDRS
    195321#define SOMAXCONN       5
     322#else
     323#define SOMAXCONN       1024
     324#endif
    196325
    197326/*
     
    201330struct msghdr {
    202331        caddr_t msg_name;               /* optional address */
     332#ifdef TCPV40HDRS
    203333        int     msg_namelen;            /* size of address */
    204334        struct  iovec *msg_iov;         /* scatter/gather array */
     
    206336        caddr_t msg_accrights;          /* access rights sent/received */
    207337        int     msg_accrightslen;
     338#else
     339        u_int   msg_namelen;            /* size of address */
     340        struct  iovec *msg_iov;         /* scatter/gather array */
     341        u_int   msg_iovlen;             /* # elements in msg_iov */
     342        caddr_t msg_control;            /* ancillary data, see below */
     343        u_int   msg_controllen;         /* ancillary data buffer len */
     344        long    msg_flags;              /* flags on received message */
     345#endif
    208346};
    209347
     
    211349#define MSG_PEEK        0x2             /* peek at incoming message */
    212350#define MSG_DONTROUTE   0x4             /* send without using routing tables */
    213 #define MSG_EOR         0x8             /* data completes record */
    214 #define MSG_TRUNC       0x10            /* data discarded before delivery */
    215 #define MSG_CTRUNC      0x20            /* control data lost before delivery */
    216 #define MSG_WAITALL     0x40            /* wait for full request or error */
    217 
     351#define MSG_FULLREAD    0x8             /* send without using routing tables */
     352#ifndef TCPV40HDRS
     353#define MSG_EOR         0x10            /* data completes record */
     354#define MSG_TRUNC       0x20            /* data discarded before delivery */
     355#define MSG_CTRUNC      0x40            /* control data lost before delivery */
     356#define MSG_WAITALL     0x80            /* wait for full request or error */
     357#define MSG_DONTWAIT    0x100           /* this message should be nonblocking */
     358#ifdef TTCP
     359#define MSG_EOF         0x200
     360#endif
     361#define MSG_MAPIO       0x400           /* mem mapped io */
     362#define MSG_CLOSE       0x800           /* close connection after succesful send_file */
     363#endif
     364
     365#ifdef TCPV40HDRS
    218366#define MSG_MAXIOVLEN   16
     367#endif
    219368
    220369/*
     
    246395#define SCM_RIGHTS      0x01            /* access rights (array of int) */
    247396
    248 extern  int     accept (int, struct sockaddr *, int *);
    249 extern  int     bind (int, __const__ struct sockaddr *, int);
    250 extern  int     connect (int, __const__ struct sockaddr *, int);
    251 extern  int     gethostid (void);
    252 extern  int     getpeername (int, struct sockaddr *, int *);
    253 extern  int     getsockname (int, struct sockaddr *, int *);
    254 extern  int     getsockopt (int, int, int, void *, int *);
    255 extern  int     listen (int, int);
    256 extern  int     recv (int, void *, int, int);
    257 extern  int     recvfrom (int, void *, int, int, struct sockaddr *, int *);
    258 extern  int     recvmsg (int, struct msghdr *, int);
    259 extern  int     send (int, __const__ void *, int, int);
    260 extern  int     sendto (int, __const__ void *, int, int, __const__ struct sockaddr *, int);
    261 extern  int     sendmsg (int, __const__ struct msghdr *, int);
    262 extern  int     setsockopt (int, int, int, __const__ void *, int);
    263 extern  int     shutdown (int, int);
    264 extern  int     socket (int, int, int);
    265 extern  int     socketpair (int, int, int, int *);
    266 
    267 extern  int     _impsockhandle (int, int);
    268 
    269 /* special IBM prototypes
    270  * hv: warning: usage of these routines may interfere with EMX operation
    271  * usage is not recommended.
    272  */
    273 extern  void    psock_errno(__const__ char*);
    274 extern  int     soabort(int);
    275 extern  int     soclose(int);
    276 extern  int     sock_init(void);
    277 extern  int     sock_errno(void);
    278 extern  int     so_cancel(int);
    279 extern  int     getinetversion(char*);
    280 
    281 /* hv: these are new TCPIPV4 data structures. Consult IBM doc on that */
    282 #ifdef TCPIPV4
     397#ifndef TCPV40HDRS
     398/*
     399 * 4.3 compat sockaddr, move to compat file later
     400 */
     401struct osockaddr {
     402        u_short sa_family;              /* address family */
     403        char    sa_data[14];            /* up to 14 bytes of direct address */
     404};
     405
     406/*
     407 * 4.3-compat message header (move to compat file later).
     408 */
     409struct omsghdr {
     410        caddr_t msg_name;               /* optional address */
     411        int     msg_namelen;            /* size of address */
     412        struct  iovec *msg_iov;         /* scatter/gather array */
     413        int     msg_iovlen;             /* # elements in msg_iov */
     414        caddr_t msg_accrights;          /* access rights sent/received */
     415        int     msg_accrightslen;
     416};
     417
     418/*
     419 * send_file parameter structure
     420 */
     421struct sf_parms {
     422        void   *header_data;      /* ptr to header data */
     423        size_t header_length;     /* size of header data */
     424        int    file_handle;       /* file handle to send from */
     425        size_t file_size;         /* size of file */
     426        int    file_offset;       /* byte offset in file to send from */
     427        size_t file_bytes;        /* bytes of file to be sent */
     428        void   *trailer_data;     /* ptr to trailer data */
     429        size_t trailer_length;    /* size of trailer data */
     430        size_t bytes_sent;        /* bytes sent in this send_file call */
     431};
     432#endif
     433
     434int     _System accept (int, struct sockaddr *, int *);
     435int     _System bind (int, __const__ struct sockaddr *, int);
     436int     _System connect (int, __const__ struct sockaddr *, int);
     437int     _System gethostid (void);
     438int     _System getpeername (int, struct sockaddr *, int *);
     439int     _System getsockname (int, struct sockaddr *, int *);
     440int     _System getsockopt (int, int, int, void *, int *);
     441int     _System listen (int, int);
     442int     _System recv (int, void *, int, int);
     443int     _System recvfrom (int, void *, int, int, struct sockaddr *, int *);
     444int     _System recvmsg (int, struct msghdr *, int);
     445int     _System send (int, __const__ void *, int, int);
     446int     _System sendto (int, __const__ void *, int, int, __const__ struct sockaddr *, int);
     447int     _System sendmsg (int, __const__ struct msghdr *, int);
     448int     _System setsockopt (int, int, int, __const__ void *, int);
     449int     _System shutdown (int, int);
     450int     _System socket (int, int, int);
     451int     _System socketpair (int, int, int, int *);
     452
     453/* EMX addition */
     454int    _impsockhandle (int, int);
     455
     456#ifndef TCPV40HDRS
     457int     _System accept_and_recv (long, long*, struct sockaddr *, long*, struct sockaddr*, long*, caddr_t, size_t);
     458#endif
     459
     460/* OS/2 additions */
     461void    _System addsockettolist(int);
     462int     _System removesocketfromlist(int);
     463#include <sys/ioccom.h>
     464#ifdef TCPV40HDRS
     465#include <sys/select.h>
     466#endif
     467int     _System sock_init( void );
     468int     _System sock_errno( void );
     469void    _System psock_errno( char * );
     470int     _System soclose( int );
     471int     _System so_cancel(int);
     472int     _System Raccept(int, struct sockaddr *, int *);
     473#ifdef TCPV40HDRS
     474struct sockaddr_in;
     475int     _System Rbind(int, struct sockaddr_in *, int, struct sockaddr_in *);
     476#else
     477int     _System Rbind(int, struct sockaddr *, int, struct sockaddr *);
     478#endif
     479int     _System Rconnect(int, const struct sockaddr *, int);
     480int     _System Rgetsockname(int, struct sockaddr *, int *);
     481int     _System Rlisten(int, int);
     482#ifndef TCPV40HDRS
     483ssize_t _System send_file(int *, struct sf_parms *, int );
     484char *  _System sock_strerror(int);
     485int     _System getinetversion(char *);
     486#endif
     487
     488
     489/* more OS/2 stuff. */
     490#ifndef MAXSOCKETS
     491#define MAXSOCKETS      2048
     492#endif
     493
    283494#define MT_FREE         0
    284495#define MT_DATA         1
     
    305516};
    306517
    307 #define MAXSOCKETS      2048
    308518
    309519struct sostats {
    310520        short count;
    311         short socketdata[9*MAXSOCKETS];
    312 };
    313 #endif
     521#ifdef TCPV40HDRS
     522        short socketdata[9*MAXSOCKETS];
     523#else
     524        short socketdata[13*MAXSOCKETS];
     525#endif
     526};
    314527
    315528#if defined (__cplusplus)
  • trunk/src/emx/include/sys/sockio.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* Copyright (c)1996 by Holger Veit
    2  * May be freely used with EMX
     1/*- Modified for gcc/os2 by bird 2003
     2 *
     3 * Copyright (c) 1982, 1986, 1990, 1993, 1994
     4 *      The Regents of the University of California.  All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 * 3. All advertising materials mentioning features or use of this software
     15 *    must display the following acknowledgement:
     16 *      This product includes software developed by the University of
     17 *      California, Berkeley and its contributors.
     18 * 4. Neither the name of the University nor the names of its contributors
     19 *    may be used to endorse or promote products derived from this software
     20 *    without specific prior written permission.
     21 *
     22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32 * SUCH DAMAGE.
     33 *
     34 *      @(#)sockio.h    8.1 (Berkeley) 3/28/94
     35 * $FreeBSD: src/sys/sys/sockio.h,v 1.14.2.6 2002/02/07 15:12:37 ambrisko Exp $
    336 */
    437
    5 /* BSD uses this to declare some more ioctls */
    6 
    7 #ifndef _SYS_SOCKIO_H_
    8 #define _SYS_SOCKIO_H_
    9 
    10 #include <sys/so_ioctl.h>
     38#ifndef _SYS_SOCKIO_H_
     39#define _SYS_SOCKIO_H_
     40
     41#include <sys/ioccom.h>
     42#include "ioccom.h"
     43
     44/* Socket ioctl's. */
     45#ifdef TCPV40HDRS
     46#define SIOCSHIWAT       _IOW('s',  0, int)             /* set high watermark */
     47#define SIOCGHIWAT       _IOR('s',  1, int)             /* get high watermark */
     48#define SIOCSLOWAT       _IOW('s',  2, int)             /* set low watermark */
     49#define SIOCGLOWAT       _IOR('s',  3, int)             /* get low watermark */
     50#endif /* TCPV40HDRS */
     51#define SIOCATMARK       _IOR('s',  7, int)             /* at oob mark? */
     52#define SIOCSPGRP        _IOW('s',  8, int)             /* set process group */
     53#define SIOCGPGRP        _IOR('s',  9, int)             /* get process group */
     54
     55#define SIOCADDRT        _IOW('r', 10, struct ortentry) /* add route */
     56#define SIOCDELRT        _IOW('r', 11, struct ortentry) /* delete route */
     57#if 0 /* not on OS/2 */
     58#define SIOCGETVIFCNT   _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
     59#define SIOCGETSGCNT    _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
     60#endif
     61
     62#define SIOCSIFADDR      _IOW('i', 12, struct ifreq)    /* set ifnet address */
     63#define OSIOCGIFADDR    _IOWR('i', 13, struct ifreq)    /* get ifnet address */
     64#ifdef TCPV40HDRS
     65#define SIOCGIFADDR     _IOWR('i', 13, struct ifreq)    /* get ifnet address */
     66#else
     67#define SIOCGIFADDR     _IOWR('i', 33, struct ifreq)    /* get ifnet address */
     68#endif /* TCPV40HDRS */
     69#define SIOCSIFDSTADDR   _IOW('i', 14, struct ifreq)    /* set p-p address */
     70#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq)    /* get p-p address */
     71#ifdef TCPV40HDRS
     72#define SIOCGIFDSTADDR  _IOWR('i', 15, struct ifreq)    /* get p-p address */
     73#else
     74#define SIOCGIFDSTADDR  _IOWR('i', 34, struct ifreq)    /* get p-p address */
     75#endif /* TCPV40HDRS */
     76#define SIOCSIFFLAGS     _IOW('i', 16, struct ifreq)    /* set ifnet flags */
     77#define SIOCGIFFLAGS    _IOWR('i', 17, struct ifreq)    /* get ifnet flags */
     78#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq)    /* get broadcast addr */
     79#ifdef TCPV40HDRS
     80#define SIOCGIFBRDADDR  _IOWR('i', 18, struct ifreq)    /* get broadcast addr */
     81#else
     82#define SIOCGIFBRDADDR  _IOWR('i', 35, struct ifreq)    /* get broadcast addr */
     83#endif /* TCPV40HDRS */
     84#define SIOCSIFBRDADDR   _IOW('i', 19, struct ifreq)    /* set broadcast addr */
     85#define OSIOCGIFCONF    _IOWR('i', 20, struct ifconf)   /* get ifnet list */
     86#ifdef TCPV40HDRS
     87#define SIOCGIFCONF     _IOWR('i', 20, struct ifconf)   /* get ifnet list */
     88#else
     89#define SIOCGIFCONF     _IOWR('i', 36, struct ifconf)   /* get ifnet list */
     90#endif /* TCPV40HDRS */
     91#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq)    /* get net addr mask */
     92#ifdef TCPV40HDRS
     93#define SIOCGIFNETMASK  _IOWR('i', 21, struct ifreq)    /* get net addr mask */
     94#else
     95#define SIOCGIFNETMASK  _IOWR('i', 37, struct ifreq)    /* get net addr mask */
     96#endif /* TCPV40HDRS */
     97#define SIOCSIFNETMASK   _IOW('i', 22, struct ifreq)    /* set net addr mask */
     98#define SIOCGIFMETRIC   _IOWR('i', 23, struct ifreq)    /* get IF metric */
     99#define SIOCSIFMETRIC    _IOW('i', 24, struct ifreq)    /* set IF metric */
     100
     101#if 1 /* different on OS/2 */
     102#define SIOCDIFADDR      _IOW('i', 64, struct ifreq)    /* delete IF addr */
     103#define SIOCAIFADDR      _IOW('i', 63, struct ifaliasreq)/* add/chg IF alias */
     104#else /*!OS2:*/
     105#define SIOCDIFADDR      _IOW('i', 25, struct ifreq)    /* delete IF addr */
     106#define SIOCAIFADDR      _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
     107#endif
     108
     109#if 0 /* not on OS/2 */
     110#define SIOCALIFADDR     _IOW('i', 27, struct if_laddrreq) /* add IF addr */
     111#define SIOCGLIFADDR    _IOWR('i', 28, struct if_laddrreq) /* get IF addr */
     112#define SIOCDLIFADDR     _IOW('i', 29, struct if_laddrreq) /* delete IF addr */
     113#define SIOCSIFCAP       _IOW('i', 30, struct ifreq)    /* set IF features */
     114#define SIOCGIFCAP      _IOWR('i', 31, struct ifreq)    /* get IF features */
     115#endif /*!OS2*/
     116
     117#if 1 /* different on OS/2 */
     118#define SIOCADDMULTI     _IOW('i', 51, struct ifreq)    /* add m'cast addr */
     119#define SIOCDELMULTI     _IOW('i', 52, struct ifreq)    /* del m'cast addr */
     120#else /* !OS2: */
     121#define SIOCADDMULTI     _IOW('i', 49, struct ifreq)    /* add m'cast addr */
     122#define SIOCDELMULTI     _IOW('i', 50, struct ifreq)    /* del m'cast addr */
     123#endif
     124
     125#if 1 /* different on OS/2 */
     126#define SIOCGIFMTU        _IOR('i', 57, struct ifreq)   /* get IF mtu */
     127#define SIOCSIFMTU        _IOW('i', 45, struct ifreq)   /* set IF mtu */
     128#else
     129#define SIOCGIFMTU      _IOWR('i', 51, struct ifreq)    /* get IF mtu */
     130#define SIOCSIFMTU       _IOW('i', 52, struct ifreq)    /* set IF mtu */
     131#endif
     132#if 0 /* not on OS/2 */
     133#define SIOCGIFPHYS     _IOWR('i', 53, struct ifreq)    /* get IF wire */
     134#define SIOCSIFPHYS      _IOW('i', 54, struct ifreq)    /* set IF wire */
     135#define SIOCSIFMEDIA    _IOWR('i', 55, struct ifreq)    /* set net media */
     136#define SIOCGIFMEDIA    _IOWR('i', 56, struct ifmediareq) /* get net media */
     137
     138#define SIOCSIFPHYADDR   _IOW('i', 70, struct ifaliasreq) /* set gif addres */
     139#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq)    /* get gif psrc addr */
     140#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq)    /* get gif pdst addr */
     141#define SIOCDIFPHYADDR   _IOW('i', 73, struct ifreq)    /* delete gif addrs */
     142#define SIOCSLIFPHYADDR  _IOW('i', 74, struct if_laddrreq) /* set gif addrs */
     143#define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */
     144
     145#define SIOCSIFGENERIC   _IOW('i', 57, struct ifreq)    /* generic IF set op */
     146#define SIOCGIFGENERIC  _IOWR('i', 58, struct ifreq)    /* generic IF get op */
     147
     148#define SIOCGIFSTATUS   _IOWR('i', 59, struct ifstat)   /* get IF status */
     149#define SIOCSIFLLADDR    _IOW('i', 60, struct ifreq)    /* set linklevel addr */
     150
     151#define SIOCGPRIVATE_0  _IOWR('i', 80, struct ifreq)    /* Linux Private + 0 */
     152#define SIOCGPRIVATE_1  _IOWR('i', 81, struct ifreq)    /* Linux Private + 1 */
     153
     154#define SIOCIFCREATE    _IOWR('i', 122, struct ifreq)   /* create clone if */
     155#define SIOCIFDESTROY    _IOW('i', 121, struct ifreq)   /* destroy clone if */
     156#define SIOCIFGCLONERS  _IOWR('i', 120, struct if_clonereq) /* get cloners */
     157#endif /*!OS2*/
     158
     159/* OS2 specific ioctls */
     160#define SIOCSHOSTID       _IOW('s', 10, long)
     161#define SIOCGNBNAME       _IOR('s', 11, long)   /* AFNB code. Not clear now */
     162#define SIOCSNBNAME       _IOW('s', 12, long)   /* AFNB                     */
     163#define SIOCGNCBFN        _IOR('s', 13, long)   /* AFNB                     */
     164#ifndef TCPV40HDRS
     165#define SIOCSSYN          _IOW('s', 14, long)   /* SYN Attack */
     166#endif /* !TCPV40HDRS */
     167#define SIOCSIFBRD        _IOW('i', 27, int)    /* SINGLE-rt bcst. using old # for bkw cmpt */
     168#ifdef TCPV40HDRS
     169#define SIOCSIFALLRTB      ioc('i', 63) /* added to configure all-route broadcst */
     170#else
     171#define SIOCSIFALLRTB     _IOW('i', 65, struct ifreq) /* added to configure all-route broadcst */
     172#endif /* TCPV40HDRS */
     173
     174#define SIOCSARP          _IOW('i', 30, struct arpreq)/* set ARP entry */
     175#define SIOCGARP          _IOR('i', 31, struct arpreq)
     176#define SIOCDARP          _IOW('i', 32, struct arpreq)
     177
     178#define SIOCSIF802_3      _IOW('i', 40, struct ifreq)
     179#define SIOCSIFNO802_3    _IOW('i', 41, struct ifreq)
     180#define SIOCSIFNOREDIR    _IOW('i', 42, struct ifreq)
     181#define SIOCSIFYESREDIR   _IOW('i', 43, struct ifreq)
     182
     183#define SIOCSIFFDDI       _IOW('i', 46, struct ifreq)
     184#define SIOCSIFNOFDDI     _IOW('i', 47, struct ifreq)
     185#define SIOCSRDBRD        _IOW('i', 48, struct ifreq)
     186
     187#define SIOCGARP_TR       _IOR('i', 50, struct arpreq_tr)
     188#define SIOCSARP_TR       _IOW('i', 49, struct arpreq_tr)
     189
     190#if defined(SLBOOTP) || defined(INCL_TCPIP_ALLIOCTLS)
     191/** Used to retreive unit number on serial interface. */
     192#define SIOCGUNIT         _IOR('i', 70, struct ifreq)
     193#endif
     194
     195/** To check if the interface is Valid or not */
     196#define SIOCGIFVALID      _IOR('i', 75, struct ifreq)
     197/** Ioctl to return bound/shld bind ifs */
     198struct bndreq { short bindings; short bound; };
     199#define SIOCGIFBOUND      _IOR('i', 76, struct bndreq)
     200
     201/** Get multicast gp. info for an interface ret list of m-cast addrs for an if */
     202#define SIOCGMCAST        _IOR('i', 81, struct addrreq)
     203#define SIOCMULTISBC      _IOW('i', 61, struct ifreq)   /* use broadcast to send IP multicast*/
     204#define SIOCMULTISFA      _IOW('i', 62, struct ifreq)   /* use functional addr to send IP multicast*/
     205
     206#ifndef TCPV40HDRS
     207/** block until intf change to running state */
     208#define SIOCSIFRUNNINGBLK _IOW('i', 77, struct ifreq)
     209#endif
     210
     211/* Interface Tracing Support */
     212#define SIOCGIFEFLAGS     _IOR('i', 150, struct ifreq)
     213#define SIOCSIFEFLAGS     _IOW('i', 151, struct ifreq)
     214#define SIOCGIFTRACE      _IOR('i', 152, struct ifreq)
     215#define SIOCSIFTRACE      _IOW('i', 153, struct ifreq)
     216
     217/* SLIP STATS */
     218#define SIOCSSTAT         _IOW('i', 154, struct ifreq)
     219#define SIOCGSTAT         _IOR('i', 155, struct ifreq)
     220
     221#ifndef TCPV40HDRS
     222#define SIOCSMSL          _IOW('t', 1, long)          /* set the msl in seconds */
     223#define SIOCGMSL          _IOR('t', 2, long)          /* get the msl in seconds */
     224#endif
     225
     226/* NETSTAT stuff */
     227#define SIOSTATMBUF       _IOR('n', 40, struct mbstat)
     228#define SIOSTATTCP        _IOR('n', 41, struct tcpstat)
     229#define SIOSTATUDP        _IOR('n', 42, struct udpstat)
     230#define SIOSTATIP         _IOR('n', 43, struct ipstat)
     231#define SIOSTATSO         _IOR('n', 44, char /*struct sockaddr*/)
     232#ifndef TCPV40HDRS
     233#define SIOSTATTCPZ       _IOR('n', 241, struct tcpstat)
     234#define SIOSTATUDPZ       _IOR('n', 242, struct udpstat)
     235#define SIOSTATIPZ        _IOR('n', 243, struct ipstat)
     236#endif
     237
     238#define SIOSTATRT         _IOR('n', 45, char /*struct rtentries*/)
     239#define SIOFLUSHRT        _IOW('n', 46, long)                     /* Backward compatibility */
     240#define SIOSTATICMP       _IOR('n', 47, struct icmpstat)
     241#ifndef TCPV40HDRS
     242#define SIOSTATICMPZ      _IOR('n', 247, struct icmpstat)
     243#endif
     244#define SIOSTATIF         _IOR('n', 48, char /*struct ifmib*/)
     245#define SIOSTATAT         _IOR('n', 49, char /*struct statatreq*/)
     246#define SIOSTATARP        _IOR('n', 50, char /*struct oarptab*/)
     247#define SIOSTATIF42       _IOR('n', 51, char /*struct ifmib*/)
     248#define SIOSTATCNTRT      _IOR('n', 52, int)
     249#define SIOSTATCNTAT      _IOR('n', 53, int)
     250
     251#ifndef TCPV40HDRS
     252#define SIOSTATIGMP       _IOR('n', 54, struct igmpstat)  /* SNMP stuff     */
     253#define SIOFLUSHRTIFP     _IOW('n', 55, long) /* delete routes on an interface */
     254#define SIOSTATIGMPZ      _IOR('n', 254, struct igmpstat) /* SNMP stuff     */
     255
     256/** adding this ioctl() to be able to send arp request using an ioctl() */
     257#define SIOCARP           _IOR('i', 156, int)
     258#endif /* !TCPV40HDRS */
     259
     260#if defined(TCPV40HDRS) || defined(INCL_TCPIP_ALLIOCTLS)
     261#define SIOMETRIC1RT    ioc('r', 12)
     262#define SIOMETRIC2RT    ioc('r', 13)
     263#define SIOMETRIC3RT    ioc('r', 14)
     264#define SIOMETRIC4RT    ioc('r', 15)
     265#define SIOCREGADDNET   ioc('r', 12)
     266#define SIOCREGDELNET   ioc('r', 13)
     267#define SIOCREGROUTES   ioc('r', 14)
     268#define SIOCFLUSHROUTES ioc('r', 15)
     269#define SIOCSIFSETSIG   ioc('i', 25)
     270#define SIOCSIFCLRSIG   ioc('i', 26)
     271#define SIOCGIFLOAD     ioc('i', 27)
     272#define SIOCSIFFILTERSRC ioc('i', 28)
     273#define SIOCGIFFILTERSRC ioc('i',29)
     274#define SIOCSIFSNMPSIG  ioc('i', 33)
     275#define SIOCSIFSNMPCLR  ioc('i', 34)
     276#define SIOCSIFSNMPCRC  ioc('i', 35)
     277#define SIOCSIFPRIORITY ioc('i', 36)
     278#define SIOCGIFPRIORITY ioc('i', 37)
     279#define SIOCSIFFILTERDST ioc('i', 38)
     280#define SIOCGIFFILTERDST ioc('i',39)
     281#define SIOCSIFSPIPE    ioc('i',71)   /* used to set pipe size on interface */
     282                                      /* this is used as tcp send buffer size */
     283#define SIOCSIFRPIPE    ioc('i',72)   /* used to set pipe size on interface */
     284                                      /* this is used as tcp recv buffer size */
     285#define SIOCSIFTCPSEG   ioc('i',73)   /* set the TCP segment size on interface*/
     286#define SIOCSIFUSE576   ioc('i',74)   /* enable/disable the automatic change of mss to 576 */
     287                                      /* if going through a router */
     288#endif  /* TCPV40HDRS || ALL */
    11289
    12290#endif /* !_SYS_SOCKIO_H_ */
  • trunk/src/emx/include/sys/syslimits.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    5757#ifndef NGROUPS_MAX
    5858/** Max supplemental group id's.
    59  * OS2: doesn't make much sens just set it high. */
    60 #define NGROUPS_MAX     256
     59 * OS2: doesn't make much sense. Redefined in limits.h btw. */
     60#define NGROUPS_MAX     0
    6161#endif
    6262
  • trunk/src/emx/include/sys/time.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* sys/time.h (emx+gcc) */
     1/* - modified for gcc/os2 by bird 2003
     2 *
     3 * Copyright (c) 1982, 1986, 1993
     4 *      The Regents of the University of California.  All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 * 3. All advertising materials mentioning features or use of this software
     15 *    must display the following acknowledgement:
     16 *      This product includes software developed by the University of
     17 *      California, Berkeley and its contributors.
     18 * 4. Neither the name of the University nor the names of its contributors
     19 *    may be used to endorse or promote products derived from this software
     20 *    without specific prior written permission.
     21 *
     22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32 * SUCH DAMAGE.
     33 *
     34 *      @(#)time.h      8.5 (Berkeley) 5/4/95
     35  */
    236
    3 #ifndef _SYS_TIME_H
    4 #define _SYS_TIME_H
     37#ifndef _SYS_TIME_H_
     38#define _SYS_TIME_H_
    539
    640#include <time.h>
     41#include <sys/types.h>
    742
    843#if defined (__cplusplus)
     
    1247#if !defined (_TIMEVAL)
    1348#define _TIMEVAL
     49/** gettimeofday return structure */
    1450struct timeval
    1551{
     52  /** seconds */
    1653  long tv_sec;
     54  /** and microseconds */
    1755  long tv_usec;
    1856};
     
    2159#if !defined (_TIMEZONE)
    2260#define _TIMEZONE
     61/** Timezone information */
    2362struct timezone
    2463{
     64  /** minutes west of Greenwich */
    2565  int tz_minuteswest;
     66  /** type of dst correction. */
    2667  int tz_dsttime;
    2768};
    2869#endif
    2970
    30 int utimes (__const__ char *, __const__ struct timeval *);
    31 int gettimeofday (struct timeval *, struct timezone *);
    32 int settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     71#if !defined(TCPV40HDRS) && !defined(DST_NONE)
     72#define DST_NONE    0   /* not on dst */
     73#define DST_USA     1   /* USA style dst. */
     74#define DST_AUST    2   /* Australian style dst. */
     75#define DST_WET     3   /* Western European dst. */
     76#define DST_MET     4   /* Middle European dst. */
     77#define DST_EET     5   /* Eastern European dst. */
     78#define DST_CAN     6   /* Canada. */
     79#endif  /* !TCPV40HDRS */
     80
     81#ifndef TCPV40HDRS
     82#pragma pack(4)
     83/** POSIX.4 version of timeval. */
     84struct timespec {
     85        time_t  ts_sec;         /* seconds */
     86        long    ts_nsec;        /* and nanoseconds */
     87};
     88#pragma pack()
     89#define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
     90        (ts)->ts_sec = (tv)->tv_sec;                                    \
     91        (ts)->ts_nsec = (tv)->tv_usec * 1000;                           \
     92}
     93#define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
     94        (tv)->tv_sec = (ts)->ts_sec;                                    \
     95        (tv)->tv_usec = (ts)->ts_nsec / 1000;                           \
     96}
     97
     98/* Operations on timevals. */
     99#define timerclear(tvp)         ((tvp)->tv_sec = (tvp)->tv_usec = 0)
     100#define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
     101#ifndef timercmp
     102#define timercmp(tvp, uvp, cmp)                                         \
     103        (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
     104            ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
     105            ((tvp)->tv_sec cmp (uvp)->tv_sec))
     106#endif
     107#ifndef timeradd
     108#define timeradd(tvp, uvp, vvp)                                         \
     109        do {                                                            \
     110                (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;          \
     111                (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
     112                if ((vvp)->tv_usec >= 1000000) {                        \
     113                        (vvp)->tv_sec++;                                \
     114                        (vvp)->tv_usec -= 1000000;                      \
     115                }                                                       \
     116        } while (0)
     117#endif
     118#ifdef timersub
     119#define timersub(tvp, uvp, vvp)                                         \
     120        do {                                                            \
     121                (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
     122                (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
     123                if ((vvp)->tv_usec < 0) {                               \
     124                        (vvp)->tv_sec--;                                \
     125                        (vvp)->tv_usec += 1000000;                      \
     126                }                                                       \
     127        } while (0)
     128#endif
     129
     130/*
     131 * Getkerninfo clock information structure
     132 */
     133struct clockinfo {
     134        int     hz;             /* clock frequency */
     135        int     tick;           /* micro-seconds per hz tick */
     136        int     stathz;         /* statistics clock frequency */
     137        int     profhz;         /* profiling clock frequency */
     138};
     139
     140/*
     141 * Names of the interval timers, and structure
     142 * defining a timer setting.
     143 */
     144#define ITIMER_REAL     0
     145#define ITIMER_VIRTUAL  1
     146#define ITIMER_PROF     2
     147#endif /* !TCPV40HDRS */
     148
     149#pragma pack(4)
     150struct  itimerval {
     151        struct  timeval it_interval;    /* timer interval */
     152        struct  timeval it_value;       /* current value */
     153};
     154#pragma pack()
    33155
    34156
    35 int _utimes (__const__ char *, __const__ struct timeval *);
    36 int _gettimeofday (struct timeval *, struct timezone *);
    37 int _settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     157#if defined(TCPV40HDRS) || !defined(_POSIX_SOURCE)
     158int     _System utimes (__const__ char *, __const__ struct timeval *);
     159int     _System gettimeofday (struct timeval *, struct timezone *);
     160int     _System settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     161#ifndef TCPV40HDRS
     162#include <sys/cdefs.h>
     163int     _System adjtime(const struct timeval *, struct timeval *);
     164int     _System getitimer(int, struct itimerval *);
     165int     _System setitimer(int, const struct itimerval *, struct itimerval *);
     166#endif
     167#endif /* TCPV40HDRS */
     168
    38169
    39170#if defined (__cplusplus)
     
    41172#endif
    42173
    43 #endif /* not _SYS_TIME_H */
     174#endif /* not _SYS_TIME_H_ */
  • trunk/src/emx/include/sys/types.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r182 r183  
    44#define _SYS_TYPES_H
    55
     6/* freebsd/toolkit compatibility */
     7#include <sys/cdefs.h>
     8#include <sys/inttypes.h> /* includes machine/ansi.h */
     9#include <machine/types.h>
     10
    611#if !defined (_SIZE_T)
    712#define _SIZE_T
    813typedef unsigned long size_t;
     14#undef  _BSD_SIZE_T_
    915#endif
    1016
     
    1218#define _SSIZE_T
    1319typedef int ssize_t;
     20#undef  _BSD_SSIZE_T_
    1421#endif
    1522
     
    1724#define _TIME_T
    1825typedef unsigned long time_t;
     26#undef  _BSD_TIME_T_
    1927#endif
    2028
     
    2230#define _INO_T
    2331typedef int ino_t;
     32#undef  _BSD_INO_T_
    2433#endif
    2534
     
    2736#define _DEV_T
    2837typedef int dev_t;
     38#undef  _BSD_DEV_T_
    2939#endif
    3040
     
    3242#define _OFF_T
    3343typedef long off_t;
     44#undef  _BSD_OFF_T_
    3445#endif
    3546
     
    3748#define _MODE_T
    3849typedef int mode_t;
     50#undef  _BSD_MODE_T_
    3951#endif
    4052
     
    4254#define _NLINK_T
    4355typedef int nlink_t;
     56#undef  _BSD_NLINK_T_
    4457#endif
    4558
     
    4760#define _UID_T
    4861typedef int uid_t;
     62#undef  _BSD_UID_T_
    4963#endif
    5064
     
    5266#define _PID_T
    5367typedef int pid_t;
     68#undef  _BSD_PID_T_
    5469#endif
    5570
     
    5772#define _GID_T
    5873typedef int gid_t;
     74#undef  _BSD_GID_T_
    5975#endif
    6076
     
    6278
    6379#if !defined (FD_SETSIZE)
    64 #define FD_SETSIZE      256
    65 #else
    66 #if FD_SETSIZE < 256
    67  #error FD_SETSIZE must be at least 256
     80#define FD_SETSIZE 256
     81#elif FD_SETSIZE < 256
     82#error FD_SETSIZE must be at least 256
    6883#endif
     84
     85#ifndef _howmany
     86#define _howmany(a,b)       (((a) + ((b) - 1)) / (b))
     87#endif
     88#if defined(TCPV40HDRS) && !defined(howmany)
     89#define howmany(a,b)        (((a) + ((b) - 1)) / (b))
    6990#endif
    7091
    7192#if !defined (_FD_SET_T)
    7293#define _FD_SET_T
     94/** The base type for the select file descriptor bitmap. */
     95typedef unsigned long   __fd_mask;
     96/** Number of bits in a byte. */
     97#define NBBY        8
     98/** Number of bits in a byte. */
     99#define _NFDBITS    (sizeof(__fd_mask) * 8)     /* bits per mask */
     100/** Select set. */
     101typedef struct fd_set
     102{
     103    __fd_mask   __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
     104} fd_set;
    73105
    74 typedef struct _fd_set
    75 {
    76   unsigned long fds_bits[(FD_SETSIZE+31) / 32];
    77 } fd_set;
     106#if defined(__BSD_VISIBLE) || defined(TCPV40HDRS)
     107typedef __fd_mask   fd_mask;
     108#define fds_bits    __fds_bits
     109#define NFDBITS     _NFDBITS
     110#endif
    78111
    79112#endif
    80113
    81 #define FD_SET(n,s)    ((s)->fds_bits[(n)/32] |=  (1L << ((n) & 0x1f)))
    82 #define FD_CLR(n,s)    ((s)->fds_bits[(n)/32] &= ~(1L << ((n) & 0x1f)))
    83 #define FD_ISSET(n,s)  ((s)->fds_bits[(n)/32] &   (1L << ((n) & 0x1f)))
    84 #define FD_ZERO(s)     (void)memset (s, 0, sizeof (*(s)))
     114#ifndef FD_SET
     115/** Set a bit in the select file descriptor bitmap. */
     116#define FD_SET(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] |=  (1L << ((n) & (_NFDBITS - 1))))
     117/** Clear a bit in the select file descriptor bitmap. */
     118#define FD_CLR(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] &= ~(1L << ((n) & (_NFDBITS - 1))))
     119/** Test if a bit in the select file descriptor bitmap is set. */
     120#define FD_ISSET(n,s)  ((s)->__fds_bits[(n)/_NFDBITS] &   (1L << ((n) & (_NFDBITS - 1))))
     121/** Initialize the select file descriptor bitmap clearing all bits. */
     122#define FD_ZERO(s)     (void)memset(s, 0, sizeof(*(s)))
     123#if __BSD_VISIBLE
     124/** Copy a select file descriptor bitmap. */
     125#define FD_COPY(src,trg) (void)(*(trg) = *(src))
     126#endif
     127#endif /* !FD_SET */
    85128
    86 #endif
     129#endif /* !_POSIX_SOURCE */
    87130
    88131#if !defined (_POSIX_SOURCE)
     
    94137typedef char *caddr_t;
    95138
     139/* toolkit pollution */
     140#ifdef __32BIT__
     141typedef int             long_int;       /* 32-bit compilers */
     142#else
     143typedef long int        long_int;       /* 16-bit compilers */
    96144#endif
    97145
     146#endif /* not _POSIX_SOURCE */
     147
     148typedef __uint8_t       u_int8_t;
     149typedef __uint16_t      u_int16_t;
     150typedef __uint32_t      u_int32_t;
     151typedef __uint64_t      u_int64_t;
     152
    98153#endif /* not _SYS_TYPES_H */
  • trunk/src/emx/include/sys/uio.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    33#ifndef _SYS_UIO_H
    44#define _SYS_UIO_H
     5#define _SYS_UIO_H_ /*toolkit pollution*/
    56
    67#if defined (__cplusplus)
     
    1112{
    1213  caddr_t iov_base;
     14#if defined(__32BIT__) && !defined(TCPV40HDRS)
     15  size_t  iov_len;
     16#else
    1317  int     iov_len;
     18#endif
    1419};
    1520
     21
    1622/* needed for sys\socket.h TCPIPV4 now */
    17 #ifdef TCPIPV4
     23#ifdef TCPV40HDRS
    1824struct uio {
    1925        struct iovec    *uio_iov;
     
    2329        unsigned int    uio_resid;
    2430};
    25 enum    uio_rw { UIO_READ, UIO_WRITE };
     31#ifndef FREAD
    2632#define FREAD   1
    2733#define FWRITE  2
    2834#endif
     35#endif
    2936
    30 int readv (int, __const__ struct iovec *, int);
    31 int writev (int, __const__ struct iovec *, int);
     37enum    uio_rw { UIO_READ, UIO_WRITE };
    3238
    33 int _readv (int, __const__ struct iovec *, int);
    34 int _writev (int, __const__ struct iovec *, int);
     39#ifndef TCPV40HDRS
     40/* Segment flag values. */
     41enum uio_seg {
     42        UIO_USERSPACE,          /* from user data space */
     43        UIO_SYSSPACE,           /* from system space */
     44        UIO_USERISPACE          /* from user I space */
     45};
     46#endif
     47
     48int _System readv (int, __const__ struct iovec *, int);
     49int _System writev (int, __const__ struct iovec *, int);
    3550
    3651#if defined (__cplusplus)
  • trunk/src/emx/include/sys/un.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Copyright (c)1996 by Holger Veit
    2  * May be freely used with EMX
     2 * May be freely used with EMX
     3 * Modified 2003 by bird
    34 */
    45
     
    67#define _SYS_UN_H_
    78
     9/** Definitions for UNIX IPC domain. */
    810struct  sockaddr_un {
     11#ifdef TCPV40HDRS
    912        u_short sun_family;     /* socket family: AF_UNIX */
     13#else
     14        u_char  sun_len;        /* sockaddr len including null */
     15        u_char  sun_family;     /* AF_UNIX */
     16#endif
    1017        char    sun_path[108];  /* path name (not used) */
    1118};
    1219
     20#ifndef TCPV40HDRS
     21/* actual length of an initialized sockaddr_un */
     22#define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
     23#endif
     24
    1325#endif /* !_SYS_UN_H_ */
Note: See TracChangeset for help on using the changeset viewer.