Merge commit 'ad3ad82ad2fb99c424a8482bd1908d08b990ccea'
[unleashed.git] / share / man / man7d / sad.7d
blobfd87328b4c0fafd9047ba3d21e6926281a77e730
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 1997, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH SAD 7D "Apr 16, 1997"
7 .SH NAME
8 sad \- STREAMS Administrative Driver
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/types.h>
13 .fi
15 .LP
16 .nf
17 #include <sys/conf.h>
18 .fi
20 .LP
21 .nf
22 #include <sys/sad.h>
23 .fi
25 .LP
26 .nf
27 #include <sys/stropts.h>
28 .fi
30 .LP
31 .nf
32 \fBint\fR \fBioctl\fR\fB(int\fR \fIfildes\fR, \fBint\fR \fIcommand\fR, \fBint \fR\fIarg\fR);
33 .fi
35 .SH DESCRIPTION
36 .sp
37 .LP
38 The  \fBSTREAMS\fR Administrative Driver provides an interface for
39 applications to perform administrative operations on  \fBSTREAMS\fR modules and
40 drivers. The interface is provided through  \fBioctl\fR(2) commands. Privileged
41 operations may access the \fBsad\fR driver using \fB/dev/sad/admin\fR.
42 Unprivileged operations may access the  \fBsad\fR driver using
43 \fB/dev/sad/user\fR.
44 .sp
45 .LP
46 The \fIfildes\fR argument is an open file descriptor that refers to the
47 \fBsad\fR driver.  The \fBcommand\fR argument determines the control function
48 to be performed as described below.  The \fIarg\fR argument represents
49 additional information that is needed by this command. The type of \fIarg\fR
50 depends upon the command, but it is generally an integer or a pointer to a
51 \fBcommand\fR-specific data structure.
52 .SH COMMAND FUNCTIONS
53 .sp
54 .LP
55 The autopush facility (see  \fBautopush\fR(8)) allows one to configure a list
56 of modules to be automatically pushed on a stream when a driver is  first
57 opened. Autopush is controlled by the following commands:
58 .sp
59 .ne 2
60 .na
61 \fB\fBSAD_SAP\fR\fR
62 .ad
63 .RS 11n
64 Allows the administrator to configure the given device's autopush information.
65 \fIarg\fR points to a  \fBstrapush\fR structure, which contains the following
66 members:
67 .sp
68 .in +2
69 .nf
70  unit_t   ap_cmd;
71  major_t  sap_major;
72  minor_t  sap_minor;
73  minor_t  sap_lastminor;
74  unit_t   sap_npush;
75  unit_t   sap_list [MAXAPUSH] [FMNAMESZ + 1];
76 .fi
77 .in -2
79 The  \fBsap_cmd\fR field indicates the type of configuration being done. It may
80 take on one of the following values:
81 .sp
82 .ne 2
83 .na
84 \fB\fBSAP_ONE\fR\fR
85 .ad
86 .RS 13n
87 Configure one minor device of a driver.
88 .RE
90 .sp
91 .ne 2
92 .na
93 \fB\fBSAP_RANGE\fR\fR
94 .ad
95 .RS 13n
96 Configure a range of minor devices of a driver.
97 .RE
99 .sp
100 .ne 2
102 \fB\fBSAP_ALL\fR\fR
104 .RS 13n
105 Configure all minor devices of a driver.
109 .ne 2
111 \fB\fBSAP_CLEAR\fR\fR
113 .RS 13n
114 Undo configuration information for a driver.
117 The  \fBsap_major\fR field is the major device number of the device to be
118 configured. The  \fBsap_minor\fR field is the minor device number of the device
119 to be configured. The  \fBsap_lastminor\fR field is used only with the
120 \fBSAP_RANGE\fR command,  which configures a range of minor devices between
121 \fBsap_minor\fR and  \fBsap_lastminor\fR, inclusive. The minor fields have no
122 meaning for the  \fBSAP_ALL\fR command. The  \fBsap_npush\fR field indicates
123 the number of modules to be automatically pushed when the device is opened. It
124 must be less than or equal to  \fBMAXAPUSH\fR \fB,\fR defined in  \fBsad.h\fR.
125 It must also be less than or equal to  \fBNSTRPUSH,\fR the maximum number of
126 modules that can be pushed on a stream, defined in the kernel master file.  The
127 field  \fBsap_list\fR is an array of NULL-terminated module names to be pushed
128 in the order  in which they appear in the list.
130 When using the  \fBSAP_CLEAR\fR command, the user sets only  \fBsap_major\fR
131 and \fBsap_minor\fR. This will undo the configuration information for any of
132 the other commands.  If a previous entry was configured as  \fBSAP_ALL,
133 sap_minor\fR should be set to zero. If a previous entry was configured as
134 \fBSAP_RANGE\fR \fB, sap_minor\fR should be set to the lowest minor device
135 number in the range configured.
137 On failure,  \fBerrno\fR is set to the following value:
139 .ne 2
141 \fB\fBEFAULT\fR\fR
143 .RS 10n
144 \fIarg\fR points outside the allocated address space.
148 .ne 2
150 \fB\fBEINVAL\fR\fR
152 .RS 10n
153 The major device number is invalid, the number of modules is invalid, or the
154 list of module names is invalid.
158 .ne 2
160 \fB\fBENOSTR\fR\fR
162 .RS 10n
163 The major device number does not represent a  \fBSTREAMS\fR driver.
167 .ne 2
169 \fB\fBEEXIST\fR\fR
171 .RS 10n
172 The major-minor device pair is already configured.
176 .ne 2
178 \fB\fBERANGE\fR\fR
180 .RS 10n
181 The command is  \fBSAP_RANGE\fR and  \fBsap_lastminor\fR is not greater than
182 \fBsap_minor\fR, or the command is  \fBSAP_CLEAR\fR and  \fBsap_minor\fR is not
183 equal to the first minor in the range.
187 .ne 2
189 \fB\fBENODEV\fR\fR
191 .RS 10n
192 The command is  \fBSAP_CLEAR\fR and the device is not configured for autopush.
196 .ne 2
198 \fB\fBENOSR\fR\fR
200 .RS 10n
201 An internal autopush data structure cannot be allocated.
207 .ne 2
209 \fB\fBSAD_GAP\fR\fR
211 .RS 11n
212 Allows any user to query the  \fBsad\fR driver to get the autopush
213 configuration information for a given device. \fIarg\fR points to a
214 \fBstrapush\fR structure as described in the previous command.
216 The user should set the  \fBsap_major\fR and  \fBsap_minor\fR fields of the
217 \fBstrapush\fR structure to the major and minor device numbers, respectively,
218 of the device in question. On return, the  \fBstrapush\fR structure will be
219 filled in with the entire information used to configure the device. Unused
220 entries in the module list will be zero-filled.
222 On failure,  \fBerrno\fR is set to one of the following values:
224 .ne 2
226 \fB\fBEFAULT\fR\fR
228 .RS 10n
229 \fIarg\fR points outside the allocated address space.
233 .ne 2
235 \fB\fBEINVAL\fR\fR
237 .RS 10n
238 The major device number is invalid.
242 .ne 2
244 \fB\fBENOSTR\fR\fR
246 .RS 10n
247 The major device number does not represent a  \fBSTREAMS\fR driver.
251 .ne 2
253 \fB\fBENODEV\fR\fR
255 .RS 10n
256 The device is not configured for autopush.
262 .ne 2
264 \fB\fBSAD_VML\fR\fR
266 .RS 11n
267 Allows any user to validate a list of modules (that is, to see if they are
268 installed on the system). \fIarg\fR is a pointer to a  \fBstr_list\fR structure
269 with the following members:
271 .in +2
273 int     sl_nmods;
274  struct  str_mlist      *sl_modlist;
276 .in -2
278 The  \fBstr_mlist\fR structure has the following member:
280 .in +2
282 char  l_name[FMNAMESZ+1];
284 .in -2
286 \fBsl_nmods\fR indicates the number of entries the user has allocated in the
287 array and  \fBsl_modlist\fR points to the array of module names. The return
288 value is 0 if the list is valid, 1 if the list contains an invalid module name,
289 or \(mi1 on failure. On failure,  \fBerrno\fR is set to one of the following
290 values:
292 .ne 2
294 \fB\fBEFAULT\fR\fR
296 .RS 10n
297 \fIarg\fR points outside the allocated address space.
301 .ne 2
303 \fB\fBEINVAL\fR\fR
305 .RS 10n
306 The  \fBsl_nmods\fR field of the  \fBstr_list\fR structure is less than or
307 equal to zero.
312 .SH SEE ALSO
315 \fBIntro\fR(2), \fBioctl\fR(2), \fBopen\fR(2)
318 \fISTREAMS Programming Guide\fR
319 .SH DIAGNOSTICS
322 Unless otherwise specified, the return value from  \fBioctl()\fR is \fB0\fR
323 upon success and  \fB\(mi1\fR upon failure with  \fBerrno\fR set as indicated.