summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-07-20 07:37:22 +0000
committerderaadt <deraadt@openbsd.org>1998-07-20 07:37:22 +0000
commit34673a67ca86be59a6b4a35242fe5c4e49b450dc (patch)
treea48089ec650cb21ebf8742b5473e0a3bef1bad41
parentclone freebsd semantics for usernames; noted by abyss@abyss.imaji.net (diff)
downloadwireguard-openbsd-34673a67ca86be59a6b4a35242fe5c4e49b450dc.tar.xz
wireguard-openbsd-34673a67ca86be59a6b4a35242fe5c4e49b450dc.zip
SEM_R and SEM_A userland accessable as required; michaels@inet.no
-rw-r--r--lib/libc/sys/semget.230
-rw-r--r--sys/sys/sem.h16
2 files changed, 33 insertions, 13 deletions
diff --git a/lib/libc/sys/semget.2 b/lib/libc/sys/semget.2
index 5a337b6f27b..00863ab13c5 100644
--- a/lib/libc/sys/semget.2
+++ b/lib/libc/sys/semget.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: semget.2,v 1.4 1997/11/24 02:07:32 deraadt Exp $
+.\" $OpenBSD: semget.2,v 1.5 1998/07/20 07:37:24 deraadt Exp $
.\" $NetBSD: semget.2,v 1.2 1997/03/27 08:20:41 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -54,9 +54,27 @@ semaphores is created if either
.Fa key
is equal to IPC_PRIVATE, or
.Fa key
-does not have a semaphore set associated with it, and the IPC_CREAT bit is
+does not have a semaphore set associated with it and the IPC_CREAT bit is
set in
-.Fa msgflg.
+.Fa semflg.
+
+The access modes of the created semaphores is specified in
+.Fa semflg
+by
+.Em or Ns 'ing
+the following values
+.Pp
+.Bd -literal -offset indent -compact
+SEM_A alter permission for owner
+SEM_R read permission for owner
+
+SEM_A >> 3 alter permission for group
+SEM_R >> 3 read permission for group
+
+SEM_A >> 6 alter permission for other
+SEM_R >> 6 read permission for other
+.Ed
+.Pp
If a new set of semaphores is created, the data structure associated with it
(the
@@ -78,7 +96,7 @@ are set to the effective gid of the calling process.
.It
.Va sem_perm.mode
is set to the lower 9 bits of
-.Fa msgflg .
+.Fa semflg .
.It
.Va sem_nsems
is set to the value of
@@ -103,7 +121,7 @@ The caller has no permission to access a semaphore set already associated with
.Fa key.
.It Bq Er EEXIST
Both IPC_CREAT and IPC_EXCL are set in
-.Fa msgflg ,
+.Fa semflg ,
and a semaphore set is already associated with
.Fa key .
.It Bq Er EINVAL
@@ -121,7 +139,7 @@ for the number of semaphores or the number of semaphore sets has been
reached.
.It Bq Er ENOENT
IPC_CREAT was not set in
-.Fa msgflg
+.Fa semflg
and no semaphore set associated with
.Fa key
was found.
diff --git a/sys/sys/sem.h b/sys/sys/sem.h
index 6fca814e76d..45d53039830 100644
--- a/sys/sys/sem.h
+++ b/sys/sys/sem.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sem.h,v 1.6 1998/06/11 19:21:29 deraadt Exp $ */
+/* $OpenBSD: sem.h,v 1.7 1998/07/20 07:37:22 deraadt Exp $ */
/* $NetBSD: sem.h,v 1.8 1996/02/09 18:25:29 christos Exp $ */
/*
@@ -79,12 +79,6 @@ union semun {
#define SETVAL 8 /* Set the value of semval to arg.val {ALTER} */
#define SETALL 9 /* Set semvals from arg.array {ALTER} */
-#ifdef _KERNEL
-/*
- * Kernel implementation stuff
- */
-#define SEMVMX 32767 /* semaphore maximum value */
-#define SEMAEM 16384 /* adjust on exit max value */
/*
* Permissions
@@ -92,6 +86,14 @@ union semun {
#define SEM_A 0200 /* alter permission */
#define SEM_R 0400 /* read permission */
+
+#ifdef _KERNEL
+/*
+ * Kernel implementation stuff
+ */
+#define SEMVMX 32767 /* semaphore maximum value */
+#define SEMAEM 16384 /* adjust on exit max value */
+
/*
* Undo structure (one per process)
*/