| OpenSS7 SS7 for the Common Man | © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. Last modified: Sat, 01 Nov 2008 10:41:51 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 compactpciSTREAMIOSection: Linux Fast-STREAMS Protocols (7)Updated: 2008-10-31 Index Return to Main Contents NAMEstreamio - STREAMS ioctl commandsSYNOPSIS#include <sys/types.h>
DESCRIPTIONSTREAMS
STREAMS I/O control commands are invoked using the normal ioctl(2s) system call, but are defined only for STREAMS character special files.
IOCTLSI_ATMARKChecks whether the next messages on the stream head read queue is marked. arg is an integer value indicating which messages to check as follows:
Marked messages are messages that have the MSGMARK flag set in the message b_flag field. Upon success, I_ATMARK returns (0) to indicate that the stream head read queue does not meet the mark criteria, or (1) to indicate that it meets the mark criteria. Upon failure, I_ATMARK returns -1 and sets errno(3) to an appropriate error number as follows:
Solaris®[1] also uses the MSGNEXTMARK and MSGNOTNEXTMARK flags on the message blocks; but their use is undocumented. AIX®[2] indicates that it is permissible for arg to be the inclusive OR of the ANYMARK and LASTMARK flags. HP-UX®[3] indicates that if both ANYMARK and LASTMARK are set, ANYMARK supersedes LASTMARK. UnixWare®[4] indicates that the bitwise-OR of ANYMARK and LASTMARK is allowed and that, if both are set, ANYMARK supersedes LASTMARK. I_CANPUTChecks whether messages can be written to the queue band specified by arg. arg is an integer which contains the queue band to test for flow control. Linux Fast-STREAMS adds the extension that arg can also be one of the following values:
Upon success, retval is false (0) if the queue band arg is flow controlled, true (1) if the queue band is not flow controlled. Upon failure, retval is -1 and errno(3) is set to one of the following errors numbers:
Any of the errors returned by putpmsg(2s) may be returned in errno. Any error received in an M_ERROR(9) message indicating a write error for the stream will be returned in errno. (See also ERRORS below.) I_CKBANDChecks whether messages can be read from the queue band specified by arg. arg is an integer which contains the queue band to test for an available message. Upon success, I_CKBAND returns false (0) if there is no message for the specified queue band arg available, and true (1) if a message for the specified queue band arg is available to be read with read(2) or getmsg(2). Upon failure, I_CKBAND returns -1 and errno(3) is set to one of the following error numbers:
Any of the errors returned by getpmsg(2s) may be returned in errno. Any error received in an M_ERROR(9) message indicating a read error for the stream will be returned in errno. (See also ERRORS below.) I_FDINSERTThis command performs similar to putmsg(2), however, it performs the additional function of inserting the bottom read queue pointer associated with a specified file descriptor in the resulting message. This ioctl is often used to accepting incoming connections on tpi(7) based protocols. arg is a pointer to a strfdinsert structure that is formatted as follows:
struct strfdinsert {
struct strbuf ctlbuf;
struct strbuf databuf;
ulong flags;
int fildes;
int offset;
};
Upon success, I_FDINSERT returns zero (0). Upon failure, I_FDINSERT returns -1 and sets errno(3) to one of the following error numbers:
Any of the errors returned by putpmsg(2s) may be returned in errno. Any error received in an M_ERROR(9) message indicating a write error for the stream will be returned in errno. (See also ERRORS below.) I_FINDChecks whether the specified module is currently present in the stream specified by fd. arg is a pointer to a string which provides the name of the module to find. Upon success, I_FIND returns true (1) if the module is present in the stream under the name arg, and returns false (0) if the module is not present in the stream. Upon failure, I_FIND returns -1 and sets errno(3) to an appropriate error number as follows:
I_FLUSHBANDFlushes the stream for a specified band. arg points to a bandinfo structure formatted as follows:
struct bandinfo {
unsigned char bi_pri;
int bi_flag;
};
bi_pri specifies the priority of the band to flush. bi_flag specifies which queues to flush and has one of the following values:
Note that on a bare STREAMS-based pipe(4), specifying FLUSHR will flush the read queues at both ends of the pipe, and FLUSHW will flush the write queues at both ends of the pipe. FLUSHRW will still flush both queues. This is expected behaviour for bare STREAMS-based pipes (that is, pipes that have no modules pushed on either end). For the I_FLUSH command to flush the proper queues in modules pushed on a STREAMS-based pipe, pipemod(4) must be pushed onto one end of the pipe before pushing any other modules. Pushing pipemod(4) will also reverse the effect that FLUSHR and FLUSHW have on the opposite STREAM head: FLUSHR flushes the near read queue and the far write queue, FLUSHW flushes the near write queue and the far read queue. See pipemod(4) for details. Upon success, I_FLUSHBAND returns zero (0). Upon failure, I_FLUSHBAND returns -1 and sets errno(3) to an appropriate error number as follows:
I_FLUSHFlushes the stream. arg is an integer containing one of the following flags:
Note that on a bare STREAMS-based pipe(4), specifying FLUSHR will flush the read queues at both ends of the pipe, and FLUSHW will flush the write queues at both ends of the pipe. FLUSHRW will still flush both queues. This is expected behaviour for bare STREAMS-based pipes (that is, pipes that have no modules pushed on either end). For the I_FLUSH command to flush the proper queues in modules pushed on a STREAMS-based pipe, pipemod(4) must be pushed onto one end of the pipe before pushing any other modules. Pushing pipemod(4) will also reverse the effect that FLUSHR and FLUSHW have on the opposite STREAM head: FLUSHR flushes the near read queue and the far write queue, FLUSHW flushes the near write queue and the far read queue. See pipemod(4) for details. Upon success, I_FLUSH returns zero (0). Upon failure, I_FLUSH returns -1 and sets errno(3) to an appropriate error number as follows:
I_GETBANDGets the priority band associated with the next message on the stream head read queue. arg is a pointer to an integer to receive the band number. Upon success, I_GETBAND returns (0) and places the band associated with the next message on the stream head read queue into the integer pointed to by arg. Upon failure, I_GETBAND returns -1 and sets errno(3) to an appropriate error number as follows:
Any of the errors returned by getpmsg(2s) may be returned in errno. Any error received in an M_ERROR(9) message indicating a read error for the stream will be returned in errno. (See also ERRORS below.) I_GETCLTIMEGets the close delay time (in milliseconds) associated with the stream head. arg points to an int to receive the delay. Upon success, I_GETCLTIME returns zero (0) and the close delay time in the int pointed to by arg. Upon failure, I_GETCLTIME returns -1 and sets errno(3) to an appropriate error number as follows:
I_GETSIGGets a bitmask of the events for which the calling process is registered to be sent a SIGPOLL signal. arg points to an integer into which will be returned the bit mask. The bit mask returned in the integer pointed to by arg will contain a bitwise OR of one or more of the following flags:
Upon success, I_GETSIG returns (0) and the event bit mask in the integer pointed to by arg. Upon failure, I_GETSIG returns -1 and sets errno(3) to an appropriate error number as follows:
I_SRDOPTSets the read(2s) options flags for the stream head. These flags alter the behaviour of the read(2s) call when called for fd. arg is an integer value containing the read options flags which may be one flag from the mode group as follows:
bitwise OR'ed with one flag from the protocol group as follows:
Note: Although all modes terminate the read on a zero-length message, POSIX requires that zero only be returned from read when the requested length is zero or an end of file (M_HANGUP(9)) has occurred. Therefore, LfS[6] only returns on a zero-length message if some data has been read already. I_GRDOPTGets the read options flags for the stream head. arg is a pointer to an integer to receive the stream head read options. The integer pointed to by arg will return one flag from the following mode flags:
bitwise OR'ed with one flag from the following protocol flags:
Upon success, I_GRDOPT returns zero (0) and the read options flags in the integer pointed to by arg. Upon failure, I_GRDOPT returns -1 and sets errno(3) to an appropriate error number as follows:
I_SWROPTSets the write(2s) options flags for the stream head. These flags alter the behaviour of the write(2) and putmsg(2) calls when called for fd. arg is an integer value containing the write options flags which may be one or more flags from the following:
I_GWROPTGets the write options flags for the stream head. arg is a pointer to an integer to receive the stream head write options. The integer pointed to by arg will return zero or more flags from the following flags: (These flags alter the operations of write(2) and putmsg(2) on a STREAMS character special file.)
Upon success, I_GWROPT returns zero (0) and the write options flags in the integer pointed to by arg. Upon failure, I_GWROPT returns -1 and sets errno(3) to an appropriate error number as follows:
I_SERROPTSets the error options flags for the stream head. These flags alter the behavior of system calls in response to the receipt of an M_ERROR(9) message at the stream head when called for fd. arg is an integer value containing the error option flags which may be one flag controlling the read error behaviour from the following:
and one flag controlling the write error behaviour from the following:
Upon success, I_SERROPT returns zero (0) and the error options flags are set according to the value in arg. Upon failure, I_SERROPT returns -1 and sets errno(3) to an appropriate error number as follows:
I_GERROPTGets ther error options flags for the stream head. arg is a pointer to an integer to receive the stream head error options. The integer pointed to by arg will return one flag from the following flags: (These flags alter the operations of read errors in return to system calls.)
and one flag from the following flags: (These flags alter the operations of the write errors in return to system calls.)
Upon success, I_GERROPT returns the error options flags in the integer pointed to by arg. Upon failure, I_GERROPT returns -1 and sets errno(3) to an appropriate error number as follows:
I_LINKLinks one Stream under the multiplexing driver on stream fd. arg is the integer file descriptor of the stream to link under fd. This call is passed as an I_STR ioctl using an M_IOCTL(9) down the stream head write queue to be processed by the multiplexing driver on fd. I_LINK will block until an acknowledgement is received from the driver, the call times out waiting for an acknowledgement, the call is interrupted while blocked by a signal, or the receipt of hangup or error message. Upon success, I_LINK returns a positive integer representing the multiplex identifier of the lower stream. This value can be subsequently used in a I_UNLINK command. Upon failure, I_LINK returns -1 and sets errno(3) to an appropriate error number as follows:
In addition, any error received in an error message will be returned in errno. Also, any error returned by the module or driver in an ioctl positive or negative acknowledgement message will also be returned in errno. I_LISTList all of the modules pushed on the stream specified by fd. arg is a pointer to a str_list structure to place the module names as follows:
struct str_list {
int sl_nmods;
struct str_mlist *sl_modlist;
};
sl_nmods indicates the number of str_mlist structures the array pointed to by sl_modlist. sl_modlist points to a list of str_mlist structures formatted as follows:
struct str_mlist {
char l_name[FMNAMESZ + 1];
};
If arg is NULL, I_LIST will return a positive integer retval indicating the number of modules, including the driver, on stream fd. This can be used to determine the number of module and driver names before passing the str_list structure. I_LIST only lists sl_nmods number of modules and drivers starting with the module below the stream head. If there is an insufficient number of members in the sl_modlist array to hold all of the names, I_LIST will success, but will return only the number of names in the space provided. Upon success, I_LIST returns zero (0) and the module and driver names in the passed in str_list and str_mlist structures, or, when arg is NULL, returns a positive integer indicating the number of modules plus the driver on the stream fd. Upon failure, I_LIST returns -1 and sets errno(3) to an appropriate error number as follows:
I_LOOKGets the name of the first module beneath the stream head. arg is a pointer to a character string buffer to accept the name. This buffer must be at least (FNAMESZ + 1) in length. Upon success, I_LOOK copies the name of the module beneath the stream head to the buffer pointed to by arg. Upon failure, I_LOOK returns -1 and sets errno(3) to an appropriate error number as follows:
I_NREADGets the number of unread data bytes contained in M_DATA(9) message blocks in the first message on the stream head read queue. arg points to an integer to contain the number of unread bytes. Upon success, I_NREAD returns zero (0) or a positive integer indicating the number of messages on the stream head read queue. Upon failure, I_NREAD returns -1 and sets errno(3) to an appropriate error number as follows:
I_PEEKPeeks at the next message on the stream head read queue without removing the message from the queue. arg is a pointer to a strpeek structure formatted as follows:
struct strpeek {
struct strbuf ctlbuf;
struct strbuf databuf;
long flags;
};
Upon success, I_PEEK returns zero (0) if there was no message on the stream head read queue, and returns one (1) and the retrieved message in the structure pointed to by arg, if there was a message on the stream head read queue. Upon failure, I_PEEK returns -1 and sets errno(3) to an appropriate error message as follows:
In addition, I_PEEK can return any errno(3) returned by getmsg(2). See getmsg(2). I_PLINKLinks on stream under the multiplexing driver on stream fd. arg is the integer file descriptor of the stream to link under fd. This call is passed as an I_STR ioctl using an M_IOCTL(9) down the stream head write queue to be processed by the multiplexing driver on fd. I_PLINK will block until an acknowledgement is received from the driver, the call times out waiting for an acknowledgement, the call is interrupted while blocked by a signal, or the receipt of hangup or error message. Upon success, I_PLINK returns a positive integer representing the multiplex identifier of the lower stream. This value can be subsequently used in a I_PUNLINK command. Upon failure, I_PLINK returns -1 and sets errno(3) to an appropriate error number as follows:
In addition, any error received in an error message will be returned in errno. Also, any error returned by the module or driver in an ioctl positive or negative acknowledgement message will also be returned in errno. I_POPPops the STREAMS module just beneath the stream head from fd. arg is ignored. Upon success, I_POP pops the moudule beneath the stream head by calling qdetach(9) and returns (0). Upon failure, I_POP returns -1 and sets errno(3) to an appropriate error number as follows:
See qdetach(9) for more information. I_PUNLINKUnlink a stream from under a multiplexing driver that was previously linked with I_PLINK. arg is the multiplexer identifier of the linked stream, or, MUXID_ALL indicating that all linked streams are requested to be unlinked. When MUXID_ALL is specified, all streams previously linked under the multiplexing driver with I_PLINK will be unlinked. This call is passed as an I_STR ioctl using an M_IOCTL(9) down the stream head write queue to be processed by the multiplexing driver on fd. I_PUNLINK will block until an acknowledgement is received from the driver, the call times out waiting for an acknowledgement, the call is interrupted while blocked by a signal, or the receipt of hangup or error message. Upon success, I_PUNLINK returns zero (0) and unlinks the specified stream(s). Upon failure, I_PUNLINK returns -1 and sets errno(3) to an appropriate error number as follows:
In addition, any error received in a error message will be returned in errno. Also, any error returned by the module or driver in a ioctl positive or negative acknowledgement message will also be returned in errno. I_PUSHPushes a STREAMS module by name on the stream specified by fd. arg is a pointer to a string that contains the name of the module to push. Upon success, I_PUSH pushes the named module and returns zero (0). Upon failure, I_PUSH returns -1 and sets errno(3) to an appropriate error number as follows:
In addition, any error returned by the module's qopen(9) function may be returned by I_PUSH. See qattach(9) and qopen(9) for more information. I_ANCHORRequests that an anchor be placed at the position beneath the stream head. When an anchor is placed, modules beneath the anchor point can no longer be popped from the stream by non-privileged processing using I_POP. Modules can still be pushed and popped above the anchor by non-privileged processes. If an anchor already exists, the anchor is moved. arg is ignored and should be set to zero (0). Upon success, I_ANCHOR places the anchor and returns zero. Upon failure, I_ANCHOR returns -1 and sets errno(3) to an appropriate error number as follows:
I_RECVFDarg is a pointer to a strrecvfd structure formatted as follows:
struct strrecvfd {
int fd;
uid_t uid;
gid_t gid;
...
};
In the strrecfd structure, fd is the file descriptor received, and uid and gid are the credentials associated with the file descriptor. Upon success, I_RECVFD returns zero (0) and the completed strrecvfd structure. Upon failure, I_RECVFD returns -1 and sets errno(3) to an appropriate error number as follows:
I_SENDFDSends a file descriptor to the other end of a pipe. arg is the integer file descriptor to send. Upon success, I_SENDFD returns (0). Upon failure, I_SENDFD returns -1 and sets errno(3) to an appropriate error number as follows:
I_SETCLTIMESets the closing delay time for the stream head. arg points to an int that specifies the delay time in milliseconds. Upon success, I_SETCLTIME returns zero (0) and sets the close delay time for fd. Upon failure, I_SETCLTIME returns -1 and sets errno(3) to an appropriate error number as follows:
I_SETSIGSets the mask of events for which the stream head will send the calling process a SIGPOLL or SIGURG signal. arg is an integer value contains one or more of the following event flags:
I_STRGenerates an internal STREAMS ioctl message and places it on the stream head's write queue for processing by the module or driver and returns the response. arg is a pointer to a strioctl structure formatted as follows:
struct strioctl {
int ic_cmd;
int ic_timout;
int ic_len;
char *ic_dp;
};
I_STR generates an M_IOCTL(9) message an passes it downstream to the module or driver and blocks until a positive or negative acknowledgement is received, the command times out, an hangup or error message is received by the stream head, or a signal is received. Upon success, I_STR returns the return value specified in the positive or negative acknowledgement message. Upon failure, I_STR returns -1 and sets errno(3) to an appropriate error number as follows:
In addition, I_STR can return any errno(3) placed in an error message received by the stream head, or placed in the positive or negative acknowledgement message by the module or driver. I_UNLINKUnlink a stream from under a multiplexing driver that was previously linked with I_LINK. arg is the multiplexer identifier of the linked stream, or, MUXID_ALL indicating that all linked streams are requested to be unlinked. When MUXID_ALL is specified, all streams previously linked under the multiplexing driver with I_LINK for the specified control stream, fd, will be unlinked. This call is passed as an I_STR ioctl using an M_IOCTL(9) down the stream head write queue to be processed by the multiplexing driver on fd. I_UNLINK will block until an acknowledgement is received from the driver, the call times out waiting for an acknowledgement, the call is interrupted while blocked by a signal, or the receipt of hangup or error message. Upon success, I_UNLINK returns zero (0) and unlinks the specified stream(s). Upon failure, I_UNLINK returns -1 and sets errno(3) to an appropriate error number as follows:
In addition, any error received in a error message will be returned in errno. Also, any error returned by the module or driver in a ioctl positive or negative acknowledgement message will also be returned in errno. RETURN VALUEUpon success, ioctl() returns zero (0) or a positive integer. Upon failure, ioctl() returns -1 and sets errno(3) to an appropriate error number. ERRORSWhen ioctl() fails, it returns -1 and sets errno(3) to one of the following errors:
Any error delivered to the stream head in an M_ERROR(9) message can be returned in errno(3). Where the command is passed to the module or driver, or the command results in the call to a module or driver open or close procedures, or link or unlink procedures, the error number returned by the module or driver open or close procedure can be returned in errno(3). Any error returned in an M_IOCNAK(9) message from the driver in response to a I_STR ioctl can be returned in errno(3). NOTICESSTREAMS ioctl() calls are complex and there is much conflicting documentation in specific areas of behaviour. Not all bugs are bugs and not all features are features. SEE ALSOclose(2), fcntl(2), getmsg(2), ioctl(2s), open(2s), open(2s), poll(2s), putmsg(2), read(2s), signal(2), signal(5), write(2s), qopen(9), qclose(9), qattach(9), qdetach(9). STREAMS(9) input-output control commands are also documented individually in the following manual pages: I_ATMARK(7), I_CANPUT(7), I_CKBAND(7), I_FATTACH(7), I_FDETACH(7), I_FDINSERT(7), I_FIND(7), I_FLUSH(7), I_FLUSHBAND(7), I_GETBAND(7), I_GETCLTIME(7), I_GETPMSG(7), I_GETSIG(7), I_GRDOPT(7), I_GWROPT(7), I_ISASTREAM(7), I_LINK(7), I_LIST(7), I_LOOK(7), I_NREAD(7), I_PEEK(7), I_PIPE(7), I_PLINK(7), I_POP(7), I_PUNLINK(7), I_PUSH(7), I_PUTPMSG(7), I_RECVFD(7), I_SENDFD(7), I_SETCLTIME(7), I_SETSIG(7), I_SRDOPT(7), I_STR(7), I_SWROPT(7), I_UNLINK(7). Linux Fast-STREAMS also supports some Solaris® specific STREAMS(9) input-output controls for compatibility with Solaris®. These are documented in separate manual pages as follows: I_SERROPT(7), I_GERROPT(7), I_ANCHOR(7), I_ESETSIG(7), I_EGETSIG(7). If your GNU/Linux distribution is equipped with OpenGroup POSIX/SUSv3 manual pages, see also ioctl(3p). BUGSstreamio has no known bugs. STREAMS ioctl() calls are complex and there is much conflicting documentation in specific areas of behaviour. Not all bugs are bugs and not all features are features. COMPATIBILITYstreamio is compatible with SVR 4.2[7], Solaris®, UnixWare® and LiS[8], with the following portability considerations:
CONFORMANCESVID[14], XID[15], SUSv2[13], SUSv3[16], POSIX. Conformance is tested using the test-streams(8) test case executable and the Linux Fast-STREAMS autotest test suite. HISTORYioctl() for STREAMS first appeared in SVR 3[11]. 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: 15:09:33 GMT, May 23, 2013 | ||||||||||||||||
| OpenSS7 SS7 for the Common Man |
| ||||||||||||||||
| Last modified: Sat, 01 Nov 2008 10:41:51 GMT © Copyright 1997-2007 OpenSS7 Corporation All Rights Reserved. |