3. The Socket Map Server

Socket map server smapd is the main part of the package. When invoked, it reads the configuration file and parses its command line to determine its configuration settings. Command line settings override ones from the configuration file. The default configuration file is ‘/etc/smapd.conf(4) After that, smapd loads the requested modules and starts operation.

In this chapter we will describe the server operation in detail. The discussion below will often refer to command line options and configuration statements, so we'll first describe shortly what are those. The formal description will be given later.

Command line options have two forms. In traditional, or short form, an option is a letter prefixed by a dash (e.g. ‘-f’). In long form, an option consists of two dashes and option name (e.g. ‘--foreground’). Both option forms allow for an argument. For more information on option syntax, see Command Line Syntax.

Configuration file uses the traditional UNIX syntax. Each statement occupies a single line. Very long lines may be split into several physical lines by ending each one with a backslash character. Comments are introduced with the ‘#’ character: the character itself and everything after it up to next newline is ignored. For a detailed description, see Smapd Configuration File.

You can instruct smapd to read an alternative configuration file instead of the default one. It may be necessary, for example, to test a new configuration. To do so, use the ‘--config=file’ (‘-c file’) command line option. Its argument specifies the file name to read, e.g.:

 
$ smapd -c ./mysmapd.conf

To check whether your configuration is error-free, use the ‘--lint’ (‘-t’) option. It instructs smapd to parse the configuration file and exit after that. Any errors found are reported on the standard error. The exit code is ‘0’ if the file parsed without errors and ‘78’ otherwise (see section Smapd Exit Codes, for a full list of exit codes). For example:

 
$ smapd -t

Of course, the two options may be used together:

 
$ smapd -t -c ./mysmapd.conf

or, in long form:

 
$ smapd --lint --config ./mysmapd.conf

Footnotes

(4)

To be precise, it is ‘sysconfdir/smapd.conf’, where sysconfdir is the name of system configuration directory, determined when configuring the package. The two most frequently used values for it are ‘/etc’ and ‘/usr/local/etc’.