sdenter(S) 6 January 1993 sdenter(S) Name sdenter, sdleave - synchronizes access to a shared data segment Syntax cc . . . -lx #include <sys/sd.h> int sdenter(addr,flags) char *addr; int flags; int sdleave(addr) char *addr; Description sdenter is used to indicate that the current process is about to access the contents of a shared data segment. addr is the valid return code from a previous sdget call. The actions performed depend on the value of flags. flags values are formed by OR-ing together entries from the fol- lowing list: SDNOWAIT If another process has called sdenter but not sdleave for the indicated segment, and the segment was not created with the SDUNLOCK flag set, return an ENAVAIL error instead of waiting for the segment to become free. SDWRITE 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 SDRDONLY flag set is not allowed to enter with the SDWRITE 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 particu- lar, 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 SDUNLOCK flag. Return value Successful calls return 0. Unsuccessful calls return -1, and errno is set to indicate the error. errno is set to EINVAL if a process does an sdenter with the SDWRITE flag set and the segment is already attached with the SDRDONLY flag set. errno is set to ENAVAIL if the SDNOWAIT flag is set for sdenter call and the shared data segment is not free. Notes This feature is a XENIX specific enhancement and may not be present on all UNIX implementations. See also sdget(S), sdgetv(S) Standards conformance sdenter and sdleave are not part of any currently supported standard; they are an extension of AT&T System V provided by the Santa Cruz Opera- tion.