summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-06-02 06:10:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-06-02 06:10:34 +0000
commitdd9569aa454092b1ba4e3aec3674f2c8ff71495c (patch)
tree4db0130f333a3d280cdc1f299342398d4d03939d /lib/libc
parent3e2b3206473d422f933e48545bb8183a05d60949 (diff)
add sysctl and sysconf support for sysvsem, sysvshm, sysvmsg, and fsync; mostly from kleink
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/sysconf.36
-rw-r--r--lib/libc/gen/sysconf.c19
-rw-r--r--lib/libc/gen/sysctl.318
3 files changed, 40 insertions, 3 deletions
diff --git a/lib/libc/gen/sysconf.3 b/lib/libc/gen/sysconf.3
index cfa55b9ed1e..1bb9606077d 100644
--- a/lib/libc/gen/sysconf.3
+++ b/lib/libc/gen/sysconf.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysconf.3,v 1.3 1996/08/19 08:26:22 tholo Exp $
+.\" $OpenBSD: sysconf.3,v 1.4 1998/06/02 06:10:24 deraadt Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -142,6 +142,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
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index 49bd847aeff..3be23f90bc0 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: sysconf.c,v 1.3 1996/09/15 09:31:06 tholo Exp $";
+static char rcsid[] = "$OpenBSD: sysconf.c,v 1.4 1998/06/02 06:10:26 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -105,6 +105,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;
@@ -173,6 +183,13 @@ 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)
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index bc4324df699..86a2cf3cf80 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.3,v 1.8 1997/10/02 03:01:15 angelos Exp $
+.\" $OpenBSD: sysctl.3,v 1.9 1998/06/02 06:10:27 deraadt Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -232,6 +232,7 @@ information.
.It KERN\_CLOCKRATE struct clockinfo no
.It KERN\_DOMAINNAME string yes
.It KERN\_FILE struct file no
+.It KERN\_FSYNC integer no
.It KERN\_HOSTID integer yes
.It KERN\_HOSTNAME string yes
.It KERN\_JOB\_CONTROL integer no
@@ -256,6 +257,9 @@ information.
.It KERN\_RAWPARTITION integer no
.It KERN\_SAVED\_IDS integer no
.It KERN\_SECURELVL integer raise only
+.It KERN\_SYSVMSG integer no
+.It KERN\_SYSVSEM integer no
+.It KERN\_SYSVSHM integer no
.It KERN\_VDISABLE integer no
.It KERN\_VERSION string no
.It KERN\_VNODE struct vnode no
@@ -290,6 +294,9 @@ The returned data consists of a single
followed by an array of
.Va struct file ,
whose size depends on the current number of such objects in the system.
+.It Li KERN_FSYNC
+Return 1 if the File Synchronisation Option is available on this system,
+otherwise 0.
.It Li KERN_HOSTID
Get or set the host id.
.It Li KERN_HOSTNAME
@@ -388,6 +395,15 @@ Returns 1 if saved set-group and saved set-user ID is available.
The system security level.
This level may be raised by processes with appropriate privilege.
It may only be lowered by process 1.
+.It Li KERN_SYSVMSG
+Returns 1 if System V style message queue functionality is available on this
+system, otherwise 0.
+.It Li KERN_SYSVSEM
+Returns 1 if System V style semaphore functionality is available on this
+system, otherwise 0.
+.It Li KERN_SYSVSHM
+Returns 1 if System V style share memory functionality is available on this
+system, otherwise 0.
.It Li KERN_VDISABLE
Returns the terminal character disabling value.
.It Li KERN_VERSION