[0m


KEDEF(2)	    UNIX Programmer's Manual		 KEDEF(2)



[1mNAME
     [0mkedef - SVID Kernel Extension definitions

[1mDESCRIPTION
     [0mThe SVID Kernel Extension provides three mechanisms for
     inter-process communication (IPC): messages, semaphores and
     shared-memory. This section defines some of the data struc-
     tures employed.

[1mIPC Permissions
     [0mAll of the IPC mechanisms use a common structure type,
     _i_p_c__p_e_r_m, to pass information used in determining permission
     to perform an IPC operation.

     The _i_p_c__p_e_r_m structure is defined by the header file
     <_s_y_s/_i_p_c._h> and includes the following members:

	  ushort  cuid;               /* creator's user id */
	  ushort  cgid;               /* creator's group id */
	  ushort  uid;		      /* owner's user id */
	  ushort  gid;		      /* owner's group id */
	  ushort  mode;               /* access permissions */

     The following symbolic constants are also defined by the
     <_s_y_s/_i_p_c._h> header file:

	  IPC_CREAT		      /* create entry if key does not exist */
	  IPC_EXCL		      /* fail if key exists */
	  IPC_NOWAIT		      /* error if request must wait */
	  IPC_RMID		      /* remove identifier */
	  IPC_SET		      /* set options */
	  IPC_STAT		      /* get options */
	  IPC_PRIVATE		      /* private key */

[1mMessage Queue Identifier
     [0mA message queue identifier _m_s_q_i_d is a unique positive
     integer created by a call to the _m_s_g_g_e_t(2) routine.  Each
     _m_s_q_i_d has a message queue and a data structure associated
     with it.  The data structure is referred to as _m_s_q_i_d__d_s and
     contains the following members:

	  struct  ipc_perm msg_perm;  /* operation permissions */
	  ushort  msg_qnum;	      /* number of messages on q */
	  ushort  msg_qbytes;	      /* max number of bytes on q */
	  ushort  msg_lspid;	      /* pid of last msgsnd operation */
	  ushort  msg_lrpid;	      /* pid of last msgrcv operation */
	  time_t  msg_stime;	      /* last msgsnd time */
	  time_t  msg_rtime;	      /* last msgrcv time */
	  time_t  msg_ctime;	      /* last change time */
				      /* Times in seconds since */
				      /* 00:00:00 GMT, 1st January 1970 */




Printed 11/2/94     Revision 1.2 of 26/05/89			1






KEDEF(2)	    UNIX Programmer's Manual		 KEDEF(2)



     [1mmsg_perm	 [0mis an _i_p_c__p_e_r_m structure (see above) that speci-
		 fies the message operation permission.

     [1mmsg_qnum	 [0mis the number of messages currently on the
		 queue.

     [1mmsg_qbytes  [0mis the maximum number of bytes allowed on the
		 queue.

     [1mmsg_lspid	 [0mis the process id of the last process that per-
		 formed a _m_s_g_s_n_d operation.

     [1mmsg_lrpid	 [0mis the process id of the last process that per-
		 formed a _m_s_g_r_c_v operation.

     [1mmsg_stime	 [0mis the time of the last _m_s_g_s_n_d operation.

     [1mmsg_rtime	 [0mis the time of the last _m_s_g_r_c_v operation.

     [1mmsg_ctime	 [0mis the time of the last _m_s_g_c_t_l(2) operation that
		 changed a member of the above structure.

[1mMessage Operation Permissions
     [0mIn the _m_s_g_o_p(2) and _m_s_g_c_t_l(2) system call descriptions, the
     permission required for an operation is given as a bit pat-
     tern in _m_s_g__p_e_r_m._m_o_d_e, where the type of permission needed
     is interpreted as follows:

	    00400	   Read by user
	    00200	   Write by user
	    00040	   Read by group
	    00020	   Write by group
	    00004	   Read by others
	    00002	   Write by others

     Read and Write permissions on a _m_s_q_i_d are granted to a pro-
     cess if one or more of the following are true:

	  The effective user ID of the process is super-user.

	  The effective user ID of the process matches
	  _m_s_g__p_e_r_m._c_u_i_d or _m_s_g__p_e_r_m._u_i_d in the data structure
	  associated with _m_s_q_i_d and the appropriate bit of the
	  ``user'' portion (0600) of _m_s_g__p_e_r_m._m_o_d_e is set.

	  The effective user ID of the process does not match
	  _m_s_g__p_e_r_m._c_u_i_d or _m_s_g__p_e_r_m._u_i_d and the effective group
	  ID of the process matches _m_s_g__p_e_r_m._c_g_i_d or _m_s_g__p_e_r_m._g_i_d
	  and the appropriate bit of the ``group'' portion (0060)
	  of _m_s_g__p_e_r_m._m_o_d_e is set.

	  The effective user ID of the process does not match



Printed 11/2/94     Revision 1.2 of 26/05/89			2






KEDEF(2)	    UNIX Programmer's Manual		 KEDEF(2)



	  _m_s_g__p_e_r_m._c_u_i_d or _m_s_g__p_e_r_m._u_i_d and the effective group
	  ID of the process does not match _m_s_g__p_e_r_m._c_g_i_d or
	  _m_s_g__p_e_r_m._g_i_d and the appropriate bit of the ``other''
	  portion (0006) of _m_s_g__p_e_r_m._m_o_d_e is set.

     Otherwise, the corresponding permissions are denied.

[1mSemaphore Identifier
     [0mA semaphore identifier _s_e_m_i_d is a unique positive integer
     created by a _s_e_m_g_e_t(2) system call.  Each _s_e_m_i_d has a set of
     semaphores and a data structure associated with it.  The
     data structure is _s_e_m_i_d__d_s and contains the following
     members:

	  struct  ipc_perm sem_perm;  /* operation permissions */
	  ushort  sem_nsems;	      /* count of semaphores in set */
	  time_t  sem_otime;	      /* last operation time */
	  time_t  sem_ctime;	      /* last change time */
				      /* Times measured in seconds since */
				      /* 00:00:00 GMT, 1st January 1970 */

     [1msem_perm	 [0mis an _i_p_c__p_e_r_m structure that specifies the
		 semaphore operation permission (see above).

     [1msem_nsems	 [0mhas a value equal to the number of semaphores in
		 the set.  Each semaphore in the set is refer-
		 enced by a positive integer referred to as a
		 _s_e_m__n_u_m.  The value of _s_e_m__n_u_m runs sequentially
		 from 0 to the value of _s_e_m__n_s_e_m_s-1

     [1msem_otime	 [0mis the time of the last _s_e_m_o_p(2) operation.

     [1msem_ctime	 [0mis the time of the last _s_e_m_c_t_l(2) operation that
		 changed a member of the above structure.

     A semaphore is a data structure that contains the following
     members:

	  ushort  semval;     /* semaphore value */
	  short   sempid;     /* pid of last operation	*/
	  ushort  semncnt;    /* number awaiting semval > cval */
	  ushort  semzcnt;    /* number awaiting semval = 0 */

     [1msemval	 [0mis a non-negative integer.

     [1msempid	 [0mis equal to the process ID of the last process
		 that performed a semaphore operation on this
		 semaphore.

     [1msemncnt	 [0mis a count of the number of processes that are
		 currently suspended awaiting this semaphore's
		 _s_e_m_v_a_l to become greater than its current value.



Printed 11/2/94     Revision 1.2 of 26/05/89			3






KEDEF(2)	    UNIX Programmer's Manual		 KEDEF(2)



     [1msemzcnt	 [0mis a count of the number of processes that are
		 currently suspended awaiting this semaphore's
		 _s_e_m_v_a_l to become zero.

[1mSemaphore Operation Permissions
     [0mIn the _s_e_m_o_p(2) and _s_e_m_c_t_l(2) system call descriptions, the
     permission required for an operation is given as a bit pat-
     tern in _s_e_m__p_e_r_m._m_o_d_e where the type of permission needed
     interpreted as follows:

	    00400	   Read by user
	    00200	   Alter by user
	    00040	   Read by group
	    00020	   Alter by group
	    00004	   Readby others
	    00002	   Alter by others

     The Read and Alter permissions on a _s_e_m_i_d are granted to a
     process if one or more of the following are true:

	  The effective user ID of the process is super-user.

	  The effective user ID of the process matches
	  _s_e_m__p_e_r_m._c_u_i_d or _s_e_m__p_e_r_m._u_i_d in the data structure
	  associated with _s_e_m_i_d and the appropriate bit of the
	  ``user'' portion (0600) of _s_e_m__p_e_r_m._m_o_d_e is set.

	  The effective user ID of the process does not match
	  _s_e_m__p_e_r_m._c_u_i_d or _s_e_m__p_e_r_m._u_i_d and the effective group
	  ID of the process matches _s_e_m__p_e_r_m._c_g_i_d or _s_e_m__p_e_r_m._g_i_d
	  and the appropriate bit of the ``group'' portion (0060)
	  of _s_e_m__p_e_r_m._m_o_d_e is set.

	  The effective user ID of the process does not match
	  _s_e_m__p_e_r_m._c_u_i_d or _s_e_m__p_e_r_m._u_i_d and the effective group
	  ID of the process does not match _s_e_m__p_e_r_m._c_g_i_d or
	  _s_e_m__p_e_r_m._g_i_d and the appropriate bit of the ``other''
	  portion (0006) of _s_e_m__p_e_r_m._m_o_d_e is set.

     Otherwise, the corresponding permissions are denied.

[1mShared Memory Identifier
     [0mA shared memory identifier _s_h_m_i_d is a unique positive
     integer created by a _s_h_m_g_e_t(2) system call.  Each _s_h_m_i_d has
     a segment of memory (referred to as a shared memory segment)
     and a data structure associated with it.

     The data structure is referred to as _s_h_m_i_d__d_s and contains
     the following members:

	  struct  ipc_perm shm_perm;  /* operation permissions */
	  int	  shm_segsz;	      /* size of segment */



Printed 11/2/94     Revision 1.2 of 26/05/89			4






KEDEF(2)	    UNIX Programmer's Manual		 KEDEF(2)



	  ushort  shm_cpid;	      /* creator pid */
	  ushort  shm_lpid;	      /* pid of last operation */
	  short   shm_nattch;	      /* number of current attaches */
	  time_t  shm_atime;	      /* last attach time */
	  time_t  shm_dtime;	      /* last detach time */
	  time_t  shm_ctime;	      /* last change time */
				      /* Times measured in seconds since */
				      /* 00:00:00 GMT, 1st January 1970 */

     [1mshm_perm	 [0mis an _i_p_c__p_e_r_m structure that specifies the
		 shared memory operation permission (see above).

     [1mshm_segsz	 [0mspecifies the size of the shared memory segment.

     [1mshm_cpid	 [0mis the process id of the process that created
		 the shared memory identifier.

     [1mshm_lpid	 [0mis the process id of the last process that per-
		 formed a _s_h_m_o_p(2) operation.

     [1mshm_nattch  [0mis the number of processes that currently have
		 this segment attached.

     [1mshm_atime	 [0mis the time of the last _s_h_m_a_t operation.

     [1mshm_dtime	 [0mis the time of the last _s_h_m_d_t operation.

     [1mshm_ctime	 [0mis the time of the last _s_h_m_c_t_l(2) operation that
		 changed one of the members of the above struc-
		 ture.

[1mShared Memory Operation Permissions
     [0mIn the _s_h_m_o_p(2) and _s_h_m_c_t_l(2) system call descriptions, the
     permission required for an operation is given as a bit pat-
     tern in _s_h_m__p_e_r_m._m_o_d_e where the type of permission needed
     interpreted as follows:

	    00400	   Read by user
	    00200	   Write by user
	    00040	   Read by group
	    00020	   Write by group
	    00004	   Read by others
	    00002	   Write by others

     Read and Write permissions on a _s_h_m_i_d are granted to a pro-
     cess if one or more of the following are true:

	  The effective user ID of the process is super-user.

	  The effective user ID of the process matches
	  _s_h_m__p_e_r_m._c_u_i_d or _s_h_m__p_e_r_m._u_i_d in the data structure
	  associated with _s_h_m_i_d and the appropriate bit of the



Printed 11/2/94     Revision 1.2 of 26/05/89			5






KEDEF(2)	    UNIX Programmer's Manual		 KEDEF(2)



	  ``user'' portion (0600) of _s_h_m__p_e_r_m._m_o_d_e is set.

	  The effective user ID of the process does not match
	  _s_h_m__p_e_r_m._c_u_i_d or _s_h_m__p_e_r_m._u_i_d and the effective group
	  ID of the process matches _s_h_m__p_e_r_m._c_g_i_d or _s_h_m__p_e_r_m._g_i_d
	  and the appropriate bit of the ``group'' portion (0060)
	  of _s_h_m__p_e_r_m._m_o_d_e is set.

	  The effective user ID of the process does not match
	  _s_h_m__p_e_r_m._c_u_i_d or _s_h_m__p_e_r_m._u_i_d and the effective group
	  ID of the process does not match _s_h_m__p_e_r_m._c_g_i_d or
	  _s_h_m__p_e_r_m._g_i_d and the appropriate bit of the ``other''
	  portion (0006) of _s_h_m__p_e_r_m._m_o_d_e is set.

     Otherwise, the corresponding permissions are denied.

[1mSEE ALSO
     [0mChapters 8-11 of the _S_y_s_t_e_m _V _I_n_t_e_r_f_a_c_e _D_e_f_i_n_i_t_i_o_n, _I_s_s_u_e _2,
     _V_o_l_u_m_e _1.




































Printed 11/2/94     Revision 1.2 of 26/05/89			6



[0m