udhcpd: reduce stack usage by ~700 bytes. +28 bytes code size
[oweals/busybox.git] / networking / udhcp / signalpipe.c
index 1486b3b2dba2b7154712a7d74b513ff931966532..6355c5e90208b5c5f7b70ba74d20bcfd1b510dd5 100644 (file)
@@ -1,6 +1,5 @@
 /* vi: set sw=4 ts=4: */
-/* signalpipe.c
- *
+/*
  * Signal pipe infrastructure. A reliable way of delivering signals.
  *
  * Russ Dill <Russ.Dill@asu.edu> December 2003
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-
 #include "common.h"
 
-
+/* Global variable: we access it from signal handler */
 static struct fd_pair signal_pipe;
 
 static void signal_handler(int sig)
 {
        unsigned char ch = sig; /* use char, avoid dealing with partial writes */
        if (write(signal_pipe.wr, &ch, 1) != 1)
-               bb_perror_msg("cannot send signal");
+               bb_perror_msg("can't send signal");
 }
 
-
 /* Call this before doing anything else. Sets up the socket pair
  * and installs the signal handler */
-void udhcp_sp_setup(void)
+void FAST_FUNC udhcp_sp_setup(void)
 {
        /* was socketpair, but it needs AF_UNIX in kernel */
        xpiped_pair(signal_pipe);
@@ -49,11 +46,10 @@ void udhcp_sp_setup(void)
                , signal_handler);
 }
 
-
 /* Quick little function to setup the rfds. Will return the
  * max_fd for use with select. Limited in that you can only pass
  * one extra fd */
-int udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
+int FAST_FUNC udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
 {
        FD_ZERO(rfds);
        FD_SET(signal_pipe.rd, rfds);
@@ -64,11 +60,10 @@ int udhcp_sp_fd_set(fd_set *rfds, int extra_fd)
        return signal_pipe.rd > extra_fd ? signal_pipe.rd : extra_fd;
 }
 
-
 /* Read a signal from the signal pipe. Returns 0 if there is
  * no signal, -1 on error (and sets errno appropriately), and
  * your signal on success */
-int udhcp_sp_read(const fd_set *rfds)
+int FAST_FUNC udhcp_sp_read(const fd_set *rfds)
 {
        unsigned char sig;