From a501cd747c2f34db196be4bfd60de36060f4d439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Sun, 12 Oct 2014 20:06:46 +0200 Subject: Fix process pid detection in tdefontinst on openbsd --- kcontrol/tdefontinst/tdefontinst/GetPid.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'kcontrol/tdefontinst') diff --git a/kcontrol/tdefontinst/tdefontinst/GetPid.c b/kcontrol/tdefontinst/tdefontinst/GetPid.c index 015ea7ce9..37aba65c3 100644 --- a/kcontrol/tdefontinst/tdefontinst/GetPid.c +++ b/kcontrol/tdefontinst/tdefontinst/GetPid.c @@ -55,6 +55,7 @@ Linux Tested on Linux 2.4 FreeBSD Tested on FreeBSD 5.1 by Brian Ledbetter NetBSD + OpenBSD Irix Solaris Tested on Solaris 8 x86 by Torsten Kasch HP-UX Tested on HP-UX B.11.11 U 9000/800 @@ -160,7 +161,7 @@ unsigned int kfi_getPid(const char *proc, unsigned int ppid) return error ? 0 : pid; } -#elif defined OS_FreeBSD || defined OS_NetBSD || defined __FreeBSD__ || defined __NetBSD__ || defined OS_Darwin +#elif defined OS_FreeBSD || defined OS_NetBSD || defined __FreeBSD__ || defined __NetBSD__ || defined OS_Darwin || defined OS_OpenBSD || defined __OpenBSD__ #include #include @@ -202,6 +203,8 @@ unsigned int kfi_getPid(const char *proc, unsigned int ppid) mib[3] = p[num].ki_pid; #elif defined(__DragonFly__) && __DragonFly_version >= 190000 mib[3] = p[num].kp_pid; +#elif defined(__OpenBSD__) + mib[3] = p[num].p_pid; #else mib[3] = p[num].kp_proc.p_pid; #endif @@ -225,14 +228,21 @@ unsigned int kfi_getPid(const char *proc, unsigned int ppid) pid=p[num].kp_pid; #else #if defined(__DragonFly__) - if(proc_p.kp_eproc.e_ppid==ppid && p[num].kp_thread.td_comm && 0==strcmp(p[num].kp_thread.td_comm, proc)) + if(proc_p.kp_eproc.e_ppid==ppid && p[num].kp_thread.td_comm && 0==strcmp(p[num].kp_thread.td_comm, proc)) +#elif defined(__OpenBSD__) + if(proc_p.p_ppid==ppid && p[num].p_comm && 0==strcmp(p[num].p_comm, proc)) #else if(proc_p.kp_eproc.e_ppid==ppid && p[num].kp_proc.p_comm && 0==strcmp(p[num].kp_proc.p_comm, proc)) #endif - if(pid) + if(pid) { error=true; - else + } else { +#if defined(__OpenBSD__) + pid=p[num].p_pid; +#else pid=p[num].kp_proc.p_pid; +#endif + } #endif } } -- cgit v1.2.1