summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-04-05 05:24:22 +0200
committerGuillem Jover <guillem@debian.org>2014-04-21 16:54:28 +0200
commit559895751cb775e47e2f6466de10a55a5ee7587c (patch)
tree5b1ab56bb2a42de9ba82e8bf95abdf1681e7a96c /utils
parent02901d4027d0ac49a8a1f88e954da61ea3f625d2 (diff)
downloaddpkg-559895751cb775e47e2f6466de10a55a5ee7587c.tar.gz
s-s-d: Fix FreeBSD KVM code to use current kinfo_proc layout
Diffstat (limited to 'utils')
-rw-r--r--utils/start-stop-daemon.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c
index 559af58b4..d1d67e959 100644
--- a/utils/start-stop-daemon.c
+++ b/utils/start-stop-daemon.c
@@ -1293,11 +1293,17 @@ pid_is_user(pid_t pid, uid_t uid)
kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries);
if (kp == NULL)
errx(1, "%s", kvm_geterr(kd));
+
+#if defined(OSFreeBSD)
+ proc_uid = kp->ki_ruid;
+#else
if (kp->kp_proc.p_cred)
kvm_read(kd, (u_long)&(kp->kp_proc.p_cred->p_ruid),
&proc_uid, sizeof(uid_t));
else
return false;
+#endif
+
return (proc_uid == (uid_t)uid);
}
#endif
@@ -1370,7 +1376,13 @@ pid_is_cmd(pid_t pid, const char *name)
kp = kvm_getprocs(kd, KERN_PROC_PID, pid, &nentries);
if (kp == NULL)
errx(1, "%s", kvm_geterr(kd));
+
+#if defined(OSFreeBSD)
+ process_name = kp->ki_comm;
+#else
process_name = kp->kp_proc.p_comm;
+#endif
+
if (strlen(name) != strlen(process_name))
return false;
return (strcmp(name, process_name) == 0);
@@ -1538,7 +1550,11 @@ do_procinit(void)
enum status_code pid_status;
pid_t pid;
+#if defined(OSFreeBSD)
+ pid = kp[i].ki_pid;
+#else
pid = kp[i].kp_proc.p_pid;
+#endif
pid_status = pid_check(pid);
if (pid_status < prog_status)