SLINK(ADMN) UNIX System V
Name
slink - streams linker
Syntax
slink [-v] [-f] [ -c file] [func [arg1 arg2 ...]]
Description
slink is a STREAMS configuration utility that is used to
link together the various STREAMS modules and drivers
required for STREAMS TCP/IP. Input to slink is in the form
of a script specifying the STREAMS operations to be
performed. Input is normally taken from the file
/etc/strcf.
The following options may be specified on the slink command
line:
-c file Use file instead of /etc/strcf.
-v Verbose mode (that is, each operation is logged to
stderr).
-f Do not fork (that is, slink will remain in
foreground).
The configuration file contains a list of functions, each of
which is composed of a list of commands. Each command is a
call to one of the functions defined in the configuration
file or to one of a set of built-in functions. Among the
built-in functions are the basic STREAMS operations open,
link, and push, along with several TCP/IP-specific
functions.
slink processing consists of parsing the input file, then
calling the user-defined function boot, which is normally
used to set up the standard configuration at boot time. If
a function is specified on the slink command line, that
function will be called instead of boot. Following the
execution of the specified function, slink goes into the
background and remains idle, holding open whatever file
descriptors have been opened by the configuration commands.
A function definition has the following form:
function-name {
command1
command2
...
}
The syntax for commands is:
function arg1 arg2 arg3 ...
or:
var = function arg1 arg2 arg3 ...
The placement of newlines is important: a newline must
follow the left and right braces and every command. Extra
newlines are allowed, that is, where one newline is
required, more than one may be used. A backslash (`\')
followed immediately by a newline is considered equivalent
to a space, so it may be used to continue a command on a new
line. The use of other white space characters (spaces and
tabs) is at the discretion of the user, except that there
must be white space separating the function name and the
arguments of a command.
Comments are delimited by `#' and newline, and are
considered equivalent to a newline.
Function and variable names may be any string of characters
taken from A-Z, a-z, 0-9, and `_', except that the first
character cannot be a digit. Function names and variable
names occupy separate name spaces. All functions are global
and may be forward-referenced. All variables are local to
the functions in which they occur.
Variables are defined when they appear to the left of an
equal sign (`=') on a command line, such as:
tcp = open /dev/inet/tcp
The variable acquires the value returned by the command. In
the above example, the value of the variable tcp will be the
file descriptor returned by the open call.
Arguments to a command may be variables, parameters, or
strings.
A variable that appears as an argument must have been
assigned a value on a previous command line in that
function.
Parameters take the form of a dollar sign (`$') followed by
one or two decimal digits, and are replaced with the
corresponding argument from the function call. If a given
parameter was not specified in the function call, an error
results (for instance, if a command references $3 and only
two arguments were passed to the function, an execution
error will occur).
Strings are sequences of characters optionally enclosed in
double quotes (`"'). Quotes may be used to prevent a string
from being interpreted as a variable name or a parameter,
and to allow the inclusion of spaces, tabs, and the special
characters `{', `}', `=', and `#'. The backslash (`\') may
also be used to quote the characters `{', `}', `=', `#',
`"', and `\' individually.
The following built-in functions are provided by slink:
open path Open the device specified by pathname
path. Returns a file descriptor
referencing the open stream.
link fd1 fd2 Link the stream referenced by fd2
beneath the stream referenced by fd1.
Returns the link identifier associated
with the link. Note: The fd2 function
cannot be used after this operation.
push fd module Push the module identified by module
onto the stream referenced by fd.
sifname fd link name Send a SIOCSIFNAME (set interface
name) ioctl down the stream referenced
by fd for the link associated with
link identifier link specifying the
name given in name.
unitsel fd unit Send a IF_UNITSEL (unit select) ioctl
down the stream referenced by fd
specifying the unit given in unit.
dlattach fd unit Send a DL_ATTACH_REQ message down the
stream referenced by fd specifying the
unit given in unit.
initqp path qname lowat hiwat ...
Send an INITQPARMS (initialize queue
parameters) ioctl to the driver
corresponding to pathname path. qname
specifies the queue for which the low
and high water marks will be set, and
must be one of:
hd stream head
rq read queue
wq write queue
muxrqmultiplexor read queue
muxwqmultiplexor write queue
The lowat and hiwat functions specify
the new low and high water marks for
the queue. Both lowat and hiwat must
be present. To change only one of
these parameters, the other may be
replaced with a dash (`-'). Up to
five qname lowat hiwat triplets may be
present.
strcat str1 str2 Concatenate strings str1 and str2 and
return the resulting string.
return val Set the return value for the current
function to val. Note: executing a
return command does not terminate
execution of the current function.
Files
/etc/strcf
See Also
strcf(SFF), intro(ADMP).
(printed 8/17/89) SLINK(ADMN)