sdget(2xnx) (XENIX System Compatibility)


sdget, sdfree -- (XENIX) attach and detach a shared data segment

Synopsis

   cc [flag . . . ] flag . . . -lx 
   

#include <sys/sd.h>

char *sdget(char *path, int flags,. . . /* long size, int mode */);

int sdfree(char *addr);

Description

sdget attaches a shared data segment to the data space of the current process. The actions performed are controlled by the value of flags. flags values are constructed by an OR of flags from the following list:

SD_RDONLY
Attach the segment for reading only.

SD_WRITE
Attach the segment for both reading and writing.

SD_CREAT
If the segment named by path exists and is not in use (active), this flag will have the same effect as creating a segment from scratch. Otherwise, the segment is created according to the values of size and mode. Read and write access to the segment is granted to other processes based on the permissions passed in mode, and functions the same as those for regular files. Execute permission is meaningless. The segment is initialized to contain all zeroes.

SD_UNLOCK
If the segment is created because of this call, the segment will be made so that more than one process can be between sdenter and sdleave calls.

The mode parameter must be included on the first call of the sdget function.

sdfree detaches the current process from the shared data segment that is attached at the specified address. If the current process has done sdenter but not an sdleave for the specified segment, sdleave will be done before detaching the segment.

When no process remains attached to the segment, the contents of that segment disappear, and no process can attach to the segment without creating it by using the SD_CREAT flag in sdget.

Return values

On successful completion, the address at which the segment was attached is returned. Otherwise, -1 is returned, and errno is set to indicate the error.

Errors

sdget will fail if one or more of the following are true:

ENAMETOOLONG
The file name specified is too long.

ELOOP
The file name specified is resolvable due to a lengthy symbolic link.

ENOTDIR
The path specified contains a non-directory component.

EEXIST
A process tried to create a shared data segment that exists and is in use.

ENOTNAM
A process attempted an sdget on a file that exists but is not a shared data type.

EINVAL
A process attempted an sdget on a shared data segment to which it is already attached.

References

sdenter(2xnx), sdgetv(2xnx)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.