diff options
Diffstat (limited to 'sysdeps/generic/bits')
-rw-r--r-- | sysdeps/generic/bits/confname.h | 325 | ||||
-rw-r--r-- | sysdeps/generic/bits/ioctl-types.h | 121 | ||||
-rw-r--r-- | sysdeps/generic/bits/mathdef.h | 40 | ||||
-rw-r--r-- | sysdeps/generic/bits/resource.h | 146 | ||||
-rw-r--r-- | sysdeps/generic/bits/sched.h | 35 | ||||
-rw-r--r-- | sysdeps/generic/bits/select.h | 29 | ||||
-rw-r--r-- | sysdeps/generic/bits/sigaction.h | 50 | ||||
-rw-r--r-- | sysdeps/generic/bits/sigset.h | 81 | ||||
-rw-r--r-- | sysdeps/generic/bits/sockaddr.h | 41 | ||||
-rw-r--r-- | sysdeps/generic/bits/socket.h | 200 | ||||
-rw-r--r-- | sysdeps/generic/bits/statfs.h | 52 | ||||
-rw-r--r-- | sysdeps/generic/bits/termios.h | 230 | ||||
-rw-r--r-- | sysdeps/generic/bits/types.h | 94 | ||||
-rw-r--r-- | sysdeps/generic/bits/uio.h | 32 | ||||
-rw-r--r-- | sysdeps/generic/bits/ustat.h | 30 | ||||
-rw-r--r-- | sysdeps/generic/bits/utmp.h | 53 | ||||
-rw-r--r-- | sysdeps/generic/bits/utsname.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/bits/waitstatus.h | 104 |
18 files changed, 1666 insertions, 0 deletions
diff --git a/sysdeps/generic/bits/confname.h b/sysdeps/generic/bits/confname.h new file mode 100644 index 0000000000..5b5cf742b6 --- /dev/null +++ b/sysdeps/generic/bits/confname.h @@ -0,0 +1,325 @@ +/* `sysconf', `pathconf', and `confstr' NAME values. Generic version. + Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Values for the NAME argument to `pathconf' and `fpathconf'. */ +enum + { + _PC_LINK_MAX, +#define _PC_LINK_MAX _PC_LINK_MAX + _PC_MAX_CANON, +#define _PC_MAX_CANON _PC_MAX_CANON + _PC_MAX_INPUT, +#define _PC_MAX_INPUT _PC_MAX_INPUT + _PC_NAME_MAX, +#define _PC_NAME_MAX _PC_NAME_MAX + _PC_PATH_MAX, +#define _PC_PATH_MAX _PC_PATH_MAX + _PC_PIPE_BUF, +#define _PC_PIPE_BUF _PC_PIPE_BUF + _PC_CHOWN_RESTRICTED, +#define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED + _PC_NO_TRUNC, +#define _PC_NO_TRUNC _PC_NO_TRUNC + _PC_VDISABLE, + _PC_SYNC_IO, +#define _PC_SYNC_IO _PC_SYNC_IO + _PC_ASYNC_IO, +#define _PC_ASYNC_IO _PC_ASYNC_IO + _PC_PRIO_IO, +#define _PC_PRIO_IO _PC_PRIO_IO + _PC_SOCK_MAXBUF +#define _PC_SOCK_MAXBUF _PC_SOCK_MAXBUF + }; + +/* Values for the argument to `sysconf'. */ +enum + { + _SC_ARG_MAX, +#define _SC_ARG_MAX _SC_ARG_MAX + _SC_CHILD_MAX, +#define _SC_CHILD_MAX _SC_CHILD_MAX + _SC_CLK_TCK, +#define _SC_CLK_TCK _SC_CLK_TCK + _SC_NGROUPS_MAX, +#define _SC_NGROUPS_MAX _SC_NGROUPS_MAX + _SC_OPEN_MAX, +#define _SC_OPEN_MAX _SC_OPEN_MAX + _SC_STREAM_MAX, +#define _SC_STREAM_MAX _SC_STREAM_MAX + _SC_TZNAME_MAX, +#define _SC_TZNAME_MAX _SC_TZNAME_MAX + _SC_JOB_CONTROL, +#define _SC_JOB_CONTROL _SC_JOB_CONTROL + _SC_SAVED_IDS, +#define _SC_SAVED_IDS _SC_SAVED_IDS + _SC_REALTIME_SIGNALS, +#define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS + _SC_PRIORITY_SCHEDULING, +#define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING + _SC_TIMERS, +#define _SC_TIMERS _SC_TIMERS + _SC_ASYNCHRONOUS_IO, +#define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO + _SC_PRIORITIZED_IO, +#define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO + _SC_SYNCHRONIZED_IO, +#define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO + _SC_FSYNC, +#define _SC_FSYNC _SC_FSYNC + _SC_MAPPED_FILES, +#define _SC_MAPPED_FILES _SC_MAPPED_FILES + _SC_MEMLOCK, +#define _SC_MEMLOCK _SC_MEMLOCK + _SC_MEMLOCK_RANGE, +#define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE + _SC_MEMORY_PROTECTION, +#define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION + _SC_MESSAGE_PASSING, +#define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING + _SC_SEMAPHORES, +#define _SC_SEMAPHORES _SC_SEMAPHORES + _SC_SHARED_MEMORY_OBJECTS, +#define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS + _SC_AIO_LISTIO_MAX, +#define _SC_AIO_LIST_MAX _SC_AIO_LIST_MAX + _SC_AIO_MAX, +#define _SC_AIO_MAX _SC_AIO_MAX + _SC_AIO_PRIO_DELTA_MAX, +#define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX + _SC_DELAYTIMER_MAX, +#define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX + _SC_MQ_OPEN_MAX, +#define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX + _SC_MQ_PRIO_MAX, +#define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX + _SC_VERSION, +#define _SC_VERSION _SC_VERSION + _SC_PAGESIZE, +#define _SC_PAGESIZE _SC_PAGESIZE +#define _SC_PAGE_SIZE _SC_PAGESIZE + _SC_RTSIG_MAX, +#define _SC_RTSIG_MAX _SC_RTSIG_MAX + _SC_SEM_NSEMS_MAX, +#define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX + _SC_SEM_VALUE_MAX, +#define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX + _SC_SIGQUEUE_MAX, +#define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX + _SC_TIMER_MAX, +#define _SC_TIMER_MAX _SC_TIMER_MAX + + /* Values for the argument to `sysconf' + corresponding to _POSIX2_* symbols. */ + _SC_BC_BASE_MAX, +#define _SC_BC_BASE_MAX _SC_BC_BASE_MAX + _SC_BC_DIM_MAX, +#define _SC_BC_DIM_MAX _SC_BC_DIM_MAX + _SC_BC_SCALE_MAX, +#define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX + _SC_BC_STRING_MAX, +#define _SC_BC_STRING_MAX _SC_BC_STRING_MAX + _SC_COLL_WEIGHTS_MAX, +#define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX + _SC_EQUIV_CLASS_MAX, +#define _SC_EQUIV_CLASS_MAX _SC_EQUIV_CLASS_MAX + _SC_EXPR_NEST_MAX, +#define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX + _SC_LINE_MAX, +#define _SC_LINE_MAX _SC_LINE_MAX + _SC_RE_DUP_MAX, +#define _SC_RE_DUP_MAX _SC_RE_DUP_MAX + _SC_CHARCLASS_NAME_MAX, +#define _SC_CHARCLASS_NAME_MAX _SC_CHARCLASS_NAME_MAX + + _SC_2_VERSION, +#define _SC_2_VERSION _SC_2_VERSION + _SC_2_C_BIND, +#define _SC_2_C_BIND _SC_2_C_BIND + _SC_2_C_DEV, +#define _SC_2_C_DEV _SC_2_C_DEV + _SC_2_FORT_DEV, +#define _SC_2_FORT_DEV _SC_2_FORT_DEV + _SC_2_FORT_RUN, +#define _SC_2_FORT_RUN _SC_2_FORT_RUN + _SC_2_SW_DEV, +#define _SC_2_SW_DEV _SC_2_SW_DEV + _SC_2_LOCALEDEF, +#define _SC_2_LOCALEDEF _SC_2_LOCALEDEF + + _SC_PII, +#define _SC_PII _SC_PII + _SC_PII_XTI, +#define _SC_PII_XTI _SC_PII_XTI + _SC_PII_SOCKET, +#define _SC_PII_SOCKET _SC_PII_SOCKET + _SC_PII_INTERNET, +#define _SC_PII_INTERNET _SC_PII_INTERNET + _SC_PII_OSI, +#define _SC_PII_OSI _SC_PII_OSI + _SC_POLL, +#define _SC_POLL _SC_POLL + _SC_SELECT, +#define _SC_SELECT _SC_SELECT + _SC_UIO_MAXIOV, +#define _SC_UIO_MAXIOV _SC_UIO_MAXIOV + _SC_PII_INTERNET_STREAM, +#define _SC_PII_INTERNET_STREAM _SC_PII_INTERNET_STREAM + _SC_PII_INTERNET_DGRAM, +#define _SC_PII_INTERNET_DGRAM _SC_PII_INTERNET_DGRAM + _SC_PII_OSI_COTS, +#define _SC_PII_OSI_COTS _SC_PII_OSI_COTS + _SC_PII_OSI_CLTS, +#define _SC_PII_OSI_CLTS _SC_PII_OSI_CLTS + _SC_PII_OSI_M, +#define _SC_PII_OSI_M _SC_PII_OSI_M + _SC_T_IOV_MAX, +#define _SC_T_IOV_MAX _SC_T_IOV_MAX + + /* Values according to POSIX 1003.1c (POSIX threads). */ + _SC_THREADS, +#define _SC_THREADS _SC_THREADS + _SC_THREAD_SAFE_FUNCTIONS, +#define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS + _SC_GETGR_R_SIZE_MAX, +#define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX + _SC_GETPW_R_SIZE_MAX, +#define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX + _SC_LOGIN_NAME_MAX, +#define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX + _SC_TTY_NAME_MAX, +#define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX + _SC_THREAD_DESTRUCTOR_ITERATIONS, +#define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS + _SC_THREAD_KEYS_MAX, +#define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX + _SC_THREAD_STACK_MIN, +#define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN + _SC_THREAD_THREADS_MAX, +#define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX + _SC_THREAD_ATTR_STACKADDR, +#define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR + _SC_THREAD_ATTR_STACKSIZE, +#define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE + _SC_THREAD_PRIORITY_SCHEDULING, +#define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING + _SC_THREAD_PRIO_INHERIT, +#define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT + _SC_THREAD_PRIO_PROTECT, +#define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT + _SC_THREAD_PROCESS_SHARED, +#define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED + + _SC_NPROCESSORS_CONF, +#define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF + _SC_NPROCESSORS_ONLN, +#define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN + _SC_PHYS_PAGES, +#define _SC_PHYS_PAGES _SC_PHYS_PAGES + _SC_AVPHYS_PAGES, +#define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES + _SC_ATEXIT_MAX, +#define _SC_ATEXIT_MAX _SC_ATEXIT_MAX + _SC_PASS_MAX, +#define _SC_PASS_MAX _SC_PASS_MAX + + _SC_XOPEN_VERSION, +#define _SC_XOPEN_VERSION _SC_XOPEN_VERSION + _SC_XOPEN_XCU_VERSION, +#define _SC_XOPEN_XCU_VERSION _SC_XOPEN_XCU_VERSION + _SC_XOPEN_UNIX, +#define _SC_XOPEN_UNIX _SC_XOPEN_UNIX + _SC_XOPEN_CRYPT, +#define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT + _SC_XOPEN_ENH_I18N, +#define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N + _SC_XOPEN_SHM, +#define _SC_XOPEN_SHM _SC_XOPEN_SHM + + _SC_2_CHAR_TERM, +#define _SC_2_CHAR_TERM _SC_2_CHAR_TERM + _SC_2_C_VERSION, +#define _SC_2_C_VERSION _SC_2_C_VERSION + _SC_2_UPE, +#define _SC_2_UPE _SC_2_UPE + + _SC_XOPEN_XPG2, +#define _SC_XOPEN_XPG2 _SC_XOPEN_XPG2 + _SC_XOPEN_XPG3, +#define _SC_XOPEN_XPG3 _SC_XOPEN_XPG3 + _SC_XOPEN_XPG4, +#define _SC_XOPEN_XPG4 _SC_XOPEN_XPG4 + + _SC_CHAR_BIT, +#define _SC_CHAR_BIT _SC_CHAR_BIT + _SC_CHAR_MAX, +#define _SC_CHAR_MAX _SC_CHAR_MAX + _SC_CHAR_MIN, +#define _SC_CHAR_MIN _SC_CHAR_MIN + _SC_INT_MAX, +#define _SC_INT_MAX _SC_INT_MAX + _SC_INT_MIN, +#define _SC_INT_MIN _SC_INT_MIN + _SC_LONG_BIT, +#define _SC_LONG_BIT _SC_LONG_BIT + _SC_WORD_BIT, +#define _SC_WORD_BIT _SC_WORD_BIT + _SC_MB_LEN_MAX, +#define _SC_MB_LEN_MAX _SC_MB_LEN_MAX + _SC_NZERO, +#define _SC_NZERO _SC_NZERO + _SC_SSIZE_MAX, +#define _SC_SSIZE_MAX _SC_SSIZE_MAX + _SC_SCHAR_MAX, +#define _SC_SCHAR_MAX _SC_SCHAR_MAX + _SC_SCHAR_MIN, +#define _SC_SCHAR_MIN _SC_SCHAR_MIN + _SC_SHRT_MAX, +#define _SC_SHRT_MAX _SC_SHRT_MAX + _SC_SHRT_MIN, +#define _SC_SHRT_MIN _SC_SHRT_MIN + _SC_UCHAR_MAX, +#define _SC_UCHAR_MAX _SC_UCHAR_MAX + _SC_UINT_MAX, +#define _SC_UINT_MAX _SC_UINT_MAX + _SC_ULONG_MAX, +#define _SC_ULONG_MAX _SC_ULONG_MAX + _SC_USHRT_MAX, +#define _SC_USHRT_MAX _SC_USHRT_MAX + + _SC_NL_ARGMAX, +#define _SC_NL_ARGMAX _SC_NL_ARGMAX + _SC_NL_LANGMAX, +#define _SC_NL_LANGMAX _SC_NL_LANGMAX + _SC_NL_MSGMAX, +#define _SC_NL_MSGMAX _SC_NL_MSGMAX + _SC_NL_NMAX, +#define _SC_NL_NMAX _SC_NL_NMAX + _SC_NL_SETMAX, +#define _SC_NL_SETMAX _SC_NL_SETMAX + _SC_NL_TEXTMAX +#define _SC_NL_TEXTMAX _SC_NL_TEXTMAX + }; + +#ifdef __USE_POSIX2 +/* Values for the NAME argument to `confstr'. */ +enum + { + _CS_PATH /* The default search path. */ + }; +#endif diff --git a/sysdeps/generic/bits/ioctl-types.h b/sysdeps/generic/bits/ioctl-types.h new file mode 100644 index 0000000000..1d5c8a002f --- /dev/null +++ b/sysdeps/generic/bits/ioctl-types.h @@ -0,0 +1,121 @@ +/* Structure types for pre-termios terminal ioctls. Generic Unix version. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * Never include this file directly; use <sys/ioctl.h> instead. + */ + +#ifndef _BITS_IOCTL_TYPES_H +#define _BITS_IOCTL_TYPES_H 1 + + +#if defined(TIOCGETC) || defined(TIOCSETC) +/* Type of ARG for TIOCGETC and TIOCSETC requests. */ +struct tchars +{ + char t_intrc; /* Interrupt character. */ + char t_quitc; /* Quit character. */ + char t_startc; /* Start-output character. */ + char t_stopc; /* Stop-output character. */ + char t_eofc; /* End-of-file character. */ + char t_brkc; /* Input delimiter character. */ +}; + +#define _IOT_tchars /* Hurd ioctl type field. */ \ + _IOT (_IOTS (char), 6, 0, 0, 0, 0) +#endif + +#if defined(TIOCGLTC) || defined(TIOCSLTC) +/* Type of ARG for TIOCGLTC and TIOCSLTC requests. */ +struct ltchars +{ + char t_suspc; /* Suspend character. */ + char t_dsuspc; /* Delayed suspend character. */ + char t_rprntc; /* Reprint-line character. */ + char t_flushc; /* Flush-output character. */ + char t_werasc; /* Word-erase character. */ + char t_lnextc; /* Literal-next character. */ +}; + +#define _IOT_ltchars /* Hurd ioctl type field. */ \ + _IOT (_IOTS (char), 6, 0, 0, 0, 0) +#endif + +/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */ +struct sgttyb +{ + char sg_ispeed; /* Input speed. */ + char sg_ospeed; /* Output speed. */ + char sg_erase; /* Erase character. */ + char sg_kill; /* Kill character. */ + short int sg_flags; /* Mode flags. */ +}; + +#define _IOT_sgttyb /* Hurd ioctl type field. */ \ + _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0) + +#if defined(TIOCGWINSZ) || defined(TIOCSWINSZ) +/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */ +struct winsize +{ + unsigned short int ws_row; /* Rows, in characters. */ + unsigned short int ws_col; /* Columns, in characters. */ + + /* These are not actually used. */ + unsigned short int ws_xpixel; /* Horizontal pixels. */ + unsigned short int ws_ypixel; /* Vertical pixels. */ +}; + +#define _IOT_winsize /* Hurd ioctl type field. */ \ + _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0) +#endif + +#if defined (TIOCGSIZE) || defined (TIOCSSIZE) +/* The BSD-style ioctl constructor macros use `sizeof', which can't be used + in a preprocessor conditional. Since the commands are always unique + regardless of the size bits, we can safely define away `sizeof' for the + purpose of the conditional. */ +# define sizeof(type) 0 +# if defined (TIOCGWINSZ) && TIOCGSIZE == TIOCGWINSZ +/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source + compatibility with Sun; they define `struct ttysize' to have identical + layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ + (likewise TIOCSSIZE and TIOCSWINSZ). */ +struct ttysize +{ + unsigned short int ts_lines; + unsigned short int ts_cols; + unsigned short int ts_xxx; + unsigned short int ts_yyy; +}; +#define _IOT_ttysize _IOT_winsize +# else +/* Suns use a different layout for `struct ttysize', and TIOCGSIZE and + TIOCGWINSZ are separate commands that do the same thing with different + structures (likewise TIOCSSIZE and TIOCSWINSZ). */ +struct ttysize +{ + int ts_lines, ts_cols; /* Lines and columns, in characters. */ +}; +# endif +# undef sizeof /* See above. */ +#endif + + +#endif /* bits/ioctl-types.h */ diff --git a/sysdeps/generic/bits/mathdef.h b/sysdeps/generic/bits/mathdef.h new file mode 100644 index 0000000000..93b60bd25f --- /dev/null +++ b/sysdeps/generic/bits/mathdef.h @@ -0,0 +1,40 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _MATH_H +# error "Never use <bits/mathdef.h> directly; include <math.h> instead" +#endif + + +/* Normally, there is no long double type and the `float' and `double' + expressions are evaluated as `double'. */ +typedef double float_t; /* `float' expressions are evaluated as + `double'. */ +typedef double double_t; /* `double' expressions are evaluated as + `double'. */ + +/* Signal that both types are `double'. */ +#define FLT_EVAL_METHOD 1 + +/* Define `INFINITY' as value of type `float_t'. */ +#define INFINITY HUGE_VAL + + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +#define FP_ILOGB0 0x80000001 +#define FP_ILOGBNAN 0x7fffffff diff --git a/sysdeps/generic/bits/resource.h b/sysdeps/generic/bits/resource.h new file mode 100644 index 0000000000..2c35c12a47 --- /dev/null +++ b/sysdeps/generic/bits/resource.h @@ -0,0 +1,146 @@ +/* Bit values & structures for resource limits. 4.4 BSD/generic GNU version. + Copyright (C) 1994, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* These are the values for 4.4 BSD and GNU. Earlier BSD systems have a + subset of these kinds of resource limit. In systems where `getrlimit' + and `setrlimit' are not system calls, these are the values used by the C + library to emulate them. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource + { + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU, +#define RLIMIT_CPU RLIMIT_CPU + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE, +#define RLIMIT_FSIZE RLIMIT_FSIZE + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA, +#define RLIMIT_DATA RLIMIT_DATA + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK, +#define RLIMIT_STACK RLIMIT_STACK + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE, +#define RLIMIT_CORE RLIMIT_CORE + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + RLIMIT_RSS, +#define RLIMIT_RSS RLIMIT_RSS + /* Locked-in-memory address space. */ + RLIMIT_MEMLOCK, +#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK + /* Number of processes. */ + RLIMIT_NPROC, +#define RLIMIT_NPROC RLIMIT_NPROC + /* Number of open files. */ + RLIMIT_OFILE, + RLIMIT_NOFILE = RLIMIT_OFILE, /* Another name for the same thing. */ +#define RLIMIT_OFILE RLIMIT_OFILE +#define RLIMIT_NOFILE RLIMIT_NOFILE + + RLIMIT_NLIMITS, /* Number of limit flavors. */ + RLIM_NLIMITS = RLIMIT_NLIMITS, /* Traditional name for same. */ + + RLIM_INFINITY = 0x7fffffff /* Value to indicate that there is no limit. */ +#define RLIM_INFINITY RLIM_INFINITY + }; + +struct rlimit + { + /* The current (soft) limit. */ + int rlim_cur; + /* The hard limit. */ + int rlim_max; + }; + +/* Whose usage statistics do you want? */ +enum __rusage_who +/* The macro definitions are necessary because some programs want + to test for operating system features with #ifdef RUSAGE_SELF. + In ISO C the reflexive definition is a no-op. */ + { + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN + }; + +#include <sys/time.h> /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; + /* Amount of stack memory used (kilobyte-seconds). */ + long int ru_isrss; + /* Number of soft page faults (i.e. those serviced by reclaiming + a page from the list of pages awaiting reallocation. */ + long int ru_minflt; + /* Number of hard page faults (i.e. those that required I/O). */ + long int ru_majflt; + /* Number of times a process was swapped out of physical memory. */ + long int ru_nswap; + /* Number of input operations via the file system. Note: This + and `ru_oublock' do not include operations with the cache. */ + long int ru_inblock; + /* Number of output operations via the file system. */ + long int ru_oublock; + /* Number of IPC messages sent. */ + long int ru_msgsnd; + /* Number of IPC messages received. */ + long int ru_msgrcv; + /* Number of signals delivered. */ + long int ru_nsignals; + /* Number of voluntary context switches, i.e. because the process + gave up the process before it had to (usually to wait for some + resource to be available). */ + long int ru_nvcsw; + /* Number of involuntary context switches, i.e. a higher priority process + became runnable or the current process used up its time slice. */ + long int ru_nivcsw; + }; + +/* Priority limits. */ +#define PRIO_MIN -20 /* Minimum priority a process can have. */ +#define PRIO_MAX 20 /* Maximum priority a process can have. */ + +/* The type of the WHICH argument to `getpriority' and `setpriority', + indicating what flavor of entity the WHO argument specifies. */ +enum __priority_which + { + PRIO_PROCESS = 0, /* WHO is a process ID. */ + PRIO_PGRP = 1, /* WHO is a process group ID. */ + PRIO_USER = 2 /* WHO is a user ID. */ + }; diff --git a/sysdeps/generic/bits/sched.h b/sysdeps/generic/bits/sched.h new file mode 100644 index 0000000000..bb5da5676f --- /dev/null +++ b/sysdeps/generic/bits/sched.h @@ -0,0 +1,35 @@ +/* Definitions of constants and data structure for POSIX 1003.1b-1993 + scheduling interface. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., 59 Temple Place + Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef _SCHED_H +#error "Never use <bits/sched.h> directly; include <sched.h> instead." +#endif + + +/* Scheduling algorithms. */ +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +/* Data structure to describe a process' schedulability. */ +struct sched_param +{ + int sched_priority; +}; diff --git a/sysdeps/generic/bits/select.h b/sysdeps/generic/bits/select.h new file mode 100644 index 0000000000..613919577c --- /dev/null +++ b/sysdeps/generic/bits/select.h @@ -0,0 +1,29 @@ +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_SELECT_H +#error "Never use <bits/select.h> directly; include <sys/select.h> instead." +#endif + + +/* This line MUST be split! Otherwise m4 will not change it. */ +#define __FD_ZERO(set) \ + ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set))) +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) diff --git a/sysdeps/generic/bits/sigaction.h b/sysdeps/generic/bits/sigaction.h new file mode 100644 index 0000000000..1676b1ce8e --- /dev/null +++ b/sysdeps/generic/bits/sigaction.h @@ -0,0 +1,50 @@ +/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* These definitions match those used by the 4.4 BSD kernel. + If the operating system has a `sigaction' system call that correctly + implements the POSIX.1 behavior, there should be a system-dependent + version of this file that defines `struct sigaction' and the `SA_*' + constants appropriately. */ + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Signal handler. */ + __sighandler_t sa_handler; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Special flags. */ + int sa_flags; + }; + +/* Bits in `sa_flags'. */ +#ifdef __USE_BSD +#define SA_ONSTACK 0x1 /* Take signal on signal stack. */ +#define SA_RESTART 0x2 /* Don't restart syscall on signal return. */ +#define SA_DISABLE 0x4 /* Disable alternate signal stack. */ +#endif +#define SA_NOCLDSTOP 0x8 /* Don't send SIGCHLD when children stop. */ + + +/* Values for the HOW argument to `sigprocmask'. */ +#define SIG_BLOCK 1 /* Block signals. */ +#define SIG_UNBLOCK 2 /* Unblock signals. */ +#define SIG_SETMASK 3 /* Set the set of blocked signals. */ diff --git a/sysdeps/generic/bits/sigset.h b/sysdeps/generic/bits/sigset.h new file mode 100644 index 0000000000..9fad4538d7 --- /dev/null +++ b/sysdeps/generic/bits/sigset.h @@ -0,0 +1,81 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. Generic/BSD version. + Copyright (C) 1991, 1992, 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SIGSET_H_types +#define _SIGSET_H_types 1 + +typedef int __sig_atomic_t; + +/* A `sigset_t' has a bit for each signal. */ +typedef unsigned long int __sigset_t; + +#endif + + +/* We only want to define these functions if <signal.h> was actually + included; otherwise we were included just to define the types. Since we + are namespace-clean, it wouldn't hurt to define extra macros. But + trouble can be caused by functions being defined (e.g., any global + register vars declared later will cause compilation errors). */ + +#if !defined (_SIGSET_H_fns) && defined (_SIGNAL_H) +#define _SIGSET_H_fns 1 + +#ifndef _EXTERN_INLINE +#define _EXTERN_INLINE extern __inline +#endif + +/* Return a mask that includes SIG only. The cast to `sigset_t' avoids + overflow if `sigset_t' is wider than `int'. */ +#define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1)) + +#define __sigemptyset(set) ((*(set) = (__sigset_t) 0), 0) +#define __sigfillset(set) ((*(set) = ~(__sigset_t) 0), 0) + +#ifdef _GNU_SOURCE +# define __sigisemptyset(set) (*(set) == (__sigset_t) 0) +# define __sigandset(dest, left, right) \ + ((*(dest) = (*(left) & *(right))), 0) +# define __sigorset(dest, left, right) \ + ((*(dest) = (*(left) | *(right))), 0) +#endif + +/* These functions needn't check for a bogus signal number -- error + checking is done in the non __ versions. */ + +extern int __sigismember (__const __sigset_t *, int); +extern int __sigaddset (__sigset_t *, int); +extern int __sigdelset (__sigset_t *, int); + +#define __SIGSETFN(NAME, BODY, CONST) \ + _EXTERN_INLINE int \ + NAME (CONST __sigset_t *__set, int __sig) \ + { \ + __sigset_t __mask = __sigmask (__sig); \ + return BODY; \ + } + +__SIGSETFN (__sigismember, (*__set & __mask) ? 1 : 0, __const) +__SIGSETFN (__sigaddset, ((*__set |= __mask), 0), ) +__SIGSETFN (__sigdelset, ((*__set &= ~__mask), 0), ) + +#undef __SIGSETFN + + +#endif /* ! _SIGSET_H_fns. */ diff --git a/sysdeps/generic/bits/sockaddr.h b/sysdeps/generic/bits/sockaddr.h new file mode 100644 index 0000000000..73a0e26ec4 --- /dev/null +++ b/sysdeps/generic/bits/sockaddr.h @@ -0,0 +1,41 @@ +/* Definition of `struct sockaddr_*' common members. Generic/4.2 BSD version. + Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * Never include this file directly; use <sys/socket.h> instead. + */ + +#ifndef _BITS_SOCKADDR_H +#define _BITS_SOCKADDR_H 1 + + +/* POSIX.1g specifies this type name for the `sa_family' member. */ +typedef unsigned short int sa_family_t; + +/* This macro is used to declare the initial common members + of the data types used for socket addresses, `struct sockaddr', + `struct sockaddr_in', `struct sockaddr_un', etc. */ + +#define __SOCKADDR_COMMON(sa_prefix) \ + sa_family_t sa_prefix##family + +#define __SOCKADDR_COMMON_SIZE (sizeof (unsigned short int)) + + +#endif /* bits/sockaddr.h */ diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h new file mode 100644 index 0000000000..d12d96cc14 --- /dev/null +++ b/sysdeps/generic/bits/socket.h @@ -0,0 +1,200 @@ +/* System-specific socket constants and types. Generic/4.3 BSD version. + Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_SOCKET_H +#error "Never include <bits/socket.h> directly; use <sys/socket.h> instead." +#endif + + +#include <features.h> + +__BEGIN_DECLS + +#define __need_size_t +#include <stddef.h> + + +/* Types of sockets. */ +enum __socket_type +{ + SOCK_STREAM = 1, /* Sequenced, reliable, connection-based + byte streams. */ +#define SOCK_STREAM SOCK_STREAM + SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams + of fixed maximum length. */ +#define SOCK_DGRAM SOCK_DGRAM + SOCK_RAW = 3, /* Raw protocol interface. */ +#define SOCK_RAW SOCK_RAW + SOCK_RDM = 4, /* Reliably-delivered messages. */ +#define SOCK_RDM SOCK_RDM + SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, + datagrams of fixed maximum length. */ +#define SOCK_SEQPACKET SOCK_SEQPACKET +}; + +/* Protocol families. */ +#define PF_UNSPEC 0 /* Unspecified. */ +#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ +#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ +#define PF_FILE PF_LOCAL /* POSIX name for PF_LOCAL. */ +#define PF_INET 2 /* IP protocol family. */ +#define PF_IMPLINK 3 /* ARPAnet IMP protocol. */ +#define PF_PUP 4 /* PUP protocols. */ +#define PF_CHAOS 5 /* MIT Chaos protocols. */ +#define PF_NS 6 /* Xerox NS protocols. */ +#define PF_ISO 7 /* ISO protocols. */ +#define PF_OSI PF_ISO +#define PF_ECMA 8 /* ECMA protocols. */ +#define PF_DATAKIT 9 /* AT&T Datakit protocols. */ +#define PF_CCITT 10 /* CCITT protocols (X.25 et al). */ +#define PF_SNA 11 /* IBM SNA protocol. */ +#define PF_DECnet 12 /* DECnet protocols. */ +#define PF_DLI 13 /* Direct data link interface. */ +#define PF_LAT 14 /* DEC Local Area Transport protocol. */ +#define PF_HYLINK 15 /* NSC Hyperchannel protocol. */ +#define PF_APPLETALK 16 /* Don't use this. */ +#define PF_ROUTE 17 /* Internal Routing Protocol. */ +#define PF_LINK 18 /* Link layer interface. */ +#define PF_XTP 19 /* eXpress Transfer Protocol (no AF). */ +#define PF_COIP 20 /* Connection-oriented IP, aka ST II. */ +#define PF_CNT 21 /* Computer Network Technology. */ +#define PF_RTIP 22 /* Help Identify RTIP packets. **/ +#define PF_IPX 23 /* Novell Internet Protocol. */ +#define PF_SIP 24 /* Simple Internet Protocol. */ +#define PF_PIP 25 /* Help Identify PIP packets. */ +#define PF_INET6 26 /* IP version 6. */ +#define PF_MAX 27 + +/* Address families. */ +#define AF_UNSPEC PF_UNSPEC +#define AF_LOCAL PF_LOCAL +#define AF_UNIX PF_UNIX +#define AF_FILE PF_FILE +#define AF_INET PF_INET +#define AF_IMPLINK PF_IMPLINK +#define AF_PUP PF_PUP +#define AF_CHAOS PF_CHAOS +#define AF_NS PF_NS +#define AF_ISO PF_ISO +#define AF_OSI PF_OSI +#define AF_ECMA PF_ECMA +#define AF_DATAKIT PF_DATAKIT +#define AF_CCITT PF_CCITT +#define AF_SNA PF_SNA +#define AF_DECnet PF_DECnet +#define AF_DLI PF_DLI +#define AF_LAT PF_LAT +#define AF_HYLINK PF_HYLINK +#define AF_APPLETALK PF_APPLETALK +#define AF_ROUTE PF_ROUTE +#define AF_LINK PF_LINK +#define pseudo_AF_XTP PF_XTP +#define AF_COIP PF_COIP +#define AF_CNT PF_CNT +#define pseudo_AF_RTIP PF_RTIP +#define AF_IPX PF_IPX +#define AF_SIP PF_SIP +#define pseudo_AF_PIP PF_PIP +#define AF_INET6 PF_INET6 +#define AF_MAX PF_MAX + + +/* Get the definition of the macro to define the common sockaddr members. */ +#include <bits/sockaddr.h> + +/* Structure describing a generic socket address. */ +struct sockaddr + { + __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ + char sa_data[14]; /* Address data. */ + }; + + +/* Bits in the FLAGS argument to `send', `recv', et al. */ +enum + { + MSG_OOB = 0x01, /* Process out-of-band data. */ + MSG_PEEK = 0x02, /* Peek at incoming messages. */ + MSG_DONTROUTE = 0x04, /* Don't use local routing. */ + MSG_EOR = 0x08, /* Data completes record. */ + MSG_TRUNC = 0x10, /* Data discarded before delivery. */ + MSG_CTRUNC = 0x20, /* Control data lost before delivery. */ + MSG_WAITALL = 0x40, /* Wait for full request or error. */ + MSG_DONTWAIT = 0x80, /* This message should be nonblocking. */ + }; + + +/* Structure describing messages sent by + `sendmsg' and received by `recvmsg'. */ +struct msghdr + { + __ptr_t msg_name; /* Address to send to/receive from. */ + size_t msg_namelen; /* Length of address data. */ + + struct iovec *msg_iov; /* Vector of data to send/receive into. */ + size_t msg_iovlen; /* Number of elements in the vector. */ + + __ptr_t msg_accrights; /* Access rights information. */ + size_t msg_accrightslen; /* Length of access rights information. */ + }; + + +/* Protocol number used to manipulate socket-level options + with `getsockopt' and `setsockopt'. */ +#define SOL_SOCKET 0xffff + +/* Socket-level options for `getsockopt' and `setsockopt'. */ +enum + { + SO_DEBUG = 0x0001, /* Record debugging information. */ + SO_ACCEPTCONN = 0x0002, /* Accept connections on socket. */ + SO_REUSEADDR = 0x0004, /* Allow reuse of local addresses. */ + SO_KEEPALIVE = 0x0008, /* Keep connections alive and send + SIGPIPE when they die. */ + SO_DONTROUTE = 0x0010, /* Don't do local routing. */ + SO_BROADCAST = 0x0020, /* Allow transmission of + broadcast messages. */ + SO_USELOOPBACK = 0x0040, /* Use the software loopback to avoid + hardware use when possible. */ + SO_LINGER = 0x0080, /* Block on close of a reliable + socket to transmit pending data. */ + SO_OOBINLINE = 0x0100, /* Receive out-of-band data in-band. */ + + SO_REUSEPORT = 0x0200, /* Allow local address and port reuse. */ + + SO_SNDBUF = 0x1001, /* Send buffer size. */ + SO_RCVBUF = 0x1002, /* Receive buffer. */ + SO_SNDLOWAT = 0x1003, /* Send low-water mark. */ + SO_RCVLOWAT = 0x1004, /* Receive low-water mark. */ + SO_SNDTIMEO = 0x1005, /* Send timeout. */ + SO_RCVTIMEO = 0x1006, /* Receive timeout. */ + + SO_ERROR = 0x1007, /* Get and clear error status. */ + SO_STYLE = 0x1008, /* Get socket connection style. */ + SO_TYPE = SO_STYLE, /* Compatible name for SO_STYLE. */ + }; + +/* Structure used to manipulate the SO_LINGER option. */ +struct linger + { + int l_onoff; /* Nonzero to linger on close. */ + int l_linger; /* Time to linger. */ + }; + +__END_DECLS diff --git a/sysdeps/generic/bits/statfs.h b/sysdeps/generic/bits/statfs.h new file mode 100644 index 0000000000..10bc0728b2 --- /dev/null +++ b/sysdeps/generic/bits/statfs.h @@ -0,0 +1,52 @@ +/* Definition of `struct statfs', information about a filesystem. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * Never include this file directly; use <sys/statfs.h> instead. + */ + +#ifndef _BITS_STATFS_H +#define _BITS_STATFS_H 1 + +#include <bits/types.h> + +/* GNU Hurd NOTE: The size of this structure (16 ints) is known in + <hurd/hurd_types.defs>, since it is used in the `file_statfs' RPC. MiG + does not cope at all well with the passed C structure not being of the + expected size. There are some filler words at the end to allow for + future expansion. To increase the size of the structure used in the RPC + and retain binary compatibility, we would need to assign a new message + number. */ + +struct statfs + { + unsigned int f_type; + unsigned int f_bsize; + unsigned int f_blocks; + unsigned int f_bfree; + unsigned int f_bavail; + unsigned int f_files; + unsigned int f_ffree; + __fsid_t f_fsid; + unsigned int f_namelen; + unsigned int f_spare[6]; + }; + + +#endif /* bits/statfs.h */ diff --git a/sysdeps/generic/bits/termios.h b/sysdeps/generic/bits/termios.h new file mode 100644 index 0000000000..9a6aed2bba --- /dev/null +++ b/sysdeps/generic/bits/termios.h @@ -0,0 +1,230 @@ +/* termios type and macro definitions. 4.4 BSD/generic GNU version. + Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* These macros are also defined in some <bits/ioctls.h> files (with + numerically identical values), but this serves to shut up cpp's + complaining. */ +#ifdef __USE_BSD + +#ifdef MDMBUF +#undef MDMBUF +#endif +#ifdef FLUSHO +#undef FLUSHO +#endif +#ifdef PENDIN +#undef PENDIN +#endif + +#endif /* __USE_BSD */ + +#ifdef ECHO +#undef ECHO +#endif +#ifdef TOSTOP +#undef TOSTOP +#endif +#ifdef NOFLSH +#undef NOFLSH +#endif + + +/* These definitions match those used by the 4.4 BSD kernel. + If the operating system has termios system calls or ioctls that + correctly implement the POSIX.1 behavior, there should be a + system-dependent version of this file that defines `struct termios', + `tcflag_t', `cc_t', `speed_t' and the `TC*' constants appropriately. */ + +/* Type of terminal control flag masks. */ +typedef unsigned long int tcflag_t; + +/* Type of control characters. */ +typedef unsigned char cc_t; + +/* Type of baud rate specifiers. */ +typedef long int speed_t; + +/* Terminal control structure. */ +struct termios +{ + /* Input modes. */ + tcflag_t c_iflag; +#define IGNBRK (1 << 0) /* Ignore break condition. */ +#define BRKINT (1 << 1) /* Signal interrupt on break. */ +#define IGNPAR (1 << 2) /* Ignore characters with parity errors. */ +#define PARMRK (1 << 3) /* Mark parity and framing errors. */ +#define INPCK (1 << 4) /* Enable input parity check. */ +#define ISTRIP (1 << 5) /* Strip 8th bit off characters. */ +#define INLCR (1 << 6) /* Map NL to CR on input. */ +#define IGNCR (1 << 7) /* Ignore CR. */ +#define ICRNL (1 << 8) /* Map CR to NL on input. */ +#define IXON (1 << 9) /* Enable start/stop output control. */ +#define IXOFF (1 << 10) /* Enable start/stop input control. */ +#ifdef __USE_BSD +#define IXANY (1 << 11) /* Any character will restart after stop. */ +#define IMAXBEL (1 << 13) /* Ring bell when input queue is full. */ +#endif + + /* Output modes. */ + tcflag_t c_oflag; +#define OPOST (1 << 0) /* Perform output processing. */ +#ifdef __USE_BSD +#define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ +#define OXTABS (1 << 2) /* Expand tabs to spaces. */ +#define ONOEOT (1 << 8) /* Discard EOT (^D) on output. */ +#endif + + /* Control modes. */ + tcflag_t c_cflag; +#ifdef __USE_BSD +#define CIGNORE (1 << 0) /* Ignore these control flags. */ +#endif +#define CSIZE (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask). */ +#define CS5 0 /* 5 bits per byte. */ +#define CS6 (1 << 8) /* 6 bits per byte. */ +#define CS7 (1 << 9) /* 7 bits per byte. */ +#define CS8 (CS6|CS7) /* 8 bits per byte. */ +#define CSTOPB (1 << 10) /* Two stop bits instead of one. */ +#define CREAD (1 << 11) /* Enable receiver. */ +#define PARENB (1 << 12) /* Parity enable. */ +#define PARODD (1 << 13) /* Odd parity instead of even. */ +#define HUPCL (1 << 14) /* Hang up on last close. */ +#define CLOCAL (1 << 15) /* Ignore modem status lines. */ +#ifdef __USE_BSD +#define CCTS_OFLOW (1 << 16) /* CTS flow control of output. */ +#define CRTS_IFLOW (1 << 17) /* RTS flow control of input. */ +#define MDMBUF (1 << 20) /* Carrier flow control of output. */ +#endif + + /* Local modes. */ + tcflag_t c_lflag; +#ifdef __USE_BSD +#define ECHOKE (1 << 0) /* Visual erase for KILL. */ +#endif +#define _ECHOE (1 << 1) /* Visual erase for ERASE. */ +#define ECHOE _ECHOE +#define _ECHOK (1 << 2) /* Echo NL after KILL. */ +#define ECHOK _ECHOK +#define _ECHO (1 << 3) /* Enable echo. */ +#define ECHO _ECHO +#define _ECHONL (1 << 4) /* Echo NL even if ECHO is off. */ +#define ECHONL _ECHONL +#ifdef __USE_BSD +#define ECHOPRT (1 << 5) /* Hardcopy visual erase. */ +#define ECHOCTL (1 << 6) /* Echo control characters as ^X. */ +#endif +#define _ISIG (1 << 7) /* Enable signals. */ +#define ISIG _ISIG +#define _ICANON (1 << 8) /* Do erase and kill processing. */ +#define ICANON _ICANON +#ifdef __USE_BSD +#define ALTWERASE (1 << 9) /* Alternate WERASE algorithm. */ +#endif +#define _IEXTEN (1 << 10) /* Enable DISCARD and LNEXT. */ +#define IEXTEN _IEXTEN +#define EXTPROC (1 << 11) /* External processing. */ +#define _TOSTOP (1 << 22) /* Send SIGTTOU for background output. */ +#define TOSTOP _TOSTOP +#ifdef __USE_BSD +#define FLUSHO (1 << 23) /* Output being flushed (state). */ +#define NOKERNINFO (1 << 25) /* Disable VSTATUS. */ +#define PENDIN (1 << 29) /* Retype pending input (state). */ +#endif +#define _NOFLSH (1 << 31) /* Disable flush after interrupt. */ +#define NOFLSH _NOFLSH + + /* Control characters. */ +#define VEOF 0 /* End-of-file character [ICANON]. */ +#define VEOL 1 /* End-of-line character [ICANON]. */ +#ifdef __USE_BSD +#define VEOL2 2 /* Second EOL character [ICANON]. */ +#endif +#define VERASE 3 /* Erase character [ICANON]. */ +#ifdef __USE_BSD +#define VWERASE 4 /* Word-erase character [ICANON]. */ +#endif +#define VKILL 5 /* Kill-line character [ICANON]. */ +#ifdef __USE_BSD +#define VREPRINT 6 /* Reprint-line character [ICANON]. */ +#endif +#define VINTR 8 /* Interrupt character [ISIG]. */ +#define VQUIT 9 /* Quit character [ISIG]. */ +#define VSUSP 10 /* Suspend character [ISIG]. */ +#ifdef __USE_BSD +#define VDSUSP 11 /* Delayed suspend character [ISIG]. */ +#endif +#define VSTART 12 /* Start (X-ON) character [IXON, IXOFF]. */ +#define VSTOP 13 /* Stop (X-OFF) character [IXON, IXOFF]. */ +#ifdef __USE_BSD +#define VLNEXT 14 /* Literal-next character [IEXTEN]. */ +#define VDISCARD 15 /* Discard character [IEXTEN]. */ +#endif +#define VMIN 16 /* Minimum number of bytes read at once [!ICANON]. */ +#define VTIME 17 /* Time-out value (tenths of a second) [!ICANON]. */ +#ifdef __USE_BSD +#define VSTATUS 18 /* Status character [ICANON]. */ +#endif +#define NCCS 20 /* Value duplicated in <hurd/tioctl.defs>. */ + cc_t c_cc[NCCS]; + + /* Input and output baud rates. */ + speed_t __ispeed, __ospeed; +#define B0 0 /* Hang up. */ +#define B50 50 /* 50 baud. */ +#define B75 75 /* 75 baud. */ +#define B110 110 /* 110 baud. */ +#define B134 134 /* 134.5 baud. */ +#define B150 150 /* 150 baud. */ +#define B200 200 /* 200 baud. */ +#define B300 300 /* 300 baud. */ +#define B600 600 /* 600 baud. */ +#define B1200 1200 /* 1200 baud. */ +#define B1800 1800 /* 1800 baud. */ +#define B2400 2400 /* 2400 baud. */ +#define B4800 4800 /* 4800 baud. */ +#define B9600 9600 /* 9600 baud. */ +#define B19200 19200 /* 19200 baud. */ +#define B38400 38400 /* 38400 baud. */ +#ifdef __USE_BSD +#define EXTA 19200 +#define EXTB 38400 +#endif +}; + +#define _IOT_termios /* Hurd ioctl type field. */ \ + _IOT (_IOTS (tcflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2) + +/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'. */ +#define TCSANOW 0 /* Change immediately. */ +#define TCSADRAIN 1 /* Change when pending output is written. */ +#define TCSAFLUSH 2 /* Flush pending input before changing. */ +#ifdef __USE_BSD +#define TCSASOFT 0x10 /* Flag: Don't alter hardware state. */ +#endif + +/* Values for the QUEUE_SELECTOR argument to `tcflush'. */ +#define TCIFLUSH 1 /* Discard data received but not yet read. */ +#define TCOFLUSH 2 /* Discard data written but not yet sent. */ +#define TCIOFLUSH 3 /* Discard all pending data. */ + +/* Values for the ACTION argument to `tcflow'. */ +#define TCOOFF 1 /* Suspend output. */ +#define TCOON 2 /* Restart suspended output. */ +#define TCIOFF 3 /* Send a STOP character. */ +#define TCION 4 /* Send a START character. */ diff --git a/sysdeps/generic/bits/types.h b/sysdeps/generic/bits/types.h new file mode 100644 index 0000000000..c264adc917 --- /dev/null +++ b/sysdeps/generic/bits/types.h @@ -0,0 +1,94 @@ +/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* + * Never include this file directly; use <sys/types.h> instead. + */ + +#ifndef _BITS_TYPES_H +#define _BITS_TYPES_H 1 + + +/* Convenience types. */ +typedef unsigned char __u_char; +typedef unsigned short __u_short; +typedef unsigned int __u_int; +typedef unsigned long __u_long; +#ifdef __GNUC__ +typedef unsigned long long int __u_quad_t; +typedef long long int __quad_t; +#else +typedef struct +{ + long __val[2]; +} __quad_t; +typedef struct +{ + __u_long __val[2]; +} __u_quad_t; +#endif +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef signed short int __int16_t; +typedef unsigned short int __uint16_t; +typedef signed int __int32_t; +typedef unsigned int __uint32_t; +#ifdef __GNUC__ +typedef signed long long int __int64_t; +typedef unsigned long long int __uint64_t; +#endif +typedef __quad_t *__qaddr_t; +typedef int __dev_t; /* Type of device numbers. */ +typedef unsigned int __uid_t; /* Type of user identifications. */ +typedef unsigned int __gid_t; /* Type of group identifications. */ +typedef unsigned int __ino_t; /* Type of file serial numbers. */ +typedef unsigned int __mode_t; /* Type of file attribute bitmasks. */ +typedef unsigned short int __nlink_t; /* Type of file link counts. */ +typedef long int __off_t; /* Type of file sizes and offsets. */ +typedef __quad_t __loff_t; /* Type of file sizes and offsets. */ +typedef int __pid_t; /* Type of process identifications. */ +typedef int __ssize_t; /* Type of a byte count, or error. */ +typedef __u_quad_t __fsid_t; /* Type of file system IDs. */ +typedef long int __clock_t; /* Type of CPU usage counts. */ + +/* Everythin' else. */ +typedef long int __daddr_t; /* The type of a disk address. */ +typedef char *__caddr_t; +typedef long int __time_t; +typedef long int __swblk_t; /* Type of a swap block maybe? */ +typedef long int __key_t; /* Type of an IPC key */ + +/* fd_set for select. */ + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 256 + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NFDBITS (sizeof (unsigned long int) * 8) +#define __FDELT(d) ((d) / __NFDBITS) +#define __FDMASK(d) (1 << ((d) % __NFDBITS)) + +typedef struct + { + /* XPG4.2 requires this member name. */ + unsigned long int fds_bits[(__FD_SETSIZE + (__NFDBITS - 1)) / __NFDBITS]; + } __fd_set; + +typedef unsigned long int __fd_mask; + +#endif /* bits/types.h */ diff --git a/sysdeps/generic/bits/uio.h b/sysdeps/generic/bits/uio.h new file mode 100644 index 0000000000..1a12697008 --- /dev/null +++ b/sysdeps/generic/bits/uio.h @@ -0,0 +1,32 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_UIO_H +#error "Never use <bits/uio.h> directly; include <sys/uio.h> instead." +#endif + + +/* `struct iovec' -- Structure describing a section of memory. */ + +struct iovec +{ + /* Starting address. */ + __ptr_t iov_base; + /* Length in bytes. */ + size_t iov_len; +}; diff --git a/sysdeps/generic/bits/ustat.h b/sysdeps/generic/bits/ustat.h new file mode 100644 index 0000000000..aa5d493e63 --- /dev/null +++ b/sysdeps/generic/bits/ustat.h @@ -0,0 +1,30 @@ +/* Generic declaration of ustat structure. +Copyright (C) 1994, 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +__BEGIN_DECLS + +struct ustat +{ + __daddr_t f_tfree; /* total free */ + __ino_t f_tinode; /* total inodes free */ + char f_fname[6]; /* filesystem name */ + char f_fpack[6]; /* filesystem pack name */ +}; + +__END_DECLS diff --git a/sysdeps/generic/bits/utmp.h b/sysdeps/generic/bits/utmp.h new file mode 100644 index 0000000000..b8decb0598 --- /dev/null +++ b/sysdeps/generic/bits/utmp.h @@ -0,0 +1,53 @@ +/* The `struct utmp' type, describing entries in the utmp file. Generic/BSDish + Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _UTMP_H +#error "Never use <bits/utmp.h> directly; include <utmp.h> instead." +#endif + + +#include <features.h> + +#include <paths.h> +#include <time.h> + + +#define UT_NAMESIZE 8 +#define UT_LINESIZE 8 +#define UT_HOSTSIZE 16 + +__BEGIN_DECLS + +struct lastlog { + time_t ll_time; + char ll_line[UT_LINESIZE]; + char ll_host[UT_HOSTSIZE]; +}; + +struct utmp { + char ut_line[UT_LINESIZE]; + char ut_name[UT_NAMESIZE]; + char ut_host[UT_HOSTSIZE]; + long ut_time; +}; + + +#define _HAVE_UT_HOST 1 /* We have the ut_host field. */ + + +__END_DECLS diff --git a/sysdeps/generic/bits/utsname.h b/sysdeps/generic/bits/utsname.h new file mode 100644 index 0000000000..5594bcc4da --- /dev/null +++ b/sysdeps/generic/bits/utsname.h @@ -0,0 +1,3 @@ +/* The size of the character arrays used to hold the information + in a `struct utsname'. Enlarge this as necessary. */ +#define _UTSNAME_LENGTH 1024 diff --git a/sysdeps/generic/bits/waitstatus.h b/sysdeps/generic/bits/waitstatus.h new file mode 100644 index 0000000000..8e97f2702c --- /dev/null +++ b/sysdeps/generic/bits/waitstatus.h @@ -0,0 +1,104 @@ +/* Definitions of status bits for `wait' et al. + Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_WAIT_H +#error "Never use <bits/waitstatus.h> directly; include <sys/wait.h> instead." +#endif + + +/* Everything extant so far uses these same bits. */ + + +/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */ +#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8) + +/* If WIFSIGNALED(STATUS), the terminating signal. */ +#define __WTERMSIG(status) ((status) & 0x7f) + +/* If WIFSTOPPED(STATUS), the signal that stopped the child. */ +#define __WSTOPSIG(status) __WEXITSTATUS(status) + +/* Nonzero if STATUS indicates normal termination. */ +#define __WIFEXITED(status) (__WTERMSIG(status) == 0) + +/* Nonzero if STATUS indicates termination by a signal. */ +#ifdef __GNUC__ +#define __WIFSIGNALED(status) \ + (__extension__ ({ int __status = (status); \ + !__WIFSTOPPED(__status) && !__WIFEXITED(__status); })) +#else /* Not GCC. */ +#define __WIFSIGNALED(status) (!__WIFSTOPPED(status) && !__WIFEXITED(status)) +#endif /* GCC. */ + +/* Nonzero if STATUS indicates the child is stopped. */ +#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f) + +/* Nonzero if STATUS indicates the child dumped core. */ +#define __WCOREDUMP(status) ((status) & __WCOREFLAG) + +/* Macros for constructing status values. */ +#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) +#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f) +#define __WCOREFLAG 0x80 + + +#ifdef __USE_BSD + +#include <endian.h> + +union wait + { + int w_status; + struct + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int __w_termsig:7; /* Terminating signal. */ + unsigned int __w_coredump:1; /* Set if dumped core. */ + unsigned int __w_retcode:8; /* Return code if exited normally. */ + unsigned int:16; +#endif /* Little endian. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int:16; + unsigned int __w_retcode:8; + unsigned int __w_coredump:1; + unsigned int __w_termsig:7; +#endif /* Big endian. */ + } __wait_terminated; + struct + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int:16; +#endif /* Little endian. */ +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned int:16; + unsigned int __w_stopsig:8; /* Stopping signal. */ + unsigned int __w_stopval:8; /* W_STOPPED if stopped. */ +#endif /* Big endian. */ + } __wait_stopped; + }; + +#define w_termsig __wait_terminated.__w_termsig +#define w_coredump __wait_terminated.__w_coredump +#define w_retcode __wait_terminated.__w_retcode +#define w_stopsig __wait_stopped.__w_stopsig +#define w_stopval __wait_stopped.__w_stopval + +#endif /* Use BSD. */ |