From 2091b38022112e2a6f844554afe5a282078ad58b Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 19 Jan 2013 13:42:36 +0100 Subject: [PATCH] hotplugd(8): Remove some compat defines and add comments about it. --- usr.sbin/hotplugd/compat.h | 15 --------------- usr.sbin/hotplugd/hotplugd.c | 21 ++++++++------------- 2 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 usr.sbin/hotplugd/compat.h diff --git a/usr.sbin/hotplugd/compat.h b/usr.sbin/hotplugd/compat.h deleted file mode 100644 index a497a784b0..0000000000 --- a/usr.sbin/hotplugd/compat.h +++ /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 diff --git a/usr.sbin/hotplugd/hotplugd.c b/usr.sbin/hotplugd/hotplugd.c index ae56849bd7..5574388ed5 100644 --- a/usr.sbin/hotplugd/hotplugd.c +++ b/usr.sbin/hotplugd/hotplugd.c @@ -35,7 +35,6 @@ #include #include #include -#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); -- 2.41.0