|
|
coherent
msgsnd() COHERENT System Call msgsnd() Send a message #include <sys/msg.h> mmssggssnndd(_m_s_q_i_d, _m_s_g_p, _m_s_g_s_z, _m_s_g_f_l_g) iinntt _m_s_q_i_d, _m_s_g_s_z, _m_s_g_f_l_g; ssttrruucctt mmssggbbuuff *_m_s_g_p; The COHERENT system call msgsnd sends a message to the queue as- sociated with the message queue identifier msqid. msgp points to a structure that contains the message. This structure consists of the following members: long mtype; /* message type */ char mtext[]; /* message text */ mtype is a positive long integer that the receiving process uses to select messages. mtext is a string that is msgsz bytes long. msgsz can range from zero to a system-imposed limit as specified in the kernel variable NMSC. msgflg specifies the action to be taken if one or more of the following are true: * The number of bytes already on the queue is equal to msg_qbytes. * The number of messages on all queues system-wide equals the system limit specified in the kernel variable NMSG. msgflg can specify any of the following actions: * If (_m_s_g_f_l_g & IIPPCC_NNOOWWAAIITT) is true, the message is not sent and the calling process returns immediately. * If (_m_s_g_f_l_g & IIPPCC_NNOOWWAAIITT) is false, the calling process suspends execution until one of the following occurs: 11. The condition responsible for the suspension no longer exists, in which case the message is sent. 22. msqid is removed from the system. When this occurs, msgsnd sets errno to EDOM and returns -1. 33. The calling process receives a signal that is to be caught. In this case, the message is not sent and the calling process resumes execution in the manner prescribed in signal. msgsnd fails and no message is sent if one or more of the following are true: * msqid is not a valid message queue identifier. msgsnd sets errno to EINVAL. COHERENT Lexicon Page 1 msgsnd() COHERENT System Call msgsnd() * Operation permission is denied to the calling process (EEAACCCCEESS). * mtype is less than one (EEIINNVVAALL). * The message cannot be sent for one of the reasons cited above and (_m_s_g_f_l_g & IIPPCC_NNOOWWAAIITT) is true (EEAAGGAAIINN). * msgsz is less than zero or greater than the system-imposed limit (EEIINNVVAALL). * msgp points to an illegal address (EEFFAAUULLTT). Upon successful completion, the following actions are taken with respect to the data structure associated with msqid. * msg_qnum is incremented by one. * msg_lspid is set equal to the process ID of the calling process. * msg_stime is set equal to the current time. ***** Return Values ***** If msgsnd return because it has received a signal, it returns -1 and sets errno to EINTR. If it returns because msqid was removed from the system, it returns -1 and sets errno to EDOM. Upon successful completion, msgsnd returns zero. Otherwise, it returns -1 and sets errno to an appropriate value. ***** Files ***** /usr/include/sys/ipc.h /usr/include/sys/msg.h /dev/msg ***** See Also ***** COHERENT system calls, msg, msgctl(), msgget(), msgrcv() ***** Notes ***** To improve portability, the mmssgg functions are presently im- plemented as a device driver rather than as an actual system call. COHERENT Lexicon Page 2
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.