aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-02-21 15:19:53 +0100
committerLukas Larsson <[email protected]>2014-02-24 15:24:07 +0100
commit13ed57745c639f72be8ae1f25fbd206f6e7307f3 (patch)
tree3d12d1c2a19105bc53075a886f02096a982774af
parent08910c59fb8dda35ee3c272d84cba450954fcd24 (diff)
downloadotp-13ed57745c639f72be8ae1f25fbd206f6e7307f3.tar.gz
otp-13ed57745c639f72be8ae1f25fbd206f6e7307f3.tar.bz2
otp-13ed57745c639f72be8ae1f25fbd206f6e7307f3.zip
ose: Expand OSE docs
-rw-r--r--erts/etc/common/to_erl_common.c4
-rw-r--r--lib/ose/doc/src/ose_intro.xml97
-rw-r--r--lib/ose/doc/src/ose_signals_chapter.xml23
3 files changed, 122 insertions, 2 deletions
diff --git a/erts/etc/common/to_erl_common.c b/erts/etc/common/to_erl_common.c
index 1b2f27fa04..a49be44b6c 100644
--- a/erts/etc/common/to_erl_common.c
+++ b/erts/etc/common/to_erl_common.c
@@ -279,7 +279,11 @@ int to_erl(int argc, char **argv)
fprintf(stderr, "to_erl: %s opened for writing\n", FIFO2);
#endif
+#ifndef __OSE__
fprintf(stderr, "Attaching to %s (^D to exit)\n\n", pipename);
+#else
+ fprintf(stderr, "Attaching to %s (^C to exit)\n\n", pipename);
+#endif
#ifndef __OSE__
/* Set break handler to our handler */
diff --git a/lib/ose/doc/src/ose_intro.xml b/lib/ose/doc/src/ose_intro.xml
index 8fe723ba83..0dd3ec409e 100644
--- a/lib/ose/doc/src/ose_intro.xml
+++ b/lib/ose/doc/src/ose_intro.xml
@@ -34,6 +34,62 @@
</section>
<section>
+ <title>Starting Erlang/OTP</title>
+ <p>
+ 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 <c>erl</c> on Unix/Windows has a
+ undocumented flag called <c>-emu_args_exit</c> that can be used to
+ figure out what the arguments to beam look like. For example:</p>
+ <code># 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
+--</code>
+ <p>
+ The arguments are printed on seperate lines to make it possible to know
+ what has to be quoted with &quot;. 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:</p>
+ <code>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</code>
+ <p>
+ Also note that since we are running erl to figure out the arguments on a
+ seperate machine the paths have to be updated. In the example above
+ <c>/usr/local/lib/erlang</c> was replaced by <c>/mst/erlang/</c>. The
+ goal is to in future releases not have to do the special argument handling
+ but for now (17.0-rc2) you have to do it.
+ </p>
+ <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.
+ </note>
+ </section>
+
+ <section>
<title>run_erl and to_erl</title>
<p>
In OSE run_erl and to_erl are combined into a single load module called
@@ -48,13 +104,50 @@
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:
- <code>pm_install erlang /path/to/erlang/vm
-run_erl -daemon -block erlang /pipe/ /mst/erlang_logs/ "erl -A 10"</code>
+ <code>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 --"</code>
</item>
</taglist>
+ The same argument munching as when starting Erlang/OTP without run_erl
+ has to be done. If <c>-daemon</c> is given then all error printouts
+ are sent to the ramlog.
See also
<seealso marker="erts:run_erl">run_erl</seealso> for more details.
</p>
+ <p>
+ Below is an example of how to get started with <c>run_erl_lm</c>.
+ <code>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.</code>
+ Note that Ctrl-C is used instead of Ctrl-D to exit the to_erl shell.
+ </p>
+ </section>
+
+ <section>
+ <title>epmd</title>
+ <p>
+ In OSE epmd will not be started automatically so if you want to use
+ Erlang distribution you have to manually start epmd.
+ </p>
+ </section>
+
+ <section>
+ <title>VM Process Priorities</title>
+ <p>
+ 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/default.lmconf.
+ </p>
</section>
</chapter>
diff --git a/lib/ose/doc/src/ose_signals_chapter.xml b/lib/ose/doc/src/ose_signals_chapter.xml
index c8d98f4099..ff501777cc 100644
--- a/lib/ose/doc/src/ose_signals_chapter.xml
+++ b/lib/ose/doc/src/ose_signals_chapter.xml
@@ -45,6 +45,29 @@
<marker id="erlang"></marker>
<section>
<title>Signals in Erlang</title>
+ <p>Erlang/OTP on OSE provides a erlang module called
+ <seealso marker="ose:ose">ose</seealso> that can be used to interact
+ with other OSE processes using message passing. The api in the module
+ is very similar to the native OSE api, so for details of how the
+ functions work please refer to the official OSE documenation. Below
+ is an example usage of the API.
+ </p>
+ <code>1> P1 = ose:open("p1").
+#Port&gt;0.344>
+2> ose:hunt(P1,"p2").
+{#Port&gt;0.344>,1}
+3> P2 = ose:open("p2").
+#Port&gt;0.355>
+4> flush().
+Shell got {mailbox_up,#Port&gt;0.344>,{#Port&gt;0.344>,1},852189}
+ok
+5> ose:listen(P1,[1234]).
+ok
+6> ose:send(P2,ose:get_id(P1),1234,&gt;&gt;"hello">>).
+ok
+7> flush().
+Shell got {message,#Port&gt;0.344>,{852189,1245316,1234,&gt;&gt;"hello">>}}
+ok</code>
</section>
<marker id="driver"></marker>