STREAMS-UX Programmer's Guide (February 2007)

STREAMS IOCTL Commands
Overview
Appendix A
144
[ETIME] Acknowledgement message not received at stream head before timeout.
The I_LINK IOCTL can also fail if an M_ERROR or M_HANGUP message is received at the stream head for fildes
before receiving the driver acknowledgement. In addition, an error can be returned in an M_IOCACK or
M_IOCNAK message. When these occur, the I_LINK IOCTL fails with errno set to the value in the message.
I_LIST
This command allows the user to list all the module names on the stream, up to and including the topmost
driver name. If arg is NULL, the return value is the number of modules, including the driver, that are on the
stream pointed to by fildes. This allows the user to allocate enough space for the module names. If arg is not
NULL, it should point to a str_list structure that has the following members:
int sl_nmods;
struct str_mlist *sl_modlist;
The str_mlist structure has the following member:
char l_name[FMNAMESZ+1];
The sl_nmods indicates the number of entries the user has allocated in the array. On success, the return
value is 0, sl_modlist contains the list of module names, and sl_nmods indicates the number of entries that
have been filled in.
On failure, the errno is set to one of the following values:
[EINVAL] The sl_nmods is less than 1.
[EAGAIN] Could not allocate buffers.
I_LOOK
This command retrieves the name of the module located just below the streams head of the stream pointed to
by fildes, and places it in a null terminated character string pointed at by arg. The buffer pointed to by arg
should be at least FNAMESZ+1 bytes long. A #include <stropts.h> declaration is required.
On failure, the errno is set to one of the following values:
[EINVAL] There are no modules in the stream.
[EFAULT] The arg points outside the allocated address space.
I_NREAD
Counts the number of data bytes in data blocks in the first message on the stream head read queue, and
places this value in the location pointed to by arg. The return value for the command is the number of
messages on the stream head read queue. For example, if zero is returned in arg, but the IOCTL return value
is greater than zero, this indicates that a zero-length message is next on the queue.
On failure, the errno is set to the following value:
[EFAULT] The arg is pointing outside the allocated address space.