ipcs: code shrink
[oweals/busybox.git] / util-linux / uevent.c
index 514a9e934a943204d7df8d99d84def0d26d5be89..7ff866ceca059a9ab86b82d6bcaf1e96f986a695 100644 (file)
@@ -3,14 +3,13 @@
  *
  * Licensed under GPLv2, see file LICENSE in this source tree.
  */
-
 //config:config UEVENT
-//config:      bool "uevent"
+//config:      bool "uevent (3.2 kb)"
 //config:      default y
 //config:      select PLATFORM_LINUX
 //config:      help
-//config:        uevent is a netlink listener for kernel uevent notifications
-//config:        sent via netlink. It is usually used for dynamic device creation.
+//config:      uevent is a netlink listener for kernel uevent notifications
+//config:      sent via netlink. It is usually used for dynamic device creation.
 
 //applet:IF_UEVENT(APPLET(uevent, BB_DIR_SBIN, BB_SUID_DROP))
 
 //usage:   "\n""       # uevent mdev & mdev -s"
 
 #include "libbb.h"
+#include "common_bufsiz.h"
 #include <linux/netlink.h>
 
 #define BUFFER_SIZE 16*1024
 
-#define env ((char **)&bb_common_bufsiz1)
+#define env ((char **)bb_common_bufsiz1)
+#define INIT_G() do { setup_common_bufsiz(); } while (0)
 enum {
-       MAX_ENV = COMMON_BUFSIZE / sizeof(env[0]) - 1,
+       MAX_ENV = COMMON_BUFSIZE / sizeof(char*) - 1,
+       /* sizeof(env[0]) instead of sizeof(char*)
+        * makes gcc-6.3.0 emit "strict-aliasing" warning.
+        */
 };
 
 #ifndef SO_RCVBUFFORCE
@@ -45,6 +49,8 @@ int uevent_main(int argc UNUSED_PARAM, char **argv)
        struct sockaddr_nl sa;
        int fd;
 
+       INIT_G();
+
        argv++;
 
        // Subscribe for UEVENT kernel messages