erl

Section: USER COMMANDS (1)
Updated: erts 5.6.3
Index Return to Main Contents
 

名前

erl - Erlang エミュレータ  

説明

この erl プログラムは Erlang ランタイムシステムを開始します。正確な詳細は(例えば、erl がスクリプトかプログラムであるかや他のプログラムを呼び出すかどうかは)システム依存です。

恐らく Windows ユーザーは代わりにそれぞれのウィンドウとスクロールバーを持ちコマンドライン編集をサポートして実行される werl プログラムを使用したがります。Windows 上の erl プログラムではシェルでのライン編集を提供しませんし、Windows 95 上ではスクロールしたテキストをスクロールバックする方法は有りません。erl プログラムはパイプライン使うか必要なら標準入力や照準出力をリダイレクトしなければなりません。  

使い方

erl <引数>

Erlang ランタイムシステムを開始します.

この引数は エミュレータフラグフラグプレーン引数 に分けられます:

*
+ から始まる引数はエミュレータフラグとして解釈されます。

名前通り、エミュレータフラグはエミュレータの挙動をコントロールします。

*
- (ハイフン)から始まる引数は Erlang ランタイム部を通過すべきフラグとして解釈され、具体的には init システムによって処理されます、see init(3)。

この init 処理では init flags と呼ばれる幾つかのフラグをそれ自身で解釈します。これはまた残りのフラグを user flags として格納します。これは後から init:get_argument/1 を呼ぶことによって取得することが出来ます。

実際にはエミュレータフラグである "-" フラグが極少数存在する事に注意が必要です、以下の説明を見てください。

*
プレーン引数はどんな場合にも解釈されません。それらはまたinit 処理によって格納され、init:get_plain_arguments/0 が呼ばれる事による取得する事が出来ます。 プレーン引数は最初のフラグの後か -- フラグの後に現れます。さらに -extra フラグによって後続の全てがプレーン引数になります。

例:

% erl +W w -sname arnie +R 9 -s my_init -extra +bertie

(arnie@host)1> init:get_argument(sname).

{ok,[["arnie"]]}
(arnie@host)2> init:get_plain_arguments().

["+bertie"]

この +W w+R 9 はエミュレータフラグです。-s my_init は初期化フラグで、init により処理されます。-sname arnie はユーザーフラグです、init により保存されます。それはカーネルに読み込まれ、Erlangランタイムシステムを分散させる要因となるでしょう。最後に、-extra(+bertie) 以降のすべてはプレーン引数とみなされます。

% erl -myflag 1

1> init:get_argument(myflag).

{ok,[["1"]]}
2> init:get_plain_arguments().

[]

このユーザーフラグ -myflag 1init プロセスを通過し、保存されます。それはユーザーの定義したフラグで、おそらくはユーザーの定義したアプリケーションによって使用されます。

 

フラグ

以下の一覧は初期化フラグ(init flag)に分類されます。特別にに指定しない限り、その他の全てのフラグは init:get_argument/1 を呼び出すことで取得する事が出来るユーザーフラグになります。このリストにユーザーフラグは含まれていないことに注意してください、それらはおそらく付加的なアプリケーション固有のフラグですので、アプリケーションに付随するドキュメントに記載されています。

--(init flag):
-- 以降に続く全てのフラグ (-flag+flag) はプレーン引数としてみなされ、init:get_plain_arguments/0 を使用して取得できます。

-Application Par Val:
アプリケーション Application の為の構成パラメータ Par に値の Val を設定します、app(4) and application(3) を参照してください。

-args_file FileName:

コマンドライン引数はファイル FileName から読み込まれます。この引数はファイルを読み込み、コマンドラインの結果は '-args_file FileName' フラグを置き換えたものとなります。

このFileName で指定するファイルはプレーンテキストである必要があり、コメントとコマンドライン引数を含むことができます。# の文字から始まり行末までがコメントです。バックスラッシュ(\)は文字の引用に使用されます。erl で許可されている全てのコマンドが受け入れられます(-args_file FileName フラグも)。ただし、-args_file フラグの依存関係が巡回するケースに注意してください。

この-extraフラグは特別に処理されます。そのスコープはファイルの終端で終了します。コマンドライン上の-extraフラグ以降の引数は、-extraセクションへ移動します。すなわち、-extraフラグからコマンドラインの終端までです。

-async_shell_start:
Erlangシェルの初期段階では起動手続きが完了するまでユーザーの入力を読み込みません(Erlang 5.4 以降)。このフラグは同期開始機能を無効化し、システムの空き時間を使用してシェルの開始を並列化します。
-boot File:
ブートファイル名 File を指定します。これはシステムを開始するときに使用されます。 参照 init(3)。File に絶対パスを指定した場合を除き、システムは File.boot をカレントディレクトリと、$ROOT/binディレクトリから探索します。

デフォルトは $ROOT/bin/start.boot です。

-boot_var Var Dir:
もしブートスクリプトに $ROOT 以外のパス変数 Var が含まれていれば、この変数は Dirに展開されます。アプリケーションは $ROOT/lib とは別のディレクトリにインストールされたものを使用します。systools:make_script/1,2 を参照してください。
-code_path_cache:
コードサーバーのコードパスキャッシュを有効にします。code(3)を参照してください。
-compile Mod1 Mod2 ...:
指定した終端までの複数のモジュールをコンパイルします(終了コードがゼロ以外だった場合、いくつかのファイルのコンパイルは成功していません)。暗黙的に -noinput が使用されます。このフラグは推奨されません - 代わりに erlc を使用してください。
-config Config:
コンフィグレーションファイル名 Config.config を指定します、これはアプリケーションを設定するために使用されます。 app(4) と application(3) を参照してください。
-connect_all false:

If this flag is present, global will not maintain a fully connected network of distributed Erlang nodes, and then global name registration cannot be used. See global(3).

-cookie Cookie:
Obsolete flag without any effect and common misspelling for -setcookie. Use -setcookie instead.
-detached:
Starts the Erlang runtime system detached from the system console. Useful for running daemons and backgrounds processes.
-emu_args:
Useful for debugging. Prints out the actual arguments sent to the emulator.
-env Variable Value:
Sets the host OS environment variable Variable to the value Value for the Erlang runtime system. Example:

% erl -env DISPLAY gin:0

In this example, an Erlang runtime system is started with the DISPLAY environment variable set to gin:0.

-eval Expr(init flag):
Makes init evaluate the expression Expr, see init(3).
-extra(init flag):
Everything following -extra is considered plain arguments and can be retrieved using init:get_plain_arguments/0.
-heart:
Starts heart beat monitoring of the Erlang runtime system. See heart(3).
-hidden:
Starts the Erlang runtime system as a hidden node, if it is run as a distributed node. Hidden nodes always establish hidden connections to all other nodes except for nodes in the same global group. Hidden connections are not published on neither of the connected nodes, i.e. neither of the connected nodes are part of the result from nodes/0 on the other node. See also hidden global groups, global_group(3).
-hosts Hosts:
Specifies the IP addresses for the hosts on which Erlang boot servers are running, see erl_boot_server(3). This flag is mandatory if the -loader inet flag is present.

The IP addresses must be given in the standard form (four decimal numbers separated by periods, for example "150.236.20.74". Hosts names are not acceptable, but a broadcast address (preferably limited to the local network) is.

-id Id:
Specifies the identity of the Erlang runtime system. If it is run as a distributed node, Id must be identical to the name supplied together with the -sname or -name flag.
-init_debug:
Makes init write some debug information while interpreting the boot script.
-instr(emulator flag):

 

Selects an instrumented Erlang runtime system (virtual machine) to run, instead of the ordinary one. When running an instrumented runtime system, some resource usage data can be obtained and analysed using the module instrument. Functionally, it behaves exactly like an ordinary Erlang runtime system.

-loader Loader:
Specifies the method used by erl_prim_loader to load Erlang modules into the system. See erl_prim_loader(3). Two Loader methods are supported, efile and inet. efile means use the local file system, this is the default. inet means use a boot server on another machine, and the -id, -hosts and -setcookie flags must be specified as well. If Loader is something else, the user supplied Loader port program is started.
-make:
Makes the Erlang runtime system invoke make:all() in the current working directory and then terminate. See make(3). Implies -noinput.
-man Module:
Displays the manual page for the Erlang module Module. Only supported on Unix.
-mode interactive | embedded:
Indicates if the system should load code dynamically (interactive), or if all code should be loaded during system initialization (embedded), see code(3). Defaults to interactive.
-name Name:
Makes the Erlang runtime system into a distributed node. This flag invokes all network servers necessary for a node to become distributed. See net_kernel(3). It is also ensured that epmd runs on the current host before Erlang is started. See epmd(1).

The name of the node will be Name@Host, where Host is the fully qualified host name of the current host. For short names, use the -sname flag instead.

-noinput:
Ensures that the Erlang runtime system never tries to read any input. Implies -noshell.
-noshell:
Starts an Erlang runtime system with no shell. This flag makes it possible to have the Erlang runtime system as a component in a series of UNIX pipes.
-nostick:
Disables the sticky directory facility of the Erlang code server, see code(3).
-oldshell:
Invokes the old Erlang shell from Erlang 3.3. The old shell can still be used.
-pa Dir1 Dir2 ...:
Adds the specified directories to the beginning of the code path, similar to code:add_pathsa/1. See code(3). As an alternative to -pa, if several directories are to be prepended to the code and the directories have a common parent directory, that parent directory could be specified in the ERL_LIBS environment variable. See code(3).
-pz Dir1 Dir2 ...:
Adds the specified directories to the end of the code path, similar to code:add_pathsz/1. See code(3).
-remsh Node:
Starts Erlang with a remote shell connected to Node.
-rsh Program:
Specifies an alternative to rsh for starting a slave node on a remote host. See slave(3).
-run Mod [Func [Arg1, Arg2, ...]](init flag):
Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1, Arg2, ...] as argument. All arguments are passed as strings. See init(3).
-s Mod [Func [Arg1, Arg2, ...]](init flag):
Makes init call the specified function. Func defaults to start. If no arguments are provided, the function is assumed to be of arity 0. Otherwise it is assumed to be of arity 1, taking the list [Arg1, Arg2, ...] as argument. All arguments are passed as atoms. See init(3).
-setcookie Cookie:
ノードのマジッククッキーを Cookie に設定します、erlang:set_cookie/2 を参照してください。
-shutdown_time Time:
init プロセスがシステムのシャットダウンを許可するまでの時間(ミリ秒)を指定します。Time ミリ秒の時間を経過したら、既存のプロセスはすべて終了させられます。デフォルトでこの値は infinity です。
-sname Name:
Erlangランタイムシステムは分散ノードの中で作られます。-name とよく似ていますがノード名 Name@Host のホスト名の部分を省略し、完全に修飾しません。

これは時々、DNS(Domain Name System)が動作していない場合で分散Erlangを実行する為の唯一の方法です。-sname フラグで実行したノードと -name フラグで実行したノードの間で通信を行うことは出来ませんが、ノード名は分散Erlangシステム内でユニークでなければなりません。

-smp [enable|auto|disable]:

-smp enable-smp は SMPサポートを有効にして Erlangランタイムシステムを起動します。もしランタイムシステムがSMPをサポートしていない場合に、これは失敗するかもしれません。-smp auto は SMPサポートを有効であり一つ以上の論理プロセッサを検出出来た場合に SMPサポートを有効にして Erlangランタイムシステムを起動します。-smp disable は SMPサポートを無効にして Erlangランタイムシステムを起動します。デフォルトでは -smp auto が使用されますが、競合するパラメータ通過した場合には -smp disable が使用されます。現在 -smp auto と競合するパラメーターは -hybrid だけです。

ノート: SMPをサポートしたランタイムシステムは全てのプラットホームでサポートされていません。+Sフラグを参照してください。

-version(エミュレーターフラグ):
エミュレーター自身のバージョン番号を表示します。erl +V と同じです。
 

エミュレーターフラグ

erl invokes the code for the Erlang emulator (virtual machine), which supports the following flags:

+a size:

 

Suggested stack size, in kilowords, for threads in the async-thread pool. Valid range is 16-8192 kilowords. The default suggested stack size is 16 kilowords, i.e, 64 kilobyte on 32-bit architectures. This small default size has been chosen since the amount of async-threads might be quite large. The default size is enough for drivers delivered with Erlang/OTP, but might not be sufficiently large for other dynamically linked in drivers that use the driver_async() functionality. Note that the value passed is only a suggestion, and it might even be ignored on some platforms.

+A size:

 

Sets the number of threads in async thread pool, valid range is 0-1024. Default is 0.

+B [c | d | i]:
The c option makes Ctrl-C interrupt the current shell instead of invoking the emulator break handler. The d option (same as specifying +B without an extra option) disables the break handler. The i option makes the emulator ignore any break signal.

If the c option is used with oldshell on Unix, Ctrl-C will restart the shell process rather than interrupt it.

Note that on Windows, this flag is only applicable for werl, not erl (oldshell). Note also that Ctrl-Break is used instead of Ctrl-C on Windows.

+c:
Disable compensation for sudden changes of system time.

Normally, erlang:now/0 will not immediately reflect sudden changes in the system time, in order to keep timers (including receive-after) working. Instead, the time maintained by erlang:now/0 is slowly adjusted towards the new system time. (Slowly means in one percent adjustments; if the time is off by one minute, the time will be adjusted in 100 minutes.)

When the +c option is given, this slow adjustment will not take place. Instead erlang:now/0 will always reflect the current system time. Note that timers are based on erlang:now/0. If the system time jumps, timers then time out at the wrong time.

+h Size:
Sets the default heap size of processes to the size Size.
+K true | false:
Enables or disables the kernel poll functionality if the emulator supports it. Default is false (disabled). If the emulator does not support kernel poll, and the +K flag is passed to the emulator, a warning is issued at startup.
+l:
Enables auto load tracing, displaying info while loading code.
+MFlag Value:

 

Memory allocator specific flags, see erts_alloc(3) for further information.

+P Number:

 

Sets the maximum number of concurrent processes for this system. Number must be in the range 16..134217727. Default is 32768.

+R ReleaseNumber:

 

Sets the compatibility mode.

The distribution mechanism is not backwards compatible by default. This flags sets the emulator in compatibility mode with an earlier Erlang/OTP release ReleaseNumber. The release number must be in the range 7..<current release>. This limits the emulator, making it possible for it to communicate with Erlang nodes (as well as C- and Java nodes) running that earlier release.

For example, an R10 node is not automatically compatible with an R9 node, but R10 nodes started with the +R 9 flag can co-exist with R9 nodes in the same distributed Erlang system, they are R9-compatible.

Note: Make sure all nodes (Erlang-, C-, and Java nodes) of a distributed Erlang system is of the same Erlang/OTP release, or from two different Erlang/OTP releases X and Y, where all Y nodes have compatibility mode X.

For example: A distributed Erlang system can consist of R10 nodes, or of R9 nodes and R9-compatible R10 nodes, but not of R9 nodes, R9-compatible R10 nodes and "regular" R10 nodes, as R9 and "regular" R10 nodes are not compatible.

+r:
Force ets memory block to be moved on realloc.
+S Number:

 

Sets the number of scheduler threads to use when SMP support has been enabled. Valid range is 1-1024. If the Erlang runtime system is able to determine the number of processor cores available, the default value will equal the this value; otherwise, the default value will be one.

This flag will be ignored if the emulator doesn't have SMP support enabled (see the -smp flag).

+T Level:

 

Enables modified timing and sets the modified timing level. Currently valid range is 0-9. The timing of the runtime system will change. A high level usually means a greater change than a low level. Changing the timing can be very useful for finding timing related bugs.

Currently, modified timing affects the following:

Process spawning:
A process calling spawn, spawn_link, spawn_monitor, or spawn_opt will be scheduled out immediately after completing the call. When higher modified timing levels are used, the caller will also sleep for a while after being scheduled out.
Context reductions:
The amount of reductions a process is a allowed to use before being scheduled out is increased or reduced.
Input reductions:
The amount of reductions performed before checking I/O is increased or reduced.

NOTE: Performance will suffer when modified timing is enabled. This flag is only intended for testing and debugging. Also note that return_to and return_from trace messages will be lost when tracing on the spawn BIFs. This flag may be removed or changed at any time without prior notice.

+V:
Makes the emulator print out its version number.
+v:
Verbose.
+W w | i:
Sets the mapping of warning messages for error_logger. Messages sent to the error logger using one of the warning routines can be mapped either to errors (default), warnings (+W w), or info reports (+W i). The current mapping can be retrieved using error_logger:warning_map/0. See error_logger(3) for further information.
 

環境変数

ERL_CRASH_DUMP:
If the emulator needs to write a crash dump, the value of this variable will be the file name of the crash dump file. If the variable is not set, the name of the crash dump file will be erl_crash.dump in the current directory.
ERL_CRASH_DUMP_NICE:
Unix systems: If the emulator needs to write a crash dump, it will use the value of this variable to set the nice value for the process, thus lowering its priority. The allowable range is 1 through 39 (higher values will be replaced with 39). The highest value, 39, will give the process the lowest priority.
ERL_CRASH_DUMP_SECONDS:
Unix systems: This variable gives the number of seconds that the emulator will be allowed to spend writing a crash dump. When the given number of seconds have elapsed, the emulator will be terminated by a SIGALRM signal.
ERL_AFLAGS:
The content of this environment variable will be added to the beginning of the command line for erl.

The -extra flag is treated specially. Its scope ends at the end of the environment variable content. Arguments following an -extra flag are moved on the command line into the -extra section, i.e. the end of the command line following after an -extra flag.

ERL_ZFLAGSand ERL_FLAGS:
The content of these environment variables will be added to the end of the command line for erl.

The -extra flag is treated specially. Its scope ends at the end of the environment variable content. Arguments following an -extra flag are moved on the command line into the -extra section, i.e. the end of the command line following after an -extra flag.

ERL_LIBS:
This environment variable contains a list of additional library directories that the code server will search for applications and add to the code path. See code(3).
 

関連項目

init(3), erl_prim_loader(3), erl_boot_server(3), code(3), application(3), heart(3), net_kernel(3), auth(3), make(3), epmd(1), erts_alloc(3)


 

Index

名前
説明
使い方
フラグ
エミュレーターフラグ
環境変数
関連項目

This document was created by man2html, using the manual pages.
Time: 04:17:23 GMT, May 14, 2009