Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2001 11:28:12 +0100 (CET)
From:      Hartmut Brandt <brandt@fokus.gmd.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   docs/32793: Wrong error named in sysctl man page
Message-ID:  <200112131028.fBDASCi51711@fokus.gmd.de>

next in thread | raw e-mail | index | archive | help

>Number:         32793
>Category:       docs
>Synopsis:       Wrong error named in sysctl man page
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 13 02:30:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hartmut Brandt
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Fhg Fokus
>Environment:
System: FreeBSD beagle.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Mon Dec 10 11:29:08 CET 2001 hbb@beagle.fokus.gmd.de:/opt/obj/usr/src/sys/BEAGLE i386


	
>Description:
	The sysctl.3 man page describes sysctl() returning EOPNOTSUPP
	in the case the named variable is not found. This is obviously wrong
	because sysctl() returns ENOENT. There is only one instance of
	EOPNOTSUPP in kern_sysctl.c and this is for the BSDI 1.0 getkerninfo.
>How-To-Repeat:
	Compile and run the following test program which tries to access an
	non-existing variable. See it printing an errno of 2 (ENOENT).

#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <net/if.h>
#include <net/if_mib.h>

int
main(int argc, char *argv[])
{
	u_int ifnum;
	int name[6];
	size_t len = sizeof(ifnum);

	name[0] = CTL_NET;
	name[1] = PF_LINK;
	name[2] = NETLINK_GENERIC;
	name[3] = IFMIB_SYSTEM;
	name[4] = 17;

	if (sysctl(name, 5, &ifnum, &len, NULL, 0) == -1)
		err(1, "sysctl %d", errno);

	return (0);
}
>Fix:
	Patch for /usr/src/lib/libc/gen/sysctl.3:
Index: sysctl.3
===================================================================
RCS file: /usr/ncvs/src/lib/libc/gen/sysctl.3,v
retrieving revision 1.51
diff -r1.51 sysctl.3
452c452
< .Er EOPNOTSUPP .
---
> .Er ENOENT .
790c790
< .It Bq Er EOPNOTSUPP
---
> .It Bq Er ENOENT


>Release-Note:
>Audit-Trail:
>Unformatted:

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




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