1kernel(7)                Erlang Application Definition               kernel(7)
2
3
4

NAME

6       kernel - The Kernel application.
7

DESCRIPTION

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         * Error logging
24
25         * Global name service
26
27         * Supervision of Erlang/OTP
28
29         * Communication with sockets
30
31         * Operating system interface
32

ERROR LOGGER EVENT HANDLERS

34       Two  standard  error  logger  event  handlers are defined in the Kernel
35       application. These are described in error_logger(3).
36

OS SIGNAL EVENT HANDLER

38       Asynchronous OS signals may be subscribed to via  the  Kernel  applica‐
39       tions event manager (see OTP Design Principles and gen_event(3)) regis‐
40       tered as erl_signal_server. A default signal handler is installed which
41       handles the following signals:
42
43         sigusr1:
44           The  default  handler will halt Erlang and produce a crashdump with
45           slogan  "Received  SIGUSR1".  This   is   equivalent   to   calling
46           erlang:halt("Received SIGUSR1").
47
48         sigquit:
49           The  default  handler will halt Erlang immediately. This is equiva‐
50           lent to calling erlang:halt().
51
52         sigterm:
53           The default handler will terminate Erlang normally. This is equiva‐
54           lent to calling init:stop().
55
56   Events
57       Any  event handler added to erl_signal_server must handle the following
58       events.
59
60         sighup:
61           Hangup detected on controlling terminal  or  death  of  controlling
62           process
63
64         sigquit:
65           Quit from keyboard
66
67         sigabrt:
68           Abort signal from abort
69
70         sigalrm:
71           Timer signal from alarm
72
73         sigterm:
74           Termination signal
75
76         sigusr1:
77           User-defined signal 1
78
79         sigusr2:
80           User-defined signal 2
81
82         sigchld:
83           Child process stopped or terminated
84
85         sigstop:
86           Stop process
87
88         sigtstp:
89           Stop typed at terminal
90
91       Setting OS signals are described in os:set_signal/2.
92

CONFIGURATION

94       The  following  configuration  parameters  are  defined  for the Kernel
95       application. For more information about configuration  parameters,  see
96       file app(4).
97
98         browser_cmd = string() | {M,F,A}:
99           When  pressing the Help button in a tool such as Debugger, the help
100           text (an HTML file File) is by  default  displayed  in  a  Netscape
101           browser, which is required to be operational. This parameter can be
102           used to change the command for how to  display  the  help  text  if
103           another  browser than Netscape is preferred, or if another platform
104           than Unix or Windows is used.
105
106           If set to a string Command, the command "Command File" is evaluated
107           using os:cmd/1.
108
109           If   set   to  a  module-function-args  tuple,  {M,F,A},  the  call
110           apply(M,F,[File|A]) is evaluated.
111
112         distributed = [Distrib]:
113           Specifies which applications that  are  distributed  and  on  which
114           nodes they are allowed to execute. In this parameter:
115
116           * Distrib = {App,Nodes} | {App,Time,Nodes}
117
118           * App = atom()
119
120           * Time = integer()>0
121
122           * Nodes = [node() | {node(),...,node()}]
123
124           The parameter is described in application:load/2.
125
126         dist_auto_connect = Value:
127           Specifies when nodes are automatically connected. If this parameter
128           is not specified, a node is  always  automatically  connected,  for
129           example,  when  a  message is to be sent to that node. Value is one
130           of:
131
132           never:
133             Connections are never automatically  established,  they  must  be
134             explicitly connected. See net_kernel(3).
135
136           once:
137             Connections  are  established  automatically,  but  only once per
138             node. If a node goes down, it must thereafter be explicitly  con‐
139             nected. See net_kernel(3).
140
141         permissions = [Perm]:
142           Specifies  the  default  permission  for applications when they are
143           started. In this parameter:
144
145           * Perm = {ApplName,Bool}
146
147           * ApplName = atom()
148
149           * Bool = boolean()
150
151           Permissions are described in application:permit/2.
152
153         error_logger = Value:
154           Value is one of:
155
156           tty:
157             Installs the standard event handler, which prints  error  reports
158             to stdio. This is the default option.
159
160           {file, FileName}:
161             Installs  the  standard event handler, which prints error reports
162             to file FileName, where FileName is a string. The file is  opened
163             with encoding UTF-8.
164
165           false:
166             No  standard  event handler is installed, but the initial, primi‐
167             tive event handler is kept, printing raw event messages to tty.
168
169           silent:
170             Error logging is turned off.
171
172         error_logger_format_depth = Depth:
173
174
175           Can be used to limit the size of  the  formatted  output  from  the
176           error logger event handlers.
177
178     Note:
179         This configuration parameter was introduced in OTP 18.1 and is exper‐
180         imental. Based on user feedback, it can be  changed  or  improved  in
181         future  releases,  for  example,  to  gain better control over how to
182         limit the size of the formatted output. We have no  plans  to  remove
183         this new feature entirely, unless it turns out to be useless.
184
185
186           Depth is a positive integer representing the maximum depth to which
187           terms are printed by the error logger event  handlers  included  in
188           OTP. This configuration parameter is used by the two event handlers
189           defined by the Kernel application and the two event handlers in the
190           SASL application. (If you have implemented your own error handlers,
191           this configuration parameter has no effect on them.)
192
193           Depth is used as follows: Format strings passed to the  event  han‐
194           dlers  are  rewritten.  The  format controls ~p and ~w are replaced
195           with ~P and ~W, respectively, and Depth is used as the depth param‐
196           eter. For details, see io:format/2 in STDLIB.
197
198     Note:
199         A  reasonable  starting  value  for Depth is 30. We recommend to test
200         crashing various processes in your application, examine the logs from
201         the crashes, and then increase or decrease the value.
202
203
204         global_groups = [GroupTuple]:
205
206
207           Defines global groups, see global_group(3). In this parameter:
208
209           * GroupTuple  =  {GroupName,  [Node]}  |  {GroupName,  PublishType,
210             [Node]}
211
212           * GroupName = atom()
213
214           * PublishType = normal | hidden
215
216           * Node = node()
217
218         inet_default_connect_options = [{Opt, Val}]:
219           Specifies default options for connect sockets, see inet(3).
220
221         inet_default_listen_options = [{Opt, Val}]:
222           Specifies default options for  listen  (and  accept)  sockets,  see
223           inet(3).
224
225         {inet_dist_use_interface, ip_address()}:
226           If  the  host  of  an Erlang node has many network interfaces, this
227           parameter specifies which one to listen on. For the type definition
228           of ip_address(), see inet(3).
229
230         {inet_dist_listen_min, First} and {inet_dist_listen_max, Last}:
231           Defines  the  First..Last  port  range for the listener socket of a
232           distributed Erlang node.
233
234         {inet_dist_listen_options, Opts}:
235
236
237           Defines a list of extra socket options to be used when opening  the
238           listening  socket  for  a distributed Erlang node. See gen_tcp:lis‐
239           ten/2.
240
241         {inet_dist_connect_options, Opts}:
242
243
244           Defines a list of extra socket options to be used  when  connecting
245           to other distributed Erlang nodes. See gen_tcp:connect/4.
246
247         inet_parse_error_log = silent:
248           If set, no error_logger messages are generated when erroneous lines
249           are found and skipped in the various Inet configuration files.
250
251         inetrc = Filename:
252           The name (string) of an Inet user configuration file. For  details,
253           see section Inet Configuration in the ERTS User's Guide.
254
255         net_setuptime = SetupTime:
256
257
258           SetupTime  must be a positive integer or floating point number, and
259           is interpreted as the maximum allowed time for each network  opera‐
260           tion  during  connection  setup to another Erlang node. The maximum
261           allowed value is 120. If higher values are specified, 120 is  used.
262           Default  is  7  seconds if the variable is not specified, or if the
263           value is incorrect (for example, not a number).
264
265           Notice that this value does not limit the  total  connection  setup
266           time,  but rather each individual network operation during the con‐
267           nection setup and handshake.
268
269         net_ticktime = TickTime:
270
271
272           Specifies the net_kernel tick time. TickTime is specified  in  sec‐
273           onds.  Once every TickTime/4 second, all connected nodes are ticked
274           (if anything else is written to a node).  If  nothing  is  received
275           from  another  node  within  the last four tick times, that node is
276           considered to be  down.  This  ensures  that  nodes  that  are  not
277           responding,  for reasons such as hardware errors, are considered to
278           be down.
279
280           The time T, in which a node that is not responding is detected,  is
281           calculated as MinT < T < MaxT, where:
282
283         MinT = TickTime - TickTime / 4
284         MaxT = TickTime + TickTime / 4
285
286           TickTime defaults to 60 (seconds). Thus, 45 < T < 75 seconds.
287
288           Notice  that  all communicating nodes are to have the same TickTime
289           value specified.
290
291           Normally, a terminating node is detected immediately.
292
293         shutdown_timeout = integer() | infinity:
294           Specifies the time application_controller waits for an  application
295           to  terminate  during node shutdown. If the timer expires, applica‐
296           tion_controller brutally kills application_master  of  the  hanging
297           application.  If this parameter is undefined, it defaults to infin‐
298           ity.
299
300         sync_nodes_mandatory = [NodeName]:
301           Specifies which other nodes that must be alive  for  this  node  to
302           start  properly. If some node in the list does not start within the
303           specified time, this node does not start either. If this  parameter
304           is undefined, it defaults to [].
305
306         sync_nodes_optional = [NodeName]:
307           Specifies  which  other  nodes  that  can be alive for this node to
308           start properly. If some node in this list does not start within the
309           specified time, this node starts anyway. If this parameter is unde‐
310           fined, it defaults to the empty list.
311
312         sync_nodes_timeout = integer() | infinity:
313           Specifies the time (in milliseconds) that this node waits  for  the
314           mandatory  and  optional nodes to start. If this parameter is unde‐
315           fined, no node synchronization is performed.  This  option  ensures
316           that global is synchronized.
317
318         start_dist_ac = true | false:
319           Starts  the dist_ac server if the parameter is true. This parameter
320           is to be set to true for systems using distributed applications.
321
322           Defaults to false. If this parameter is undefined,  the  server  is
323           started if parameter distributed is set.
324
325         start_boot_server = true | false:
326           Starts   the   boot_server   if   the   parameter   is   true  (see
327           erl_boot_server(3)). This parameter is to be  set  to  true  in  an
328           embedded system using this service.
329
330           Defaults to false.
331
332         boot_server_slaves = [SlaveIP]:
333           If  configuration parameter start_boot_server is true, this parame‐
334           ter can be used to initialize boot_server with a list of  slave  IP
335           addresses:
336
337           SlaveIP  =  string()  | atom | {integer(),integer(),integer(),inte‐
338           ger()},
339
340           where 0 <= integer() <=255.
341
342           Examples of SlaveIP in atom, string, and tuple form:
343
344           '150.236.16.70', "150,236,16,70", {150,236,16,70}.
345
346           Defaults to [].
347
348         start_disk_log = true | false:
349           Starts  the  disk_log_server  if  the  parameter   is   true   (see
350           disk_log(3)).  This  parameter  is to be set to true in an embedded
351           system using this service.
352
353           Defaults to false.
354
355         start_pg2 = true | false:
356
357
358           Starts the pg2 server (see pg2(3)) if the parameter is  true.  This
359           parameter is to be set to true in an embedded system that uses this
360           service.
361
362           Defaults to false.
363
364         start_timer = true | false:
365           Starts the timer_server if the parameter is  true  (see  timer(3)).
366           This  parameter  is  to  be set to true in an embedded system using
367           this service.
368
369           Defaults to false.
370
371         shell_history = enabled | disabled :
372           Specifies whether shell history should be logged  to  disk  between
373           usages of erl.
374
375         shell_history_drop = [string()]:
376           Specific  log  lines  that  should  not  be  persisted. For example
377           ["q().", "init:stop()."] will allow to ignore  commands  that  shut
378           the node down. Defaults to [].
379
380         shell_history_file_bytes = integer():
381           how  many bytes the shell should remember. By default, the value is
382           set to 512kb, and the minimal value is 50kb.
383
384         shell_history_path = string():
385           Specifies where the shell history files will be stored. defaults to
386           the    user's    cache    directory    as    returned    by   file‐
387           name:basedir(user_cache, "erlang-history").
388
389         shutdown_func = {Mod, Func}:
390           Where:
391
392           * Mod = atom()
393
394           * Func = atom()
395
396           Sets a function that application_controller calls when it starts to
397           terminate. The function is called as Mod:Func(Reason), where Reason
398           is the terminate reason for  application_controller,  and  it  must
399           return  as soon as possible for application_controller to terminate
400           properly.
401
402         source_search_rules = [DirRule] | [SuffixRule] :
403
404
405           Where:
406
407           * DirRule = {ObjDirSuffix,SrcDirSuffix}
408
409           * SuffixRule = {ObjSuffix,SrcSuffix,[DirRule]}
410
411           * ObjDirSuffix = string()
412
413           * SrcDirSuffix = string()
414
415           * ObjSuffix = string()
416
417           * SrcSuffix = string()
418
419           Specifies  a  list  of  rules  for   use   by   filelib:find_file/2
420           filelib:find_source/2  If  this is set to some other value than the
421           empty list, it replaces the default  rules.  Rules  can  be  simple
422           pairs  of  directory  suffixes,  such as {"ebin", "src"}, which are
423           used by filelib:find_file/2, or triples specifying separate  direc‐
424           tory  suffix  rules  depending on file name extensions, for example
425           [{".beam",  ".erl",  [{"ebin",  "src"}]},   which   are   used   by
426           filelib:find_source/2.  Both  kinds  of  rules  can be mixed in the
427           list.
428
429           The interpretation of ObjDirSuffix and SrcDirSuffix is as  follows:
430           if the end of the directory name where an object is located matches
431           ObjDirSuffix, then the name created by replacing ObjDirSuffix  with
432           SrcDirSuffix  is  expanded  by  calling filelib:wildcard/1, and the
433           first regular file found among the matches is the source file.
434

SEE ALSO

436       app(4),  application(3),  code(3),   disk_log(3),   erl_boot_server(3),
437       erl_ddll(3),   error_logger(3),  file(3),  global(3),  global_group(3),
438       heart(3), inet(3), net_kernel(3), os(3), pg2(3), rpc(3),  seq_trace(3),
439       user(3), timer(3)
440
441
442
443Ericsson AB                     kernel 5.4.3.2                       kernel(7)
Impressum