| 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 PUTMSGDescription: 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 compactpciPUTMSGSection: Linux Fast-STREAMS System Calls (2)Updated: 2008-10-31 Index Return to Main Contents NAMEputmsg - put a message to a STREAMS character deviceSYNOPSIS#include <stropts.h>
ARGUMENTS
DESCRIPTIONputmsg() generates a STREAMS message from the buffer supplied in the specified ctlptr and datapr and with options specified by flags and delivers the message to the stream head associated with the STREAMS character special file fd. The resulting STREAMS message can contain a control part as specified by ctlptr, a data part as specified by datptr, or both. The control part, when present, will generate M_PROTO or M_PCPROTO message blocks. The data part, when present, will generate M_DATTA message blocks. When both control and data parts are present, an M_PROTO or M_PCPROTO message block followed by one or more M_DATA message blocks will be generated. fd is an open file descriptor for the STREAMS character special file to which the STREAMS message is to be written. ctlptr and datptr point to a strbuf structure, which contains the following members:
struct strbuf {
int maxlen; /* Maximum buffer length. */
int len; /* Length of data. */
char *buf; /* Pointer to buffer. */
};
ctlptr points to a strbuf structure describing the control part to be included in the message, or NULL if there is no control part. The buf member of the strbuf structure pointed to by ctlptr indicates the start of the information to sent in the control part, and the len member indicates the length of the information for the control part. datptr points to a strbuf structure describing the data part to be included in the message, or NULL is there is no data part. The buf member of the strbuf structure pointed to by ctlptr indicates the start of the information to sent in the data part, and the len member indicates the length of the information for the data part. len can be zero (0) to send zero-length data. flags specifies whether to send a high priority message or a normal priority message. flags can be one of the following values:
When the O_NONBLOCK(or O_NDELAY) file flag is clear, putmsg() blocks for normal priority messages (ones for which flags is set to zero (0)) when the stream cannot accept data (the stream write queue is full due to internal flow conditions). For normal priority messages (ones for which flags is set to zero (0)), when the O_NONBLOCK(or O_NDELAY) file flag is set, and the stream cannot accept data (the stream write queue is full due to internal flow conditions), putmsg() will fail, return minus one (-1) and set the global error number, errno(3) to [EAGAIN] (or [EWOULDBLOCK]). When the stream head is set for old TTY semantics for O_NDELAY, and the O_NDELAY(or O_NONBLOCK) file flag is clear, putmsg() blocks for normal priority messages (ones for which flags is set to zero (0)) when the stream cannot accept data (the stream write queue is full due to internal flow conditions). For normal priority messages (ones for which flags is set to zero (0)), when the O_NDELAY(or O_NONBLOCK) file flag is set, and the stream cannot accept data (the stream write queue is full due to internal flow conditions), putmsg() will terminate and return zero (0). For high priority messages (ones for which flags is set to RS_HIPRI), putmsg() will neither block nor fail on flow control conditions, regardless of the stream head O_NDELAY semantics, or the setting of O_NDELAY or O_NONBLOCK. Unlike write(2s) or writev(2s), putmsg(), unless prevented by the lack of internal STREAMS resources, blocks awaiting the availability of message blocks to service the request, regardless of the stream head O_NDELAY semantics or the settings of the O_NDELAY or O_NONBLOCK file flags. This is necessary because no partial messages will be written by putmsg(). When prevented by the lack of internal STREAMS resources, putmsg() will fail, return minus one (-1) and set the global error number, errno(3), to [ENOSR]. STREAMS Semantics for O_NDELAYWhen O_NDELAY (or O_NONBLOCK) is set, putmsg() will fail, return minus one (-1) and set the global error number, errno(3), to [EAGAIN] if flow control is in effect when the call is received. It will block, unless prevented by lack of internal STREAMS resources, awaiting the availability of message buffers. When O_NDELAY (or O_NONBLOCK) is clear, putmsg() will block on flow control and, unless prevented by the lack of internal STREAMS resources, will block if buffers are not available. Old TTY Semantics for O_NDELAYRegardless of the setting of O_NDELAY (or O_NONBLOCK), putmsg() will block on flow control and, unless prevented by lack of internal STREAMS resources, will also block on the availability of message buffers. STREAMS-base Pipes and FIFOsRETURN VALUEUpon success, putmsg() returns zero (0). Upon failure, putmsg() returns minus one (-1) and sets the global error number, errno(3) to an appropriate error number. ERRORSWhen putmsg() fails, it returns minus one (-1) and sets the global error number, errno(3), to one of the following:
Other errors may be returned by putmsg(). If the protocol module sends an M_ERROR message to the stream head, the error returned on all subsequent write operations, including putsmg(), is specified in the M_ERROR message by the protocol module. Which errors are returned under what conditions form part of the necessary documentation of the protocol module. NOTICESMulti-Threadingputmsg() is thread-safe. Because putmsg() does not allow partial writes (unlike write(2s)), POSIX mandatory locks (see lockf(3)) are not necessary to make write operations atomic. Asynchronous I/OIf the file is set for blocking operation (see fcntl(2)), or old TTY semantics for O_NDELAY are set for the stream head, putmsg() will block waiting for the stream to permit sending messages under flow control. When the file is set for non-blocking operation, and the stream is set for STREAMS semantics for O_NDELAY, putmsg() will not block, but will fail, return minus one (-1), and populate the global error number, errno(3) with [EAGAIN]. Regardless of the stream head semantics for O_NDELAY, or the setting of the O_NDELAY and O_NONBLOCK file flags, for high priority messages (for which flags is set to RS_HIPRI), putmsg() will not block on flow control, because STREAMS flow control conditions do not apply to high priority messages. Regardless of the stream head semantics for O_NDELAY, or the setting of the O_NDELAY and O_NONBLOCK file flags, putmsg() will block, unless prevented by lack of internal STREAMS resources, awaiting the availability of message blocks to complete the operation. When prevented from blocking due to a lack of internal STREAMS resources, putmsg() wil fail, return minus one (-1), and set the global error number, errno(3) to [ENOSR]. IMPLEMENTATIONWhen an implementation returns [ENOSR] is not clear. An implementation that uses bufcall(9) to implement waiting for the availability of message blocks might fail allocate a bufcall(9) callback due to the unavailability of STREAMS resources. That is, a call to bufcall(9) to create a buffer callback fails and returns zero (0), leaving the implementation little option but to return [ENOSR]. Linux Fast-STREAMS uses a different approach, utilizing the non-standard BPRI_WAITOK flag to allocb(9). This permits the stream head to block awaiting the availability of message blocks without ever failing due to lack of internal STREAMS resources. Therefore, Linux Fast-STREAMS will not return [ENOSR], but will block indefinitely awaiting the availability of a message block. SEE ALSOintro(2), poll(2s), putmsg(2), write(2s), streamio(7). BUGSCOMPATIBILITYputmsg() is compatible with SVID[1], XID[2], SUSv2[3], SUSv3/POSIX[4], and implementations based on SVR 4.2[5], including AIX®, HP-UX®, IRIX®, LiS, MacOT®, OSF/1®, Solaris®, SUPER-UX®, UnixWare®, UXP/V®, with the following compatibility considerations:
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 write(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/POSIX[4]. HISTORYputmsg() 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: 12:32:29 GMT, May 18, 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. |