On 17-Mar-01 David Malone wrote:
> On Fri, Mar 16, 2001 at 06:21:46PM -0800, Brooks Davis wrote:
>> Ah, you are correct.  I should have tried that.  What a strange bug.
> 
> It happens for any option which causes the sysctl to return no
> processes to libkvm. (Try ps -p 100000). I think the following
> patch should fix the problem.
> 
> (Kirk changed the way the struct proc size was checked, and the
> old way happened to work OK if no data was returned. Kirk, should
> I go ahead and commit this?)
> 
>       David.

I actually prefer the ESRCH patch as a) it better describes what happens and b)
it returns a proper error when no processes are found, making it easier for
other programs to detect this error condition.  Programs should already be
checking for a error return from the sysctlbyname() that they use to get this
(or else they allow for kvm to inform them of errors) and thus won't need to
add in special case checks for 'size > 0'.  errno is the standard way of
returning errors after all. :)

-- 

John Baldwin <[EMAIL PROTECTED]> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to