From 8df5860848485426bb1d08021d562049350bafeb Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Wed, 28 Nov 2007 10:06:31 +0000 Subject: Use a more generic BSD define. --- src/librc-daemon.c | 10 +++++----- src/librc.c | 1 - src/librc.h | 1 + src/rc-misc.h | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/librc-daemon.c b/src/librc-daemon.c index d5c2ffdb..e7e66b92 100644 --- a/src/librc-daemon.c +++ b/src/librc-daemon.c @@ -172,8 +172,7 @@ pid_t *rc_find_pids (const char *exec, const char *cmd, } librc_hidden_def(rc_find_pids) -#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ - defined(__NetBSD__) || defined(__OpenBSD__) +#elif BSD # if defined(__DragonFly__) || defined(__FreeBSD__) # ifndef KERN_PROC_PROC @@ -185,6 +184,7 @@ librc_hidden_def(rc_find_pids) # define _GET_KINFO_COMM(kp) (kp.ki_comm) # define _GET_KINFO_PID(kp) (kp.ki_pid) # else +# define _KVM_GETPROC2 # define _KINFO_PROC kinfo_proc2 # define _KVM_GETARGV kvm_getargv2 # define _GET_KINFO_UID(kp) (kp.p_ruid) @@ -211,11 +211,11 @@ pid_t *rc_find_pids (const char *exec, const char *cmd, return (NULL); } -#if defined(__DragonFly__) || defined( __FreeBSD__) - kp = kvm_getprocs (kd, KERN_PROC_PROC, 0, &processes); -#else +#ifdef _KVM_GETPROC2 kp = kvm_getproc2 (kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), &processes); +#else + kp = kvm_getprocs (kd, KERN_PROC_PROC, 0, &processes); #endif for (i = 0; i < processes; i++) { pid_t p = _GET_KINFO_PID (kp[i]); diff --git a/src/librc.c b/src/librc.c index da443b77..0fdf6e09 100644 --- a/src/librc.c +++ b/src/librc.c @@ -72,7 +72,6 @@ static const rc_service_state_name_t rc_service_state_names[] = { { 0, NULL} }; - #define LS_INITD 0x01 #define LS_DIR 0x02 static char **ls_dir (const char *dir, int options) diff --git a/src/librc.h b/src/librc.h index 370a1266..de035fd0 100644 --- a/src/librc.h +++ b/src/librc.h @@ -35,6 +35,7 @@ #define _IN_LIBRC +#include #include #include #include diff --git a/src/rc-misc.h b/src/rc-misc.h index 7e69f451..040cc116 100644 --- a/src/rc-misc.h +++ b/src/rc-misc.h @@ -35,6 +35,7 @@ #include #include +#include #ifndef LIB # define LIB "lib" -- cgit v1.2.3