Add support for missing _SC_* constants for sysconf().
From andy dot shevchenko at gmail dot com
This commit is contained in:
parent
4e69f53b47
commit
c331e46238
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: sysconf.3,v 1.33 2007/10/15 14:12:56 ad Exp $
|
||||
.\" $NetBSD: sysconf.3,v 1.34 2008/08/06 17:17:04 matt Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
|
@ -87,6 +87,8 @@ The number of clock ticks per second.
|
|||
.It Li _SC_FSYNC
|
||||
Return 1 if the File Synchronization Option is available on this system,
|
||||
otherwise \-1.
|
||||
.It Li _SC_HOST_NAME_MAX
|
||||
The maximum size of a hostname, including NULL.
|
||||
.It Li _SC_IOV_MAX
|
||||
The maximum number of
|
||||
.Va iovec
|
||||
|
@ -127,6 +129,8 @@ The maximum number of supplemental groups.
|
|||
The maximum number of open files per process.
|
||||
.It Li _SC_PAGESIZE
|
||||
The size of a system page in bytes.
|
||||
.It Li _SC_PASS_MAX
|
||||
The maximum length of the password, not counting NULL.
|
||||
.It Li _SC_READER_WRITER_LOCKS
|
||||
The version of
|
||||
.St -p1003.1
|
||||
|
@ -134,6 +138,10 @@ and its
|
|||
Read-Write Locks
|
||||
option to which the system attempts to conform,
|
||||
otherwise \-1.
|
||||
.It Li _SC_REGEXP
|
||||
Return 1 if
|
||||
.Tn POSIX
|
||||
regular expressions are available on this system, otherwise \-1.
|
||||
.It Li _SC_SEMAPHORES
|
||||
The version of
|
||||
.St -p1003.1
|
||||
|
@ -147,6 +155,10 @@ Semaphores
|
|||
option depends on the
|
||||
.Li P1003_1B_SEMAPHORE
|
||||
kernel option.
|
||||
.It Li _SC_SHELL
|
||||
Return 1 if
|
||||
.Tn POSIX
|
||||
shell is available on this system, otherwise \-1.
|
||||
.It Li _SC_SPIN_LOCKS
|
||||
The version of
|
||||
.St -p1003.1
|
||||
|
@ -157,6 +169,8 @@ otherwise \-1.
|
|||
.It Li _SC_STREAM_MAX
|
||||
The minimum maximum number of streams that a process may have open
|
||||
at any one time.
|
||||
.It Li _SC_SYMLOOP_MAX
|
||||
The maximum number of symbolic links that may be expanded in a path name.
|
||||
.It Li _SC_SYNCHRONIZED_IO
|
||||
Return 1 if the Synchronized I/O Option is available on this system,
|
||||
otherwise \-1.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sysconf.c,v 1.32 2008/06/25 11:46:12 ad Exp $ */
|
||||
/* $NetBSD: sysconf.c,v 1.33 2008/08/06 17:17:04 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: sysconf.c,v 1.32 2008/06/25 11:46:12 ad Exp $");
|
||||
__RCSID("$NetBSD: sysconf.c,v 1.33 2008/08/06 17:17:04 matt Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -52,6 +52,7 @@ __RCSID("$NetBSD: sysconf.c,v 1.32 2008/06/25 11:46:12 ad Exp $");
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <paths.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(sysconf,__sysconf)
|
||||
|
@ -336,13 +337,23 @@ sysconf(int name)
|
|||
case _SC_GETPW_R_SIZE_MAX:
|
||||
return _GETPW_R_SIZE_MAX;
|
||||
|
||||
/* Unsorted */
|
||||
case _SC_HOST_NAME_MAX:
|
||||
return MAXHOSTNAMELEN;
|
||||
case _SC_PASS_MAX:
|
||||
return _PASSWORD_LEN;
|
||||
case _SC_REGEXP:
|
||||
return _POSIX_REGEXP;
|
||||
case _SC_SHELL:
|
||||
return _POSIX_SHELL;
|
||||
case _SC_SYMLOOP_MAX:
|
||||
return MAXSYMLINKS;
|
||||
|
||||
yesno: if (sysctl(mib, mib_len, &value, &len, NULL, 0) == -1)
|
||||
return (-1);
|
||||
if (value == 0)
|
||||
return (-1);
|
||||
return (value);
|
||||
/*NOTREACHED*/
|
||||
break;
|
||||
|
||||
/* Extensions */
|
||||
case _SC_NPROCESSORS_CONF:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: unistd.h,v 1.43 2008/07/26 19:37:58 heinz Exp $ */
|
||||
/* $NetBSD: unistd.h,v 1.44 2008/08/06 17:17:03 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
|
@ -109,6 +109,10 @@
|
|||
#define _POSIX_READER_WRITER_LOCKS 200112L
|
||||
/* XPG4.2 shared memory */
|
||||
#define _XOPEN_SHM 0
|
||||
/* shell */
|
||||
#define _POSIX_SHELL 1
|
||||
/* regular expressions */
|
||||
#define _POSIX_REGEXP 1
|
||||
|
||||
/* access function */
|
||||
#define F_OK 0 /* test for existence of file */
|
||||
|
@ -227,6 +231,23 @@
|
|||
#define _SC_THREAD_PROCESS_SHARED 66
|
||||
#define _SC_THREAD_SAFE_FUNCTIONS 67
|
||||
#define _SC_TTY_NAME_MAX 68
|
||||
#define _SC_HOST_NAME_MAX 69
|
||||
#define _SC_PASS_MAX 70
|
||||
#define _SC_REGEXP 71
|
||||
#define _SC_SHELL 72
|
||||
#define _SC_SYMLOOP_MAX 73
|
||||
|
||||
/* Actually, they are not supported or implemented yet */
|
||||
#define _SC_V6_ILP32_OFF32 74
|
||||
#define _SC_V6_ILP32_OFFBIG 75
|
||||
#define _SC_V6_LP64_OFF64 76
|
||||
#define _SC_V6_LPBIG_OFFBIG 77
|
||||
#define _SC_2_PBS 80
|
||||
#define _SC_2_PBS_ACCOUNTING 81
|
||||
#define _SC_2_PBS_CHECKPOINT 82
|
||||
#define _SC_2_PBS_LOCATE 83
|
||||
#define _SC_2_PBS_MESSAGE 84
|
||||
#define _SC_2_PBS_TRACK 85
|
||||
|
||||
#ifdef _NETBSD_SOURCE
|
||||
/* Commonly provided sysconf() extensions */
|
||||
|
|
Loading…
Reference in New Issue