chiark / gitweb /
[PATCH] make udevsend binary even smaller
[elogind.git] / udevsend.c
index 6ffd68c1b740b99014f49056f05c9b90bf894af6..d3c74dd46a4e9f5b9248759b2a711888585e2222 100644 (file)
  */
 
 #include <sys/types.h>
  */
 
 #include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
+#include <sys/socket.h>
+#include <sys/wait.h>
+#include <sys/un.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
-#include <wait.h>
-#include <sys/socket.h>
-#include <sys/un.h>
 
 #include "udev.h"
 #include "udev_version.h"
 #include "udevd.h"
 #include "logging.h"
 
 
 #include "udev.h"
 #include "udev_version.h"
 #include "udevd.h"
 #include "logging.h"
 
+unsigned char logname[42];
 
 static inline char *get_action(void)
 {
 
 static inline char *get_action(void)
 {
@@ -126,6 +125,10 @@ int main(int argc, char* argv[])
        int sock;
        struct sockaddr_un saddr;
 
        int sock;
        struct sockaddr_un saddr;
 
+#ifdef DEBUG
+       init_logging("udevsend");
+#endif
+
        subsystem = argv[1];
        if (subsystem == NULL) {
                dbg("no subsystem");
        subsystem = argv[1];
        if (subsystem == NULL) {
                dbg("no subsystem");
@@ -159,10 +162,10 @@ int main(int argc, char* argv[])
 
        memset(&saddr, 0x00, sizeof(saddr));
        saddr.sun_family = AF_LOCAL;
 
        memset(&saddr, 0x00, sizeof(saddr));
        saddr.sun_family = AF_LOCAL;
-       strcpy(saddr.sun_path, UDEVD_SOCKET);
+       strcpy(saddr.sun_path, UDEVD_SOCK);
 
        /* try to connect, if it fails start daemon */
 
        /* try to connect, if it fails start daemon */
-       retval = connect(sock, &saddr, sizeof(saddr));
+       retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr));
        if (retval != -1) {
                goto send;
        } else {
        if (retval != -1) {
                goto send;
        } else {
@@ -181,7 +184,7 @@ int main(int argc, char* argv[])
        tspec.tv_nsec = 100000000;  /* 100 millisec */
        loop = UDEVSEND_CONNECT_RETRY;
        while (loop--) {
        tspec.tv_nsec = 100000000;  /* 100 millisec */
        loop = UDEVSEND_CONNECT_RETRY;
        while (loop--) {
-               retval = connect(sock, &saddr, sizeof(saddr));
+               retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr));
                if (retval != -1)
                        goto send;
                else
                if (retval != -1)
                        goto send;
                else