1sad(7D)                             Devices                            sad(7D)
2
3
4

NAME

6       sad - STREAMS Administrative Driver
7

SYNOPSIS

9       #include <sys/types.h>
10
11
12       #include <sys/conf.h>
13
14
15       #include <sys/sad.h>
16
17
18       #include <sys/stropts.h>
19
20
21       int ioctl(int fildes, int command, int arg);
22
23

DESCRIPTION

25       The   STREAMS Administrative Driver provides an interface for  applica‐
26       tions to perform administrative  operations  on   STREAMS  modules  and
27       drivers.  The  interface is provided through  ioctl(2) commands. Privi‐
28       leged operations  may  access  the  sad  driver  using  /dev/sad/admin.
29       Unprivileged operations may access the  sad driver using /dev/sad/user.
30
31
32       The  fildes argument is an open file descriptor that refers to the  sad
33       driver.  The command argument determines the  control  function  to  be
34       performed  as  described below.  The arg argument represents additional
35       information that is needed by this command. The  type  of  arg  depends
36       upon the command, but it is generally an integer or a pointer to a com‐
37       mand-specific data structure.
38

COMMAND FUNCTIONS

40       The autopush facility (see  autopush(1M)) allows  one  to  configure  a
41       list of modules to be automatically pushed on a stream when a driver is
42       first opened. Autopush is controlled by the following commands:
43
44       SAD_SAP    Allows the administrator to  configure  the  given  device's
45                  autopush  information.  arg points to a  strapush structure,
46                  which contains the following members:
47
48                     unit_t   ap_cmd;
49                     major_t  sap_major;
50                     minor_t  sap_minor;
51                     minor_t  sap_lastminor;
52                     unit_t   sap_npush;
53                     unit_t   sap_list [MAXAPUSH] [FMNAMESZ + 1];
54
55                  The  sap_cmd field indicates the type of configuration being
56                  done. It may take on one of the following values:
57
58                  SAP_ONE      Configure one minor device of a driver.
59
60
61                  SAP_RANGE    Configure a range of minor devices of a driver.
62
63
64                  SAP_ALL      Configure all minor devices of a driver.
65
66
67                  SAP_CLEAR    Undo configuration information for a driver.
68
69                  The   sap_major  field  is  the  major  device number of the
70                  device to be configured. The  sap_minor field is  the  minor
71                  device number of the device to be configured. The  sap_last‐
72                  minor field is used only with the  SAP_RANGE command,  which
73                  configures  a  range of minor devices between  sap_minor and
74                  sap_lastminor, inclusive. The minor fields have  no  meaning
75                  for the  SAP_ALL command. The  sap_npush field indicates the
76                  number of modules to be automatically pushed when the device
77                  is  opened.  It  must  be  less than or equal to  MAXAPUSH ,
78                  defined in  sad.h. It must also be less  than  or  equal  to
79                  NSTRPUSH,  the maximum number of  modules that can be pushed
80                  on a stream, defined in the kernel master file.   The  field
81                  sap_list  is  an array of NULL-terminated module names to be
82                  pushed in the order  in which they appear in the list.
83
84                  When using  the   SAP_CLEAR  command,  the  user  sets  only
85                  sap_major  and  sap_minor.  This will undo the configuration
86                  information for any of the other commands.   If  a  previous
87                  entry was configured as  SAP_ALL, sap_minor should be set to
88                  zero. If a previous entry was  configured  as   SAP_RANGE  ,
89                  sap_minor should be set to the lowest minor device number in
90                  the range configured.
91
92                  On failure,  errno is set to the following value:
93
94                  EFAULT    arg points outside the allocated address space.
95
96
97                  EINVAL    The major device number is invalid, the number  of
98                            modules is invalid, or the list of module names is
99                            invalid.
100
101
102                  ENOSTR    The major  device  number  does  not  represent  a
103                            STREAMS driver.
104
105
106                  EEXIST    The major-minor device pair is already configured.
107
108
109                  ERANGE    The  command  is   SAP_RANGE and  sap_lastminor is
110                            not greater than  sap_minor,  or  the  command  is
111                            SAP_CLEAR and  sap_minor is not equal to the first
112                            minor in the range.
113
114
115                  ENODEV    The command is  SAP_CLEAR and the  device  is  not
116                            configured for autopush.
117
118
119                  ENOSR     An  internal  autopush  data  structure  cannot be
120                            allocated.
121
122
123
124       SAD_GAP    Allows any user to query the  sad driver to get the autopush
125                  configuration  information for a given device. arg points to
126                  a  strapush structure as described in the previous command.
127
128                  The user should set the  sap_major and  sap_minor fields  of
129                  the  strapush  structure  to the major and minor device num‐
130                  bers, respectively, of the device in  question.  On  return,
131                  the   strapush  structure  will be filled in with the entire
132                  information used to configure the device. Unused entries  in
133                  the module list will be zero-filled.
134
135                  On failure,  errno is set to one of the following values:
136
137                  EFAULT    arg points outside the allocated address space.
138
139
140                  EINVAL    The major device number is invalid.
141
142
143                  ENOSTR    The  major  device  number  does  not  represent a
144                            STREAMS driver.
145
146
147                  ENODEV    The device is not configured for autopush.
148
149
150
151       SAD_VML    Allows any user to validate a list of modules (that  is,  to
152                  see  if  they are installed on the system). arg is a pointer
153                  to a  str_list structure with the following members:
154
155                    int     sl_nmods;
156                     struct  str_mlist  *sl_modlist;
157
158                  The  str_mlist structure has the following member:
159
160                    char  l_name[FMNAMESZ+1];
161
162                  sl_nmods indicates the number of entries the user has  allo‐
163                  cated  in  the  array and  sl_modlist points to the array of
164                  module names. The return value is 0 if the list is valid,  1
165                  if  the list contains an invalid module name, or −1 on fail‐
166                  ure. On failure,  errno is set to one of the following  val‐
167                  ues:
168
169                  EFAULT    arg points outside the allocated address space.
170
171
172                  EINVAL    The   sl_nmods field of the  str_list structure is
173                            less than or equal to zero.
174
175
176

SEE ALSO

178       Intro(2), ioctl(2), open(2)
179
180
181       STREAMS Programming Guide
182

DIAGNOSTICS

184       Unless otherwise specified, the return value from  ioctl()  is  0  upon
185       success and  −1 upon failure with  errno set as indicated.
186
187
188
189SunOS 5.11                        16 Apr 1997                          sad(7D)
Impressum