1kernel(7) Erlang Application Definition kernel(7)
2
3
4
6 kernel - The Kernel application.
7
9 The Kernel application has all the code necessary to run the Erlang
10 runtime system: file servers, code servers, and so on.
11
12 The Kernel application is the first application started. It is manda‐
13 tory in the sense that the minimal system based on Erlang/OTP consists
14 of Kernel and STDLIB. Kernel contains the following functional areas:
15
16 * Start, stop, supervision, configuration, and distribution of appli‐
17 cations
18
19 * Code loading
20
21 * Logging
22
23 * Global name service
24
25 * Supervision of Erlang/OTP
26
27 * Communication with sockets
28
29 * Operating system interface
30
32 Two standard logger handlers are defined in the Kernel application.
33 These are described in the Kernel User's Guide, and in the log‐
34 ger_std_h(3) and logger_disk_log_h(3) manual pages.
35
37 Asynchronous OS signals may be subscribed to via the Kernel applica‐
38 tions event manager (see OTP Design Principles and gen_event(3)) regis‐
39 tered as erl_signal_server. A default signal handler is installed which
40 handles the following signals:
41
42 sigusr1:
43 The default handler will halt Erlang and produce a crashdump with
44 slogan "Received SIGUSR1". This is equivalent to calling er‐
45 lang:halt("Received SIGUSR1").
46
47 sigquit:
48 The default handler will halt Erlang immediately. This is equiva‐
49 lent to calling erlang:halt().
50
51 sigterm:
52 The default handler will terminate Erlang normally. This is equiva‐
53 lent to calling init:stop().
54
55 Events
56 Any event handler added to erl_signal_server must handle the following
57 events.
58
59 sighup:
60 Hangup detected on controlling terminal or death of controlling
61 process
62
63 sigquit:
64 Quit from keyboard
65
66 sigabrt:
67 Abort signal from abort
68
69 sigalrm:
70 Timer signal from alarm
71
72 sigterm:
73 Termination signal
74
75 sigusr1:
76 User-defined signal 1
77
78 sigusr2:
79 User-defined signal 2
80
81 sigchld:
82 Child process stopped or terminated
83
84 sigstop:
85 Stop process
86
87 sigtstp:
88 Stop typed at terminal
89
90 Setting OS signals are described in os:set_signal/2.
91
93 The following configuration parameters are defined for the Kernel ap‐
94 plication. For more information about configuration parameters, see
95 file app(4).
96
97 distributed = [Distrib]:
98 Specifies which applications that are distributed and on which
99 nodes they are allowed to execute. In this parameter:
100
101 * Distrib = {App,Nodes} | {App,Time,Nodes}
102
103 * App = atom()
104
105 * Time = integer()>0
106
107 * Nodes = [node() | {node(),...,node()}]
108
109 The parameter is described in application:load/2.
110
111 dist_auto_connect = Value:
112 Specifies when nodes are automatically connected. If this parameter
113 is not specified, a node is always automatically connected, for ex‐
114 ample, when a message is to be sent to that node. Value is one of:
115
116 never:
117 Connections are never automatically established, they must be ex‐
118 plicitly connected. See net_kernel(3).
119
120 once:
121 Connections are established automatically, but only once per
122 node. If a node goes down, it must thereafter be explicitly con‐
123 nected. See net_kernel(3).
124
125 dist_listen = boolean():
126 Specifies whether this node should be listening for incoming dis‐
127 tribution connections. Using this option implies that the node also
128 is -hidden.
129
130 permissions = [Perm]:
131 Specifies the default permission for applications when they are
132 started. In this parameter:
133
134 * Perm = {ApplName,Bool}
135
136 * ApplName = atom()
137
138 * Bool = boolean()
139
140 Permissions are described in application:permit/2.
141
142 logger = [Config]:
143 Specifies the configuration for Logger, except the primary log
144 level, which is specified with logger_level, and the compatibility
145 with SASL Error Logging, which is specified with logger_sasl_com‐
146 patible.
147
148 The logger parameter is described in section Logging in the Ker‐
149 nel User's Guide.
150
151 logger_level = Level:
152 Specifies the primary log level for Logger. Log events with the
153 same, or a more severe level, pass through the primary log level
154 check. See section Logging in the Kernel User's Guide for more in‐
155 formation about Logger and log levels.
156
157 Level = emergency | alert | critical | error | warning | notice |
158 info | debug | all | none
159
160 To change the primary log level at runtime, use logger:set_pri‐
161 mary_config(level, Level).
162
163 Defaults to notice.
164
165 logger_sasl_compatible = true | false:
166 Specifies if Logger behaves backwards compatible with the SASL er‐
167 ror logging functionality from releases prior to Erlang/OTP 21.0.
168
169 If this parameter is set to true, the default Logger handler does
170 not log any progress-, crash-, or supervisor reports. If the SASL
171 application is then started, it adds a Logger handler named sasl,
172 which logs these events according to values of the SASL configura‐
173 tion parameter sasl_error_logger and sasl_errlog_type.
174
175 See section Deprecated Error Logger Event Handlers and Configura‐
176 tion in the sasl(6) manual page for information about the SASL con‐
177 figuration parameters.
178
179 See section SASL Error Logging in the SASL User's Guide, and sec‐
180 tion Backwards Compatibility with error_logger in the Kernel User's
181 Guide for information about the SASL error logging functionality,
182 and how Logger can be backwards compatible with this.
183
184 Defaults to false.
185
186 Note:
187 If this parameter is set to true, sasl_errlog_type indicates that
188 progress reports shall be logged, and the configured primary log
189 level is notice or more severe, then SASL automatically sets the pri‐
190 mary log level to info. That is, this setting can potentially over‐
191 write the value of the Kernel configuration parameter logger_level.
192 This is to allow progress reports, which have log level info, to be
193 forwarded to the handlers.
194
195
196 global_groups = [GroupTuple]:
197
198
199 Defines global groups, see global_group(3). In this parameter:
200
201 * GroupTuple = {GroupName, [Node]} | {GroupName, PublishType,
202 [Node]}
203
204 * GroupName = atom()
205
206 * PublishType = normal | hidden
207
208 * Node = node()
209
210 inet_default_connect_options = [{Opt, Val}]:
211 Specifies default options for connect sockets, see inet(3).
212
213 inet_default_listen_options = [{Opt, Val}]:
214 Specifies default options for listen (and accept) sockets, see
215 inet(3).
216
217 {inet_dist_use_interface, ip_address()}:
218 If the host of an Erlang node has many network interfaces, this pa‐
219 rameter specifies which one to listen on. For the type definition
220 of ip_address(), see inet(3).
221
222 {inet_dist_listen_min, First} and {inet_dist_listen_max, Last}:
223 Defines the First..Last port range for the listener socket of a
224 distributed Erlang node.
225
226 {inet_dist_listen_options, Opts}:
227
228
229 Defines a list of extra socket options to be used when opening the
230 listening socket for a distributed Erlang node. See gen_tcp:lis‐
231 ten/2.
232
233 {inet_dist_connect_options, Opts}:
234
235
236 Defines a list of extra socket options to be used when connecting
237 to other distributed Erlang nodes. See gen_tcp:connect/4.
238
239 inet_parse_error_log = silent:
240 If set, no log events are issued when erroneous lines are found and
241 skipped in the various Inet configuration files.
242
243 inetrc = Filename:
244 The name (string) of an Inet user configuration file. For details,
245 see section Inet Configuration in the ERTS User's Guide.
246
247 net_setuptime = SetupTime:
248
249
250 SetupTime must be a positive integer or floating point number, and
251 is interpreted as the maximum allowed time for each network opera‐
252 tion during connection setup to another Erlang node. The maximum
253 allowed value is 120. If higher values are specified, 120 is used.
254 Default is 7 seconds if the variable is not specified, or if the
255 value is incorrect (for example, not a number).
256
257 Notice that this value does not limit the total connection setup
258 time, but rather each individual network operation during the con‐
259 nection setup and handshake.
260
261 net_ticktime = TickTime:
262
263
264 Specifies the net_kernel tick time in seconds. This is the approxi‐
265 mate time a connected node may be unresponsive until it is consid‐
266 ered down and thereby disconnected.
267
268 Once every TickTime/4 seconds, each connected node is ticked if
269 nothing has been sent to it during that last TickTime/4 interval. A
270 tick is a small package sent on the connection. A connected node is
271 considered to be down if no ticks or payload packages have been re‐
272 ceived during the last four TickTime/4 intervals. This ensures that
273 nodes that are not responding, for reasons such as hardware errors,
274 are considered to be down.
275
276 As the availability is only checked every TickTime/4 seconds, the
277 actual time T a node have been unresponsive when detected may vary
278 between MinT and MaxT, where:
279
280 MinT = TickTime - TickTime / 4
281 MaxT = TickTime + TickTime / 4
282
283 TickTime defaults to 60 seconds. Thus, 45 < T < 75 seconds.
284
285 Notice that all communicating nodes are to have the same TickTime
286 value specified, as it determines both the frequency of outgoing
287 ticks and the expected frequency of incominging ticks.
288
289 Normally, a terminating node is detected immediately by the trans‐
290 port protocol (like TCP/IP).
291
292 shutdown_timeout = integer() | infinity:
293 Specifies the time application_controller waits for an application
294 to terminate during node shutdown. If the timer expires, applica‐
295 tion_controller brutally kills application_master of the hanging
296 application. If this parameter is undefined, it defaults to infin‐
297 ity.
298
299 sync_nodes_mandatory = [NodeName]:
300 Specifies which other nodes that must be alive for this node to
301 start properly. If some node in the list does not start within the
302 specified time, this node does not start either. If this parameter
303 is undefined, it defaults to [].
304
305 sync_nodes_optional = [NodeName]:
306 Specifies which other nodes that can be alive for this node to
307 start properly. If some node in this list does not start within the
308 specified time, this node starts anyway. If this parameter is unde‐
309 fined, it defaults to the empty list.
310
311 sync_nodes_timeout = integer() | infinity:
312 Specifies the time (in milliseconds) that this node waits for the
313 mandatory and optional nodes to start. If this parameter is unde‐
314 fined, no node synchronization is performed. This option ensures
315 that global is synchronized.
316
317 start_distribution = true | false:
318 Starts all distribution services, such as rpc, global, and net_ker‐
319 nel if the parameter is true. This parameter is to be set to false
320 for systems who want to disable all distribution functionality.
321
322 Defaults to true.
323
324 start_dist_ac = true | false:
325 Starts the dist_ac server if the parameter is true. This parameter
326 is to be set to true for systems using distributed applications.
327
328 Defaults to false. If this parameter is undefined, the server is
329 started if parameter distributed is set.
330
331 start_boot_server = true | false:
332 Starts the boot_server if the parameter is true (see
333 erl_boot_server(3)). This parameter is to be set to true in an em‐
334 bedded system using this service.
335
336 Defaults to false.
337
338 boot_server_slaves = [SlaveIP]:
339 If configuration parameter start_boot_server is true, this parame‐
340 ter can be used to initialize boot_server with a list of slave IP
341 addresses:
342
343 SlaveIP = string() | atom | {integer(),integer(),integer(),inte‐
344 ger()},
345
346 where 0 <= integer() <=255.
347
348 Examples of SlaveIP in atom, string, and tuple form:
349
350 '150.236.16.70', "150,236,16,70", {150,236,16,70}.
351
352 Defaults to [].
353
354 start_disk_log = true | false:
355 Starts the disk_log_server if the parameter is true (see
356 disk_log(3)). This parameter is to be set to true in an embedded
357 system using this service.
358
359 Defaults to false.
360
361 start_pg = true | false:
362
363
364 Starts the default pg scope server (see pg(3)) if the parameter is
365 true. This parameter is to be set to true in an embedded system
366 that uses this service.
367
368 Defaults to false.
369
370 start_pg2 = true | false:
371
372
373 Starts the pg2 server (see pg2(3)) if the parameter is true. This
374 parameter is to be set to true in an embedded system that uses this
375 service.
376
377 Defaults to false.
378
379 start_timer = true | false:
380 Starts the timer_server if the parameter is true (see timer(3)).
381 This parameter is to be set to true in an embedded system using
382 this service.
383
384 Defaults to false.
385
386 shell_history = enabled | disabled :
387 Specifies whether shell history should be logged to disk between
388 usages of erl.
389
390 shell_history_drop = [string()]:
391 Specific log lines that should not be persisted. For example
392 ["q().", "init:stop()."] will allow to ignore commands that shut
393 the node down. Defaults to [].
394
395 shell_history_file_bytes = integer():
396 How many bytes the shell should remember. By default, the value is
397 set to 512kb, and the minimal value is 50kb.
398
399 shell_history_path = string():
400 Specifies where the shell history files will be stored. defaults to
401 the user's cache directory as returned by file‐
402 name:basedir(user_cache, "erlang-history").
403
404 shutdown_func = {Mod, Func}:
405 Where:
406
407 * Mod = atom()
408
409 * Func = atom()
410
411 Sets a function that application_controller calls when it starts to
412 terminate. The function is called as Mod:Func(Reason), where Reason
413 is the terminate reason for application_controller, and it must re‐
414 turn as soon as possible for application_controller to terminate
415 properly.
416
417 source_search_rules = [DirRule] | [SuffixRule] :
418
419
420 Where:
421
422 * DirRule = {ObjDirSuffix,SrcDirSuffix}
423
424 * SuffixRule = {ObjSuffix,SrcSuffix,[DirRule]}
425
426 * ObjDirSuffix = string()
427
428 * SrcDirSuffix = string()
429
430 * ObjSuffix = string()
431
432 * SrcSuffix = string()
433
434 Specifies a list of rules for use by filelib:find_file/2
435 filelib:find_source/2 If this is set to some other value than the
436 empty list, it replaces the default rules. Rules can be simple
437 pairs of directory suffixes, such as {"ebin", "src"}, which are
438 used by filelib:find_file/2, or triples specifying separate direc‐
439 tory suffix rules depending on file name extensions, for example
440 [{".beam", ".erl", [{"ebin", "src"}]}, which are used by
441 filelib:find_source/2. Both kinds of rules can be mixed in the
442 list.
443
444 The interpretation of ObjDirSuffix and SrcDirSuffix is as follows:
445 if the end of the directory name where an object is located matches
446 ObjDirSuffix, then the name created by replacing ObjDirSuffix with
447 SrcDirSuffix is expanded by calling filelib:wildcard/1, and the
448 first regular file found among the matches is the source file.
449
451 In Erlang/OTP 21.0, a new API for logging was added. The old error_log‐
452 ger event manager, and event handlers running on this manager, still
453 work, but they are no longer used by default.
454
455 The following application configuration parameters can still be set,
456 but they are only used if the corresponding configuration parameters
457 for Logger are not set.
458
459 error_logger:
460 Replaced by setting the type, and possibly file and modes parame‐
461 ters of the default logger_std_h handler. Example:
462
463 erl -kernel logger '[{handler,default,logger_std_h,#{config=>#{file=>"/tmp/erlang.log"}}}]'
464
465
466 error_logger_format_depth:
467 Replaced by setting the depth parameter of the default handlers
468 formatter. Example:
469
470 erl -kernel logger '[{handler,default,logger_std_h,#{formatter=>{logger_formatter,#{legacy_header=>true,template=>[{logger_formatter,header},"\n",msg,"\n"],depth=>10}}}]'
471
472
473 See Backwards compatibility with error_logger for more information.
474
476 app(4), application(3), code(3), disk_log(3), erl_boot_server(3),
477 erl_ddll(3), file(3), global(3), global_group(3), heart(3), inet(3),
478 logger(3), net_kernel(3), os(3), pg(3), pg2(3), rpc(3), seq_trace(3),
479 user(3), timer(3)
480
481
482
483Ericsson AB kernel 7.3.1.1 kernel(7)