Manual Pages for UNIX Darwin command on man shmget
MyWebUniversity

Manual Pages for UNIX Darwin command on man shmget

SHMGET(2) BSD System Calls Manual SHMGET(2)

NAME

sshhmmggeett - get shared memory area identifier

SYNOPSIS

##iinncclluuddee <>

int sshhmmggeett(keyt key, sizet size, int shmflg);

DESCRIPTION

sshhmmggeett() returns the shared memory identifier associated with the key key. A shared memory segment is created if either key is equal to IPCPRIVATE, or key does not have a shared memory segment identifier associated with it, and the IPCCREAT bit is set in shmflg. If a new shared memory segment is created, the data structure associated

with it (the shmidds structure, see shmctl(2)) is initialized as fol-

lows: ++oo shmperm.cuid and shmperm.uid are set to the effective uid of the calling process. ++oo shmperm.gid and shmperm.cgid are set to the effective gid of the calling process. ++oo shmperm.mode is set to the lower 9 bits of shmflg. ++oo shmlpid, shmnattch, shmatime, and shmdtime are set to 0 ++oo shmctime is set to the current time. ++oo shmsegsz is set to the value of size.

RETURN VALUES

Upon successful completion a positive shared memory segment identifier is

returned. Otherwise, -1 is returned and the global variable errno is set

to indicate the error. EERRRROORRSS The sshhmmggeett() system call will fail if: [EACCES] A shared memory segment is already associated with key and the caller has no permission to access it. [EEXIST] Both IPCCREAT and IPCEXCL are set in shmflg, and a shared memory segment is already associated with key. [EINVAL] No shared memory segment is to be created, and a shared memory segment exists for key, but the size of the segment associated with it is less than size,

which is non-zero.

[ENOENT] IPCCREAT was not set in shmflg and no shared memory segment associated with key was found. [ENOMEM] There is not enough memory left to created a shared memory segment of the requested size. [ENOSPC] A new shared memory identifier could not be created

because the system limit for the number of shared mem-

ory identifiers has been reached.

LEGACY SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

##iinncclluuddee <>

int sshhmmggeett(keyt key, int size, int shmflg); All of these include files are necessary. The type of size has changed.

SEE ALSO

shmat(2), shmctl(2), shmdt(2), compat(5) BSD August 17, 1995 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™