|
|
coherent
shmget() COHERENT System Call shmget() Get shared-memory segment #include <sys/shm.h> sshhmmggeett(_k_e_y, _s_i_z_e, _s_h_m_f_l_g) kkeeyy_tt _k_e_y; iinntt _s_i_z_e, _s_h_m_f_l_g; shmget returns the shared-memory identifier associated with key. A shared-memory identifier and associated data structure and shared memory segment of size size bytes is created for key if key does not already have a shared-memory identifier associated with it, and (_s_h_m_f_l_g & IIPPCC_CCRREEAATT) is true. Upon creation, the data structure associated with the new shared memory identifier is initialized as follows: * shm_perm.cuid, shm_perm.uid, shm_perm.cgid, and shm_perm.gid are set equal to the effective user ID and effective group ID, respectively, of the calling process. * The low-order nine bits of shm_perm.mode are set equal to the low-order nine bits of shmflg. These nine bits define access permissions: the top three bits give the owner's access per- missions (read, write, execute), the middle three bits the owning group's access permissions, and the low three bits ac- cess permissions for others. * shm_segsz is set equal to the value of size. * shm_lpid, shm_nattch, shm_atime, and shm_dtime are set equal to zero. shm_ctime is set equal to the current time. shmget fails if any of the following is true: * size is less than the system-imposed minimum or greater than the system-imposed maximum. shmget sets errno to EINVAL. * A shared-memory identifier exists for key but operation per- mission as specified by the low-order nine bits of shmflg would not be granted (EEAACCCCEESS). * A shared-memory identifier exists for key but the size of the segment associated with it is less than size and size is not equal to zero (EEIINNVVAALL). * A shared-memory identifier does not exist for key and (_s_h_m_f_l_g & IIPPCC_CCRREEAATT) is false (EENNOOEENNTT). * A shared-memory identifier is to be created but the system-im- posed limit on the maximum number of allowed shared memory identifiers system-wide would be exceeded (EENNOOSSPPCC). * A shared-memory identifier and associated shared-memory seg- ment are to be created, but the amount of available physical COHERENT Lexicon Page 1 shmget() COHERENT System Call shmget() memory is not sufficient to fill the request (EENNOOMMEEMM). * A shared-memory identifier exists for key but ( (_s_h_m_f_l_g & IIPPCC_CCRREEAATT) && (_s_h_m_f_l_g & IIPPCC_EEXXCCLL) ) is true (EEEEXXIISSTT). ***** Return Value ***** Upon successful completion, shmget returns a shared-memory iden- tifier, which is always a non-negative integer. Otherwise, it returns -1 and sets eerrrrnnoo to an appropriate value. ***** Files ***** /usr/include/sys/ipc.h /usr/include/sys/shm.h /dev/shm /drv/shm ***** See Also ***** COHERENT system calls, shm, shmctl() ***** Notes ***** To improve portability, the COHERENT system implements its shared-memory functions as a device driver rather than actual system calls. COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.