mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 02:40:08 +00:00
* sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask): Replace
macro with inline function. (sigset_get_old_mask): Likewise. * sysdeps/posix/sigblock.c (__sigblock): Update callers. * sysdeps/posix/sigsetmask.c (__sigsetmask): Likewise. * sysdeps/posix/sigpause.c (__sigpause): Likewise. * sysdeps/posix/sigvec.c (__sigvec, sigvec_wrapper_handler): Likewise. * sysdeps/unix/sysv/aix/sigset-cvt-mask.h (sigset_set_old_mask, sigset_get_old_mask): Make these macros return values. * sysdeps/unix/sysv/linux/sigset-cvt-mask.h: Likewise. * sysdeps/unix/sysv/sysv4/sigset-cvt-mask.h: Likewise. 2002-07-06 Bruno Haible <bruno@clisp.org> * sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask, sigset_get_old_mask): Make it work with larger sigset_t. * sysdeps/posix/sigblock.c (__sigblock): Use those macros. * sysdeps/posix/sigsetmask.c (__sigsetmask): Likewise. * sysdeps/posix/sigpause.c (__sigpause): Likewise. 2002-08-26 Roland McGrath <roland@redhat.com>
This commit is contained in:
parent
20acbc2542
commit
b5d482d00e
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
||||
2002-08-26 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask): Replace
|
||||
macro with inline function.
|
||||
(sigset_get_old_mask): Likewise.
|
||||
* sysdeps/posix/sigblock.c (__sigblock): Update callers.
|
||||
* sysdeps/posix/sigsetmask.c (__sigsetmask): Likewise.
|
||||
* sysdeps/posix/sigpause.c (__sigpause): Likewise.
|
||||
* sysdeps/posix/sigvec.c (__sigvec, sigvec_wrapper_handler): Likewise.
|
||||
* sysdeps/unix/sysv/aix/sigset-cvt-mask.h
|
||||
(sigset_set_old_mask, sigset_get_old_mask): Make these macros return
|
||||
values.
|
||||
* sysdeps/unix/sysv/linux/sigset-cvt-mask.h: Likewise.
|
||||
* sysdeps/unix/sysv/sysv4/sigset-cvt-mask.h: Likewise.
|
||||
|
||||
2002-07-06 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
* sysdeps/generic/sigset-cvt-mask.h (sigset_set_old_mask,
|
||||
sigset_get_old_mask): Make it work with larger sigset_t.
|
||||
* sysdeps/posix/sigblock.c (__sigblock): Use those macros.
|
||||
* sysdeps/posix/sigsetmask.c (__sigsetmask): Likewise.
|
||||
* sysdeps/posix/sigpause.c (__sigpause): Likewise.
|
||||
|
||||
2002-08-26 Roland McGrath <roland@redhat.com>
|
||||
|
||||
* time/sys/time.h [__USE_BSD] (lutimes, futimes): Declare them.
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Convert between lowlevel sigmask and libc representation of sigset_t.
|
||||
Generic version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Joe Keane <jgk@jgk.org>.
|
||||
|
||||
@ -19,6 +19,46 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#define sigset_set_old_mask(set, mask) (*(set) = (unsigned long int) (mask))
|
||||
/* Convert between an old-style 32-bit signal mask and a POSIX sigset_t. */
|
||||
|
||||
#define sigset_get_old_mask(set, mask) ((mask) = (unsigned int) *(set))
|
||||
/* Perform *SET = MASK. Unused bits of *SET are set to 0.
|
||||
Returns zero for success or -1 for errors (from sigaddset/sigemptyset). */
|
||||
static inline int __attribute__ ((unused))
|
||||
sigset_set_old_mask (sigset_t *set, int mask)
|
||||
{
|
||||
if (sizeof (__sigset_t) == sizeof (unsigned int))
|
||||
*set = (unsigned int) (mask);
|
||||
else
|
||||
{
|
||||
register unsigned int __sig;
|
||||
|
||||
if (__sigemptyset (set) < 0)
|
||||
return -1;
|
||||
|
||||
for (__sig = 1; __sig < NSIG && __sig <= sizeof (mask) * 8; __sig++)
|
||||
if (mask & sigmask (__sig))
|
||||
if (__sigaddset (set, __sig) < 0)
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the sigmask corresponding to *SET.
|
||||
Unused bits of *SET are thrown away. */
|
||||
static inline int __attribute__ ((unused))
|
||||
sigset_get_old_mask (const sigset_t *set)
|
||||
{
|
||||
if (sizeof (sigset_t) == sizeof (unsigned int))
|
||||
return (unsigned int) *set;
|
||||
else
|
||||
{
|
||||
unsigned int mask = 0;
|
||||
register unsigned int sig;
|
||||
|
||||
for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; sig++)
|
||||
if (__sigismember (set, sig))
|
||||
mask |= sigmask (sig);
|
||||
|
||||
return mask;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 94, 95, 96, 97, 98, 2001 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 1994-1998, 2001-2002 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
|
||||
@ -19,39 +19,22 @@
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sigset-cvt-mask.h>
|
||||
|
||||
/* Block signals in MASK, returning the old mask. */
|
||||
int
|
||||
__sigblock (mask)
|
||||
int mask;
|
||||
{
|
||||
register unsigned int sig;
|
||||
sigset_t set, oset;
|
||||
|
||||
if (__sigemptyset (&set) < 0)
|
||||
if (sigset_set_old_mask (&set, mask) < 0)
|
||||
return -1;
|
||||
|
||||
if (sizeof (mask) == sizeof (set))
|
||||
*(int *) &set = mask;
|
||||
else if (sizeof (unsigned long int) == sizeof (set))
|
||||
*(unsigned long int *) &set = (unsigned int) mask;
|
||||
else
|
||||
for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
|
||||
if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
|
||||
return -1;
|
||||
|
||||
if (__sigprocmask (SIG_BLOCK, &set, &oset) < 0)
|
||||
return -1;
|
||||
|
||||
if (sizeof (mask) == sizeof (oset))
|
||||
mask = *(int *) &oset;
|
||||
else if (sizeof (unsigned long int) == sizeof (oset))
|
||||
mask = *(unsigned long int*) &oset;
|
||||
else
|
||||
for (sig = 1, mask = 0; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
|
||||
if (__sigismember (&oset, sig))
|
||||
mask |= sigmask (sig);
|
||||
|
||||
return mask;
|
||||
return sigset_get_old_mask (&oset);
|
||||
}
|
||||
|
||||
weak_alias (__sigblock, sigblock)
|
||||
|
@ -20,13 +20,14 @@
|
||||
#include <signal.h>
|
||||
#include <stddef.h> /* For NULL. */
|
||||
|
||||
#include <sigset-cvt-mask.h>
|
||||
|
||||
/* Set the mask of blocked signals to MASK,
|
||||
wait for a signal to arrive, and then restore the mask. */
|
||||
int
|
||||
__sigpause (int sig_or_mask, int is_sig)
|
||||
{
|
||||
sigset_t set;
|
||||
int sig;
|
||||
|
||||
if (is_sig != 0)
|
||||
{
|
||||
@ -36,20 +37,8 @@ __sigpause (int sig_or_mask, int is_sig)
|
||||
|| __sigdelset (&set, sig_or_mask) < 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__sigemptyset (&set) < 0)
|
||||
return -1;
|
||||
|
||||
if (sizeof (sig_or_mask) == sizeof (set))
|
||||
*(int *) &set = sig_or_mask;
|
||||
else if (sizeof (unsigned long int) == sizeof (set))
|
||||
*(unsigned long int *) &set = (unsigned int) sig_or_mask;
|
||||
else
|
||||
for (sig = 1; sig < NSIG; ++sig)
|
||||
if ((sig_or_mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
|
||||
return -1;
|
||||
}
|
||||
else if (sigset_set_old_mask (&set, sig_or_mask) < 0)
|
||||
return -1;
|
||||
|
||||
return __sigsuspend (&set);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991,1994,1995,1996,1997,2001 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,1994-1997,2001-2002 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
|
||||
@ -19,38 +19,21 @@
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <sigset-cvt-mask.h>
|
||||
|
||||
/* Set the mask of blocked signals to MASK, returning the old mask. */
|
||||
int
|
||||
__sigsetmask (int mask)
|
||||
{
|
||||
register unsigned int sig;
|
||||
sigset_t set, oset;
|
||||
|
||||
if (__sigemptyset (&set) < 0)
|
||||
if (sigset_set_old_mask (&set, mask) < 0)
|
||||
return -1;
|
||||
|
||||
if (sizeof (mask) == sizeof (set))
|
||||
*(int *) &set = mask;
|
||||
else if (sizeof (unsigned long int) == sizeof (set))
|
||||
*(unsigned long int *) &set = (unsigned int) mask;
|
||||
else
|
||||
for (sig = 1; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
|
||||
if ((mask & sigmask (sig)) && __sigaddset (&set, sig) < 0)
|
||||
return -1;
|
||||
|
||||
if (__sigprocmask (SIG_SETMASK, &set, &oset) < 0)
|
||||
return -1;
|
||||
|
||||
if (sizeof (mask) == sizeof (oset))
|
||||
mask = *(int *) &oset;
|
||||
else if (sizeof (unsigned long int) == sizeof (oset))
|
||||
mask = *(unsigned long int *) &oset;
|
||||
else
|
||||
for (sig = 1, mask = 0; sig < NSIG && sig <= sizeof (mask) * 8; ++sig)
|
||||
if (__sigismember (&oset, sig))
|
||||
mask |= sigmask (sig);
|
||||
|
||||
return mask;
|
||||
return sigset_get_old_mask (&oset);
|
||||
}
|
||||
|
||||
weak_alias (__sigsetmask, sigsetmask)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 92, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,92,94,95,96,97,98,2002 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
|
||||
@ -21,7 +21,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
/* Include macros to convert between `sigset_t' and old-style mask. */
|
||||
#include "sigset-cvt-mask.h"
|
||||
#include <sigset-cvt-mask.h>
|
||||
|
||||
/* We use a wrapper handler to support SV_RESETHAND. */
|
||||
struct sigvec_wrapper_data
|
||||
@ -80,7 +80,8 @@ __sigvec (sig, vec, ovec)
|
||||
#endif
|
||||
n = &new;
|
||||
new.sa_handler = handler;
|
||||
sigset_set_old_mask (&new.sa_mask, mask);
|
||||
if (sigset_set_old_mask (&new.sa_mask, mask) < 0)
|
||||
return -1;
|
||||
new.sa_flags = sa_flags;
|
||||
}
|
||||
|
||||
@ -122,7 +123,7 @@ __sigvec (sig, vec, ovec)
|
||||
/* should we use data->sw_mask?? */
|
||||
sv_flags |= SV_RESETHAND;
|
||||
}
|
||||
sigset_get_old_mask (&old.sa_mask, mask);
|
||||
mask = sigset_get_old_mask (&old.sa_mask);
|
||||
#ifdef SA_ONSTACK
|
||||
if (sa_flags & SA_ONSTACK)
|
||||
sv_flags |= SV_ONSTACK;
|
||||
@ -147,19 +148,18 @@ sigvec_wrapper_handler (sig)
|
||||
int sig;
|
||||
{
|
||||
struct sigvec_wrapper_data *data;
|
||||
unsigned int mask;
|
||||
struct sigaction act;
|
||||
int save;
|
||||
__sighandler_t handler;
|
||||
|
||||
data = &sigvec_wrapper_data[sig];
|
||||
mask = data->sw_mask;
|
||||
act.sa_handler = SIG_DFL;
|
||||
sigset_set_old_mask (&act.sa_mask, mask);
|
||||
act.sa_flags = 0;
|
||||
save = errno;
|
||||
sigset_set_old_mask (&act.sa_mask, data->sw_mask);
|
||||
handler = data->sw_handler;
|
||||
save = errno;
|
||||
(void) __sigaction (sig, &act, (struct sigaction *) NULL);
|
||||
__set_errno (save);
|
||||
|
||||
(*handler) (sig);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Convert between lowlevel sigmask and libc representation of sigset_t.
|
||||
AIX version.
|
||||
Copyright (C) 1998, 2000 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998,2000,02 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
|
||||
@ -19,10 +19,7 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#define sigset_set_old_mask(set, mask) \
|
||||
do { \
|
||||
(set)->__losigs = (unsigned int) mask; \
|
||||
(set)->__hisigs = 0; \
|
||||
} while (0)
|
||||
((set)->__losigs = (unsigned int) (mask), (set)->__hisigs = 0, 0)
|
||||
|
||||
#define sigset_get_old_mask(set, mask) \
|
||||
((mask) = (unsigned int) (set)->__losigs)
|
||||
((unsigned int) (set)->__losigs)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Convert between lowlevel sigmask and libc representation of sigset_t.
|
||||
Linux version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Joe Keane <jgk@jgk.org>.
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#define sigset_set_old_mask(set, mask) \
|
||||
do { \
|
||||
({ \
|
||||
unsigned long int *__ptr; \
|
||||
int __cnt; \
|
||||
__ptr = &(set)->__val[0]; \
|
||||
@ -29,7 +29,7 @@
|
||||
do \
|
||||
*__ptr++ = 0ul; \
|
||||
while (--__cnt >= 0); \
|
||||
} while (0)
|
||||
0; })
|
||||
|
||||
#define sigset_get_old_mask(set, mask) \
|
||||
((mask) = (unsigned int) (set)->__val[0])
|
||||
#define sigset_get_old_mask(set) \
|
||||
((unsigned int) (set)->__val[0])
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Convert between lowlevel sigmask and libc representation of sigset_t.
|
||||
SysVr4 version.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 2002 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Joe Keane <jgk@jgk.org>.
|
||||
|
||||
@ -20,14 +20,14 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#define sigset_set_old_mask(set, mask) \
|
||||
do { \
|
||||
({ \
|
||||
unsigned long int *__ptr; \
|
||||
__ptr = &(set)->__sigbits[0]; \
|
||||
__ptr[0] = (mask); \
|
||||
__ptr[1] = 0ul; \
|
||||
__ptr[2] = 0ul; \
|
||||
__ptr[3] = 0ul; \
|
||||
} while (0)
|
||||
0; })
|
||||
|
||||
#define sigset_get_old_mask(set, mask) \
|
||||
((mask) = (unsigned int) (set)->__sigbits[0])
|
||||
#define sigset_get_old_mask(set) \
|
||||
((unsigned int) (set)->__sigbits[0])
|
||||
|
Loading…
Reference in New Issue
Block a user