User's Guide
Reference Manual
Release Notes
PDF
Top

OSE
User's Guide
Version 1.1

Expand All
Contract All

Chapters

- Introduction
  - Top of chapter
  - Features
  - Starting Erlang/OTP
  - run_erl and to_erl
  - epmd
  - VM Process Priorities
- Interacting with Enea OSE
  - Top of chapter
  - Introduction
  - Signals in Erlang
  - Signals in a Linked-in driver
  - Example Linked-in driver

# 1 Introduction

### 1.1 Features

### 1.2 Starting Erlang/OTP

Starting Erlang/OTP on OSE is not as simple as on Unix/Windows (yet). First of all you have to explicitly use the beam (or beam.smp) executables found in erts-X.Y.Z/bin as the load module that you run. This in turn means that you have to supply the raw beam arguments to the emulator when starting. Fortunately erl on Unix/Windows has a undocumented flag called -emu_args_exit that can be used to figure out what the arguments to beam look like. For example:

    # erl +Mut false +A 10 +S 4:4 +Muycs256 +P 2096 +Q 2096 -emu_args_exit
    -Mut
    false
    -A
    10
    -S
    4:4
    -Muycs256
    -P
    2096
    -Q
    2096
    --
    -root
    /usr/local/lib/erlang
    -progname
    erl
    --
    -home
    /home/erlang
    --

The arguments are printed on separate lines to make it possible to know what has to be quoted with ". Each line is one quotable unit. So taking the arguments above you can supply them to pm_create or just execute directly on the command line. For example:

    rtose@acp3400> pm_install erlang /mst/erlang/erts-6.0/bin/beam.smp
    rtose@acp3400> pm_create -c ARGV="-Mut false -A 10 -S 4:4 -Muycs256 -P 2096 -Q 2099 -- -root /mst/erlang -progname erl -- -home /mst/erlang --" erlang
    pid: 0x110059
    rtose@acp3400> pm_start 0x110059

Also note that since we are running erl to figure out the arguments on a separate machine the paths have to be updated. In the example above /usr/local/lib/erlang was replaced by /mst/erlang/. The goal is to in future releases not have to do the special argument handling but for now (OTP 17.0) you have to do it.

Note

Because of a limitation in the way the OSE handles stdio when starting load modules using pm_install/create the Erlang shell only reads every other command from stdin. However if you start Erlang using run_erl you do not have this problem. So it is highly recommended that you start Erlang using run_erl.

### 1.3 run_erl and to_erl

In OSE run_erl and to_erl are combined into a single load module called run_erl_lm. Installing and starting the load module will add two new shell commands called run_erl and to_erl. They work in exactly the same way as the unix variants of run_erl and to_erl, except that the read and write pipes have to be placed under the /pipe vm. One additional option also exists to run_erl on ose:

-block Name
  The name of the install handle and block that will be created/used by installing and exectuting the first part of the command. If nothing if given the basename of the load module will be used for this value. Example:

      pm_install erlang /path/to/erlang/vm/beam.smp
      run_erl -daemon -block erlang /pipe/ /mst/erlang_logs/ "beam.smp -A 1 -- -root /mst/erlang -- -home /mst --"

The same argument munching as when starting Erlang/OTP without run_erl has to be done. If -daemon is given then all error printouts are sent to the ramlog. See also run_erl for more details.

Below is an example of how to get started with run_erl_lm.

    rtose@acp3400> pm_install run_erl_lm /mst/erlang/erts-6.0/bin/run_erl_lm
    rtose@acp3400> pm_create run_erl_lm
    pid: 0x1c005d
    rtose@acp3400> pm_start 0x1c005d
    rtose@acp3400> mkdir /mst/erlang_log
    rtose@acp3400> run_erl -daemon /pipe/ /mst/erlang_log/ "/mst/erlang/erts-6.0/bin/beam.smp -A 1 -- -root /mst/erlang -- -home /mst --"
    rtose@acp3400> to_erl
    Attaching to /pipe/erlang.pipe.1 (^C to exit)
    os:type().
    {ose,release}
    2>
    'to_erl' terminated.

Note that Ctrl-C is used instead of Ctrl-D to exit the to_erl shell.

### 1.4 epmd

In OSE epmd will not be started automatically so if you want to use Erlang distribution you have to manually start epmd.

### 1.5 VM Process Priorities

It is possible to set the priorities you want for the OSE processes that thr emulator creates in the lmconf. An example of how to do it can be found in the default lmconf file in $ERL_TOP/erts/emulator/sys/ose/beam.lmconf.