sad(7) DEVICES AND MODULES sad(7)
NAME
sad - STREAMS Administrative Driver
SYNOPSIS
#include <sys/types.h>
#include <sys/conf.h>
#include <sys/sad.h>
int ioctl (fildes, command, arg);
int fildes, command;
DESCRIPTION
The STREAMS Administrative Driver provides an interface for
applications to perform administrative operations on STREAMS
modules and drivers. The interface is provided through
ioctl(2) commands. Privileged operations may access the sad
driver via /dev/sad/admin. Unprivileged operations may
access the sad driver via /dev/sad/user. fildes is an open
file descriptor that refers to the sad driver. 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.
COMMAND FUNCTIONS
The autopush facility [see autopush(1M)] allows one to con-
figure a list of modules to be automatically pushed on a
stream when a driver is first opened. autopush is con-
trolled by the next two commands.
SADSAP Allows the super-user to configure the autopush
information for the given device. arg points
to a strapush structure which contains the fol-
lowing members:
uint sapcmd;
long sapmajor;
long sapminor;
long saplastminor;
long sapnpush;
uint saplist[MAXAPUSH] [FMNAMESZ + 1];
The sapcmd field indicates the type of confi-
guration being done. It may take on one of the
following values:
SAPONE Configure one minor device of a
driver.
SAPRANGE Configure a range of minor devices
of a driver.
SAPALL Configure all minor devices of a
1
sad(7) DEVICES AND MODULES sad(7)
driver.
SAPCLEAR Undo configuration information for
a driver. The sapmajor field is
the major device number of the
device to be configured. The
sapminor field is the minor dev-
ice number of the device to be
configured. The saplastminor
field is used only with the
SAPRANGE command, with which a
range of minor devices between
sapminor and saplastminor,
inclusive, are to be configured.
These fields have no meaning for
the SAPALL command. The
sapnpush field indicates the
number of modules to be automati-
cally pushed when the device is
opened. It must be less than or
equal to MAXAPUSH, defined in
sad.h. It must also be less than
or equal to NSTRPUSH, the maximum
number of modules that can be
pushed on a stream. The field
saplist is an array of module
names to be pushed in the order in
which they appear in the list.
When using the SAPCLEAR command,
the user sets only sapmajor and
sapminor. This will undo the
configuration information for any
of the other commands. If a pre-
vious entry was configured as
SAPALL, sapminor should be set
to zero. If a previous entry was
configured as SAPRANGE, sapminor
should be set to the lowest minor
device number in the range config-
ured. On failure, errno is set to
the following value:
EFAULT arg points outside the allocated
address space.
EPERM The user does not have permission
to set autopush configuration
information (e.g., the user is not
the super-user).
EINVAL The major device number is
invalid, the number of modules is
2
sad(7) DEVICES AND MODULES sad(7)
invalid, or the list of module
names is invalid.
ENOSTR The major device number does not
represent a STREAMS driver.
EEXIST The major-minor device pair is
already configured.
ENODEV The command was SAPCLEAR and the
entry could not be found. The
autopush configuration information
for the given major/minor device
can not be found in the cache
maintained by the sad driver,
probably because the given
major/minor device has not yet
been configured for autopush.
SADGAP Allows any user to query the sad driver to get
the autopush configuration information for a
given device. arg points to a strapush struc-
ture as described in the previous command.
The user should set the sapmajor and sapminor
fields of the strapush structure to the major
and minor device numbers, respectively, of the
device in question. On return, the strapush
structure will be filled in with the entire
information used to configure the device.
Unused entries in the module list will be
zero-filled.
On failure, errno is set to one of the follow-
ing values:
EFAULT arg points outside the allocated
address space.
EINVAL The major device number is
invalid.
ENOSTR The major device number does not
represent a STREAMS driver.
ENODEV An entry could not be found for
the given major/minor device. The
autopush configuration information
for the given major/minor device
can not be found in the cache
maintained by the sad driver,
probably because the given
3
sad(7) DEVICES AND MODULES sad(7)
major/minor device has not yet
been configured for autopush.
SEE ALSO
intro(2), ioctl(2), open(2).
Programmer's Guide: STREAMS.
DIAGNOSTICS
Unless specified otherwise above, the return value from
ioctl is 0 upon success and -1 upon failure with errno set
as indicated.
4