msgsnd(PCI) 6 January 1993 msgsnd(PCI) Name msgsnd - message sending Syntax #include <pcilib.h> #include <memmdl.h> #include <ipc.h> int msgsnd (msqid, msgp, msgsz, msgflg) int msqid; struct msgbuf *msgp; int msgsz, msgflg; Description msgsnd sends a message to the queue associated with the message queue identifier specified by msqid. The operations are performed on the current host (as specified in the most recent dflthost call). msgp points to a structure containing the message. This structure is composed of the following members: long mtype; /* message type */ char mtext[]; /* message text */ mtype is a positive integer that can be used by the receiving process for message selection. mtext is any text of length msgsz bytes. msgsz ranges from zero to a system-imposed maximum which can be no greater than 1008. msgflg specifies the action to be taken if either or both of the follow- ing are true: + The number of bytes already on the queue is equal to msgqbytes. + The total number of messages on all queues system-wide is equal to the UNIX operating system-imposed limit. If one of the two events occurs and msgflg is "true," the message is not sent and the DOS function returns immediately. If msgflg is "false," the DOS function returns -1 and errno is set to EIDRM. Under no cir- cumstances does the PCILIB msgsnd function allow the DOS task to suspend. msgsnd fails and no message is sent if one or more of the following are true: [EINVAL] msqid is not a valid message queue identifier. [EACCES] Operation permission is denied to the calling process; see Intro(PCI). [EINVAL] mtype is less than 1. [EAGAIN] The message cannot be sent for one of the reasons cited above, and (msgflg & CNOWAIT) is "true." [EINVAL] msgsz is less than zero or greater than the system-imposed limit. [E2BIG] msgsnd is gretaer than 1008. mtext is greater than msgsz and (msgflg & MSGNOERROR) is "false." [EFAULT] msgp points to an illegal address. On successful completion, the following actions are taken with respect to the data structure associated with msqid; see Intro(PCI). + msgqnum is incremented by 1. + msglspid is set to the process ID of the calling process. + msgstime is set to the current time. Return value On successful completion, msgsnd returns a value of 0. If msgsnd returns due to removal of msqid from the system, a value of -1 returns and errno is set to EIDRM. Otherwise, a value of -1 returns and errno is set to indicate the error. See also dflthost(PCI), Intro(PCI), msgctl(PCI), msgget(PCI), msgrcv(PCI), sleeph(PCI) Difference from System V msgsnd calls that would cause a process to suspend in System V-compatible operating system cause an error to be returned in DOS. DOS tasks may not be suspended using msgsnd functions; sleeph may be used instead.