hotplugd(8): Remove some compat defines and add comments about it.
authorSascha Wildner <saw@online.de>
Sat, 19 Jan 2013 12:42:36 +0000 (13:42 +0100)
committerSascha Wildner <saw@online.de>
Sat, 19 Jan 2013 23:08:36 +0000 (00:08 +0100)
usr.sbin/hotplugd/compat.h [deleted file]
usr.sbin/hotplugd/hotplugd.c

diff --git a/usr.sbin/hotplugd/compat.h b/usr.sbin/hotplugd/compat.h
deleted file mode 100644 (file)
index a497a78..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Used by reentrant functions */
-
-struct syslog_data {
-       int     log_file;
-       int     connected;
-       int     opened;
-       int     log_stat;
-       const char      *log_tag;
-       int     log_fac;
-       int     log_mask;
-};
-
-#define SYSLOG_DATA_INIT {-1, 0, 0, 0, (const char *)0, LOG_USER, 0xff}
-#define syslog_r(_a, _b, _c...) syslog(_a, _c)
-#define __dead __dead2
index ae56849..5574388 100644 (file)
@@ -35,7 +35,6 @@
 #include <syslog.h>
 #include <unistd.h>
 #include <devattr.h>
-#include "compat.h"
 
 #define _PATH_DEV_HOTPLUG              "/dev/hotplug"
 #define _PATH_ETC_HOTPLUG              "/etc/hotplug"
@@ -61,7 +60,7 @@ volatile sig_atomic_t quit = 0;
 void exec_script(const char *, int, const char *);
 void sigchild(int);
 void sigquit(int);
-__dead void usage(void);
+__dead2 void usage(void);
 
 int
 main(int argc, char *argv[])
@@ -209,34 +208,30 @@ exec_script(const char *file, int class, const char *name)
 void
 sigchild(int signum __unused)
 {
-       struct syslog_data sdata = SYSLOG_DATA_INIT;
        int saved_errno, status;
        pid_t pid;
 
        saved_errno = errno;
 
-       sdata.log_tag = _LOG_TAG;
-       sdata.log_fac = _LOG_FACILITY;
-       sdata.log_stat = _LOG_OPT;
-
        while ((pid = waitpid(WAIT_ANY, &status, WNOHANG)) != 0) {
                if (pid == -1) {
                        if (errno == EINTR)
                                continue;
                        if (errno != ECHILD)
-                               syslog_r(LOG_ERR, &sdata, "waitpid: %m");
+                               /* XXX syslog_r() */
+                               syslog(LOG_ERR, "waitpid: %m");
                        break;
                }
 
                if (WIFEXITED(status)) {
                        if (WEXITSTATUS(status) != 0) {
-                               syslog_r(LOG_NOTICE, &sdata,
-                                   "child exit status: %d",
+                               /* XXX syslog_r() */
+                               syslog(LOG_NOTICE, "child exit status: %d",
                                    WEXITSTATUS(status));
                        }
                } else {
-                       syslog_r(LOG_NOTICE, &sdata,
-                           "child is terminated abnormally");
+                       /* XXX syslog_r() */
+                       syslog(LOG_NOTICE, "child is terminated abnormally");
                }
        }
 
@@ -250,7 +245,7 @@ sigquit(int signum __unused)
        quit = 1;
 }
 
-__dead void
+__dead2 void
 usage(void)
 {
        fprintf(stderr, "usage: %s [-d device]\n", __progname);