glibc/sysdeps/unix/sysv/sysv4/bits/sigset.h

99 lines
2.9 KiB
C
Raw Normal View History

1995-02-18 01:27:10 +00:00
/* __sig_atomic_t, __sigset_t, and related definitions. SVR4 version.
1996-11-15 04:08:00 +00:00
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
1996-11-15 04:08:00 +00:00
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
Lesser General Public License for more details.
1996-11-15 04:08:00 +00:00
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
1995-02-18 01:27:10 +00:00
#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 <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
/* 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))
Update. 1998-08-18 Ulrich Drepper <drepper@cygnus.com> * include/features.h: Define __USE_EXTERN_INLINES for recent enough gcc. * argp/argp.h: Define extern inline functions only if __USE_EXTERN_INLINES is defined. * libio/stdio.h: Likewise. * math/math.h: Likewise. * stdlib/stdlib.h: Likewise. * string/argz.h: Likewise. * sysdeps/generic/bits/sigset.h: Likewise. * sysdeps/unix/sysv/linux/bits/sigset.h: Likewise. * sysdeps/unix/sysv/sysv4/bits/sigset.h: Likewise. * sysdeps/wordsize-32/inttypes.h: Likewise. * sysdeps/wordsize-64/inttypes.h: Likewise. * wcsmbs/wchar.h: Likewise. * sysdeps/generic/bits/glob.c [_LIBC]: Define __stat using __xstat to allow compilation without optimization. 1998-08-14 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nss_compat/compat-grp.c: Set errno to ENOENT if we have no more entries. * nis/nss_compat/compat-initgroups.c: Likewise. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. * nis/nss_nis/nis-alias.c: Likewise. * nis/nss_nis/nis-ethers.c: Likewise. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nis/nis-hosts.c: Likewise. * nis/nss_nis/nis-initgroups.c: Likewise. * nis/nss_nis/nis-network.c: Likewise. * nis/nss_nis/nis-proto.c: Likewise. * nis/nss_nis/nis-pwd.c: Likewise. * nis/nss_nis/nis-rpc.c: Likewise. * nis/nss_nis/nis-service.c: Likewise. * nis/nss_nis/nis-spwd.c: Likewise. * nis/rpcsvc/yp.h: Generate new without 1024 byte limits. * nis/ypclnt.c: Try binding dir only first time, could be to old. * nis/yp_xdr.c: Remove 1024 byte limit. * nis/ypupdate_xdr.c: Likewise. * nis/nss_nis/nis-publickey.c: Make sure, nobody could send wrong data.
1998-08-18 23:27:30 +00:00
#ifdef __USE_EXTERN_INLINES
# ifndef _EXTERN_INLINE
# define _EXTERN_INLINE extern __inline
# endif
1995-02-18 01:27:10 +00:00
_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;
1995-02-18 01:27:10 +00:00
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;
}
Update. 1998-08-18 Ulrich Drepper <drepper@cygnus.com> * include/features.h: Define __USE_EXTERN_INLINES for recent enough gcc. * argp/argp.h: Define extern inline functions only if __USE_EXTERN_INLINES is defined. * libio/stdio.h: Likewise. * math/math.h: Likewise. * stdlib/stdlib.h: Likewise. * string/argz.h: Likewise. * sysdeps/generic/bits/sigset.h: Likewise. * sysdeps/unix/sysv/linux/bits/sigset.h: Likewise. * sysdeps/unix/sysv/sysv4/bits/sigset.h: Likewise. * sysdeps/wordsize-32/inttypes.h: Likewise. * sysdeps/wordsize-64/inttypes.h: Likewise. * wcsmbs/wchar.h: Likewise. * sysdeps/generic/bits/glob.c [_LIBC]: Define __stat using __xstat to allow compilation without optimization. 1998-08-14 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/nss_compat/compat-grp.c: Set errno to ENOENT if we have no more entries. * nis/nss_compat/compat-initgroups.c: Likewise. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. * nis/nss_nis/nis-alias.c: Likewise. * nis/nss_nis/nis-ethers.c: Likewise. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nis/nis-hosts.c: Likewise. * nis/nss_nis/nis-initgroups.c: Likewise. * nis/nss_nis/nis-network.c: Likewise. * nis/nss_nis/nis-proto.c: Likewise. * nis/nss_nis/nis-pwd.c: Likewise. * nis/nss_nis/nis-rpc.c: Likewise. * nis/nss_nis/nis-service.c: Likewise. * nis/nss_nis/nis-spwd.c: Likewise. * nis/rpcsvc/yp.h: Generate new without 1024 byte limits. * nis/ypclnt.c: Try binding dir only first time, could be to old. * nis/yp_xdr.c: Remove 1024 byte limit. * nis/ypupdate_xdr.c: Likewise. * nis/nss_nis/nis-publickey.c: Make sure, nobody could send wrong data.
1998-08-18 23:27:30 +00:00
#endif /* use extern inlines. */
1995-02-18 01:27:10 +00:00
#endif /* ! _SIGSET_H_fns */