Date: Sat, 23 Apr 2005 22:13:38 GMT From: Bill Middleton <flashdict@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/80293: sysconf() does not support well-defined unistd values Message-ID: <200504232213.j3NMDcBL026587@www.freebsd.org> Resent-Message-ID: <200504232220.j3NMKHj5020634@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 80293
>Category: misc
>Synopsis: sysconf() does not support well-defined unistd values
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Apr 23 22:20:17 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Bill Middleton
>Release: CURRENT
>Organization:
>Environment:
FreeBSD my.hostname.com 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Wed Apr 6 02:41:00 CEST 2005
>Description:
Calling sysconf() on an defined value, including _SC_GETGR_R_SIZE_MAX, is supposed to return -1 and not set errno(), if I understand the man page correctly. However, in CURRENT, errno is set to "Invalid argument", even though the value is defined in unistd.h.
>How-To-Repeat:
The following C snippet will print:
Errno is currently Unknown error: 0
_SC_GETGR_R_SIZE_MAX is
Errno is now Invalid argument
Arguably, errno should not have been set?
#include <unistd.h>
#include <sys/errno.h>
int
main(int argc, char **argv)
{
long fbufsize;
printf("Errno is currently %s\n", strerror(errno));
printf("_SC_GETGR_R_SIZE_MAX is %l\n",_SC_GETGR_R_SIZE_MAX);
fbufsize = sysconf (_SC_GETGR_R_SIZE_MAX);
printf("Errno is now %s\n", strerror(errno));
}
>Fix:
Make sysconf() support all values defined in unistd.h, or don't define them, perhaps.
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504232213.j3NMDcBL026587>
