From fc961ebd7f305c6c5917b16102639cca887a8dca Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 21 Jun 1997 02:53:38 +0000 Subject: [PATCH] SysVr4 info header. --- sysdeps/unix/sysv/sysv4/bits/sigaction.h | 51 +++++++++++++ sysdeps/unix/sysv/sysv4/bits/signum.h | 66 ++++++++++++++++ sysdeps/unix/sysv/sysv4/bits/sigset.h | 96 ++++++++++++++++++++++++ sysdeps/unix/sysv/sysv4/bits/utsname.h | 1 + sysdeps/unix/sysv/sysv4/bits/waitflags.h | 34 +++++++++ 5 files changed, 248 insertions(+) create mode 100644 sysdeps/unix/sysv/sysv4/bits/sigaction.h create mode 100644 sysdeps/unix/sysv/sysv4/bits/signum.h create mode 100644 sysdeps/unix/sysv/sysv4/bits/sigset.h create mode 100644 sysdeps/unix/sysv/sysv4/bits/utsname.h create mode 100644 sysdeps/unix/sysv/sysv4/bits/waitflags.h diff --git a/sysdeps/unix/sysv/sysv4/bits/sigaction.h b/sysdeps/unix/sysv/sysv4/bits/sigaction.h new file mode 100644 index 0000000000..1305ba61e6 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/bits/sigaction.h @@ -0,0 +1,51 @@ +/* The proper definitions for SVR4's sigaction. +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., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +/* Structure describing the action to be taken when a signal arrives. */ +struct sigaction + { + /* Special flags. */ + int sa_flags; + + /* Signal handler. */ + __sighandler_t sa_handler; + + /* Additional set of signals to be blocked. */ + __sigset_t sa_mask; + + /* Padding. */ + int sa_resv[2]; + }; + +/* Bits in `sa_flags'. */ +#ifdef __USE_MISC +#define SA_ONSTACK 0x1 /* Take signal on signal stack. */ +#define SA_RESETHAND 0x2 /* Reset to SIG_DFL on entry to handler. */ +#define SA_RESTART 0x4 /* Don't restart syscall on signal return. */ +#define SA_SIGINFO 0x8 /* Provide additional info to the handler. */ +#define SA_NODEFER 0x10 /* Don't automatically block the signal when + its handler is being executed. */ +#define SA_NOCLDWAIT 0x10000 /* Don't save zombie processes. */ +#endif +#define SA_NOCLDSTOP 0x20000 /* 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/unix/sysv/sysv4/bits/signum.h b/sysdeps/unix/sysv/sysv4/bits/signum.h new file mode 100644 index 0000000000..f11c731a42 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/bits/signum.h @@ -0,0 +1,66 @@ +/* Signal number definitions. SVR4 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. */ + +#ifdef _SIGNAL_H + +/* Fake signal functions. */ +#define SIG_ERR ((__sighandler_t) -1) /* Error return. */ +#define SIG_DFL ((__sighandler_t) 0) /* Default action. */ +#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */ + + +/* Signals. */ +#define SIGHUP 1 /* Hangup (POSIX). */ +#define SIGINT 2 /* Interrupt (ANSI). */ +#define SIGQUIT 3 /* Quit (POSIX). */ +#define SIGILL 4 /* Illegal instruction (ANSI). */ +#define SIGABRT SIGIOT /* Abort (ANSI). */ +#define SIGTRAP 5 /* Trace trap (POSIX). */ +#define SIGIOT 6 /* IOT trap (4.2 BSD). */ +#define SIGEMT 7 /* EMT trap (4.2 BSD). */ +#define SIGFPE 8 /* Floating-point exception (ANSI). */ +#define SIGKILL 9 /* Kill, unblockable (POSIX). */ +#define SIGBUS 10 /* Bus error (4.2 BSD). */ +#define SIGSEGV 11 /* Segmentation violation (ANSI). */ +#define SIGSYS 12 /* Bad argument to system call (4.2 BSD)*/ +#define SIGPIPE 13 /* Broken pipe (POSIX). */ +#define SIGALRM 14 /* Alarm clock (POSIX). */ +#define SIGTERM 15 /* Termination (ANSI). */ +#define SIGUSR1 16 /* User-defined signal 1 (POSIX). */ +#define SIGUSR2 17 /* User-defined signal 2 (POSIX). */ +#define SIGCHLD 18 /* Child status has changed (POSIX). */ +#define SIGCLD SIGCHLD /* Same as SIGCHLD (System V). */ +#define SIGPWR 19 /* Power failure restart (System V). */ +#define SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */ +#define SIGURG 21 /* Urgent condition on socket (4.2 BSD).*/ +#define SIGPOLL 22 /* Pollable event occurred (System V). */ +#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */ +#define SIGSTOP 23 /* Stop, unblockable (POSIX). */ +#define SIGTSTP 24 /* Keyboard stop (POSIX). */ +#define SIGCONT 25 /* Continue (POSIX). */ +#define SIGTTIN 26 /* Background read from tty (POSIX). */ +#define SIGTTOU 27 /* Background write to tty (POSIX). */ +#define SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */ +#define SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */ +#define SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */ +#define SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */ + +#endif /* included. */ + +#define _NSIG 32 /* Biggest signal number + 1. */ diff --git a/sysdeps/unix/sysv/sysv4/bits/sigset.h b/sysdeps/unix/sysv/sysv4/bits/sigset.h new file mode 100644 index 0000000000..1461c93b3d --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/bits/sigset.h @@ -0,0 +1,96 @@ +/* __sig_atomic_t, __sigset_t, and related definitions. SVR4 version. + Copyright (C) 1994, 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. */ + +#ifndef _SIGSET_H_types +#define _SIGSET_H_types 1 + +typedef int __sig_atomic_t; + +/* A `sigset_t' has a bit for each signal. */ +typedef struct + { + unsigned long int __sigbits[4]; + } __sigset_t; + +#endif /* ! _SIGSET_H_types */ + +/* We only want to define these functions if 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 + +/* Return a mask that includes SIG only. */ +#define __sigmask(sig) (1 << ((sig) - 1)) + + +/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */ +#define __NSSBITS (sizeof (__sigset_t) * 8) +#define __SSELT(s) ((s) / __NSSBITS) +#define __SSMASK(s) (1 << ((s) % __NSSBITS)) + +#ifndef _EXTERN_INLINE +#define _EXTERN_INLINE extern __inline +#endif + +_EXTERN_INLINE int +__sigemptyset (__sigset_t *__set) +{ + __set->__sigbits[0] = __set->__sigbits[1] = + __set->__sigbits[2] = __set->__sigbits[3] = 0L; + return 0; +} + +_EXTERN_INLINE int +__sigfillset (__sigset_t *__set) +{ + /* SVR4 has a system call for `sigfillset' (!), and it only sets the bits + for signals [1,31]. Setting bits for unimplemented signals seems + harmless (and we will find out if it really is). */ + __set->__sigbits[0] = __set->__sigbits[1] = + __set->__sigbits[2] = __set->__sigbits[3] = ~0L; + return 0; +} + +_EXTERN_INLINE int +__sigaddset (__sigset_t *__set, int __sig) +{ + __set->__sigbits[__SSELT (__sig)] |= __SSMASK (__sig); + return 0; +} + +_EXTERN_INLINE int +__sigdelset (__sigset_t *__set, int __sig) +{ + __set->__sigbits[__SSELT (__sig)] &= ~__SSMASK (__sig); + return 0; +} + +_EXTERN_INLINE int +__sigismember (__const __sigset_t *__set, int __sig) +{ + if (__set->__sigbits[__SSELT (__sig)] & __SSMASK (__sig)) + return 1; + return 0; +} + +#endif /* ! _SIGSET_H_fns */ diff --git a/sysdeps/unix/sysv/sysv4/bits/utsname.h b/sysdeps/unix/sysv/sysv4/bits/utsname.h new file mode 100644 index 0000000000..9dcc618068 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/bits/utsname.h @@ -0,0 +1 @@ +#define _UTSNAME_LENGTH 257 diff --git a/sysdeps/unix/sysv/sysv4/bits/waitflags.h b/sysdeps/unix/sysv/sysv4/bits/waitflags.h new file mode 100644 index 0000000000..29ff566342 --- /dev/null +++ b/sysdeps/unix/sysv/sysv4/bits/waitflags.h @@ -0,0 +1,34 @@ +/* Definitions of flag bits for `waitpid' et al. + Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Brendan Kehoe (brendan@zen.org). + + 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 directly; include instead." +#endif + + +/* Bits in the third argument to `waitpid'. */ +#define WNOHANG 64 /* Don't block waiting. */ +#define WUNTRACED 4 /* Report status of stopped children. */ + +#ifdef __USE_SVID +#define WEXITED 1 /* Look for children that have exited. */ +#define WTRAPPED 2 /* Look for processes that stopped + while tracing. */ +#endif