Add support to query PAGESIZE, PAGE_SIZE, _POSIX_FSYNC and _XOPEN_SHM via

sysconf().
This commit is contained in:
kleink 1998-05-24 20:12:25 +00:00
parent d96ca9b830
commit 3759ec18f5
3 changed files with 34 additions and 5 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sysconf.3,v 1.7 1998/04/28 20:11:35 fair Exp $
.\" $NetBSD: sysconf.3,v 1.8 1998/05/24 20:12:25 kleink Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -146,6 +146,10 @@ otherwise \-1.
.It Li _SC_2_UPE
Return 1 if the system supports the User Portability Utilities Option,
otherwise \-1.
.It Li _SC_PAGESIZE
The size of a system page in bytes.
.It Li _SC_FSYNC
Return 1 if the system supports the File Synchronisation Option, otherwise \-1.
.El
.Sh RETURN VALUES
If the call to

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysconf.c,v 1.7 1998/03/30 14:33:22 kleink Exp $ */
/* $NetBSD: sysconf.c,v 1.8 1998/05/24 20:12:27 kleink Exp $ */
/*-
* Copyright (c) 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
#else
__RCSID("$NetBSD: sysconf.c,v 1.7 1998/03/30 14:33:22 kleink Exp $");
__RCSID("$NetBSD: sysconf.c,v 1.8 1998/05/24 20:12:27 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -118,6 +118,16 @@ sysconf(name)
mib[1] = KERN_POSIX1;
break;
/* 1003.1b */
case _SC_PAGESIZE:
mib[0] = CTL_HW;
mib[1] = HW_PAGESIZE;
break;
case _SC_FSYNC:
mib[0] = CTL_KERN;
mib[1] = KERN_FSYNC;
goto yesno;
/* 1003.2 */
case _SC_BC_BASE_MAX:
mib[0] = CTL_USER;
@ -186,6 +196,12 @@ sysconf(name)
case _SC_2_UPE:
mib[0] = CTL_USER;
mib[1] = USER_POSIX2_UPE;
goto yesno;
/* XPG 4.2 */
case _SC_XOPEN_SHM:
mib[0] = CTL_KERN;
mib[1] = KERN_SYSVSHM;
yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
return (-1);
if (value == 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: getconf.c,v 1.6 1997/10/19 02:13:41 lukem Exp $ */
/* $NetBSD: getconf.c,v 1.7 1998/05/24 20:12:28 kleink Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: getconf.c,v 1.6 1997/10/19 02:13:41 lukem Exp $");
__RCSID("$NetBSD: getconf.c,v 1.7 1998/05/24 20:12:28 kleink Exp $");
#endif /* not lint */
#include <err.h>
@ -133,6 +133,15 @@ const struct conf_variable conf_table[] =
{ "_POSIX_NO_TRUNC", PATHCONF, _PC_NO_TRUNC },
{ "_POSIX_VDISABLE", PATHCONF, _PC_VDISABLE },
/* POSIX.1.b Configurable System Variables */
{ "_POSIX_FSYNC", SYSCONF, _SC_FSYNC },
{ "PAGESIZE", SYSCONF, _SC_PAGESIZE },
/* XPG4.2 Configurable System Variables */
{ "_XOPEN_SHM", SYSCONF, _SC_XOPEN_SHM },
/* X/Open Spec 1170 Configurable System Variables. */
{ "PAGE_SIZE", SYSCONF, _SC_PAGE_SIZE },
{ NULL }
};