HPUX sad[7]






 sad(7)                                                               sad(7)





 NAME
      sad - STREAMS Administrative Driver

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

      int ioctl(fildes, command, arg);
      int fildes;
      int command;
      void *arg;


 DESCRIPTION
      The sad driver provides an interface to the autopush facility using
      the ioctl(2) function.  As an interface, the sad driver enables
      administrative tasks to be performed on STREAMS modules and drivers.
      By specifying the command parameter to the ioctl(2) function, an
      administrator can configure autopush information for a device, get
      information on a device, or check a list of modules.

      fildes is a file descriptor obtained by opening /dev/sad using
      open(2).  command specifies the administrative function to be
      performed.  arg points to a data structure.  If command is SAD_SAP or
      SAD_GAP, arg points to a struct of type strapush.  If command is
      SAD_VML, arg points to a struct of type str_list.

    ioctl Commands
      The commands used to perform administrative functions on a STREAMS
      module or driver are specified by the following ioctl(2) commands:

      SAD_SAP        Allows the superuser to configure autopush information
                     for a device. The arg parameter points to a strapush
                     structure (defined in the <sys/sad.h> header file),
                     whose members are as follows:

                     struct strapush {
                         uint sap_cmd;
                         long sap_major;
                         long sap_minor;
                         long sap_lastminor;
                         long sap_npush;
                         char sap_list[MAXAPUSH][FMNAMESZ+1];
                     };


                     sap_cmd        Allows you to specify the type of
                                    configuration to perform.  This field
                                    can have the following values:



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






 sad(7)                                                               sad(7)





                                    SAP_ALL        Configures all minor
                                                   devices.

                                    SAP_RANGE      Configures a range of
                                                   minor devices.

                                    SAP_ONE        Configures a single minor
                                                   device.

                                    SAP_CLEAR      Clears the previous
                                                   settings.  Specify only
                                                   the sap_major and
                                                   sap_minor fields when
                                                   using this command.  If a
                                                   previous entry specified
                                                   SAP_ALL, set the
                                                   sap_minor field to 0
                                                   (zero).  If a previous
                                                   entry was specified as
                                                   SAP_RANGE, set the
                                                   sap_minor field to the
                                                   lowest minor device
                                                   number in the range.

                     sap_major      Specifies the major device number.

                     sap_minor      Specifies the minor device number.

                     sap_lastminor  Specifies the range of minor devices.

                     sap_npush      Specifies the number of modules to push.
                                    This number must be no more than
                                    MAXAPUSH, which is defined in <sad.h>.
                                    Additionally, this number must not
                                    exceed NSTRPUSH.

                     sap_list       Specifies, in order, the array of
                                    modules to push.

      SAD_GAP        Lets you use the sad driver to obtain autopush
                     configuration information for a device by setting the
                     sap_major and sap_minor fields of the strapush
                     structure (see the SAD_SAP command) to the major and
                     minor device numbers of the device being queried.

                     arg should point to a struct of type strapush.  Upon
                     successful completion, the strapush structure contains
                     all of the information used to configure the device.
                     Values of 0 (zero) will appear in any unused entry in
                     the module list.




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






 sad(7)                                                               sad(7)





      SAD_VML        Enables you to check a list of modules.  For example,
                     you can determine if a specific module has been
                     installed.  The arg parameter points to a str_list
                     structure (defined in the <stropts.h> header file),
                     whose members are as follows:

                     struct str_list {
                         int sl_nmods;
                         struct str_mlist *sl_modlist;
                     };


                     sl_nmods       Specifies the number of entries you have
                                    allocated in an array.

                     sl_modlist     Points to the array of module names.
                                    The str_mlist structure (also in the
                                    <stropts.h> header file) is as follows:

                                    struct str_mlist {
                                        char    l_name[FMNAMESZ+1];
                                    };

                                    where l_name specifies the array of
                                    module names.

                     If the 1_name array is valid, the SAD_VML command
                     returns a value of 0 (zero).  If the array contains an
                     invalid module name, the command returns a value of 1.
                     Upon failure, the command returns a value of -1.

                     WARNING: HP9000 Series 700 and 800 machines align on
                     word boundaries while Series 300 machines align on
                     half-word boundaries. Thus, when writing portable code,
                     do not set:

                     sl_modlist = (struct str_mlist *)strapush.sap_list;

                     because the size of struct str_mlist will cause an
                     alignment mismatch on a Series 300 machine.

 NOTES
      As a STREAMS driver, sad also supports the normal STREAMS I_STR
      ioctl(2):

      int ioctl(fildes, I_STR, strp);
      int fildes;
      struct strioctl *strp;

      In this form, specify the ic_cmd field in the strioctl structure to
      either SAD_SAP, SAD_GAP, or SAD_VML.  The ic_dp field points to the



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






 sad(7)                                                               sad(7)





      strapush structure (see the SAD_SAP command in the DESCRIPTION
      section).  Refer to the streamio(7) reference page for further
      details.

 ERRORS
      If any of the following conditions occur, the sad ioctl commands
      return the corresponding value:

      SAD_SAP

                     [EEXIST]       The specified major/minor device number
                                    pair (sad_major/sad_minor) has already
                                    been configured.

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

                     [EINVAL]       The major device number (sad_major) is
                                    invalid, the number of modules
                                    (sap_list[MAXAPUSH][FMNAMESZ+1]) is
                                    invalid, or the list of module names is
                                    invalid.

                     [ENODEV]       The device is not configured for
                                    autopush.  This value is returned from a
                                    SAD_GAP command.

                     [ENOSR]        A internal autopush data structure
                                    cannot be allocated.

                     [ENOSTR]       The major device does not represent a
                                    STREAMS driver.

                     [ERANGE]       The sap_lastminor field is less than the
                                    sap_minor field when the command is
                                    SAP_RANGE, or the minor device specified
                                    in a SAP_CLEAR command does not exist.

                     [EACCES]       Only superuser is allowed to execute the
                                    SAD_SAP ioctl.

      SAD_GAP

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

                     [EINVAL]       The major device number (sad_major) is
                                    invalid.

                     [ENODEV]       The device is not configured for
                                    autopush.



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






 sad(7)                                                               sad(7)





                     [ENOSTR]       The major device does not represent a
                                    STREAMS driver.

      SAD_VML

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

                     [EINVAL]       The list of module names is invalid.

 RETURN VALUES
      Unless specified otherwise, upon successful completion, the sad
      ioctl(2) commands return a value of 0 (zero).  Otherwise, a value of
      -1 is returned.

 SEE ALSO
      autopush(1m), ioctl(2), open(2), streamio(7).





































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