Annotation of researchv10dc/630/man/src/p_man/man3/msgop.3l, revision 1.1

1.1     ! root        1: .ds ZZ DEVELOPMENT PACKAGE
        !             2: .TH MSGOP 3L "630 MTG"
        !             3: .XE "msgsnd()"
        !             4: .XE "msgrcv()"
        !             5: .SH NAME
        !             6: msgop \- message operations
        !             7: .SH SYNOPSIS
        !             8: .B #include <message.h>
        !             9: 
        !            10: .B int msgsnd (msqid, msgp, msgsz, msgflg)
        !            11: .br
        !            12: .B long msqid;
        !            13: .br
        !            14: .B struct msgbuf \(**msgp;
        !            15: .br
        !            16: .B int msgsz, msgflg;
        !            17: .sp
        !            18: \fBint msgrcv (msqid, msgp, msgsz, msgtyp, msgflg)\fR
        !            19: .br
        !            20: .B long msqid;
        !            21: .br
        !            22: .B struct msgbuf [\(**]\(**msgp;
        !            23: .br
        !            24: .B int msgsz;
        !            25: .br
        !            26: .B long msgtyp;
        !            27: .br
        !            28: .B int msgflg;
        !            29: .SH DESCRIPTION
        !            30: .I Msgsnd
        !            31: is used to send a message to the queue associated
        !            32: with the message queue identifier specified by
        !            33: .IR msqid .
        !            34: .I Msgp
        !            35: points to a structure containing the message.
        !            36: This structure is composed of the following members:
        !            37: .sp
        !            38: .RS 6
        !            39: long    mtype;      /* message type */
        !            40: .br
        !            41: char    mtext[];    /* message text */
        !            42: .sp
        !            43: .RE
        !            44: .I Mtype
        !            45: is a positive integer that can be used by the
        !            46: receiving process for message selection (see
        !            47: .I msgrcv
        !            48: below).
        !            49: .I Mtext
        !            50: is any text of length
        !            51: .I msgsz
        !            52: bytes.
        !            53: .I Msgsz
        !            54: can range from 0 to what memory will allow.
        !            55: .PP
        !            56: .I Msgflg
        !            57: specifies the action to be taken if one or more of
        !            58: the following are true:
        !            59: .sp
        !            60: .RS 6
        !            61: The number of bytes already on the queue is equal to
        !            62: .BR msg_qbytes .
        !            63: .sp
        !            64: There is not enough memory to put the message on the queue.
        !            65: .sp
        !            66: .RE
        !            67: These actions are as follows:
        !            68: .sp
        !            69: .RS 6
        !            70: If
        !            71: .RI ( msgflg
        !            72: & 
        !            73: .BR IPC_NOWAIT )
        !            74: is ``true'', the message will not be sent and the
        !            75: calling process will return immediately.
        !            76: .sp
        !            77: If
        !            78: .RI ( msgflg
        !            79: &
        !            80: .BR IPC_NOWAIT )
        !            81: is ``false'', the calling process will suspend
        !            82: execution until one of the following occurs:
        !            83: .sp
        !            84: .RS 6
        !            85: The condition responsible for the suspension no
        !            86: longer exists, in which case the message is
        !            87: sent.
        !            88: .sp
        !            89: .I Msqid
        !            90: is removed from the system (see
        !            91: .IR msgctl ).
        !            92: .PP
        !            93: .RE 1
        !            94: .I Msgsnd
        !            95: will fail and no message will be sent if one or more
        !            96: of the following are true:
        !            97: .RS 6
        !            98: .sp
        !            99: .I Msqid
        !           100: is not a valid message queue identifier.
        !           101: .sp
        !           102: .I Mtype
        !           103: is less than 1.
        !           104: .sp
        !           105: The message cannot be sent for one of the
        !           106: reasons cited above and
        !           107: .RI ( msgflg
        !           108: &
        !           109: .BR IPC_NOWAIT )
        !           110: is ``true''.
        !           111: .sp
        !           112: .I Msgsz
        !           113: is less than zero.
        !           114: .sp
        !           115: .RE
        !           116: Upon successful completion, the following actions are taken
        !           117: with respect to the data structure associated with
        !           118: .IR msqid .
        !           119: .sp
        !           120: .RS 6
        !           121: .B Msg_qnum
        !           122: is incremented by 1.
        !           123: .sp
        !           124: .B Msg_lspid
        !           125: is set equal to the process id of the cal\ ling process.
        !           126: .sp
        !           127: .B Msg_stime
        !           128: is set equal to the current time.
        !           129: .RE
        !           130: .PP
        !           131: An extra feature of
        !           132: .I msgsnd
        !           133: lets the user send messages without a copy being made. If
        !           134: .RI ( msgflg
        !           135: &
        !           136: .BR NO_COPY )
        !           137: is ``true'', the message pointed to by
        !           138: .I msgp
        !           139: is put directly
        !           140: into the message queue. This can only be done if the
        !           141: .I msgbuf
        !           142: was allocated (created by a call to alloc).
        !           143: This is because the ownership of that memory must
        !           144: be changed. The sending process then no longer owns that memory
        !           145: and should not try to access it or free it.
        !           146: .PP
        !           147: .I Msgrcv
        !           148: reads a message from the queue associated with the
        !           149: message queue identifier specified by
        !           150: .I msqid
        !           151: and places it in the structure pointed to by
        !           152: .IR msgp .
        !           153: This structure is composed of the following members:
        !           154: .sp
        !           155: .RS 6
        !           156: long    mtype;      /* message type */
        !           157: .br
        !           158: char    mtext[];    /* message text */
        !           159: .PP
        !           160: .RE
        !           161: .I Mtype
        !           162: is the received message's type as specified by the
        !           163: sending process.
        !           164: .I Mtext
        !           165: is the text of the message.
        !           166: .I Msgsz
        !           167: specifies the size in bytes of
        !           168: .IR mtext .
        !           169: The received message is truncated to
        !           170: .I msgsz
        !           171: bytes if it is larger than
        !           172: .I msgsz
        !           173: and
        !           174: .RI ( msgflg
        !           175: &
        !           176: .BR MSG_NOERROR )
        !           177: is ``true''.  The truncated part of
        !           178: the message is lost and no indication of the truncation is
        !           179: given to the calling process.
        !           180: .PP
        !           181: .I Msgtyp
        !           182: specifies the type of message requested as follows:
        !           183: .RS 6
        !           184: .sp
        !           185: If
        !           186: .I msgtyp
        !           187: is equal to 0, the first message on the queue is received.
        !           188: .sp
        !           189: If
        !           190: .I msgtyp
        !           191: is greater than 0, the first message of type
        !           192: .I msgtyp
        !           193: is received.
        !           194: .sp
        !           195: If
        !           196: .I msgtyp
        !           197: is less than 0, the first message of the
        !           198: lowest type that is less than or equal to the absolute
        !           199: value of
        !           200: .I msgtyp
        !           201: is received.
        !           202: .PP
        !           203: .RE
        !           204: .I Msgflg
        !           205: specifies the action to be taken if a message of the
        !           206: desired type is not on the queue.  These are as follows:
        !           207: .RS 6
        !           208: .sp
        !           209: If
        !           210: .RI ( msgflg
        !           211: &
        !           212: .BR IPC_NOWAIT )
        !           213: is ``true'', the calling process will return immediately
        !           214: with a return value of -1.
        !           215: .sp
        !           216: If
        !           217: .RI ( msgflg
        !           218: &
        !           219: .BR IPC_NOWAIT )
        !           220: is ``false'', the calling process will suspend execution
        !           221: until one of the following occurs:
        !           222: .RS 6
        !           223: .sp
        !           224: A message of the desired type is placed on the queue.
        !           225: .sp
        !           226: .I Msqid
        !           227: is removed from the system. When this occurs,
        !           228: a value of -1 is returned.
        !           229: .PP
        !           230: .RE 1
        !           231: .I Msgrcv
        !           232: will fail and no message will be received if one or
        !           233: more of the following are true:
        !           234: .RS 6
        !           235: .sp
        !           236: .I Msqid
        !           237: is not a valid message queue identifier.
        !           238: .sp
        !           239: .I Msgsz
        !           240: is less than 0.
        !           241: .sp
        !           242: .I Mtext
        !           243: is greater than
        !           244: .I msgsz
        !           245: and
        !           246: .RI ( msgflg
        !           247: &
        !           248: .BR MSG_NOERROR )
        !           249: is ``false''.
        !           250: .sp
        !           251: The queue does not contain a message of the
        !           252: desired type and
        !           253: .RI ( msgtyp
        !           254: &
        !           255: .BR IPC_NOWAIT )
        !           256: is ``true''.
        !           257: .PP
        !           258: .RE
        !           259: Upon successful completion, the following actions are taken
        !           260: with respect to the data structure associated with
        !           261: .IR msqid .
        !           262: .sp
        !           263: .RS 6
        !           264: .B Msg_qnum
        !           265: is decremented by 1.
        !           266: .sp
        !           267: .B Msg_lrpid
        !           268: is set equal to the process id of the calling process.
        !           269: .sp
        !           270: .B Msg_rtime
        !           271: is set equal to the current time.
        !           272: .PP
        !           273: .RE
        !           274: Again, the option of not copying the message is available. If
        !           275: .RI ( msgflg
        !           276: &
        !           277: .BR NO_COPY )
        !           278: is ``true'',
        !           279: .I msgp
        !           280: is treated as a pointer to a pointer to a message. In other words,
        !           281: .I *msgp
        !           282: is set to the address of the received message. The ownership of the message
        !           283: is then set to the receiving process. The receiving process can then
        !           284: read the message and free it.
        !           285: .PP
        !           286: A side effect of \fImsgrcv\fR is that it clears the MSG resource
        !           287: ready condition used by the \fIwait\fR and \fIown\fR resource functions.
        !           288: .PP
        !           289: .SS Return Values
        !           290: Upon successful completion, the return value is as follows:
        !           291: .sp
        !           292: .RS 6
        !           293: .I Msgsnd
        !           294: returns a value of 0.
        !           295: .sp
        !           296: .I Msgrcv
        !           297: returns a value equal to the number of bytes
        !           298: actually placed into
        !           299: .IR mtext .
        !           300: .sp
        !           301: .RE
        !           302: Otherwise, a value of -1 is returned.
        !           303: .PP
        !           304: .SH SEE ALSO
        !           305: alloc(3R), msgctl(3L), msgget(3L), realtime(3R), resources(3R), structures(3R).

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.