sdenter(2XNX) (XENIX System Compatibility) sdenter(2XNX)
NAME
sdenter, sdleave - (XENIX) synchronize access to a shared data
segment
SYNOPSIS
cc [flag . . . ] flag . . . -lx
#include <sys/sd.h>
int sdenter(char *addr, int flags);
int sdleave(char *addr);
DESCRIPTION
sdenter is used to indicate that the current process is about
to access the contents of a shared data segment. The actions
performed depend on the value of flags. flags values are
formed by OR-ing together entries from the following list:
SD_NOWAIT If another process has called sdenter but not
sdleave for the indicated segment, and the segment
was not created with the SD_UNLOCK flag set,
return an ENAVAIL error instead of waiting for the
segment to become free.
SD_WRITE Indicates that the process wants to write data to
the shared data segment. A process that has
attached to a shared data segment with the
SD_RDONLY flag set will not be allowed to enter
with the SD_WRITE flag set.
sdleave is used to indicate that the current process is done
modifying the contents of a shared data segment.
Only changes made between invocations of sdenter and sdleave
are guaranteed to be reflected in other processes. sdenter
and sdleave are very fast; consequently, it is recommended
that they be called frequently rather than leave sdenter in
effect for any period of time. In particular, system calls
should be avoided between sdenter and sdleave calls.
The fork system call is forbidden between calls to sdenter and
sdleave if the segment was created without the SD_UNLOCK flag.
Return Values
Successful calls return 0. Unsuccessful calls return -1 and
set errno to indicate the error. errno is set to EINVAL if a
process does an sdenter with the SD_WRITE flag set and the
segment is already attached with the SD_RDONLY flag set.
Copyright 1994 Novell, Inc. Page 1
sdenter(2XNX) (XENIX System Compatibility) sdenter(2XNX)
errno is set to ENAVAIL if the SD_NOWAIT flag is set for
sdenter and the shared data segment is not free.
REFERENCES
sdget(2XNX), sdgetv(2XNX)
Copyright 1994 Novell, Inc. Page 2