HPUX streamio[7]






 streamio(7)                                                     streamio(7)





 NAME
      streamio - STREAMS ioctl commands

 SYNOPSIS
      #include <sys/types.h>
      #include <stropts.h>

      int ioctl( int fildes, int command, [void arg ])

 DESCRIPTION
      The STREAMS ioctl commands perform control operations on streams.
      User processes can use these commands on all STREAMS file types.

      When the stream head receives a STREAMS ioctl function, it interprets
      the command parameter and optional arg parameter, when specified, into
      an M_IOCTL message.  In some cases, the command and optional arg
      parameters are passed onto a module or driver in the stream.

      The modules or drivers in a stream can detect errors in the ioctl
      command.  When they do, they send an error message containing an error
      number to the stream head.  Subsequent calls to functions fail with
      errno set to this number.

    Parameters
      fildes         Contains the open file descriptor for the stream to be
                     operated on.

      command        Specifies the STREAMS ioctl() command function to be
                     performed on the stream.

      arg            Contains additional information that the specified
                     command may need for performing its function. This is
                     usually an integer or a pointer to a command-specific
                     structure, but must be of the type required for the
                     specific command.

    ioctl Commands
      The STREAMS ioctl commands are the following:

           I_ATMARK       Lets the user process determine whether the
                          message currently on the stream head read queue is
                          marked by a downstream module.  A message is
                          marked when its b_flag field has MSGMARK ORed in
                          by a module/driver.  The arg field specifies how
                          the checking is done when there are multiple
                          marked messages on the queue.  Acceptable values
                          of arg are:

                               ANYMARK        Checks if the message is
                                              marked.




 Hewlett-Packard Company            - 1 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                               LASTMARK       Checks if the message is the
                                              last one that is marked on the
                                              queue.

                          The command returns a value of 1 if the mark
                          condition is satisfied; otherwise, a 0 (zero) is
                          returned.

           I_CANPUT       Checks if the specified priority band is currently
                          writeable.  The arg parameter specifies the
                          priority band to check.

                          The command returns a value of 0 (zero) if the
                          priority band is being flow controlled; otherwise,
                          a value of 1 is returned.

           I_CKBAND       Checks if a priority band message is currently on
                          the stream head read queue.  The arg parameter
                          specifies the priority band being checked.

                          If a message of the priority band is on the stream
                          head read queue, the command returns a value of 1;
                          otherwise, a value of 0 (zero) is returned.

           I_FDINSERT     Creates a message from one or more user specified
                          buffers, includes information about another
                          stream, and sends the message downstream.  The
                          message contains a control part and a data part
                          (which is optional).  These parts are placed in
                          separate buffers, ctlbuf and databuf.  These
                          buffers are contained in an strfdinsert structure
                          (defined in the <stropts.h> header file), whose
                          members are as follows:

                               struct strbuf      ctlbuf;
                               struct strbuf      databuf;
                               long               options;
                               int                fildes;
                               int                offset;

                          The strbuf structure pointed to by ctlbuf and
                          databuf has the following members:

                               int    maxlen;
                               int    len;
                               char   *buf

                          The len field of the strbuf structure for ctlbuf
                          must specify the size of a pointer, plus the
                          number of information control bytes to be sent in
                          the message.



 Hewlett-Packard Company            - 2 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                          The fildes field in the strfdinsert structure
                          specifies the file descriptor of the stream to
                          which the message will be sent.

                          The offset field needs to be properly aligned.
                          This field specifies the number of bytes after the
                          beginning of the control buffer where the
                          I_FDINSERT command will store a pointer.  This
                          pointer is the address of the read queue of the
                          device driver for the stream designated by fildes
                          in the strfdinsert structure.

                          The len field in the strbuf structure for databuf
                          must contain the number of bytes of data
                          information to be sent with the message, or 0
                          (zero) if no data part is to be sent.

                          The options field specifies the type of message to
                          be created.  When this field contains 0 (zero),
                          the I_FDINSERT command creates an ordinary
                          message.  When the field is set to RS_HIPRI, the
                          I_FDINSERT command creates a high priority
                          message.  This command will block for an ordinary
                          message if the named stream's read queue is full
                          because of internal flow control conditions.  It
                          will not block on these conditions for a high
                          priority message.  For ordinary messges, the ioctl
                          will not block when the write queue is full and
                          O_NDELAY or O_NONBLOCK (see open(2) or fcntl(2) )
                          is specified.  It will fail instead.

           I_FIND         Compares the names of all modules currently
                          present on the stream to the name specified in
                          arg.  The command returns a value of 1 if the
                          module is present and a value of 0 (zero) if the
                          the module is not present.

           I_FLUSH        Flushes the read and write queues of the stream
                          head and all of the modules and drivers on the
                          stream, according to the value of arg.  The arg
                          parameter value can specify one of the following
                          operations:

                               FLUSHRW        Flushes write and read queues.

                               FLUSHW         Flushes write queues.

                               FLUSHR         Flushes read queues.

           I_FLUSHBAND    Flushes a band of messages.  The band of messages
                          to be flushed is defined in the bandinfo structure



 Hewlett-Packard Company            - 3 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                          pointed to by arg.  This structure (in the
                          <stropts.h> header file) has the following
                          members:

                               unsigned char     bi_pri:
                               int               bi_option;

                          The value of the bi_option field can be FLUSHR,
                          FLUSHW, or FLUSHRW, as described for the I_FLUSH
                          command.

           I_GETBAND      Returns the priority of the first message on the
                          stream head read queue.  The priority is returned
                          as an integer in the arg parameter.

           I_GETCLTIME    Returns the time delay for closing a stream (see
                          the I_SETCLTIME ioctl command).  The time value is
                          returned in the long pointed to by arg.  This
                          value may, or may not, have been set by a
                          previously issued I_SETCLTIME ioctl.

           I_GETSIG       Returns the events for which the calling process
                          has registered to receive a SIGPOLL signal.
                          Events are returned as in arg bitmask as defined
                          for the I_SETSIG command.

           I_GRDOPT       Returns the current read mode setting of the
                          stream (see read(2)) in an integer pointed to by
                          arg.

           I_GWROPT       Returns the current write mode setting for a
                          stream in the integer pointed to by arg.  See the
                          I_SWROPT command for a description of write modes.

           I_LINK         Connects two streams: the file descriptor of the
                          stream associated with the multiplexing driver
                          (where fildes is the file descriptor) and the
                          stream associated with another driver (where arg
                          is the file descriptor).  The stream referred to
                          by arg is connected below the multiplexing driver.

                          The I_LINK ioctl requires a multiplexing driver to
                          send an acknowledgement message (M_IOCACK or
                          M_IOCNAK) to the stream head about the linking
                          operation.  Upon successful completion, the call
                          returns a multiplexor ID number, which is an
                          identifier that is used to disconnect the link
                          (see the I_UNLINK command).  If the request fails,
                          a value of -1 is returned.





 Hewlett-Packard Company            - 4 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           I_LIST         Lets the user process list the names of all the
                          modules present on a stream.  This includes the
                          names up to and including the topmost driver name.
                          If the arg parameter is a null value, the command
                          returns the number of modules, plus the driver,
                          which are present on the stream referred to by
                          fildes.  The user can use this information to
                          allocate enough space for the module and driver
                          names in user space.  If the arg parameter is not
                          a null value, its value should point to an
                          str_list structure (in the <stropts.h> header
                          file), with the following members:

                               int       sl_nmods;
                               struct    str_mlist   *sl_modlist;

                          The str_mlist structure (also in the <stropts.h>
                          header file) has the following member:

                               char    l_name[FMNAMESZ+1];

                          The sl_nmods field of the str_list structure
                          indicates the number of entries that the user
                          process has allocated in the array pointed to be
                          the sl_modlist field.  On return, the array
                          pointed to by the sl_modlist field contains the
                          list of module names.

                          The return value for the I_LIST ioctl indicates
                          the number of entries that have been filled in the
                          array.

           I_LOOK         Retrieves the name of the module located just
                          below the stream head, placing it in a null
                          terminated character string pointed to by arg.
                          The stream is referred to by fildes.  The arg
                          parameter should point to a buffer, whose size is
                          at least FMNAMESZ + 1 bytes.  The <stropts.h> file
                          contains the definition for FMNAMESZ.

           I_NREAD        Counts the bytes in the data blocks of the first
                          message on the stream head read queue.  This
                          command places this value in the location pointed
                          to by arg.  The command returns the number of
                          messages on the queue.  For example, if the
                          command call results in a value of 0 (zero) in
                          arg, but a return value greater than 0 (zero) is
                          returned by the ioctl() function, the first
                          message on the queue contains 0 (zero) bytes.





 Hewlett-Packard Company            - 5 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           I_PEEK         Allows the user process to look (peek) at the
                          contents of the first message on the stream head
                          read queue.  This is done without taking the
                          message off the queue.  The I_PEEK ioctl operates
                          the same way as the getmsg() function, except that
                          it does not remove the messsage.  The arg
                          parameter points to a strpeek structure (in the
                          <stropts.h> header file) with the following
                          members:

                               struct strbuf     ctlbuf;
                               struct strbuf     databuf;
                               long             options;

                          The strbuf structure pointed to by ctlbuf and
                          databuf has the following members:

                               int   maxlen;
                               int   len;
                               char  *buf

                          The maxlen field of the strbuf structure must
                          specify the number of bytes of control or data
                          information to be retrieved.  The options field
                          can be set to RS_HIPRI or 0 (zero).  If this field
                          is set to RS_HIPRI, the I_PEEK ioctl looks for a
                          high priority message on the queue.  If the field
                          is set to 0, the I_PEEK ioctl looks at the first
                          message on the queue.

                          The I_PEEK returns a 1 if a message was retrieved,
                          and returns a value of 0 (zero) if no message was
                          found; it does not wait for a message.  Upon
                          successful completion, ctlbuf specifies control
                          information in the control buffer, databuf
                          specifies data information in the data buffer, and
                          options contains RS_HIPRI or 0 (zero).

           I_PLINK        Connects two streams: the file descriptor of the
                          stream associated with the multiplexing driver
                          (where fildes is the file descriptor) and the
                          stream associated with another driver (where arg
                          is the file descriptor).  The stream referred to
                          by arg is connected via a persistent link below
                          the multiplexing driver.  A persistent link is a
                          link that can exist even if the file descriptor
                          fildes referring to the stream associated with the
                          multiplexing driver is closed.

                          The I_PLINK ioctl requires a multiplexing driver
                          to send an acknowledgement message (M_IOCACK or



 Hewlett-Packard Company            - 6 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)




                          M_IOCNAK) to the stream head about the linking
                          operation.

                          On successful completion, the command returns a
                          multiplexor ID number, which is an identifier that
                          is used to disconnect the multiplexing driver (see
                          the I_PUNLINK command).  Otherwise, a -1 is
                          returned.

                          The I_PLINK ioctl can also fail if it is waiting
                          for the multiplexing driver to acknowledge the
                          link request and an error (M_ERROR) message, or
                          hangup (M_HANGUP) message is received at the
                          stream head for fildes.  In addition, an error can
                          be returned in an ( M_IOCACK or M_IOCNAK )
                          message.  When these occur, the I_PLINK ioctl
                          fails with errno set to the value in the message.

           I_POP          Removes the module just below the stream head.
                          The stream is referred to by the fildes parameter.
                          The arg parameter must be set to the value 0
                          (zero) in the request.

           I_PUNLINK      Disconnects two streams that are connected via a
                          persistent link, where fildes is the file
                          descriptor of the stream associated with a
                          multiplexing driver and arg is the multiplexor ID
                          number returned by the I_PLINK ioctl.  If arg is
                          MUXID_ALL (as defined in the <stropts.h> header
                          file), then all streams that are connected by
                          persistent links to the stream referred to by
                          fildes are disconnected.

                          The I_PUNLINK ioctl requires a multiplexing driver
                          to send an acknowledgement message (M_IOCACK or
                          M_IOCNAK) to the stream head about the unlinking
                          operation.

           I_PUSH         Pushes the module whose name is pointed to by arg
                          onto the stream just below the stream head, then
                          calls the open routine of the module.

           I_RECVFD       Gets the file descriptor associated with the
                          message sent by the I_SENDFD command over a stream
                          pipe.

                          The arg parameter points to a data buffer large
                          enough to hold a strrecvfd structure (in the
                          <stropts.h> header file) which contains user data.
                          This structure has the following members:




 Hewlett-Packard Company            - 7 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                               int        fd;
                               uid_t      uid;
                               gid_t      gid;
                               char       fill[8]

                          The fd field of the strrecvfd structure contains
                          the integer for the file descriptor.  The uid and
                          gid fields contain the user ID and group ID of the
                          sending stream.  If the O_ONDELAY or O_NONBLOCK
                          options (see open(2) or fcntl(2)) function) are
                          not set, the I_RECVFD ioctl blocks until a message
                          is present at the stream head.  If the O_ONDELAY
                          or O_NONBLOCK options are set, the I_RECVFD ioctl
                          fails if no message is present at the stream head.

                          If the I_SENDFD command sent the message at the
                          stream head, the I_RECVFD command allocates a new
                          file descriptor for the file pointer contained in
                          the message.  The new file descriptor is placed in
                          the fd field of the strrecvfd structure, and the
                          structure is copied into the data buffer pointed
                          to by arg.

           I_SENDFD       Requests the stream referred to by fildes to send
                          a message M_PASSFP to the stream head at the other
                          end of a stream pipe.  The file pointer
                          corresponds to the value of arg, which specifies
                          an open file descriptor.

                          The I_SENDFD command changes the arg value into a
                          system file pointer, allocates a message data
                          block, and inserts the file pointer in the block.
                          The user ID and group ID associated with the
                          calling process are also placed in the block.  The
                          message is then placed directly on the read queue
                          of the stream head at the other end of the stream
                          pipe.  It does not go through the stream.

           I_SETCLTIME    Lets the user process set the time that the stream
                          head delays when the stream is closing and the
                          write queues contain data.  The arg parameter
                          contains a pointer to the number of milliseconds
                          to delay, rounded up to the nearest legal value on
                          the system.  The default time is 15 seconds.

                          Before stream modules and drivers are closed, the
                          stream head delays for the specified amount of
                          time.  This allows the data on the write queues to
                          drain.  If data is still present on the writes
                          queues after the delay, the queues are flushed.




 Hewlett-Packard Company            - 8 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           I_SETSIG       Tells the stream head that the user process wants
                          a SIGPOLL signal to be issued by the kernel for a
                          particular event that can occur on a stream.  This
                          command provides support for asynchronous
                          processing in STREAMS.

                          The arg parameter contains a bitmask specifying
                          the particular events that SIGPOLL is to be sent
                          for.  The value is the bitwise OR of any
                          combination of the following constants:

                               S_BANDURG      Indicates that, when used with
                                              S_RDBAND, a priority message
                                              has reached the front of the
                                              stream head read queue.  (If
                                              only S_RDBAND is set, only a
                                              SIGPOLL signal is generated.
                                              If S_BANDURG is also set, then
                                              a SIGURG signal is generated.)

                               S_ERROR        Specifies that an M_ERROR
                                              message has reached the front
                                              of the stream head read queue.

                               S_HANGUP       Specifies that an M_HANGUP
                                              message has reached the stream
                                              head.

                               S_HIPRI        Specifies a high priority
                                              message has arrived on the
                                              read queue of the stream head.
                                              A SIGPOLL signal is issued
                                              even for zero-length messages.

                               S_INPUT        Specifies that a message,
                                              which is not a M_PCPROTO type
                                              message, has reached the front
                                              of the stream head read queue.
                                              A SIGPOLL signal is issued
                                              even for zero-length messages.
                                              The S_INPUT event is
                                              maintained for compatibility
                                              with SVID2.

                               S_MSG          Specifies that a STREAMS
                                              signal (M_SIG) signal
                                              containing the SIGPOLL signal
                                              has reached the front of the
                                              stream head read queue.





 Hewlett-Packard Company            - 9 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                               S_OUTPUT       Specifies that the write queue
                                              of the module just below the
                                              stream head is not full any
                                              more.  There is room on the
                                              queue for the user process to
                                              send (write) data to the
                                              stream.

                               S_RDBAND       Specifies a priority band
                                              message (where band is greater
                                              than 0 (zero)) has reached the
                                              front of the stream head read
                                              queue.  A SIGPOLL signal is
                                              issued even for zero-length
                                              messages.

                               S_RDNORM       Specifies that an ordinary
                                              message has reached the front
                                              of the stream head read queue.
                                              A SIGPOLL signal is issued
                                              even for zero-length messages.

                               S_WRBAND       Specifies that a priority band
                                              (where band is greater than 0
                                              (zero)) exists on a queue
                                              downstream.  The user can send
                                              (write) a priority data
                                              message on the queue.

                               S_WRNORM       This event is the same as
                                              S_OUTPUT.

                          User processes must register explicitly using the
                          I_SETSIG command to receive SIGPOLL (or SIGURG)
                          signals.  This is noted by the stream head.  When
                          more than one user process registers to receive
                          the signal for the same event on a stream, each is
                          signaled when the event occurs.  If the value of
                          arg is 0 (zero), the calling process is
                          deregistered and does not receive the signal.

                          A user process can set the arg bitmask to the
                          S_HIPRI value, thus allowing itself to be signaled
                          only when high priority messages reach the stream
                          head read queue.

           I_SRDOPT       Sets the read mode of the stream (see read(2))
                          according to the value of arg.  The arg value
                          specifies the following read modes related to data
                          and message boundaries:




 Hewlett-Packard Company           - 10 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                               RNORM          Byte-stream mode (default).
                                              The read(2) function completes
                                              when the byte count is
                                              satisfied, the stream head
                                              read queue is empty, or a
                                              zero-length message is
                                              encountered.  In the case of a
                                              zero-length message, the
                                              message is placed back on the
                                              queue, and a subsequent
                                              read(2) returns 0 bytes.

                               RMSGD          Message-discard mode.  The
                                              read(2) function completes
                                              when the byte count is
                                              satisfied, or a message
                                              boundary is reached.  Any
                                              remaining data in the message
                                              is discarded.

                               RMSGN          Message-nondiscard mode.  The
                                              read(2) function completes
                                              when the byte count is
                                              satisfied or a message
                                              boundary is reached.  Any data
                                              remaining in the message are
                                              put back on the read queue.

                          If any of the following values are set in arg, the
                          stream head treats control (protocol) messages
                          accordingly:

                               RPROTNORM      read(2) fails, returning
                                              [EBADMSG], if a control
                                              message is at the front of the
                                              read queue (default behavior).

                               RPROTDAT       read(2) delivers the control
                                              portion of the message as data
                                              to the user process.

                               RPROTDIS       read(2) discards the control
                                              portion of a message and sends
                                              the data portion to the user
                                              process.

           I_STR          Builds a STREAMS ioctl (M_IOCTL) message from the
                          data pointed to by arg and sends the message
                          downstream to a module or driver.  The command
                          allows a user process to send data with an ioctl
                          request, and to receive any information that the



 Hewlett-Packard Company           - 11 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                          downstream recipient of the message returns.  The
                          I_STR ioctl blocks until the intended recipient of
                          the M_IOCTL.  message responds with a positive
                          acknowledgement (M_IOCACK) message or negative
                          acknowledgement (M_IOCNAK) message, or until the
                          request times out (default time = 15 seconds).  If
                          the request times out, it fails.

                          Only one I_STR ioctl can be active on a stream at
                          a time.  Other requests must wait until the active
                          request completes at the stream head.  The
                          O_NDELAY and O_NONBLOCK options (see open(2) or
                          fcntl(2)) have no effect on the call.

                          User values for the I_STR ioctl request are
                          supplied by a strioctl structure (in the
                          <stropts.h> header file), to which the arg
                          parameter points.  The members of strioctl
                          structure are the following:

                               int     ic_cmd;
                               int     ic_timeout;
                               int     ic_len;
                               char    *ic_dp;

                          The ic_cmd field of the strioctl structure
                          contains the ioctl command to be sent to the
                          downstream module or driver.  The ic_timeout field
                          specifies the number of seconds that the I_STR
                          request will wait for an acknowledgement before
                          timing out:

                               -1   Indicates infinite number of seconds.

                                0   Indicates that the default number of
                                    seconds should be used (15 seconds).

                               >0   Indicates that the specified number of
                                    seconds should be used.

                          On input, the ic_len field contains the length of
                          the data argument.  On return, it contains the
                          number of bytes being returned to the user process
                          (the buffer pointed to by ic_dp).  The buffer
                          pointed to by ic_dp should be large enough to
                          contain the maximum amount of data that any module
                          or driver in the stream can return.

           I_SWROPT       Sets the stream write mode according to the arg
                          parameter value.  The legal value for arg is:




 Hewlett-Packard Company           - 12 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





                               SNDZERO        When set, the stream head
                                              sends a zero-length message
                                              downstream upon the occurrence
                                              of a write of 0 (zero) bytes.
                                              When not set, the stream head
                                              does not send a zero-length
                                              message downstream when a
                                              write of 0 bytes occurs, and
                                              returns 0 to the user process.

           I_UNLINK       Disconnects two streams, where fildes is the file
                          descriptor of the stream associated with a
                          multiplexing driver and arg is the multiplexor
                          identifier number returned by the I_LINK ioctl
                          that created the multiplexing configuration.  If
                          arg is MUXID_ALL (defined in the <stropts.h>
                          header file), all streams connected to the stream
                          referred to by fildes are disconnected.

                          The I_UNLINK ioctl requires a multiplexing driver
                          to send an acknowledgement message ( M_IOCACK or
                          M_IOCNAK) to the stream head about the unlinking
                          operation.

 RETURN VALUES
      Unless specified differently for a command, the return value for a
      STREAMS ioctl() call is 0 (zero) on success and -1 (minus one) on
      failure.

 ERRORS
      A STREAMS ioctl command fails without performing the function and with
      errno set to [EINVAL] if:

           o  The stream referred to by fildes is linked below a
              multiplexing driver.

           o  The command parameter is not a valid value for the stream.

      In addition, if any of the following conditions occur, the STREAMS
      ioctl commands return the corresponding value:

      I_ATMARK

           [EINVAL]       arg has an illegal value.

      I_CANPUT

           [EINVAL]       arg has an illegal value.

      I_CKBAND




 Hewlett-Packard Company           - 13 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           [EINVAL]       arg has an illegal value.

      I_FDINSERT

           [EINVAL]       The fildes parameter in the strfdinsert structure
                          is an invalid open file descriptor.

           [EINVAL]       The size of the pointer plus offset exceeds the
                          value of the len field for the buffer specified
                          through ctlptr.

           [EINVAL]       offset does not specify a properly aligned
                          location in the data buffer.

           [EINVAL]       options contains an undefined value.

           [EFAULT]       arg points, or ctrlbuf or databuf is outside the
                          allocated address space.

           [EAGAIN]       The ioctl request failed because a non-priority
                          message was to be created, the O_NDELAY or
                          O_NONBLOCK option was set, and the stream's write
                          queue was full because of internal flow control
                          conditions.

           [ENOSR]        Buffers could not be allocated for the message
                          that was to be created due to insufficient STREAMS
                          memory resources.

           [ENXIO]        A hangup was received on the stream specified by
                          fildes in the I_FDINSERT ioctl call or on the
                          stream specified by fildes in the strfdinsert.

           [ERANGE]       The value of the len field for the buffer
                          specified through databuf does not fall within the
                          range for the minimum and maximum sizes of packets
                          for the top-most module on the stream.

           [ERANGE]       The value of the len field for the buffer
                          specified through databuf is larger the the
                          maximum allowable size for the data part of a
                          message.

           [ERANGE]       The value of the len field for the buffer
                          specified through ctlbuf is larger the the maximum
                          allowable size for the control part of a message.

           The I_FDINSERT ioctl can also fail if an error (M_ERROR) message
           was received by the stream specified by the fildes field in the
           strfdinsert structure.  In this case, errno is set to the error
           value in the error message.



 Hewlett-Packard Company           - 14 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)




      I_FIND

           [EINVAL]       arg does not contain a valid module name.

           [EFAULT]       arg points outside the allocated address space.

      I_FLUSH

           [ENOSR]        Could not allocate buffers for flush operation
                          because of a lack of STREAMS memory resources.

           [EINVAL]       The arg parameter is an invalid value.

           [ENXIO]        A hangup was received on fildes.

      I_FLUSHBAND

           [EINVAL]       The bi_pr parameter value exceeds the maximum
                          band, or the bi_option parameter is not FLUSHR,
                          FLUSHW, or FLUSHRW.

      I_GETBAND

           [ENODATA]      No message exists on the stream head read queue.

      I_GETSIG

           [EINVAL]       User process is not registered to receive the
                          SIGPOLL signal.

           [EFAULT]       arg points outside the allocated address space.

      I_GRDOPT

           [EFAULT]       arg is pointing outside the allocated address
                          space.

      I_LINK

           [EAGAIN]       Temporarily unable to allocate storage to perform
                          the linking operation.

           [EBADF]        The arg parameter not a valid open file
                          descriptor.

           [ENXIO]        A hangup was received on fildes.

           [EINVAL]       The stream referred to by fildes does not support
                          multiplexing.





 Hewlett-Packard Company           - 15 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           [EINVAL]       The file referred to by arg is not a stream, or
                          the stream is already linked under a multiplexor.

           [EINVAL]       The link operation would cause a "cycle" in the
                          resulting multiplexing configuration.  In other
                          words, the driver referred to by the arg parameter
                          is linked into this configuration at multiple
                          places

           [ENOSR]        Not enough STREAMS memory resources to allocate
                          storage for this command.

           [ETIME]        Acknowledgement message not received at stream
                          head before timeout.

           The I_LINK ioctl can also fail if 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

           [EINVAL]       sl_nmods is less than 1.

           [EAGAIN]       Could not allocate buffers.

      I_LOOK

           [EINVAL]       There are no modules in the stream.

           [EFAULT]       arg points outside the allocated address space.

      I_NREAD

           [EFAULT]       arg is pointing outside the allocated address
                          space.

      I_PEEK

           [EINVAL]       The options parameter is an illegal value.

           [EFAULT]       arg points, or ctrlbuf or databuf is, outside the
                          allocated address space.

           [EBADMSG]      Message to be looked at is not valid for the
                          I_PEEK command.

      I_PLINK





 Hewlett-Packard Company           - 16 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           [ENXIO]        A hangup was received on the stream referred to by
                          the fildes parameter.

           [ETIME]        A timeout occured before an acknowledgement
                          message was received at the stream head.

           [EAGAIN]       Temporarily unable to allocate storage to perform
                          the linking operation.

           [EBADF]        arg is not a valid open file descriptor.

           [EINVAL]       The stream referred to by fildes does not support
                          multiplexing.

           [EINVAL]       The file referred to by arg is not a stream, or is
                          already linked under a multiplexing driver.

           [EINVAL]       The link operation would cause a "cycle" in the
                          resulting multiplexing configuration.  In other
                          words, the driver referred to by arg is linked
                          into the configuration at multiple places.

      I_POP

           [EINVAL]       There are not modules in the stream.

           [ENXIO]        Error value returned by the module being popped.

           [ENXIO]        A hangup was received on fildes.

      I_PUNLINK

           [ENXIO]        A hangup was received on fildes.

           [ETIME]        A timeout occured before an acknowledgement
                          message was received at the stream head.

           [EAGAIN]       Temporarily unable to allocate storage to perform
                          the linking operation.

           [EINVAL]       arg is an invalid multiplexor ID number.

           [EINVAL]       fildes is the file descriptor of a pipe.

           An I_PUNLINK ioctl can also fail if it is waiting for the
           multiplexor to acknowledge the unlink request and an error
           (M_ERROR) message, or hangup (M_HANGUP) is received at the stream
           head for fildes.  In addition, an error can be returned in an
           M_IOCACK or M_IOCNAK message.  When these occur, the P_UNLINK
           ioctl fails with errno set to the value in the message.




 Hewlett-Packard Company           - 17 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





      I_PUSH

           [EINVAL]       An invalid module name was used.

           [EFAULT]       arg points outside the allocated address space.

           [ENXIO]        Error value returned by the module being pushed.
                          The push has failed.

           [ENXIO]        A hangup was received on fildes.

      I_RECVFD

           [EAGAIN]       The O_ONDELAY or O_NONBLOCK option was set, and a
                          message was not present on the stream head read
                          queue.

           [EFAULT]       The arg parameter points outside the allocated
                          address space.

           [EBADMSG]      The message present on the stream head read queue
                          did not contain a passed file descriptor.

           [EMFILE]       Too many open files.  No more file descriptors are
                          permitted to be opened.

           [ENXIO]        A hangup was received on fildes.

      I_SENDFD

           [EAGAIN]       The sending stream head could not allocate a
                          message block for the file pointer.

           [EAGAIN]       The read queue of the receiving stream head was
                          full and could not accept the message.

           [EBADF]        The arg parameter is not a valid open file
                          descriptor.

           [EINVAL]       The fildes parameter does not refer to a stream.

           [ENXIO]        A hangup was received on fildes.

      I_SETCLTIME

           [EINVAL]       arg has an illegal value.

      I_SETSIG

           [EINVAL]       The user process is not registered to receive the
                          SIGPOLL signal.



 Hewlett-Packard Company           - 18 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           [EAGAIN]       A data structure to store the signal request could
                          not be allocated.

      I_SRDOPT

           [EINVAL]       arg contains an illegal value.

      I_STR

           [EINVAL]       The ic_len field is less than 0 (zero) bytes or
                          larger than the maximum allowable size of the data
                          part of a message (ic_dp).

           [EINVAL]       The ic_timeout field is less than -1.

           [EFAULT]       arg points, or the buffer area specified by ic_dp
                          or ic_len is, outside the allocated address space.

           [ENOSR]        Buffers could not be allocated for the ioctl
                          request because of a lack of STREAMS memory
                          resources.

           [ENXIO]        A hangup was received on the stream referred to by
                          fildes.

           [ETIME]        The ioctl request timed out before an
                          acknowledgement was received.

           The I_STR ioctl can also fail if the stream head receives a
           message indicating an error (M_ERROR) or a hangup (M_HANGUP).  In
           addition, an error can be returned in an M_IOCACK or M_IOCNAK
           message.  In these cases, the ioctl fails with errno set to the
           error value in the message.

      I_SWROPT

           [EINVAL]       The arg parameter is an illegal value.

      I_UNLINK

           [ENXIO]
                A hangup was received on fildes.

           [ETIME]
                A timeout occured before an acknowledgement message was
                received at the stream head.

           [EINVAL]
                arg is an invalid multiplexor ID number, or fildes is
                already linked under a multiplexing driver.




 Hewlett-Packard Company           - 19 -    HP-UX Release 9.0: October 1992






 streamio(7)                                                     streamio(7)





           An I_UNLINK ioctl can also fail if it is waiting for the
           multiplexor to acknowledge the unlink request and an error
           (M_ERROR) message, or hangup (M_HANGUP) is received at the stream
           head for fildes.  In addition, an error can be returned in
           M_IOCACK or M_IOCNAK message.  When this occurs, the I_UNLINK
           ioctl fails with errno set to the value in the message.

 NOTES
      For portability purposes, it is recommended that O_NONBLOCK be used
      instead of O_NDELAY.

 SEE ALSO
      close(2), fcntl(2), getmsg(2), ioctl(2), open(2), poll(2), putmsg(2),
      read(2), write(2), signal(4).








































 Hewlett-Packard Company           - 20 -    HP-UX Release 9.0: October 1992