# os_sup

### MODULE

os_sup

### MODULE SUMMARY

This module, together with some dedicated UNIX processes, implements a message passing service from the Solaris operating system to the error logger in the Erlang runtime system. The Solaris (SunOS 5.x) messages are retrieved from the syslog-daemon, syslogd.

### DESCRIPTION

This module starts a server written in Erlang (and later referenced only as server), which receives messages from the Solaris operating system. The messages are tagged with an atom and subsequently forwarded to the error_logger in the Erlang runtime system. If the atom is `std_error`, the messages are handled the same way as the bulk of internal error messages in the Erlang runtime system.

This module, together with the dedicated UNIX-processes, makes a number of reconfigurations to the Solaris operating system when the service is enabled. These configurations include:

- the installation of a new configuration file for `syslogd`
- the creation of a named pipe
- the start of a port program.

As a consequence of these modifications:

1. `syslogd` writes messages of interest to the named pipe
2. the port program reads messages from the named pipe and forwards them to the server
3. the server delivers them to the error logger of the Erlang runtime system.

When the service is disabled, the original configuration is restored.

### EXPORTS

`start() -> Result`

Types:

`Result = {ok, Pid} | {error, {already_started, Pid}}`
`Pid = pid()`

This function starts the server together with its dedicated UNIX processes. It returns `{ok, Pid}` if the start was successful, otherwise `{error, already_started}`.

`start_link() -> Result`

Types:

`Result = {ok, Pid} | {error, {already_started, Pid}}`
`Pid = pid()`

This function starts the server together with its dedicated UNIX processes. The caller is also linked to the server. It returns `{ok, Pid}` if the start was successful, otherwise `{error, already_started}` .

`stop() -> Result`

Types:

`Result = ok | not_started`

This function stops the server and restores the original configuration of the operating system. It returns `ok` if successful, otherwise `not_started`.

### Operation

1. This module is normally started by the supervisor and supervisor_bridge behaviours. Consequently, the user should not call the functions described above.
2. This module cannot be run in multiple instances on the same hardware. Special care must be taken if two or more Erlang nodes execute on the same hardware platform so that only one node uses this service in any one instance.
3. This module requires that a number of actions be been taken prior to starting it. These actions must be performed with root privileges on SunOS 5 and include change of ownership and file privileges of an executable binary file, and copying and creating a modified copy of the configuration file for the syslog-daemon syslogd. In addition, a the following configuration parameters must be set.
   1. implement the server using gen_server.
   2. implement protection against starting two or more instances of the service on the same hardware platform.

### See also

- os_mon(3), error_logger(3), Installation Guide for your platform.
- syslogd(1M), syslog.conf(4) in the Solaris documentation.

### AUTHORS

Mats Nilsson - support@erlang.ericsson.se

os_mon 1.7.2
Copyright © 1991-2005 Ericsson AB