| OpenSS7 SS7 for the Common Man | © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. Last modified: Sat, 01 Nov 2008 10:41:49 GMT | ||||||||||||||||
| |||||||||||||||||
| Description: Manual PageKeywords: ss7 ss7/ip ss7 over ip ss7 mtp ss7 sccp ss7 tcap sigtran mtp sccp tcap openss7 acb56 linux telephony pstn linux telephony linux nebs linux compactpciGETPMSGSection: Linux Fast-STREAMS System Calls (2)Updated: 2008-10-31 Index Return to Main Contents NAMEgetpmsg - get next message off a streamSYNOPSIS#include <stropts.h>
ARGUMENTS
DESCRIPTIONgetpmsg() reads a STREAMS message from the read queue of a stream head into the caller supplied buffers. The read messages will contain a control part or a data part or both. The data and control parts of the message are handled separately by The meaning and interpretation of the contents of the control part and data part are specific to the STREAMS module to which the stream head is attached. The semantics of these contents forms a necessary part of the STREAMS module documentation. getpmsg() provides finer control over the messages retrieved than does getmsg(2). fd specifies a file descriptor referencing an open stream. ctlptr is used to hold the control part of the retrieved message and datptr is used to hold the data part of the retrieved message. ctlptr and dataptr each contain NULL or a pointer to a strbuf structure, which contains the following members:
struct strbuf {
int maxlen; /* maximum buffer length */
int len; /* length of data */
char *buf; /* ptr to buffer */
};
If ctlptr or datptr is NULL, or the corresponding maxlen field is set to -1, the control or data part of the message is not processed and is left on the stream head read queue. bandp is the lowest numerical priority band of interest. When flagsp is set to other than MSG_BAND, the integer pointed to by this argument must be coded zero (0); when flagsp is set to MSG_BAND, the integer pointed to by this argument indicates the lowest priority band of interest. flagsp When flagsp points to an integer containing the flag MSG_ANY or MSG_HIPRI, bandp should point to an integer containing the priority band 0. When flagsp points to an integer containing the flag MSG_BAND, bandp should point to an integer containing the lowest numerical priority band of interest. flagsp should point to an integer that indicates the type of message the user is able to receive and will return the type of message received. flagsp points to an integer that can have one of the following values:
If the stream head is set for non-blocking operation and no message of the specified type and priority band is available to be read, getpmsg() will fail and set errno to EAGAIN or EWOULDBLOCK. If the stream head is set for blocking operation, getpmsg() will block until a message of the specified type and priority band becomes available on the stream head read queue, or the call is interrupted by a signal. If the call is interrupted by a signal in this fashion, getpmsg() will fail and set errno to EINTR. If a hangup occurs on the stream from which messages are to be retrieved, getpmsg() continues to operate normally, as described above, until the stream head read queue is empty. Thereafter, it returns 0 in the len field of ctlptr and dataptr. RETURN VALUESUpon failure, getpmsg() will return -1 and set errno as described under ``ERRORS'', below. Upon success, getpmsg() will return a non-negative value with any of the following flags set:
getpmsg() with the appropriate arguments will retrieve a higher priority message before the remainder of a partially retrieved lower priority message is retrieved. Upon success, getpmsg() will also alter the len values in the strbuf structures pointed to by ctlbuf and datbuf and the integer values pointed to by bandp and flagp, as follows: The maxlen member is not altered on return. If the ctlptr or datptr a not NULL, and maxlen is not -1, the existence and length of the retrieved message is returned in the len member. If there is no control or data part retrieved, the len member of the corresponding strbuf structure is set to -1. If the control or data part retrieved is of zero-length, the control or data part is removed from the stream head read queue and the returned len is set to 0. If maxlen is greater than or equal to 0 and the number of bytes in the control or data part is greater than maxlen, only maxlen bytes are retrieved and the remaining bytes of the corresponding part are left on the stream head read queue. In the return value the corresponding more flag (MORECTL or MOREDATA) is set. The buf member is not altered on return. When the integer that flagp points to returns the flag MSG_BAND, the integer bandp points to returns the priority band of the retrieved message. For getpmsg() the integer pointed to by flagsp will contain one of the following values:
ERRORSUpon failure, getpmsg() will return -1 and set errno as follows:
Other errors may be returned by getpmsg(). If the protocol module sends a M_ERROR(9) message to the stream head, the error returned on all subsequent read operations, including getpmsg(), is specified in the M_ERROR(9) message by the protocol module. Which errors are returned under which conditions form part of the necessary documentation of the protocol module. NOTICESMulti-Threadinggetpmsg() is thread-safe; however, multiple threads performing concurrent partial reads on the same stream will interfere with each other. POSIX mandatory file locks, (see lockf(3)) can be used to avoid interference. Asynchronous I/OIf the file is set for blocking operation (see fcntl(2)), then getpmsg() will block waiting for a message to arrive on the stream head in the specified band. When the file is set for non-blocking operation, getpmsg() will not block, but will return the appropriate error number ([EBADMSG], [ERESTARTSYS], [EAGAIN], [EWOULDBLOCK]) if a message of the correct type and band was not immediately available for retrieval at the stream head.SEE ALSOintro(2), poll(2s), putmsg(2), read(2s), write(2s), streamio(7). BUGSCOMPATIBILITYgetpmsg() is compatible with SVID[1], XID[2], SUSv2[3], SUSv3[4], POSIX, and implementations based on SVR 4.2[5], including AIX®, HP-UX®, LiS, OSF/1®, Solaris®, SUPER-UX®, UnixWare®, UXP/V®. getpmsg() is compatible with LiS[6] with the following exceptions:
Linux Fast-STREAMS provides system calls for __NR_getpmsg and __NR_putpmsg that are used to implement this system call. (glibc has prototypes for this system call.) In addition, Linux Fast-STREAMS recognizes the ``invalid'' buffer length to read(2s) used by LiS to emulate the __NR_getpmsg system call, permitting LiS libraries to be used with Linux Fast-STREAMS. CONFORMANCESVID[1], XID[2], SUSv2[3], SUSv3[4], POSIX. HISTORYgetpmsg() first appeared in SVR 3[7]. REFERENCES
TRADEMARKS
Other trademarks are the property of their respective owners. IDENTIFICATION
Copyright©1997-2008OpenSS7 Corp.
All Rights Reserved.
Index
This document was created by man2html, using the manual pages. Time: 22:14:01 GMT, September 08, 2010 | ||||||||||||||||
| OpenSS7 SS7 for the Common Man |
| ||||||||||||||||
| Last modified: Sat, 01 Nov 2008 10:41:49 GMT © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. |