1doconfig(3NSL) Networking Services Library Functions doconfig(3NSL)
2
3
4
6 doconfig - execute a configuration script
7
9 cc [ flag ... ] file ... -lnsl [ library ... ]
10 # include <sac.h>
11
12
13
14 int doconfig(int fildes, char *script, long rflag);
15
16
18 doconfig() is a Service Access Facility library function that inter‐
19 prets the configuration scripts contained in the files
20 </etc/saf/pmtag/_config>, </etc/saf/_sysconfig>, and
21 </etc/saf/pmtag/svctag>, where pmtag specifies the tag associated with
22 the port monitor, and svctag specifies the service tag associated with
23 a given service. See pmadm(1M) and sacadm(1M).
24
25
26 script is the name of the configuration script; fildes is a file
27 descriptor that designates the stream to which stream manipulation
28 operations are to be applied; rflag is a bitmask that indicates the
29 mode in which script is to be interpreted. If rflag is zero, all com‐
30 mands in the configuration script are eligible to be interpreted. If
31 rflag has the NOASSIGN bit set, the assign command is considered ille‐
32 gal and will generate an error return. If rflag has the NORUN bit set,
33 the run and runwait commands are considered illegal and will generate
34 error returns.
35
36
37 The configuration language in which script is written consists of a
38 sequence of commands, each of which is interpreted separately. The fol‐
39 lowing reserved keywords are defined: assign, push, pop, runwait, and
40 run. The comment character is #; when a # occurs on a line, everything
41 from that point to the end of the line is ignored. Blank lines are not
42 significant. No line in a command script may exceed 1024 characters.
43
44 assign variable=value
45
46 Used to define environment variables. variable is the name of the
47 environment variable and value is the value to be assigned to it.
48 The value assigned must be a string constant; no form of parameter
49 substitution is available. value may be quoted. The quoting rules
50 are those used by the shell for defining environment variables.
51 assign will fail if space cannot be allocated for the new variable
52 or if any part of the specification is invalid.
53
54
55 push module1[, module2, module3, . . .]
56
57 Used to push STREAMS modules onto the stream designated by fildes.
58 module1 is the name of the first module to be pushed, module2 is
59 the name of the second module to be pushed, etc. The command will
60 fail if any of the named modules cannot be pushed. If a module can‐
61 not be pushed, the subsequent modules on the same command line will
62 be ignored and modules that have already been pushed will be
63 popped.
64
65
66 pop [module]
67
68 Used to pop STREAMS modules off the designated stream. If pop is
69 invoked with no arguments, the top module on the stream is popped.
70 If an argument is given, modules will be popped one at a time until
71 the named module is at the top of the stream. If the named module
72 is not on the designated stream, the stream is left as it was and
73 the command fails. If module is the special keyword ALL, then all
74 modules on the stream will be popped. Note that only modules above
75 the topmost driver are affected.
76
77
78 runwait command
79
80 The runwait command runs a command and waits for it to complete.
81 command is the pathname of the command to be run. The command is
82 run with /usr/bin/sh -c prepended to it; shell scripts may thus be
83 executed from configuration scripts. The runwait command will fail
84 if command cannot be found or cannot be executed, or if command
85 exits with a non-zero status.
86
87
88 run command
89
90 The run command is identical to runwait except that it does not
91 wait for command to complete. command is the pathname of the com‐
92 mand to be run. run will not fail unless it is unable to create a
93 child process to execute the command.
94
95
96
97 Although they are syntactically indistinguishable, some of the commands
98 available to run and runwait are interpreter built-in commands. Inter‐
99 preter built-ins are used when it is necessary to alter the state of a
100 process within the context of that process. The doconfig() interpreter
101 built-in commands are similar to the shell special commands and, like
102 these, they do not spawn another process for execution. See sh(1). The
103 built-in commands are:
104
105 cd
106 ulimit
107 umask
108
109
111 doconfig() returns 0 if the script was interpreted successfully. If a
112 command in the script fails, the interpretation of the script ceases at
113 that point and a positive number is returned; this number indicates
114 which line in the script failed. If a system error occurs, a value of
115 −1 is returned. When a script fails, the process whose environment was
116 being established should not be started.
117
119 See attributes(5) for descriptions of the following attributes:
120
121
122
123
124 ┌─────────────────────────────┬─────────────────────────────┐
125 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
126 ├─────────────────────────────┼─────────────────────────────┤
127 │MT-Level │Unsafe │
128 └─────────────────────────────┴─────────────────────────────┘
129
131 sh(1), pmadm(1M), sacadm(1M), attributes(5)
132
134 This interface is unsafe in multithreaded applications. Unsafe inter‐
135 faces should be called only from the main thread.
136
137
138
139SunOS 5.11 30 Dec 1996 doconfig(3NSL)