Use a more generic BSD define.

This commit is contained in:
Roy Marples 2007-11-28 10:06:31 +00:00
parent 97f707db0d
commit 8df5860848
4 changed files with 7 additions and 6 deletions

View File

@ -172,8 +172,7 @@ pid_t *rc_find_pids (const char *exec, const char *cmd,
} }
librc_hidden_def(rc_find_pids) librc_hidden_def(rc_find_pids)
#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ #elif BSD
defined(__NetBSD__) || defined(__OpenBSD__)
# if defined(__DragonFly__) || defined(__FreeBSD__) # if defined(__DragonFly__) || defined(__FreeBSD__)
# ifndef KERN_PROC_PROC # 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_COMM(kp) (kp.ki_comm)
# define _GET_KINFO_PID(kp) (kp.ki_pid) # define _GET_KINFO_PID(kp) (kp.ki_pid)
# else # else
# define _KVM_GETPROC2
# define _KINFO_PROC kinfo_proc2 # define _KINFO_PROC kinfo_proc2
# define _KVM_GETARGV kvm_getargv2 # define _KVM_GETARGV kvm_getargv2
# define _GET_KINFO_UID(kp) (kp.p_ruid) # 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); return (NULL);
} }
#if defined(__DragonFly__) || defined( __FreeBSD__) #ifdef _KVM_GETPROC2
kp = kvm_getprocs (kd, KERN_PROC_PROC, 0, &processes);
#else
kp = kvm_getproc2 (kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2), kp = kvm_getproc2 (kd, KERN_PROC_ALL, 0, sizeof(struct kinfo_proc2),
&processes); &processes);
#else
kp = kvm_getprocs (kd, KERN_PROC_PROC, 0, &processes);
#endif #endif
for (i = 0; i < processes; i++) { for (i = 0; i < processes; i++) {
pid_t p = _GET_KINFO_PID (kp[i]); pid_t p = _GET_KINFO_PID (kp[i]);

View File

@ -72,7 +72,6 @@ static const rc_service_state_name_t rc_service_state_names[] = {
{ 0, NULL} { 0, NULL}
}; };
#define LS_INITD 0x01 #define LS_INITD 0x01
#define LS_DIR 0x02 #define LS_DIR 0x02
static char **ls_dir (const char *dir, int options) static char **ls_dir (const char *dir, int options)

View File

@ -35,6 +35,7 @@
#define _IN_LIBRC #define _IN_LIBRC
#include <sys/param.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>

View File

@ -35,6 +35,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include <stdbool.h>
#ifndef LIB #ifndef LIB
# define LIB "lib" # define LIB "lib"