From owner-freebsd-current Fri Oct 11 14:05:41 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA25401 for current-outgoing; Fri, 11 Oct 1996 14:05:41 -0700 (PDT) Received: from peedub.gj.org (newpc.muc.ditec.de [194.120.126.33]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA25392 for ; Fri, 11 Oct 1996 14:05:34 -0700 (PDT) Received: from peedub.gj.org (localhost [127.0.0.1]) by peedub.gj.org (8.7.6/8.6.9) with ESMTP id XAA06498; Fri, 11 Oct 1996 23:04:20 GMT Message-Id: <199610112304.XAA06498@peedub.gj.org> X-Mailer: exmh version 1.6.7 5/3/96 To: Poul-Henning Kamp cc: freebsd-current@freebsd.org Subject: Re: invalid return value from sysctl_kern_proc ? Reply-To: Gary Jennejohn In-reply-to: Your message of "Fri, 11 Oct 1996 20:36:14 +0200." <407.845058974@critter.tfs.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 11 Oct 1996 23:04:19 +0000 From: Gary Jennejohn Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Poul-Henning Kamp writes: >In message <199610111957.TAA05925@peedub.gj.org>, Gary Jennejohn writes: [cruft deleted] >>I ask because sysctl isn't returning an error when I try to get the proc >>struct for a non-existent process. Seems to me that it should. > >Well, it does, you don't get any data back. > >sysctl doesn't return error for things in the data domain it handles, >only errors about the handling. > thanks alot, Poul-Henning ! this means that this code from kvm_getprocs in libkvm is wrong. if (size % sizeof(struct kinfo_proc) != 0) { _kvm_err(kd, kd->program, "proc size mismatch (%d total, %d chunks)", size, sizeof(struct kinfo_proc)); return (0); } sysctl will set size = 0 if it can't find the requested data. This should probably read if (!size || size % sizeof(struct kinfo_proc) != 0) { ^^^^^^^ I used the code from libkvm, which didn't work as I expected it to. --- Gary Jennejohn Home - Gary.Jennejohn@munich.netsurf.de Work - gjennejohn@frt.dec.com