[git commit future] signal: cleanup, include only headers that are needed

Peter S. Mazinger ps.m at gmx.net
Thu Apr 14 07:59:26 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=b86ba6e879397217b3f52373dbaa5a26eccc0b30
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 include/signal.h          |    2 +-
 libc/signal/allocrtsig.c  |    1 -
 libc/signal/killpg.c      |    1 -
 libc/signal/raise.c       |    2 --
 libc/signal/sigaction.c   |    8 +++-----
 libc/signal/sigaddset.c   |    5 ++++-
 libc/signal/sigblock.c    |    1 -
 libc/signal/sigdelset.c   |    5 ++++-
 libc/signal/sigempty.c    |    7 +++++--
 libc/signal/sigfillset.c  |    9 +++++----
 libc/signal/siggetmask.c  |    1 -
 libc/signal/sighold.c     |    1 -
 libc/signal/sigignore.c   |    4 +---
 libc/signal/sigintr.c     |    8 ++++----
 libc/signal/sigismem.c    |    5 ++++-
 libc/signal/sigjmp.c      |    2 +-
 libc/signal/signal.c      |    2 +-
 libc/signal/sigpause.c    |    3 ++-
 libc/signal/sigrelse.c    |    1 -
 libc/signal/sigset.c      |    3 +--
 libc/signal/sigsetmask.c  |    1 -
 libc/signal/sigsetops.h   |   33 ---------------------------------
 libc/signal/sigwait.c     |    8 +++++---
 libc/signal/sysv_signal.c |    2 --
 24 files changed, 41 insertions(+), 74 deletions(-)
 delete mode 100644 libc/signal/sigsetops.h

diff --git a/include/signal.h b/include/signal.h
index 2924c7e..455cd84 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -258,7 +258,6 @@ extern int sigemptyset (sigset_t *__set) __THROW __nonnull ((1));
 
 /* Set all signals in SET.  */
 extern int sigfillset (sigset_t *__set) __THROW __nonnull ((1));
-libc_hidden_proto(sigfillset)
 
 /* Add SIGNO to SET.  */
 extern int sigaddset (sigset_t *__set, int __signo) __THROW __nonnull ((1));
@@ -483,6 +482,7 @@ extern int __libc_current_sigrtmin (void) __THROW;
 extern int __libc_current_sigrtmax (void) __THROW;
 
 #ifdef _LIBC
+extern sigset_t _sigintr attribute_hidden;
 /* simplified version without parameter checking */
 # include <string.h>
 # undef __sigemptyset
diff --git a/libc/signal/allocrtsig.c b/libc/signal/allocrtsig.c
index 05f3d6c..2b2098f 100644
--- a/libc/signal/allocrtsig.c
+++ b/libc/signal/allocrtsig.c
@@ -20,7 +20,6 @@
 
 #include <features.h>
 #include <signal.h>
-#include <sys/types.h>
 #include <sys/syscall.h>
 
 /* Only enable rt signals when it is supported at compile time */
diff --git a/libc/signal/killpg.c b/libc/signal/killpg.c
index c2dc713..73f48ec 100644
--- a/libc/signal/killpg.c
+++ b/libc/signal/killpg.c
@@ -19,7 +19,6 @@
 #include <errno.h>
 #include <signal.h>
 
-
 /* 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.  */
diff --git a/libc/signal/raise.c b/libc/signal/raise.c
index aed9b46..d9dbab6 100644
--- a/libc/signal/raise.c
+++ b/libc/signal/raise.c
@@ -3,9 +3,7 @@
  */
 
 #include <unistd.h>
-#include <string.h>
 #include <signal.h>
-#include <sys/types.h>
 
 int raise(int signo)
 {
diff --git a/libc/signal/sigaction.c b/libc/signal/sigaction.c
index 7a31e06..9630df7 100644
--- a/libc/signal/sigaction.c
+++ b/libc/signal/sigaction.c
@@ -16,14 +16,9 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
-#include <errno.h>
 #include <signal.h>
-#include <string.h>
 #include <sys/syscall.h>
 
-#include <bits/kernel_sigaction.h>
-
 #if defined __NR_rt_sigaction
 
 /* If ACT is not NULL, change the action for SIG to *ACT.
@@ -42,6 +37,9 @@ __libc_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
 }
 
 #else
+# define __need_NULL
+# include <stddef.h>
+# include <bits/kernel_sigaction.h>
 
 /* 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.  */
diff --git a/libc/signal/sigaddset.c b/libc/signal/sigaddset.c
index 7577d37..94fcc80 100644
--- a/libc/signal/sigaddset.c
+++ b/libc/signal/sigaddset.c
@@ -16,7 +16,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "sigsetops.h"
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
 
 /* Add SIGNO to SET.  */
 int
diff --git a/libc/signal/sigblock.c b/libc/signal/sigblock.c
index ad3acb0..c3ce363 100644
--- a/libc/signal/sigblock.c
+++ b/libc/signal/sigblock.c
@@ -17,7 +17,6 @@
    02111-1307 USA.  */
 
 #define __UCLIBC_HIDE_DEPRECATED__
-#include <errno.h>
 #include <signal.h>
 
 #include "sigset-cvt-mask.h"
diff --git a/libc/signal/sigdelset.c b/libc/signal/sigdelset.c
index ff30303..9262b1a 100644
--- a/libc/signal/sigdelset.c
+++ b/libc/signal/sigdelset.c
@@ -16,7 +16,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "sigsetops.h"
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
 
 /* Add SIGNO to SET.  */
 int sigdelset (sigset_t *set, int signo)
diff --git a/libc/signal/sigempty.c b/libc/signal/sigempty.c
index 2622c08..adbded6 100644
--- a/libc/signal/sigempty.c
+++ b/libc/signal/sigempty.c
@@ -16,9 +16,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <errno.h>
 #include <signal.h>
-#include <string.h>
+#if 0
+#define __need_NULL
+#include <stddef.h>
+#include <errno.h>
+#endif
 
 /* Clear all signals from SET.  */
 int sigemptyset (sigset_t *set)
diff --git a/libc/signal/sigfillset.c b/libc/signal/sigfillset.c
index 951e76b..ef60f10 100644
--- a/libc/signal/sigfillset.c
+++ b/libc/signal/sigfillset.c
@@ -16,10 +16,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <errno.h>
 #include <signal.h>
-#include <string.h>
-
+#if 0
+#define __need_NULL
+#include <stddef.h>
+#include <errno.h>
+#endif
 
 /* Set all signals in SET.  */
 int
@@ -46,4 +48,3 @@ sigfillset (sigset_t *set)
 
   return 0;
 }
-libc_hidden_def(sigfillset)
diff --git a/libc/signal/siggetmask.c b/libc/signal/siggetmask.c
index 3992a7a..833de96 100644
--- a/libc/signal/siggetmask.c
+++ b/libc/signal/siggetmask.c
@@ -20,7 +20,6 @@
 #define __UCLIBC_HIDE_DEPRECATED__
 #include <signal.h>
 
-
 int
 siggetmask (void)
 {
diff --git a/libc/signal/sighold.c b/libc/signal/sighold.c
index 6a2e718..2b1ecd1 100644
--- a/libc/signal/sighold.c
+++ b/libc/signal/sighold.c
@@ -22,7 +22,6 @@
 #include <stddef.h>
 #include <signal.h>
 
-
 int sighold (int sig)
 {
   sigset_t set;
diff --git a/libc/signal/sigignore.c b/libc/signal/sigignore.c
index a74c105..984fd85 100644
--- a/libc/signal/sigignore.c
+++ b/libc/signal/sigignore.c
@@ -18,12 +18,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <errno.h>
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
-#include <string.h>	/* For the real memset prototype.  */
-
+#include <string.h>
 
 int sigignore (int sig)
 {
diff --git a/libc/signal/sigintr.c b/libc/signal/sigintr.c
index 10567e9..210d493 100644
--- a/libc/signal/sigintr.c
+++ b/libc/signal/sigintr.c
@@ -16,16 +16,16 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <stddef.h>
 #include <signal.h>
-#include <errno.h>
-
 
 /* 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.  */
 #ifdef SA_RESTART
-extern sigset_t _sigintr attribute_hidden;	/* Defined in signal.c.  */
+# define __need_NULL
+# include <stddef.h>
+#else
+# include <errno.h>
 #endif
 
 int siginterrupt (int sig, int interrupt)
diff --git a/libc/signal/sigismem.c b/libc/signal/sigismem.c
index b546f62..334a06f 100644
--- a/libc/signal/sigismem.c
+++ b/libc/signal/sigismem.c
@@ -16,7 +16,10 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include "sigsetops.h"
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+#include <errno.h>
 
 /* Return 1 if SIGNO is in SET, 0 if not.  */
 int sigismember (const sigset_t *set, int signo)
diff --git a/libc/signal/sigjmp.c b/libc/signal/sigjmp.c
index a96d662..cf2be68 100644
--- a/libc/signal/sigjmp.c
+++ b/libc/signal/sigjmp.c
@@ -16,11 +16,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#define __need_NULL
 #include <stddef.h>
 #include <setjmp.h>
 #include <signal.h>
 
-
 /* This function is called by the `sigsetjmp' macro
    before doing a `__setjmp' on ENV[0].__jmpbuf.
    Always return zero.  */
diff --git a/libc/signal/signal.c b/libc/signal/signal.c
index 644617c..d82e421 100644
--- a/libc/signal/signal.c
+++ b/libc/signal/signal.c
@@ -22,7 +22,7 @@
 #include <signal.h>
 #include <string.h>	/* For the real memset prototype.  */
 
-sigset_t _sigintr attribute_hidden;		/* Set by siginterrupt.  */
+sigset_t _sigintr;	/* Set by siginterrupt.  */
 
 /* Set the handler for the signal SIG to HANDLER,
    returning the old handler, or SIG_ERR on error.  */
diff --git a/libc/signal/sigpause.c b/libc/signal/sigpause.c
index 0856ba2..e773b3c 100644
--- a/libc/signal/sigpause.c
+++ b/libc/signal/sigpause.c
@@ -22,7 +22,8 @@
 #include <errno.h>
 #define __FAVOR_BSD
 #include <signal.h>
-#include <stddef.h>		/* For NULL.  */
+#define __need_NULL
+#include <stddef.h>
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
 #include <sysdep-cancel.h>
 #endif
diff --git a/libc/signal/sigrelse.c b/libc/signal/sigrelse.c
index 07e7fdd..b513648 100644
--- a/libc/signal/sigrelse.c
+++ b/libc/signal/sigrelse.c
@@ -22,7 +22,6 @@
 #include <stddef.h>
 #include <signal.h>
 
-
 int sigrelse (int sig)
 {
   sigset_t set;
diff --git a/libc/signal/sigset.c b/libc/signal/sigset.c
index b91ce80..3b162df 100644
--- a/libc/signal/sigset.c
+++ b/libc/signal/sigset.c
@@ -20,8 +20,7 @@
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
-#include <string.h>	/* For the real memset prototype.  */
-
+#include <string.h>
 
 /* Set the disposition for SIG.  */
 __sighandler_t sigset (int sig, __sighandler_t disp)
diff --git a/libc/signal/sigsetmask.c b/libc/signal/sigsetmask.c
index 64c8ad6..0a73179 100644
--- a/libc/signal/sigsetmask.c
+++ b/libc/signal/sigsetmask.c
@@ -17,7 +17,6 @@
    02111-1307 USA.  */
 
 #define __UCLIBC_HIDE_DEPRECATED__
-#include <errno.h>
 #include <signal.h>
 
 #include "sigset-cvt-mask.h"
diff --git a/libc/signal/sigsetops.h b/libc/signal/sigsetops.h
deleted file mode 100644
index 52081c2..0000000
--- a/libc/signal/sigsetops.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 1991, 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.
-
-   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 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 <errno.h>
-#include <signal.h>
-#include <string.h>
-
-#define	BITS		(_NSIG - 1)
-#define	ELT(signo)	(((signo) - 1) / BITS)
-#define	MASK(signo)	(1 << (((signo) - 1) % BITS))
-
-#undef	sigemptyset
-#undef	sigfillset
-#undef	sigaddset
-#undef	sigdelset
-#undef	sigismember
diff --git a/libc/signal/sigwait.c b/libc/signal/sigwait.c
index 634a18d..5e9c427 100644
--- a/libc/signal/sigwait.c
+++ b/libc/signal/sigwait.c
@@ -19,15 +19,15 @@
  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  * 02111-1307 USA.  */
 
-#include <errno.h>
+#define __need_NULL
+#include <stddef.h>
 #include <signal.h>
-#include <string.h>
-#include <unistd.h>
 
 #ifdef __UCLIBC_HAS_THREADS_NATIVE__
 # include <sysdep-cancel.h>
 
 # ifdef __NR_rt_sigtimedwait
+#  include <string.h>
 
 /* Return any pending signal or wait for one for the given time.  */
 static int do_sigwait(const sigset_t *set, int *sig)
@@ -104,6 +104,8 @@ int sigwait (const sigset_t *set, int *sig)
 }
 
 # else /* __UCLIBC_HAS_REALTIME__ */
+# include <errno.h>
+# include <unistd.h>	/* smallint */
 /* variant without REALTIME extensions */
 
 static smallint was_sig; /* obviously not thread-safe */
diff --git a/libc/signal/sysv_signal.c b/libc/signal/sysv_signal.c
index a696a54..65d8190 100644
--- a/libc/signal/sysv_signal.c
+++ b/libc/signal/sysv_signal.c
@@ -18,8 +18,6 @@
 
 #include <errno.h>
 #include <signal.h>
-#include <string.h>	/* For the real memset prototype.  */
-
 
 /* Tolerate non-threads versions of Posix */
 #ifndef SA_ONESHOT
-- 
1.7.3.4



More information about the uClibc-cvs mailing list