streamio.7 (2010 09)

s
streamio(7) streamio(7)
NAME
streamio - STREAMS ioctl commands
SYNOPSIS
#include <sys/types.h>
#include <stropts.h>
int ioctl(int fildes, int command,
... /* arg */);
DESCRIPTION
STREAMS ioctl commands are a subset of the
ioctl() system calls which perform a variety of con-
trol functions on streams.
fildes is an open file descriptor that refers to a stream. command determines the control function to be
performed as described below. arg represents additional information that is needed by this command.
The type of arg depends upon the command, but it is generally an integer or a pointer to a command-
specific data structure. The command and arg are interpreted by the stream head. Certain combinations
of these arguments may be passed to a module or driver in the stream.
Since these STREAMS commands are a subset of
ioctl, they are subject to the errors described there.
In addition to those errors, the call will fail with
errno set to [EINVAL], without processing a control
function, if the stream referenced by fildes is linked below a multiplexor, or if command is not a valid
value for a stream.
Also, as described in
ioctl, STREAMS modules and drivers can detect errors. In this case, the module
or driver sends an error message to the stream head containing an error value. This causes subsequent
system calls to fail with errno set to this value.
The following
ioctl commands, with error values indicated, are applicable to all STREAMS files:
I_ATMARK Allows the user to see if the current message on the stream head read queue is
"marked" by some module downstream. arg determines how the checking is done
when there are multiple marked messages on the stream head read queue. It may
take the following values:
ANYMARK Checks if the message is marked.
LASTMARK Checks if the message is the last one that is marked on the queue.
If both
ANYMARK and LASTMARK are set, ANYMARK supersedes LASTMARK.
The return value is 1 if the mark condition is satisfied and 0 otherwise.
I_CANPUT Checks if a certain band is writable. arg is set to the priority band in question. The
return value is 0 if the priority band arg is flow controlled, 1 if the band is writable,
or 1 on error.
I_CKBAND Check if the message of a given priority band exists on the stream head read queue.
This returns 1 if a message of a given priority exists, or 1 on error. arg should be
an integer containing the value of the priority band in question.
I_FDINSERT Creates a message from user specified buffer(s), adds information about another
stream and sends the message downstream. The message contains a control part
and an optional data part. The data and control parts to be sent are distinguished
by placement in separate buffers, as described below.
arg points to a
strfdinsert structure which contains the following members:
struct strbuf ctlbuf;
struct strbuf databuf;
long flags;
int fildes;
int offset;
The len field in the ctlbuf strbuf structure (see putmsg(2)) must be set to the
size of a pointer plus the number of bytes of control information to be sent with the
message. fildes in the strfdinsert structure specifies the file descriptor of the
other stream. offset, which must be word-aligned, specifies the number of bytes
beyond the beginning of the control buffer where I_FDINSERT will store a pointer.
This pointer will be the address of the read queue structure of the driver for the
streams corresponding to fildes in the strfdinsert structure. The len field in
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (10 pages)