| OpenSS7 SS7 for the Common Man | © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. Last modified: Sat, 01 Nov 2008 10:41:49 GMT | ||||||||||||||||
| |||||||||||||||||
| Manpage of GETMSGDescription: 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 compactpciGETMSGSection: Linux Fast-STREAMS System Calls (2)Updated: 2008-10-31 Index Return to Main Contents NAMEgetmsg - get next message off a streamSYNOPSIS#include <stropts.h>
ARGUMENTS
DESCRIPTIONgetmsg 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 getmsg(). 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. The arguments to getmsg() are interpreted as follows: fd specifies a file descriptor referencing an open stream. ctlptr a pointer to a strbuf structure which describes the area used to store the control part of the received message. datptr a pointer to a strbuf structure which describes the area used to store the data part of the received message. The strbuf structure 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. 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. For getmsg(), 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, getmsg() will fail and set errno to [EAGAIN] or [EWOULDBLOCK]. If the stream head is set for blocking operation, getmsg() 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, getmsg() will fail and set errno to EINTR. If a hangup occurs on the stream from which messages are to be retrieved, getmsg 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, getmsg() will return -1 and set errno as described under ``ERRORS'', below. Upon success, getmsg() will return a non-negative value with any of the following flags set:
getmsg() with the appropriate arguments will retrieve a higher priority message before the remainder of a partially retrieved lower priority message is retrieved. Upon success, getmsg() will also alter the len values in the strbuf structures pointed to by ctlbuf and datbuf and the integer value pointed to by flagp, as follows: The maxlen member is not altered on return. If the ctlptr or datptr are 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. The integer pointed to by flagsp will contain one of the following values:
ERRORSUpon failure, getmsg() will return -1 and set errno as follows:
Other errors may be returned by getmsg(). If the STREAMS module sends a M_ERROR(9) message to the stream head, the error returned on all subsequent read operations, including getmsg(), is specified in the M_ERROR(9) message by the STREAMS module. Which errors are returned under which conditions form part of the necessary documentation of the STREAMS module. NOTICESMulti-Threadinggetmsg() 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 getmsg() will block waiting for a message to arrive on the stream head. When the file is set for non-blocking operation, getmsg() will not block, but will return the appropriate error number ([EBADMSG], [ERESTARTSYS], [EAGAIN], [EWOULDBLOCK]) if a message of the correct type was not immediately available for retrieval at the stream head. SEE ALSOintro(2), poll(2s), putmsg(2), read(2s), write(2s), streamio(7). BUGSCOMPATIBILITYgetmsg() 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®. getmsg() 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. HISTORYgetmsg() 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: 10:19:56 GMT, May 21, 2013 | ||||||||||||||||
| OpenSS7 SS7 for the Common Man |
| ||||||||||||||||
| Last modified: Sat, 01 Nov 2008 10:41:49 GMT © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. |