misc/80293: sysconf() does not support well-defined unistd values

Bill Middleton flashdict at gmail.com
Sat Apr 23 15:20:18 PDT 2005


>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:


More information about the freebsd-bugs mailing list