|
|
1.1 ! root 1: ! 2: ! 3: msgsnd() COHERENT System Call msgsnd() ! 4: ! 5: ! 6: ! 7: ! 8: Send a message ! 9: ! 10: #include <sys/msg.h> ! 11: mmssggssnndd(_m_s_q_i_d, _m_s_g_p, _m_s_g_s_z, _m_s_g_f_l_g) ! 12: iinntt _m_s_q_i_d, _m_s_g_s_z, _m_s_g_f_l_g; ssttrruucctt mmssggbbuuff *_m_s_g_p; ! 13: ! 14: The COHERENT system call msgsnd sends a message to the queue as- ! 15: sociated with the message queue identifier msqid. msgp points to ! 16: a structure that contains the message. This structure consists ! 17: of the following members: ! 18: ! 19: ! 20: long mtype; /* message type */ ! 21: char mtext[]; /* message text */ ! 22: ! 23: ! 24: mtype is a positive long integer that the receiving process uses ! 25: to select messages. mtext is a string that is msgsz bytes long. ! 26: msgsz can range from zero to a system-imposed limit as specified ! 27: in the kernel variable NMSC. ! 28: ! 29: msgflg specifies the action to be taken if one or more of the ! 30: following are true: ! 31: ! 32: * The number of bytes already on the queue is equal to ! 33: msg_qbytes. ! 34: ! 35: * The number of messages on all queues system-wide equals the ! 36: system limit specified in the kernel variable NMSG. ! 37: ! 38: msgflg can specify any of the following actions: ! 39: ! 40: * If (_m_s_g_f_l_g & IIPPCC_NNOOWWAAIITT) is true, the message is not sent and ! 41: the calling process returns immediately. ! 42: ! 43: * If (_m_s_g_f_l_g & IIPPCC_NNOOWWAAIITT) is false, the calling process ! 44: suspends execution until one of the following occurs: ! 45: ! 46: 11. The condition responsible for the suspension no longer exists, ! 47: in which case the message is sent. ! 48: ! 49: 22. msqid is removed from the system. When this occurs, msgsnd ! 50: sets errno to EDOM and returns -1. ! 51: ! 52: 33. The calling process receives a signal that is to be caught. ! 53: In this case, the message is not sent and the calling process ! 54: resumes execution in the manner prescribed in signal. ! 55: ! 56: msgsnd fails and no message is sent if one or more of the ! 57: following are true: ! 58: ! 59: * msqid is not a valid message queue identifier. msgsnd sets ! 60: errno to EINVAL. ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: msgsnd() COHERENT System Call msgsnd() ! 70: ! 71: ! 72: ! 73: * Operation permission is denied to the calling process ! 74: (EEAACCCCEESS). ! 75: ! 76: * mtype is less than one (EEIINNVVAALL). ! 77: ! 78: * The message cannot be sent for one of the reasons cited above ! 79: and (_m_s_g_f_l_g & IIPPCC_NNOOWWAAIITT) is true (EEAAGGAAIINN). ! 80: ! 81: * msgsz is less than zero or greater than the system-imposed ! 82: limit (EEIINNVVAALL). ! 83: ! 84: * msgp points to an illegal address (EEFFAAUULLTT). ! 85: ! 86: Upon successful completion, the following actions are taken with ! 87: respect to the data structure associated with msqid. ! 88: ! 89: * msg_qnum is incremented by one. ! 90: ! 91: * msg_lspid is set equal to the process ID of the calling ! 92: process. ! 93: ! 94: * msg_stime is set equal to the current time. ! 95: ! 96: ***** Return Values ***** ! 97: ! 98: If msgsnd return because it has received a signal, it returns -1 ! 99: and sets errno to EINTR. If it returns because msqid was removed ! 100: from the system, it returns -1 and sets errno to EDOM. ! 101: ! 102: Upon successful completion, msgsnd returns zero. Otherwise, it ! 103: returns -1 and sets errno to an appropriate value. ! 104: ! 105: ***** Files ***** ! 106: ! 107: /usr/include/sys/ipc.h ! 108: /usr/include/sys/msg.h ! 109: /dev/msg ! 110: ! 111: ***** See Also ***** ! 112: ! 113: COHERENT system calls, msg, msgctl(), msgget(), msgrcv() ! 114: ! 115: ***** Notes ***** ! 116: ! 117: To improve portability, the mmssgg functions are presently im- ! 118: plemented as a device driver rather than as an actual system ! 119: call. ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.