On 1/7/14, Guillem Jover <guil...@debian.org> wrote: > I think adding OSDragonflyBSD to previous preprocessor block for the > other BSD should be enough, the next one catching HAVE_KVM_H should > include the remaning header files.
It's a problematic because dfly disallows including sys/proc.h from userspace. >> +#elif defined (OSDragonflyBSD) >> +#define PROCESS_NAME_SIZE MAXCOMLEN >> #endif > > Just to know what's the portably safe minimum for callers to use, to > what does MAXCOMLEN expand? 16. But I think it's better to use system defined macro then "magic" constant. FreeBSD has MAXCOMLEN too. > I've got a patch to switch the FreeBSD code to use the KVM method, > unfortunately it seems to use ki_ namespaced struct members. > > Also the KVM method seems to be missing a proper do_procinit(), which > could be something like the following untested code, I had lying > around: > > ,--- > static enum status_code > do_procinit(void) > { > - /* Nothing to do. */ > - return status_unknown; > + kvm_t *kd; > + int nentries, i; > + struct kinfo_proc *kp; > + char errbuf[_POSIX2_LINE_MAX]; > + enum status_code prog_status = status_dead; > + > + kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf); > + if (kd == NULL) > + errx(1, "%s", errbuf); > + kp = kvm_getprocs(kd, KERN_PROC_PROC, 0, &nentries); > + if (kp == NULL) > + errx(1, "%s", kvm_geterr(kd)); > + > + for (i = 0; i < nentries; i++) { > + enum status_code pid_status; > + > + pid_status = pid_check(kp[i].ki_pid); > + if (pid_status < prog_status) > + prog_status = pid_status; > + } > + > + kvm_close(kd); > + > + return prog_status; > } > `--- > > For DragonFly BSD, you'll need to change ki_pid to kp_pid I guess. If > this works on DragonFly BSD, I'll commit that before applying your patch. It works, but with some more dfly specific tweaks (it uses KERN_PROC_ALL where other OSes uses KERN_PROC_PROC, and its kernel PIDs are less than 1). I'll send refreshed dfly patch after you apply patch for do_procinit. -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org