Skip Menu |

This queue is for tickets about the Proc-ProcessTable CPAN distribution.

Report information
The Basics
Id: 77094
Status: resolved
Priority: 0/
Queue: Proc-ProcessTable

People
Owner: Nobody in particular
Requestors: wyant [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.45
Fixed in: (no value)



Subject: Compile fails under OpenBSD 5.1
Proc::ProcessTable 0.45 fails to compile under OpenBSD 5.1. I am no OpenBSD guru, but this appears to be because the obsolete kvm_getproc2() and kvm_getargv2() subroutines were removed in that release. Fortunately, kvm_getprocs() and kvm_getargv() exist, with the same functionality and signatures, so all that appears to be needed to get you going is an '#ifndef kinfo_proc2' in os/OpenBSD.c to fix things up. The attached patch does this, and also silences a cast warning. CAVEAT: my experience with OpenBSD does not go back further than 5.0, and the '#ifndef' trick was cribbed from the 5.0 kvm.h file. The patch works for me under 5.0 and 5.1, but I have no idea about other version.
Subject: Proc-ProcessTable-OpenBSD.patch
--- os/OpenBSD.old Thu May 25 15:14:05 2006 +++ os/OpenBSD.c Wed May 9 10:34:27 2012 @@ -24,6 +24,15 @@ #include <time.h> #include <unistd.h> +/* The following needed with OpenBSD 5.1. In 5.0 it was in sys/sysctl.h + * and kvm.h */ + +#ifndef kinfo_proc2 +#define kinfo_proc2 kinfo_proc +#define kvm_getproc2 kvm_getprocs +#define kvm_getargv2 kvm_getargv +#endif + /* No need for the procstat structure since we don't use /proc */ /* We need to pass in a cap for ignore, lower for store on object */ @@ -124,7 +133,7 @@ } /* arguments */ - cmndline[0] = NULL; + cmndline[0] = '\0'; pargv = kvm_getargv2(kd, (const struct kinfo_proc2 *) &(procs[i]), 0); if (pargv) { argcount = 0;
On Wed May 09 15:04:37 2012, WYANT wrote: Show quoted text
> Proc::ProcessTable 0.45 fails to compile under OpenBSD 5.1. I am no > OpenBSD guru, but this appears to be because the obsolete kvm_getproc2() > and kvm_getargv2() subroutines were removed in that release. > > Fortunately, kvm_getprocs() and kvm_getargv() exist, with the same > functionality and signatures, so all that appears to be needed to get > you going is an '#ifndef kinfo_proc2' in os/OpenBSD.c to fix things up. > The attached patch does this, and also silences a cast warning. > > CAVEAT: my experience with OpenBSD does not go back further than 5.0, > and the '#ifndef' trick was cribbed from the 5.0 kvm.h file. The patch > works for me under 5.0 and 5.1, but I have no idea about other version.
Hi Tom, it neither compiles on NetBSD nor it works well on recent FreeBSD's. I plan to refactor the entire module using my code which I patched into libstatgrab from http://www.i-scream.org/ - see the patched code either on http://www.netbsd.org/~sno/smart-snmpd/ or the "jens-mega-patch" branch on the newly created github repository as documented at i-scream. You can do me a real favour testing this libstatgrab code on all machines you have available and let me (probably cc'ing users@i-scream.org, too). To get this into a perl module, I need to finish a suitable EU::CB replacement/successor to be able to eliminate a lot of warnings from the code. Will need some time ... :( Best regards, Jens
fixed in 0.47