Devices sad(7D)
NAME
sad - STREAMS Administrative Driver
SYNOPSIS
#include
#include
#include
#include
int ioctl(int fildes, int command, int arg);
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 using /dev/sad/admin. Unprivileged operations
may access the sad driver using /dev/sad/user.
The fildes argument is an open file descriptor that refers
to the sad driver. The command argument determines the
control function to be performed as described below. The
arg argument 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.
COMAND 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 following commands:
SADSAP Allows the administrator to configure the given
device's autopush information. arg points to a
strapush structure, which contains the following
members:
unitt apcmd;
majort sapmajor;
minort sapminor;
minort saplastminor;
unitt sapnpush;
SunOS 5.11 Last change: 16 Apr 1997 1
Devices sad(7D)
unitt 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.
SAPAL Configure all minor devices of a
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 device number of the device to
be configured. The saplastminor field is used
only with the SAPRANGE command, which config-
ures a range of minor devices between sapminor
and saplastminor, inclusive. The minor fields
have no meaning for the SAPAL command. The
sapnpush field indicates the number of modules
to be automatically pushed when the device is
opened. It must be less than or equal to MAXA-
PUSH , 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, defined
in the kernel master file. The field saplist
is an array of NUL-terminated 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 previous entry was configured as
SAPAL, sapminor should be set to zero. If a
previous entry was configured as SAPRANGE ,
sapminor should be set to the lowest minor dev-
ice number in the range configured.
On failure, errno is set to the following value:
SunOS 5.11 Last change: 16 Apr 1997 2
Devices sad(7D)
EFAULT arg points outside the allocated
address space.
EINVAL The major device number is invalid, the
number of modules is invalid, or the
list of module names is invalid.
ENOSTR The major device number does not
represent a STREAMS driver.
EXIST The major-minor device pair is already
configured.
ERANGE The command is SAPRANGE and
saplastminor is not greater than
sapminor, or the command is SAPCLEAR
and sapminor is not equal to the
first minor in the range.
ENODEV The command is SAPCLEAR and the dev-
ice is not configured for autopush.
ENOSR An internal autopush data structure
cannot be allocated.
SADGAP Allows any user to query the sad driver to get
the autopush configuration information for a
given device. arg points to a strapush structure
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 following
values:
EFAULT arg points outside the allocated
address space.
SunOS 5.11 Last change: 16 Apr 1997 3
Devices sad(7D)
EINVAL The major device number is invalid.
ENOSTR The major device number does not
represent a STREAMS driver.
ENODEV The device is not configured for auto-
push.
SADVML Allows any user to validate a list of modules
(that is, to see if they are installed on the
system). arg is a pointer to a strlist struc-
ture with the following members:
int slnmods;
struct strmlist *slmodlist;
The strmlist structure has the following
member:
char lname[FMNAMESZ]1];
slnmods indicates the number of entries the user
has allocated in the array and slmodlist points
to the array of module names. The return value is
0 if the list is valid, 1 if the list contains an
invalid module name, or -1 on failure. On
failure, errno is set to one of the following
values:
EFAULT arg points outside the allocated
address space.
EINVAL The slnmods field of the strlist
structure is less than or equal to
zero.
SEE ALSO
Intro(2), ioctl(2), open(2)
STREAMS Programming Guide
DIAGNOSTICS
Unless otherwise specified, the return value from ioctl()
is 0 upon success and -1 upon failure with errno set as
SunOS 5.11 Last change: 16 Apr 1997 4
Devices sad(7D)
indicated.
SunOS 5.11 Last change: 16 Apr 1997 5
|