[ovs-dev] [PATCH 2/2] signals: Remove unused functions.

Gurucharan Shetty shettyg at nicira.com
Thu Feb 20 23:17:16 UTC 2014


Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 lib/signals.c |   69 ---------------------------------------------------------
 lib/signals.h |    7 ------
 2 files changed, 76 deletions(-)

diff --git a/lib/signals.c b/lib/signals.c
index 27da5d6..85e5c79 100644
--- a/lib/signals.c
+++ b/lib/signals.c
@@ -39,66 +39,6 @@ VLOG_DEFINE_THIS_MODULE(signals);
 #define N_SIGNALS 32
 #endif
 
-struct signal {
-    int fds[2];
-};
-
-static struct signal signals[N_SIGNALS];
-
-static void signal_handler(int signr);
-
-/* Sets up a handler for 'signr' and returns a structure that represents it.
- *
- * Only one handler for a given signal may be registered. */
-struct signal *
-signal_register(int signr)
-{
-    struct sigaction sa;
-    struct signal *s;
-
-    ovs_assert(signr >= 1 && signr < N_SIGNALS);
-
-    /* Create a pipe. */
-    s = &signals[signr];
-    ovs_assert(!s->fds[0] && !s->fds[1]);
-    xpipe_nonblocking(s->fds);
-
-    /* Install signal handler. */
-    memset(&sa, 0, sizeof sa);
-    sa.sa_handler = signal_handler;
-    sigemptyset(&sa.sa_mask);
-    sa.sa_flags = SA_RESTART;
-    xsigaction(signr, &sa, NULL);
-
-    return s;
-}
-
-/* Returns true if signal 's' has been received since the last call to this
- * function with argument 's'. */
-bool
-signal_poll(struct signal *s)
-{
-    char buf[_POSIX_PIPE_BUF];
-
-    return read(s->fds[0], buf, sizeof buf) > 0;
-}
-
-/* Causes the next call to poll_block() to wake up when signal_poll(s) would
- * return true. */
-void
-signal_wait(struct signal *s)
-{
-    poll_fd_wait(s->fds[0], POLLIN);
-}
-
-static void
-signal_handler(int signr)
-{
-    if (signr >= 1 && signr < N_SIGNALS) {
-        ignore(write(signals[signr].fds[1], "", 1));
-    }
-}
-
 /* Returns the name of signal 'signum' as a string.  The return value is either
  * a statically allocated constant string or the 'bufsize'-byte buffer
  * 'namebuf'.  'bufsize' should be at least SIGNAL_NAME_BUFSIZE.
@@ -133,12 +73,3 @@ xsigaction(int signum, const struct sigaction *new, struct sigaction *old)
                    ovs_strerror(errno));
     }
 }
-
-void
-xpthread_sigmask(int how, const sigset_t *new, sigset_t *old)
-{
-    int error = pthread_sigmask(how, new, old);
-    if (error) {
-        VLOG_FATAL("pthread_sigmask failed (%s)", ovs_strerror(error));
-    }
-}
diff --git a/lib/signals.h b/lib/signals.h
index 3294293..3ef1b5b 100644
--- a/lib/signals.h
+++ b/lib/signals.h
@@ -18,18 +18,11 @@
 #define SIGNALS_H 1
 
 #include <signal.h>
-#include <stdbool.h>
-#include <stddef.h>
 #include "type-props.h"
 
-struct signal *signal_register(int signr);
-bool signal_poll(struct signal *);
-void signal_wait(struct signal *);
-
 enum { SIGNAL_NAME_BUFSIZE = 7 + INT_STRLEN(int) + 1 };
 const char *signal_name(int signum, char *namebuf, size_t bufsize);
 
 void xsigaction(int signum, const struct sigaction *, struct sigaction *old);
-void xpthread_sigmask(int how, const sigset_t *, sigset_t *old);
 
 #endif /* signals.h */
-- 
1.7.9.5




More information about the dev mailing list