summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/sys/msgctl.236
-rw-r--r--lib/libc/sys/msgget.226
-rw-r--r--lib/libc/sys/msgrcv.259
-rw-r--r--lib/libc/sys/msgsnd.234
-rw-r--r--lib/libc/sys/open.29
-rw-r--r--lib/libc/sys/semctl.241
-rw-r--r--lib/libc/sys/semget.220
-rw-r--r--lib/libc/sys/semop.231
-rw-r--r--lib/libc/sys/shmat.214
-rw-r--r--lib/libc/sys/shmctl.236
-rw-r--r--lib/libc/sys/shmget.218
11 files changed, 209 insertions, 115 deletions
diff --git a/lib/libc/sys/msgctl.2 b/lib/libc/sys/msgctl.2
index f1f242712ea..562116fc5c1 100644
--- a/lib/libc/sys/msgctl.2
+++ b/lib/libc/sys/msgctl.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: msgctl.2,v 1.6 1999/05/10 17:56:29 aaron Exp $
+.\" $OpenBSD: msgctl.2,v 1.7 1999/05/27 14:05:09 aaron Exp $
.\" $NetBSD: msgctl.2,v 1.2 1997/03/27 08:20:35 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -48,7 +48,7 @@ The
system call performs some control operations on the message queue specified
by
.Fa msqid .
-
+.Pp
Each message queue has a data structure associated with it, parts of which
may be altered by
.Fn msgctl
@@ -70,7 +70,7 @@ struct msqid_ds {
time_t msg_ctime; /* time of last msgctl() */
};
.Ed
-
+.Pp
The
.Bf -literal
ipc_perm
@@ -93,7 +93,7 @@ struct ipc_perm {
key_t key; /* user specified msg/sem/shm key */
};
.Ed
-
+.Pp
The operation to be performed by
.Fn msgctl
is specified in
@@ -129,18 +129,18 @@ can only be increased by the super-user. Values for
that exceed the system limit (MSGMNB from
.Aq Pa sys/msg.h )
are silently truncated to that limit.
-
+.Pp
.It Dv IPC_RMID
Remove the message queue specified by
.Fa msqid
and destroy the data associated with it. Only the super-user or a process
-with an effective uid equal to the
+with an effective UID equal to the
.Va msg_perm.cuid
or
.Va msg_perm.uid
values in the data structure associated with the queue can do this.
.El
-
+.Pp
The permission to read from or write to a message queue (see
.Xr msgsnd 2
and
@@ -150,12 +150,12 @@ is determined by the
field in the same way as is
done with files (see
.Xr chmod 2 ) ,
-but the effective uid can match either the
+but the effective UID can match either the
.Va msg_perm.cuid
field or the
.Va msg_perm.uid
field, and the
-effective gid can match either
+effective GID can match either
.Va msg_perm.cgid
or
.Va msg_perm.gid .
@@ -170,24 +170,30 @@ will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
.Fa cmd
-is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
-the effective uid match either the
+is equal to
+.Dv IPC_SET
+or
+.Dv IPC_RMID
+and the caller is not the super-user, nor does
+the effective UID match either the
.Va msg_perm.uid
or
.Va msg_perm.cuid
fields of the data structure associated with the message queue.
-
+.Pp
An attempt is made to increase the value of
.Va msg_qbytes
-through IPC_SET
+through
+.Dv IPC_SET
but the caller is not the super-user.
.It Bq Er EACCES
-The command is IPC_STAT
+The command is
+.Dv IPC_STAT
and the caller has no read permission for this message queue.
.It Bq Er EINVAL
.Fa msqid
is not a valid message queue identifier.
-
+.Pp
.Va cmd
is not a valid command.
.It Bq Er EFAULT
diff --git a/lib/libc/sys/msgget.2 b/lib/libc/sys/msgget.2
index 88c39c10227..b4fbf12df57 100644
--- a/lib/libc/sys/msgget.2
+++ b/lib/libc/sys/msgget.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: msgget.2,v 1.5 1999/05/25 13:06:47 aaron Exp $
+.\" $OpenBSD: msgget.2,v 1.6 1999/05/27 14:05:09 aaron Exp $
.\" $NetBSD: msgget.2,v 1.1 1995/10/16 23:49:19 jtc Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -47,15 +47,18 @@
returns the message queue identifier associated with
.Fa key .
A message queue identifier is a unique integer greater than zero.
-
+.Pp
A message queue is created if either
.Fa key
-is equal to IPC_PRIVATE, or
+is equal to
+.Dv IPC_PRIVATE ,
+or
.Fa key
-does not have a message queue identifier associated with it, and the IPC_CREAT
+does not have a message queue identifier associated with it, and the
+.Dv IPC_CREAT
bit is set in
.Fa msgflg .
-
+.Pp
If a new message queue is created, the data structure associated with it (the
.Va msqid_ds
structure, see
@@ -66,12 +69,12 @@ is initialized as follows:
.Va msg_perm.cuid
and
.Va msg_perm.uid
-are set to the effective uid of the calling process.
+are set to the effective UID of the calling process.
.It
.Va msg_perm.gid
and
.Va msg_perm.cgid
-are set to the effective gid of the calling process.
+are set to the effective GID of the calling process.
.It
.Va msg_perm.mode
is set to the lower 9 bits of
@@ -105,7 +108,11 @@ A message queue is already associated with
.Fa key
and the caller has no permission to access it.
.It Bq Er EEXIST
-Both IPC_CREAT and IPC_EXCL are set in
+Both
+.Dv IPC_CREAT
+and
+.Dv IPC_EXCL
+are set in
.Fa msgflg ,
and a message queue is already associated with
.Fa key .
@@ -113,7 +120,8 @@ and a message queue is already associated with
A new message queue could not be created because the system limit for
the number of message queues has been reached.
.It Bq Er ENOENT
-IPC_CREAT was not set in
+.Dv IPC_CREAT
+was not set in
.Fa msgflg
and no message queue associated with
.Fa key
diff --git a/lib/libc/sys/msgrcv.2 b/lib/libc/sys/msgrcv.2
index 7bad0bfd83b..420611c8248 100644
--- a/lib/libc/sys/msgrcv.2
+++ b/lib/libc/sys/msgrcv.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: msgrcv.2,v 1.5 1997/11/24 02:07:29 deraadt Exp $
+.\" $OpenBSD: msgrcv.2,v 1.6 1999/05/27 14:05:09 aaron Exp $
.\" $NetBSD: msgrcv.2,v 1.2 1997/03/27 08:20:37 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -54,12 +54,12 @@ This structure should consist of the following members:
long mtype; /* message type */
char mtext[1]; /* body of message */
.Ed
-
+.Pp
.Va mtype
is an integer greater than 0 that can be used for selecting messages,
.Va mtext
is an array of bytes, with a size up to that of the system limit (MSGMAX).
-
+.Pp
The value of
.Fa msgtyp
has one of the following meanings:
@@ -79,26 +79,36 @@ less than or equal to the absolute value of
.Fa msgtyp
will be received.
.El
-
+.Pp
.Fa msgsz
specifies the maximum length of the requested message. If the received
message has a length greater than
.Fa msgsz
-it will be silently truncated if the MSG_NOERROR flag is set in
+it will be silently truncated if the
+.Dv MSG_NOERROR
+flag is set in
.Fa msgflg ,
otherwise an error will be returned.
-
+.Pp
If no matching message is present on the message queue specified by
.Fa msqid ,
the behavior of
.Fn msgrcv
-depends on whether the IPC_NOWAIT flag is set in
+depends on whether the
+.Dv IPC_NOWAIT
+flag is set in
.Fa msgflg
-or not. If IPC_NOWAIT is set,
+or not. If
+.Dv IPC_NOWAIT
+is set,
.Fn msgrcv
will immediately return a value of -1, and set
.Va errno
-to EAGAIN. If IPC_NOWAIT is not set, the calling process will be blocked
+to
+.Er EAGAIN .
+If
+.Dv IPC_NOWAIT
+is not set, the calling process will be blocked
until:
.Bl -bullet
.It
@@ -106,13 +116,15 @@ A message of the requested type becomes available on the message queue.
.It
The message queue is removed, in which case -1 will be returned, and
.Va errno
-set to EINVAL.
+set to
+.Er EINVAL .
.It
A signal is received and caught. -1 is returned, and
.Va errno
-set to EINTR.
+set to
+.Er EINTR .
.El
-
+.Pp
If a message is successfully received, the data structure associated with
.Fa msqid
is updated as follows:
@@ -146,17 +158,19 @@ will fail if:
.It Bq Er EINVAL
.Fa msqid
is not a valid message queue identifier
-
+.Pp
The message queue was removed while
.Fn msgrcv
was waiting for a message of the requested type to become available on it.
-
+.Pp
.Fa msgsz
is less than 0.
.It Bq Er E2BIG
A matching message was received, but its size was greater than
.Fa msgsz
-and the MSG_NOERROR flag was not set in
+and the
+.Dv MSG_NOERROR
+flag was not set in
.Fa msgflg .
.It Bq Er EACCES
The calling process does not have read access to the message queue.
@@ -167,16 +181,23 @@ points to an invalid address.
The system call was interrupted by the delivery of a signal.
.It Bq Er EAGAIN
There is no message of the requested type available on the message queue,
-and IPC_NOWAIT is set in
+and
+.Dv IPC_NOWAIT
+is set in
.Fa msgflg .
.Sh SEE ALSO
.Xr msgctl 2 ,
.Xr msgget 2 ,
.Xr msgsnd 2
.Sh BUGS
-OpenBSD does not define the EIDRM error value, which should be used in
-the case of a removed message queue, nor the ENOMSG value, which
-should be used when no suitable message is available and IPC_NOWAIT
+OpenBSD does not define the
+.Er EIDRM
+error value, which should be used in
+the case of a removed message queue, nor the
+.Er ENOMSG
+value, which
+should be used when no suitable message is available and
+.Dv IPC_NOWAIT
is set.
.Sh HISTORY
Message queues appeared in the first release of AT&T Unix System V.
diff --git a/lib/libc/sys/msgsnd.2 b/lib/libc/sys/msgsnd.2
index 9d8400d9acf..ccbd1be3a83 100644
--- a/lib/libc/sys/msgsnd.2
+++ b/lib/libc/sys/msgsnd.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: msgsnd.2,v 1.5 1998/05/11 06:13:49 deraadt Exp $
+.\" $OpenBSD: msgsnd.2,v 1.6 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: msgsnd.2,v 1.2 1997/03/27 08:20:36 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -54,13 +54,13 @@ consist of the following members:
long mtype; /* message type */
char mtext[1]; /* body of message */
.Ed
-
+.Pp
.Va mtype
is an integer greater than 0 that can be used for selecting messages (see
.Xr msgrcv 2 ) ,
.Va mtext
is an array of bytes, with a size up to that of the system limit (MSGMAX).
-
+.Pp
If the number of bytes already on the message queue plus
.Fa msgsz
is bigger than the maximum number of bytes on the message queue (
@@ -74,9 +74,13 @@ determines the action of
.Fn msgsnd .
If
.Fa msgflg
-has IPC_NOWAIT mask set in it, the call will return immediately. If
+has
+.Dv IPC_NOWAIT
+mask set in it, the call will return immediately. If
.Fa msgflg
-does not have IPC_NOWAIT set in it, the call will block until:
+does not have
+.Dv IPC_NOWAIT
+set in it, the call will block until:
.Bl -bullet
.It
The condition which caused the call to block does no longer exist.
@@ -84,13 +88,15 @@ The message will be sent.
.It
The messag queue is removed, in which case -1 will be returned, and
.Va errno
-is set to EINVAL.
+is set to
+.Er EINVAL .
.It
The caller catches a signal. The call returns with
.Va errno
-set to EINTR.
+set to
+.Er EINTR .
.El
-
+.Pp
After a successful call, the data structure associated with the message
queue is updated in the following way:
.Bl -bullet
@@ -118,12 +124,12 @@ will fail if:
.It Bq Er EINVAL
.Fa msqid
is not a valid message queue identifier
-
+.Pp
The message queue was removed while
.Fn msgsnd
was waiting for a resource to become available in order to deliver the
message.
-
+.Pp
.Fa msgsz
is less than 0, or greater than
.Va msg_qbytes .
@@ -131,7 +137,9 @@ is less than 0, or greater than
The calling process does not have write access to the message queue.
.It Bq Er EAGAIN
There was no space for this message either on the queue, or in the whole
-system, and IPC_NOWAIT was set in
+system, and
+.Dv IPC_NOWAIT
+was set in
.Fa msgflg .
.It Bq Er EFAULT
.Fa msgp
@@ -144,7 +152,9 @@ The system call was interrupted by the delivery of a signal.
.Xr msgget 2 ,
.Xr msgrcv 2
.Sh BUGS
-OpenBSD does not define the EIDRM error value, which should be used
+OpenBSD does not define the
+.Er EIDRM
+error value, which should be used
in the case of a removed message queue.
.Sh HISTORY
Message queues appeared in the first release of AT&T Unix System V.
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
index fc871e9800b..994b3c2fb5e 100644
--- a/lib/libc/sys/open.2
+++ b/lib/libc/sys/open.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: open.2,v 1.9 1999/05/23 14:10:55 aaron Exp $
+.\" $OpenBSD: open.2,v 1.10 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: open.2,v 1.8 1995/02/27 12:35:14 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -250,7 +250,12 @@ were specified and the file exists.
.It Bq Er EOPNOTSUPP
An attempt was made to open a socket (not currently implemented).
.It Bq Er EAGAIN
-O_NONBLOCK and either O_EXLOCK or O_SHLOCK are set and the file
+.Dv O_NONBLOCK
+and either
+.Dv O_EXLOCK
+or
+.Dv O_SHLOCK
+are set and the file
is already locked.
.El
.Sh SEE ALSO
diff --git a/lib/libc/sys/semctl.2 b/lib/libc/sys/semctl.2
index 350446346d8..6332d596611 100644
--- a/lib/libc/sys/semctl.2
+++ b/lib/libc/sys/semctl.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: semctl.2,v 1.7 1999/05/10 17:56:29 aaron Exp $
+.\" $OpenBSD: semctl.2,v 1.8 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: semctl.2,v 1.2 1997/03/27 08:20:40 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -60,13 +60,16 @@ is a union of the following fields:
struct semid_ds *buf; /* buffer for IPC_{STAT,SET} */
u_short *array; /* array for GETALL & SETALL */
.Ed
-
+.Pp
The
.Bf -literal
semid_ds
.Ef
-structure used in the IPC_SET and IPC_STAT commands is defined
-as follows in
+structure used in the
+.Dv IPC_SET
+and
+.Dv IPC_STAT
+commands is defined as follows in
.Aq Pa sys/sem.h :
.Bd -literal
struct semid_ds {
@@ -77,7 +80,7 @@ struct semid_ds {
time_t sem_ctime; /* last change time */
};
.Ed
-
+.Pp
The
.Bf -literal
ipc_perm
@@ -100,7 +103,7 @@ struct ipc_perm {
key_t key; /* user specified msg/sem/shm key */
};
.Ed
-
+.Pp
.Fn semctl
provides the following operations:
.Bl -tag -width IPC_RMIDX
@@ -153,13 +156,13 @@ in the data structure associated with the message queue.
Remove the semaphores associated with
.Fa semid
from the system and destroy the data structures associated with it. Only the
-super-user or a process with an effective uid equal to the
+super-user or a process with an effective UID equal to the
.Va sem_perm.cuid
or
.Va sem_perm.uid
values in the data structure associated with the semaphore can do this.
.El
-
+.Pp
The permission to read or change a message queue (see
.Xr semop 2 )
is determined by the
@@ -167,17 +170,23 @@ is determined by the
field in the same way as is
done with files (see
.Xr chmod 2 ) ,
-but the effective uid can match either the
+but the effective UID can match either the
.Va sem_perm.cuid
field or the
.Va sem_perm.uid
field, and the
-effective gid can match either
+effective GID can match either
.Va sem_perm.cgid
or
.Va sem_perm.gid .
.Sh RETURN VALUES
-For the GETVAL, GETPID, GETNCNT and GETZCNT operations,
+For the
+.Dv GETVAL ,
+.Dv GETPID ,
+.Dv GETNCNT ,
+and
+.Dv GETZCNT
+operations,
.Fn semctl
returns one of the values described above if successful. All other operations
will make
@@ -191,8 +200,12 @@ will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
.Fa cmd
-is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
-the effective uid match either the
+is equal to
+.Dv IPC_SET
+or
+.Dv IPC_RMID
+and the caller is not the super-user, nor does
+the effective UID match either the
.Va sem_perm.uid
or
.Va sem_perm.cuid
@@ -202,7 +215,7 @@ The caller has no operation permission for this semaphore.
.It Bq Er EINVAL
.Fa semid
is not a valid message semaphore identifier.
-
+.Pp
.Va cmd
is not a valid command.
.It Bq Er EFAULT
diff --git a/lib/libc/sys/semget.2 b/lib/libc/sys/semget.2
index b22f85bf4c4..24ba7e6bced 100644
--- a/lib/libc/sys/semget.2
+++ b/lib/libc/sys/semget.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: semget.2,v 1.6 1999/05/25 13:06:47 aaron Exp $
+.\" $OpenBSD: semget.2,v 1.7 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: semget.2,v 1.2 1997/03/27 08:20:41 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -52,10 +52,13 @@ A new set containing
.Fa nsems
semaphores is created if either
.Fa key
-is equal to IPC_PRIVATE, or
+is equal to
+.Dv IPC_PRIVATE ,
+or
.Fa key
-does not have a semaphore set associated with it and the IPC_CREAT bit is
-set in
+does not have a semaphore set associated with it and the
+.Dv IPC_CREAT
+bit is set in
.Fa semflg .
.Pp
The access modes of the created semaphores is specified in
@@ -119,7 +122,11 @@ is set to reflect the error.
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
+Both
+.Dv IPC_CREAT
+and
+.Dv IPC_EXCL
+are set in
.Fa semflg ,
and a semaphore set is already associated with
.Fa key .
@@ -137,7 +144,8 @@ A new set of semaphores could not be created because the system limit
for the number of semaphores or the number of semaphore sets has been
reached.
.It Bq Er ENOENT
-IPC_CREAT was not set in
+.Dv IPC_CREAT
+was not set in
.Fa semflg
and no semaphore set associated with
.Fa key
diff --git a/lib/libc/sys/semop.2 b/lib/libc/sys/semop.2
index 6d816dc2502..139a22c68fb 100644
--- a/lib/libc/sys/semop.2
+++ b/lib/libc/sys/semop.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: semop.2,v 1.4 1997/11/24 02:07:33 deraadt Exp $
+.\" $OpenBSD: semop.2,v 1.5 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: semop.2,v 1.1 1995/10/16 23:49:28 jtc Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -58,7 +58,7 @@ structures in the array contain the following members:
short sem_op; /* semaphore operation */
short sem_flg; /* operation flags */
.Ed
-
+.Pp
Each operation (specified in
.Va sem_op )
is applied to semaphore number
@@ -89,18 +89,21 @@ semaphore. This is used to leave critical regions.
is equal to 0. The calling process is blocked until the value of the
specified semaphore reaches 0.
.El
-
+.Pp
The behavior of each operation is influenced by the flags set in
.Va sem_flg
in the following way:
.Bl -tag -width IPC_NOWAITX
-.It IPC_NOWAIT
+.It Dv IPC_NOWAIT
In the case where the calling process would normally block, waiting
-for a semaphore to reach a certain value, IPC_NOWAIT makes the
+for a semaphore to reach a certain value,
+.Dv IPC_NOWAIT
+makes the
call return immediately, returning a value of -1 and setting
.Va errno
-to EAGAIN.
-.It SEM_UNDO
+to
+.Er EAGAIN .
+.It Dv SEM_UNDO
Keep track of the changes that this call makes to the value of a semaphore,
so that they can be undone when the calling process terminates. This is
useful to prevent other processes waiting on a semaphore to block forever,
@@ -119,10 +122,10 @@ will fail if:
.It Bq Er EINVAL
There is no semaphore associated with
.Fa semid .
-
+.Pp
The semaphore set was removed while the process was waiting for one of
its semaphores to reach a certain value.
-
+.Pp
.It Bq Er EACCES
The calling process has no permission to access the specified semaphore set.
.It Bq Er E2BIG
@@ -135,10 +138,12 @@ in one of the sem_buf structures is less than 0, or greater than the actual
number of semaphores in the set specified by
.Fa semid .
.It Bq Er ENOSPC
-SEM_UNDO was requested, and there is not enough space left in the kernel to
+.Dv SEM_UNDO
+was requested, and there is not enough space left in the kernel to
store the unfo information.
.It Bq Er EAGAIN
-The requested operation can not immediately be performed, and IPC_NOWAIT
+The requested operation can not immediately be performed, and
+.Dv IPC_NOWAIT
was set in
.Va sem_flg .
.It Bq Er EFAULT
@@ -150,4 +155,6 @@ points to an illegal address.
.Sh BUGS
In case of a removed semaphore identifier,
.Va errno
-should be set to EIDRM, but OpenBSD does not define this error.
+should be set to
+.Er EIDRM ,
+but OpenBSD does not define this error.
diff --git a/lib/libc/sys/shmat.2 b/lib/libc/sys/shmat.2
index fd8683671b5..da313b51b1b 100644
--- a/lib/libc/sys/shmat.2
+++ b/lib/libc/sys/shmat.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: shmat.2,v 1.5 1998/05/11 06:13:50 deraadt Exp $
+.\" $OpenBSD: shmat.2,v 1.6 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: shmat.2,v 1.2 1997/03/27 08:20:38 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -62,11 +62,11 @@ the system will round the address down to a multiple of SHMLBA bytes
(SHMLBA is defined in
.Aq Pa sys/shm.h
).
-
+.Pp
A shared memory segment can be mapped read-only by specifying the
SHM_RDONLY flag in
.Fa shmflg .
-
+.Pp
.Fn shmdt
unmaps the shared memory segment that is currently mapped at
.Fa shmaddr
@@ -77,7 +77,9 @@ must be a value returned by a prior
call. A shared memory segment will remain existant until it is removed by
a call to
.Xr shmctl 2
-with the IPC_RMID command.
+with the
+.Dv IPC_RMID
+command.
.Sh RETURN VALUES
.Fn shmat
returns the address at which the shared memory segment has been mapped into
@@ -99,13 +101,13 @@ map the shared memory segment.
.It Bq Er EINVAL
.Fa shmid
is not a valid shared memory identifier.
-
+.Pp
.Fa shmaddr
specifies an illegal address.
.It Bq Er EMFILE
The number of shared memory segments has reached the system-wide limit.
.El
-
+.Pp
.Fn shmdt
will fail if:
.Bl -tag -width Er
diff --git a/lib/libc/sys/shmctl.2 b/lib/libc/sys/shmctl.2
index 726584ffd79..df75ce5008c 100644
--- a/lib/libc/sys/shmctl.2
+++ b/lib/libc/sys/shmctl.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: shmctl.2,v 1.7 1999/05/10 17:56:29 aaron Exp $
+.\" $OpenBSD: shmctl.2,v 1.8 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: shmctl.2,v 1.3 1997/03/27 08:20:39 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -48,13 +48,13 @@ The
system call performs some control operations on the shared memory area
specified by
.Fa shmid .
-
+.Pp
Each shared memory segment has a data structure associated with it,
parts of which may be altered by
.Fn shmctl
and parts of which determine the actions of
.Fn shmctl .
-
+.Pp
This structure is defined as follows in
.Aq Pa sys/shm.h :
.Bd -literal
@@ -93,7 +93,7 @@ struct ipc_perm {
key_t key; /* user specified msg/sem/shm key */
};
.Ed
-
+.Pp
The operation to be performed by
.Fn shmctl
is specified in
@@ -121,30 +121,30 @@ has an effective user id equal to either
or
.Va shm_perm.uid
in the data structure associated with the shared memory segment.
-
+.Pp
.It Dv IPC_RMID
Remove the shared memory segment specified by
.Fa shmid
and destroy the data associated with it. Only the super-user or a process
-with an effective uid equal to the
+with an effective UID equal to the
.Va shm_perm.cuid
or
.Va shm_perm.uid
values in the data structure associated with the queue can do this.
.El
-
+.Pp
The read and write permissions on a shared memory identifier
are determined by the
.Va shm_perm.mode
field in the same way as is
done with files (see
.Xr chmod 2 ) ,
-but the effective uid can match either the
+but the effective UID can match either the
.Va shm_perm.cuid
field or the
.Va shm_perm.uid
field, and the
-effective gid can match either
+effective GID can match either
.Va shm_perm.cgid
or
.Va shm_perm.gid .
@@ -159,24 +159,30 @@ will fail if:
.Bl -tag -width Er
.It Bq Er EPERM
.Fa cmd
-is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
-the effective uid match either the
+is equal to
+.Dv IPC_SET
+or
+.Dv IPC_RMID
+and the caller is not the super-user, nor does
+the effective UID match either the
.Va shm_perm.uid
or
.Va shm_perm.cuid
fields of the data structure associated with the shared memory segment.
-
+.Pp
An attempt is made to increase the value of
.Va shm_qbytes
-through IPC_SET
+through
+.Dv IPC_SET
but the caller is not the super-user.
.It Bq Er EACCES
-The command is IPC_STAT
+The command is
+.Dv IPC_STAT
and the caller has no read permission for this shared memory segment.
.It Bq Er EINVAL
.Fa shmid
is not a valid shared memory segment identifier.
-
+.Pp
.Va cmd
is not a valid command.
.It Bq Er EFAULT
diff --git a/lib/libc/sys/shmget.2 b/lib/libc/sys/shmget.2
index efca481c153..97ac040344e 100644
--- a/lib/libc/sys/shmget.2
+++ b/lib/libc/sys/shmget.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: shmget.2,v 1.5 1999/05/25 13:06:47 aaron Exp $
+.\" $OpenBSD: shmget.2,v 1.6 1999/05/27 14:05:10 aaron Exp $
.\" $NetBSD: shmget.2,v 1.2 1997/03/27 08:20:39 mikel Exp $
.\"
.\" Copyright (c) 1995 Frank van der Linden
@@ -49,9 +49,12 @@ returns the shared memory identifier associated with the key
.Pp
A shared memory segment is created if either
.Fa key
-is equal to IPC_PRIVATE, or
+is equal to
+.Dv IPC_PRIVATE ,
+or
.Fa key
-does not have a shared memory segment identifier associated with it, and the IPC_CREAT
+does not have a shared memory segment identifier associated with it, and the
+.Dv IPC_CREAT
bit is set in
.Fa shmflg .
.Pp
@@ -102,7 +105,11 @@ A shared memory segment is already associated with
.Fa key
and the caller has no permission to access it.
.It Bq Er EEXIST
-Both IPC_CREAT and IPC_EXCL are set in
+Both
+.Dv IPC_CREAT
+and
+.Dv IPC_EXCL
+are set in
.Fa shmflg ,
and a shared memory segment is already associated with
.Fa key .
@@ -110,7 +117,8 @@ and a shared memory segment is already associated with
A new shared memory indentifier could not be created because the system limit
for the number of shared memory identifiers has been reached.
.It Bq Er ENOENT
-IPC_CREAT was not set in
+.Dv IPC_CREAT
+was not set in
.Fa shmflg
and no shared memory segment associated with
.Fa key