Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Oct 1998 03:58:58 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        committers@FreeBSD.ORG, finrod@ewox.org, hackers@FreeBSD.ORG
Subject:   Re: sysctl
Message-ID:  <199810291658.DAA22379@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>While fixing a sysctl-related bug in arp, I noticed that sysctl(3) is
>kinda fubar. According to the man page, it either returns 0, or
>returns -1 and sets errno. However, reading src/lib/libc/gen/sysctl.c
>and src/sys/kern/kern_sysctl.c reveals that the sysctl syscall returns
>the error code directly, and the sysctl library function does a little
>of both. The "fix" I did to src/lib/libkvm/kvm_proc.c depends on

I think you need to read the code again.  All syscall functions in
in the kernel (at the level of sysent[]) return the error code directly.  
Normal return values are returned indirectly in p->p_retval[].

>sysctl(3) acting in accordance to the man page, which it doesn't (it
>returns ENOMEM instead of setting errno to ENOMEM and returning -1).
>
>Should sysctl(3) be fixed to act as documented, or should the man page

It already does, at least for the call near your fix in kvm_proc.c.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810291658.DAA22379>