From f6677b70e1e6379e09122ed1c705814173b83a53 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 15 Nov 2005 01:17:02 +0000 Subject: update licenses and sync with glibc --- libc/signal/killpg.c | 29 +++++----- libc/signal/sigaction.c | 141 ++++++++++++++++++++++++---------------------- libc/signal/sigaddset.c | 31 +++++----- libc/signal/sigandset.c | 30 +++++----- libc/signal/sigblock.c | 4 +- libc/signal/sigdelset.c | 31 +++++----- libc/signal/sigempty.c | 32 ++++++----- libc/signal/sigfillset.c | 41 +++++++++----- libc/signal/siggetmask.c | 25 ++++---- libc/signal/sighold.c | 42 +++++++------- libc/signal/sigignore.c | 37 ++++++------ libc/signal/sigintr.c | 53 +++++++++-------- libc/signal/sigisempty.c | 26 +++++---- libc/signal/sigismem.c | 31 +++++----- libc/signal/signal.c | 54 ++++++++++-------- libc/signal/sigorset.c | 30 +++++----- libc/signal/sigpause.c | 19 ++++--- libc/signal/sigrelse.c | 42 +++++++------- libc/signal/sigset.c | 93 +++++++++++++++--------------- libc/signal/sigsetmask.c | 18 +++--- libc/signal/sigsetops.h | 17 +++--- libc/signal/sigwait.c | 36 ++++++------ libc/signal/sysv_signal.c | 52 +++++++++-------- 23 files changed, 493 insertions(+), 421 deletions(-) (limited to 'libc/signal') diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c index e75cfc483..1fcf6bfa5 100644 --- a/libc/signal/killpg.c +++ b/libc/signal/killpg.c @@ -2,19 +2,19 @@ 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include @@ -23,13 +23,16 @@ /* Send SIG to all processes in process group PGRP. If PGRP is zero, send SIG to all processes in the current process's process group. */ -int killpg ( __pid_t pgrp, int sig) +int +killpg (pgrp, sig) + __pid_t pgrp; + int sig; { - if (pgrp < 0) + if (pgrp < 0) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return kill (- pgrp, sig); + return kill (- pgrp, sig); } diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c index eb6b43a49..0ead76ef6 100644 --- a/libc/signal/sigaction.c +++ b/libc/signal/sigaction.c @@ -1,107 +1,114 @@ -/* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include #include + #include + + +/* The difference here is that the sigaction structure used in the + kernel is not the same as we use in the libc. Therefore we must + translate it here. */ #include +int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact); #if defined __NR_rt_sigaction /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ -int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +int +__libc_sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; { - int result; - struct kernel_sigaction kact, koact; - -#ifdef SIGCANCEL - if (sig == SIGCANCEL) { - __set_errno (EINVAL); - return -1; - } -#endif - if (act) { - kact.k_sa_handler = act->sa_handler; - memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); - kact.sa_flags = act->sa_flags; + int result; + struct kernel_sigaction kact, koact; + + if (act) { + kact.k_sa_handler = act->sa_handler; + memcpy (&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask)); + kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER - kact.sa_restorer = act->sa_restorer; + kact.sa_restorer = act->sa_restorer; # endif - } - - /* XXX The size argument hopefully will have to be changed to the - real size of the user-level sigset_t. */ - result = __syscall_rt_sigaction(sig, act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); - - if (oact && result >= 0) { - oact->sa_handler = koact.k_sa_handler; - memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); - oact->sa_flags = koact.sa_flags; + } + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ + result = __syscall_rt_sigaction(sig, + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL, _NSIG / 8); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (oact->sa_mask)); + oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; + oact->sa_restorer = koact.sa_restorer; # endif - } - return result; -} + } + return result; +} #else /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ -int __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +int +__libc_sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; { - int result; - struct old_kernel_sigaction kact, koact; - -#ifdef SIGCANCEL - if (sig == SIGCANCEL) { - __set_errno (EINVAL); - return -1; - } -#endif - if (act) { - kact.k_sa_handler = act->sa_handler; - kact.sa_mask = act->sa_mask.__val[0]; - kact.sa_flags = act->sa_flags; + int result; + struct old_kernel_sigaction kact, koact; + + if (act) { + kact.k_sa_handler = act->sa_handler; + kact.sa_mask = act->sa_mask.__val[0]; + kact.sa_flags = act->sa_flags; # ifdef HAVE_SA_RESTORER - kact.sa_restorer = act->sa_restorer; + kact.sa_restorer = act->sa_restorer; # endif - } - result = __syscall_sigaction(sig, act ? __ptrvalue (&kact) : NULL, - oact ? __ptrvalue (&koact) : NULL); - - if (oact && result >= 0) { - oact->sa_handler = koact.k_sa_handler; - oact->sa_mask.__val[0] = koact.sa_mask; - oact->sa_flags = koact.sa_flags; + } + + result = __syscall_sigaction(sig, + act ? __ptrvalue (&kact) : NULL, + oact ? __ptrvalue (&koact) : NULL); + + if (oact && result >= 0) { + oact->sa_handler = koact.k_sa_handler; + oact->sa_mask.__val[0] = koact.sa_mask; + oact->sa_flags = koact.sa_flags; # ifdef HAVE_SA_RESTORER - oact->sa_restorer = koact.sa_restorer; + oact->sa_restorer = koact.sa_restorer; # endif - } - return result; + } + + return result; } #endif -weak_alias(__libc_sigaction, sigaction) - +weak_alias (__libc_sigaction, __sigaction) +weak_alias (__libc_sigaction, sigaction) diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c index 2e4f5c540..e5813c117 100644 --- a/libc/signal/sigaddset.c +++ b/libc/signal/sigaddset.c @@ -1,31 +1,34 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996, 2003 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. + 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. 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. + Lesser 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. */ + 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. */ #include "sigsetops.h" /* Add SIGNO to SET. */ -int sigaddset (sigset_t *set, int signo) +int +sigaddset (set, signo) + sigset_t *set; + int signo; { - if (set == NULL || signo <= 0 || signo >= NSIG) + if (set == NULL || signo <= 0 || signo >= NSIG) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigaddset (set, signo); + return __sigaddset (set, signo); } diff --git a/libc/signal/sigandset.c b/libc/signal/sigandset.c index a09e102ae..4e1abd969 100644 --- a/libc/signal/sigandset.c +++ b/libc/signal/sigandset.c @@ -2,19 +2,19 @@ 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. + 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. 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. + Lesser 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. */ + 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. */ #include #define __USE_GNU @@ -23,13 +23,17 @@ #include /* Combine sets LEFT and RIGHT by logical AND and place result in DEST. */ -int sigandset (sigset_t *dest, const sigset_t *left, const sigset_t *right) +int +sigandset (dest, left, right) + sigset_t *dest; + const sigset_t *left; + const sigset_t *right; { - if (dest == NULL || left == NULL || right == NULL) + if (dest == NULL || left == NULL || right == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigandset (dest, left, right); + return __sigandset (dest, left, right); } diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c index 1d673f454..c02c234b6 100644 --- a/libc/signal/sigblock.c +++ b/libc/signal/sigblock.c @@ -17,11 +17,10 @@ 02111-1307 USA. */ #include -#define __USE_GNU #include /* Block signals in MASK, returning the old mask. */ -int sigblock (int mask) +int __sigblock (int mask) { register unsigned int sig; sigset_t set, oset; @@ -53,3 +52,4 @@ int sigblock (int mask) return mask; } +strong_alias (__sigblock, sigblock) diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c index 76279a945..16bc9ea4a 100644 --- a/libc/signal/sigdelset.c +++ b/libc/signal/sigdelset.c @@ -1,31 +1,34 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1996, 2003 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. + 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. 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. + Lesser 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. */ + 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. */ #include "sigsetops.h" /* Add SIGNO to SET. */ -int sigdelset (sigset_t *set, int signo) +int +sigdelset (set, signo) + sigset_t *set; + int signo; { - if (set == NULL || signo <= 0 || signo >= NSIG) + if (set == NULL || signo <= 0 || signo >= NSIG) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigdelset (set, signo); + return __sigdelset (set, signo); } diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c index 36b8f63fa..75b5be420 100644 --- a/libc/signal/sigempty.c +++ b/libc/signal/sigempty.c @@ -1,35 +1,37 @@ -/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991,96,97,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 - 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include #include /* Clear all signals from SET. */ -int sigemptyset (sigset_t *set) +int +sigemptyset (set) + sigset_t *set; { - if (set == NULL) + if (set == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - memset (set, 0, sizeof (sigset_t)); + memset (set, 0, sizeof (sigset_t)); - return 0; + return 0; } diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c index 6edbb0e6b..03361787e 100644 --- a/libc/signal/sigfillset.c +++ b/libc/signal/sigfillset.c @@ -1,35 +1,46 @@ -/* Copyright (C) 1991, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991,96,97,2002,2003,2004 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include #include /* Set all signals in SET. */ -int sigfillset (sigset_t *set) +int +sigfillset (set) + sigset_t *set; { - if (set == NULL) + if (set == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - memset (set, 0xff, sizeof (sigset_t)); + memset (set, 0xff, sizeof (sigset_t)); - return 0; + /* If the implementation uses a cancellation signal don't set the bit. */ +#ifdef SIGCANCEL + __sigdelset (set, SIGCANCEL); +#endif + /* Likewise for the signal to implement setxid. */ +#ifdef SIGSETXID + __sigdelset (set, SIGSETXID); +#endif + + return 0; } diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c index 0436532a5..f139d3861 100644 --- a/libc/signal/siggetmask.c +++ b/libc/signal/siggetmask.c @@ -3,25 +3,28 @@ 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. + 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. 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. + Lesser 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. */ + 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. */ -#define __USE_GNU #include -int siggetmask (void) +extern int __sigblock (int __mask); +int +siggetmask (void) { - return sigblock (0); + return __sigblock (0); } +link_warning (siggetmask, + "warning: `siggetmask' is obsolete; `sigprocmask' is best") diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c index d30a337f2..670a4872e 100644 --- a/libc/signal/sighold.c +++ b/libc/signal/sighold.c @@ -1,40 +1,42 @@ /* Add SIG to the calling process' signal mask. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. 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. + 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. 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. + Lesser 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. */ + 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. */ #define __need_NULL #include -#define __USE_GNU +#define _GNU_SOURCE #include -int sighold (int sig) +int +sighold (sig) + int sig; { - sigset_t set; + sigset_t set; - /* Retrieve current signal set. */ - if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) - return -1; + /* Retrieve current signal set. */ + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return -1; - /* Add the specified signal. */ - if (__sigaddset (&set, sig) < 0) - return -1; + /* Add the specified signal. */ + if (sigaddset (&set, sig) < 0) + return -1; - /* Set the new mask. */ - return sigprocmask (SIG_SETMASK, &set, NULL); + /* Set the new mask. */ + return sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c index 64d1852ab..407b52e2a 100644 --- a/libc/signal/sigignore.c +++ b/libc/signal/sigignore.c @@ -1,36 +1,41 @@ /* Set the disposition of SIG to SIG_IGN. - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. 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. + 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. 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. + Lesser 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. */ + 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. */ +#define _GNU_SOURCE #include #define __need_NULL #include #include +#include /* For the real memset prototype. */ -int sigignore (int sig) + +int +sigignore (sig) + int sig; { - struct sigaction act; + struct sigaction act; - act.sa_handler = SIG_IGN; - if (__sigemptyset (&act.sa_mask) < 0) - return -1; - act.sa_flags = 0; + act.sa_handler = SIG_IGN; + if (__sigemptyset (&act.sa_mask) < 0) + return -1; + act.sa_flags = 0; - return sigaction (sig, &act, NULL); + return sigaction (sig, &act, NULL); } diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c index e8cdd9814..8315c3a6b 100644 --- a/libc/signal/sigintr.c +++ b/libc/signal/sigintr.c @@ -1,20 +1,20 @@ -/* Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1994, 1996, 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 - 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include @@ -23,32 +23,35 @@ /* If INTERRUPT is nonzero, make signal SIG interrupt system calls (causing them to fail with EINTR); if INTERRUPT is zero, make system calls be restarted after signal SIG. */ -int siginterrupt (int sig, int interrupt) +int +siginterrupt (sig, interrupt) + int sig; + int interrupt; { #ifdef SA_RESTART - extern sigset_t _sigintr; /* Defined in signal.c. */ - struct sigaction action; + extern sigset_t _sigintr attribute_hidden; /* Defined in signal.c. */ + struct sigaction action; - if (sigaction (sig, (struct sigaction *) NULL, &action) < 0) - return -1; + if (sigaction (sig, (struct sigaction *) NULL, &action) < 0) + return -1; - if (interrupt) + if (interrupt) { - __sigaddset (&_sigintr, sig); - action.sa_flags &= ~SA_RESTART; + __sigaddset (&_sigintr, sig); + action.sa_flags &= ~SA_RESTART; } - else + else { - __sigdelset (&_sigintr, sig); - action.sa_flags |= SA_RESTART; + __sigdelset (&_sigintr, sig); + action.sa_flags |= SA_RESTART; } - if (sigaction (sig, &action, (struct sigaction *) NULL) < 0) - return -1; + if (sigaction (sig, &action, (struct sigaction *) NULL) < 0) + return -1; - return 0; + return 0; #else - __set_errno (ENOSYS); - return -1; + __set_errno (ENOSYS); + return -1; #endif } diff --git a/libc/signal/sigisempty.c b/libc/signal/sigisempty.c index 9067ff08a..6d1de45a8 100644 --- a/libc/signal/sigisempty.c +++ b/libc/signal/sigisempty.c @@ -2,19 +2,19 @@ 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. + 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. 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. + Lesser 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. */ + 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. */ #include #define __USE_GNU @@ -23,12 +23,14 @@ #include /* Test whether SET is empty. */ -int sigisemptyset (const sigset_t *set) +int +sigisemptyset (set) + const sigset_t *set; { - if (set == NULL) + if (set == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } return __sigisemptyset (set); diff --git a/libc/signal/sigismem.c b/libc/signal/sigismem.c index f1c79d2da..6423a1a02 100644 --- a/libc/signal/sigismem.c +++ b/libc/signal/sigismem.c @@ -1,31 +1,34 @@ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1991,96,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 - 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. + 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. 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. + Lesser 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. */ + 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. */ #include "sigsetops.h" /* Return 1 if SIGNO is in SET, 0 if not. */ -int sigismember (const sigset_t *set, int signo) +int +sigismember (set, signo) + const sigset_t *set; + int signo; { - if (set == NULL || signo <= 0 || signo >= NSIG) + if (set == NULL || signo <= 0 || signo >= NSIG) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigismember (set, signo); + return __sigismember (set, signo); } diff --git a/libc/signal/signal.c b/libc/signal/signal.c index 463de1e50..7df88eff0 100644 --- a/libc/signal/signal.c +++ b/libc/signal/signal.c @@ -1,49 +1,53 @@ /* BSD-like signal function. - Copyright (C) 1991, 1992, 1996, 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1991,1992,1996,1997,2000,2002,2005 + 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include +#include /* For the real memset prototype. */ -sigset_t _sigintr; /* Set by siginterrupt. */ +sigset_t _sigintr attribute_hidden; /* Set by siginterrupt. */ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ -__sighandler_t bsd_signal (int sig, __sighandler_t handler) +__sighandler_t +__bsd_signal (int sig, __sighandler_t handler) { - struct sigaction act, oact; + struct sigaction act, oact; - /* Check signal extents to protect __sigismember. */ - if (handler == SIG_ERR || sig < 1 || sig >= NSIG) + /* Check signal extents to protect __sigismember. */ + if (handler == SIG_ERR || sig < 1 || sig >= NSIG) { - __set_errno (EINVAL); - return SIG_ERR; + __set_errno (EINVAL); + return SIG_ERR; } - act.sa_handler = handler; - if (__sigemptyset (&act.sa_mask) < 0 - || __sigaddset (&act.sa_mask, sig) < 0) - return SIG_ERR; - act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; + act.sa_handler = handler; + if (__sigemptyset (&act.sa_mask) < 0 + || __sigaddset (&act.sa_mask, sig) < 0) + return SIG_ERR; + act.sa_flags = __sigismember (&_sigintr, sig) ? 0 : SA_RESTART; + if (sigaction (sig, &act, &oact) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } -weak_alias (bsd_signal, signal) +weak_alias (__bsd_signal, bsd_signal) +weak_alias (__bsd_signal, signal) diff --git a/libc/signal/sigorset.c b/libc/signal/sigorset.c index 017f3ba06..ffabf3704 100644 --- a/libc/signal/sigorset.c +++ b/libc/signal/sigorset.c @@ -2,19 +2,19 @@ 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. + 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. 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. + Lesser 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. */ + 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. */ #include #define __USE_GNU @@ -23,13 +23,17 @@ #include /* Combine sets LEFT and RIGHT by logical OR and place result in DEST. */ -int sigorset (sigset_t *dest, const sigset_t *left, const sigset_t *right) +int +sigorset (dest, left, right) + sigset_t *dest; + const sigset_t *left; + const sigset_t *right; { - if (dest == NULL || left == NULL || right == NULL) + if (dest == NULL || left == NULL || right == NULL) { - __set_errno (EINVAL); - return -1; + __set_errno (EINVAL); + return -1; } - return __sigorset (dest, left, right); + return __sigorset (dest, left, right); } diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c index 433b92b0c..dd05e6e0a 100644 --- a/libc/signal/sigpause.c +++ b/libc/signal/sigpause.c @@ -1,20 +1,21 @@ -/* Copyright (C) 1991, 92, 1994-1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,94-98,2000,2002,2003,2004 + 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c index ae3b20ae2..091f97de5 100644 --- a/libc/signal/sigrelse.c +++ b/libc/signal/sigrelse.c @@ -1,40 +1,42 @@ /* Remove SIG from the calling process' signal mask. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. 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. + 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. 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. + Lesser 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. */ + 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. */ #define __need_NULL #include -#define __USE_GNU +#define _GNU_SOURCE #include -int sigrelse (int sig) +int +sigrelse (sig) + int sig; { - sigset_t set; + sigset_t set; - /* Retrieve current signal set. */ - if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) - return -1; + /* Retrieve current signal set. */ + if (sigprocmask (SIG_SETMASK, NULL, &set) < 0) + return -1; - /* Remove the specified signal. */ - if (__sigdelset (&set, sig) < 0) - return -1; + /* Remove the specified signal. */ + if (sigdelset (&set, sig) < 0) + return -1; - /* Set the new mask. */ - return sigprocmask (SIG_SETMASK, &set, NULL); + /* Set the new mask. */ + return sigprocmask (SIG_SETMASK, &set, NULL); } diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c index e0cda7b9f..0ce411c8c 100644 --- a/libc/signal/sigset.c +++ b/libc/signal/sigset.c @@ -1,78 +1,83 @@ -/* Copyright (C) 1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998, 2000, 2005 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. + 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. 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. + Lesser 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. */ + 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. */ #include #define __need_NULL #include +#define __USE_XOPEN_EXTENDED #include +#include /* For the real memset prototype. */ /* Set the disposition for SIG. */ -__sighandler_t sigset (int sig, __sighandler_t disp) +__sighandler_t +sigset (sig, disp) + int sig; + __sighandler_t disp; { - struct sigaction act, oact; - sigset_t set; + struct sigaction act, oact; + sigset_t set; #ifdef SIG_HOLD - /* Handle SIG_HOLD first. */ - if (disp == SIG_HOLD) + /* Handle SIG_HOLD first. */ + if (disp == SIG_HOLD) { - /* Create an empty signal set. */ - if (__sigemptyset (&set) < 0) - return SIG_ERR; + /* Create an empty signal set. */ + if (__sigemptyset (&set) < 0) + return SIG_ERR; - /* Add the specified signal. */ - if (__sigaddset (&set, sig) < 0) - return SIG_ERR; + /* Add the specified signal. */ + if (__sigaddset (&set, sig) < 0) + return SIG_ERR; - /* Add the signal set to the current signal mask. */ - if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) - return SIG_ERR; + /* Add the signal set to the current signal mask. */ + if (sigprocmask (SIG_BLOCK, &set, NULL) < 0) + return SIG_ERR; - return SIG_HOLD; + return SIG_HOLD; } #endif /* SIG_HOLD */ - /* Check signal extents to protect __sigismember. */ - if (disp == SIG_ERR || sig < 1 || sig >= NSIG) + /* Check signal extents to protect __sigismember. */ + if (disp == SIG_ERR || sig < 1 || sig >= NSIG) { - __set_errno (EINVAL); - return SIG_ERR; + __set_errno (EINVAL); + return SIG_ERR; } - act.sa_handler = disp; - if (__sigemptyset (&act.sa_mask) < 0) - return SIG_ERR; - act.sa_flags = 0; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; + act.sa_handler = disp; + if (__sigemptyset (&act.sa_mask) < 0) + return SIG_ERR; + act.sa_flags = 0; + if (sigaction (sig, &act, &oact) < 0) + return SIG_ERR; - /* Create an empty signal set. */ - if (__sigemptyset (&set) < 0) - return SIG_ERR; + /* Create an empty signal set. */ + if (__sigemptyset (&set) < 0) + return SIG_ERR; - /* Add the specified signal. */ - if (__sigaddset (&set, sig) < 0) - return SIG_ERR; + /* Add the specified signal. */ + if (__sigaddset (&set, sig) < 0) + return SIG_ERR; - /* Remove the signal set from the current signal mask. */ - if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) - return SIG_ERR; + /* Remove the signal set from the current signal mask. */ + if (sigprocmask (SIG_UNBLOCK, &set, NULL) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c index 632eaff2a..4c7a43e5f 100644 --- a/libc/signal/sigsetmask.c +++ b/libc/signal/sigsetmask.c @@ -1,20 +1,20 @@ -/* 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 - 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h index 8cdbf0d9b..52081c2ba 100644 --- a/libc/signal/sigsetops.h +++ b/libc/signal/sigsetops.h @@ -2,24 +2,23 @@ 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. + 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. 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. + Lesser 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. */ + 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. */ /* Definitions relevant to functions that operate on `sigset_t's. */ #include -#define __USE_GNU #include #include diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c index a3d43df19..99ddfc481 100644 --- a/libc/signal/sigwait.c +++ b/libc/signal/sigwait.c @@ -3,20 +3,20 @@ * * Copyright (C) 2003 by Erik Andersen * - * This program 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. + * This program 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. * - * This program 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. + * 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. * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ + * 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. */ #include #include @@ -25,12 +25,12 @@ #undef sigwait int attribute_hidden __sigwait (const sigset_t *set, int *sig) { - int ret = 1; - if ((ret = sigwaitinfo(set, NULL)) != -1) { - *sig = ret; - return 0; - } - return 1; + int ret = 1; + if ((ret = sigwaitinfo(set, NULL)) != -1) { + *sig = ret; + return 0; + } + return 1; } /* psm: keep this weak, because the one in libpthread.so could overwrite it */ diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c index 0c94577be..576fc0b8d 100644 --- a/libc/signal/sysv_signal.c +++ b/libc/signal/sysv_signal.c @@ -1,23 +1,25 @@ -/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 1996, 1997, 2005 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. + 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. 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. + Lesser 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. */ + 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. */ #include #include +#include /* For the real memset prototype. */ + /* Tolerate non-threads versions of Posix */ #ifndef SA_ONESHOT @@ -32,25 +34,29 @@ /* Set the handler for the signal SIG to HANDLER, returning the old handler, or SIG_ERR on error. */ -__sighandler_t __sysv_signal (int sig, __sighandler_t handler) +__sighandler_t +__sysv_signal (sig, handler) + int sig; + __sighandler_t handler; { - struct sigaction act, oact; + struct sigaction act, oact; - /* Check signal extents to protect __sigismember. */ - if (handler == SIG_ERR || sig < 1 || sig >= NSIG) + /* Check signal extents to protect __sigismember. */ + if (handler == SIG_ERR || sig < 1 || sig >= NSIG) { - __set_errno (EINVAL); - return SIG_ERR; + __set_errno (EINVAL); + return SIG_ERR; } - act.sa_handler = handler; - if (__sigemptyset (&act.sa_mask) < 0) - return SIG_ERR; - act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; - act.sa_flags &= ~SA_RESTART; - if (sigaction (sig, &act, &oact) < 0) - return SIG_ERR; + act.sa_handler = handler; + if (__sigemptyset (&act.sa_mask) < 0) + return SIG_ERR; + act.sa_flags = SA_ONESHOT | SA_NOMASK | SA_INTERRUPT; + act.sa_flags &= ~SA_RESTART; + if (sigaction (sig, &act, &oact) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } + weak_alias (__sysv_signal, sysv_signal) -- cgit v1.2.3