aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-28 10:06:31 +0000
committerRoy Marples <roy@marples.name>2007-11-28 10:06:31 +0000
commit8df5860848485426bb1d08021d562049350bafeb (patch)
tree356480f83c56ce1766e8a700a85470fff746dd07
parent97f707db0d42e816b90bcd0a3dee25a197ae5ac0 (diff)
Use a more generic BSD define.
-rw-r--r--src/librc-daemon.c10
-rw-r--r--src/librc.c1
-rw-r--r--src/librc.h1
-rw-r--r--src/rc-misc.h1
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 <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
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 <sys/stat.h>
#include <errno.h>
+#include <stdbool.h>
#ifndef LIB
# define LIB "lib"