<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- application</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/kernel-2.13.5.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>Kernel</strong><br><strong>Reference Manual</strong><br><small>Version 2.13.5</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li title="kernel (App)"><a href="kernel_app.html">kernel (App) </a></li> <li id="loadscrollpos" title="application " expanded="true">application<ul> <li><a href="application.html"> Top of manual page </a></li> <li title="get_all_env-0"><a href="application.html#get_all_env-0">get_all_env/0</a></li> <li title="get_all_env-1"><a href="application.html#get_all_env-1">get_all_env/1</a></li> <li title="get_all_key-0"><a href="application.html#get_all_key-0">get_all_key/0</a></li> <li title="get_all_key-1"><a href="application.html#get_all_key-1">get_all_key/1</a></li> <li title="get_application-0"><a href="application.html#get_application-0">get_application/0</a></li> <li title="get_application-1"><a href="application.html#get_application-1">get_application/1</a></li> <li title="get_env-1"><a href="application.html#get_env-1">get_env/1</a></li> <li title="get_env-2"><a href="application.html#get_env-2">get_env/2</a></li> <li title="get_key-1"><a href="application.html#get_key-1">get_key/1</a></li> <li title="get_key-2"><a href="application.html#get_key-2">get_key/2</a></li> <li title="load-1"><a href="application.html#load-1">load/1</a></li> <li title="load-2"><a href="application.html#load-2">load/2</a></li> <li title="loaded_applications-0"><a href="application.html#loaded_applications-0">loaded_applications/0</a></li> <li title="permit-2"><a href="application.html#permit-2">permit/2</a></li> <li title="set_env-3"><a href="application.html#set_env-3">set_env/3</a></li> <li title="set_env-4"><a href="application.html#set_env-4">set_env/4</a></li> <li title="start-1"><a href="application.html#start-1">start/1</a></li> <li title="start-2"><a href="application.html#start-2">start/2</a></li> <li title="start_type-0"><a href="application.html#start_type-0">start_type/0</a></li> <li title="stop-1"><a href="application.html#stop-1">stop/1</a></li> <li title="takeover-2"><a href="application.html#takeover-2">takeover/2</a></li> <li title="unload-1"><a href="application.html#unload-1">unload/1</a></li> <li title="unset_env-2"><a href="application.html#unset_env-2">unset_env/2</a></li> <li title="unset_env-3"><a href="application.html#unset_env-3">unset_env/3</a></li> <li title="which_applications-0"><a href="application.html#which_applications-0">which_applications/0</a></li> <li title="which_applications-1"><a href="application.html#which_applications-1">which_applications/1</a></li> <li title="Module:start-2"><a href="application.html#Module:start-2">Module:start/2</a></li> <li title="Module:start_phase-3"><a href="application.html#Module:start_phase-3">Module:start_phase/3</a></li> <li title="Module:prep_stop-1"><a href="application.html#Module:prep_stop-1">Module:prep_stop/1</a></li> <li title="Module:stop-1"><a href="application.html#Module:stop-1">Module:stop/1</a></li> <li title="Module:config_change-3"><a href="application.html#Module:config_change-3">Module:config_change/3</a></li> </ul> </li> <li id="no" title="auth " expanded="false">auth<ul> <li><a href="auth.html"> Top of manual page </a></li> <li title="is_auth-1"><a href="auth.html#is_auth-1">is_auth/1</a></li> <li title="cookie-0"><a href="auth.html#cookie-0">cookie/0</a></li> <li title="cookie-1"><a href="auth.html#cookie-1">cookie/1</a></li> <li title="node_cookie-1"><a href="auth.html#node_cookie-1">node_cookie/1</a></li> <li title="node_cookie-2"><a href="auth.html#node_cookie-2">node_cookie/2</a></li> </ul> </li> <li id="no" title="code " expanded="false">code<ul> <li><a href="code.html"> Top of manual page </a></li> <li title="set_path-1"><a href="code.html#set_path-1">set_path/1</a></li> <li title="get_path-0"><a href="code.html#get_path-0">get_path/0</a></li> <li title="add_path-1"><a href="code.html#add_path-1">add_path/1</a></li> <li title="add_pathz-1"><a href="code.html#add_pathz-1">add_pathz/1</a></li> <li title="add_patha-1"><a href="code.html#add_patha-1">add_patha/1</a></li> <li title="add_paths-1"><a href="code.html#add_paths-1">add_paths/1</a></li> <li title="add_pathsz-1"><a href="code.html#add_pathsz-1">add_pathsz/1</a></li> <li title="add_pathsa-1"><a href="code.html#add_pathsa-1">add_pathsa/1</a></li> <li title="del_path-1"><a href="code.html#del_path-1">del_path/1</a></li> <li title="replace_path-2"><a href="code.html#replace_path-2">replace_path/2</a></li> <li title="load_file-1"><a href="code.html#load_file-1">load_file/1</a></li> <li title="load_abs-1"><a href="code.html#load_abs-1">load_abs/1</a></li> <li title="ensure_loaded-1"><a href="code.html#ensure_loaded-1">ensure_loaded/1</a></li> <li title="load_binary-3"><a href="code.html#load_binary-3">load_binary/3</a></li> <li title="delete-1"><a href="code.html#delete-1">delete/1</a></li> <li title="purge-1"><a href="code.html#purge-1">purge/1</a></li> <li title="soft_purge-1"><a href="code.html#soft_purge-1">soft_purge/1</a></li> <li title="is_loaded-1"><a href="code.html#is_loaded-1">is_loaded/1</a></li> <li title="all_loaded-0"><a href="code.html#all_loaded-0">all_loaded/0</a></li> <li title="which-1"><a href="code.html#which-1">which/1</a></li> <li title="get_object_code-1"><a href="code.html#get_object_code-1">get_object_code/1</a></li> <li title="root_dir-0"><a href="code.html#root_dir-0">root_dir/0</a></li> <li title="lib_dir-0"><a href="code.html#lib_dir-0">lib_dir/0</a></li> <li title="lib_dir-1"><a href="code.html#lib_dir-1">lib_dir/1</a></li> <li title="lib_dir-2"><a href="code.html#lib_dir-2">lib_dir/2</a></li> <li title="compiler_dir-0"><a href="code.html#compiler_dir-0">compiler_dir/0</a></li> <li title="priv_dir-1"><a href="code.html#priv_dir-1">priv_dir/1</a></li> <li title="objfile_extension-0"><a href="code.html#objfile_extension-0">objfile_extension/0</a></li> <li title="stick_dir-1"><a href="code.html#stick_dir-1">stick_dir/1</a></li> <li title="unstick_dir-1"><a href="code.html#unstick_dir-1">unstick_dir/1</a></li> <li title="is_sticky-1"><a href="code.html#is_sticky-1">is_sticky/1</a></li> <li title="rehash-0"><a href="code.html#rehash-0">rehash/0</a></li> <li title="where_is_file-1"><a href="code.html#where_is_file-1">where_is_file/1</a></li> <li title="clash-0"><a href="code.html#clash-0">clash/0</a></li> <li title="is_module_native-1"><a href="code.html#is_module_native-1">is_module_native/1</a></li> </ul> </li> <li id="no" title="disk_log " expanded="false">disk_log<ul> <li><a href="disk_log.html"> Top of manual page </a></li> <li title="accessible_logs-0"><a href="disk_log.html#accessible_logs-0">accessible_logs/0</a></li> <li title="alog-2"><a href="disk_log.html#alog-2">alog/2</a></li> <li title="balog-2"><a href="disk_log.html#balog-2">balog/2</a></li> <li title="alog_terms-2"><a href="disk_log.html#alog_terms-2">alog_terms/2</a></li> <li title="balog_terms-2"><a href="disk_log.html#balog_terms-2">balog_terms/2</a></li> <li title="block-1"><a href="disk_log.html#block-1">block/1</a></li> <li title="block-2"><a href="disk_log.html#block-2">block/2</a></li> <li title="change_header-2"><a href="disk_log.html#change_header-2">change_header/2</a></li> <li title="change_notify-3"><a href="disk_log.html#change_notify-3">change_notify/3</a></li> <li title="change_size-2"><a href="disk_log.html#change_size-2">change_size/2</a></li> <li title="chunk-2"><a href="disk_log.html#chunk-2">chunk/2</a></li> <li title="chunk-3"><a href="disk_log.html#chunk-3">chunk/3</a></li> <li title="bchunk-2"><a href="disk_log.html#bchunk-2">bchunk/2</a></li> <li title="bchunk-3"><a href="disk_log.html#bchunk-3">bchunk/3</a></li> <li title="chunk_info-1"><a href="disk_log.html#chunk_info-1">chunk_info/1</a></li> <li title="chunk_step-3"><a href="disk_log.html#chunk_step-3">chunk_step/3</a></li> <li title="close-1"><a href="disk_log.html#close-1">close/1</a></li> <li title="format_error-1"><a href="disk_log.html#format_error-1">format_error/1</a></li> <li title="inc_wrap_file-1"><a href="disk_log.html#inc_wrap_file-1">inc_wrap_file/1</a></li> <li title="info-1"><a href="disk_log.html#info-1">info/1</a></li> <li title="lclose-1"><a href="disk_log.html#lclose-1">lclose/1</a></li> <li title="lclose-2"><a href="disk_log.html#lclose-2">lclose/2</a></li> <li title="log-2"><a href="disk_log.html#log-2">log/2</a></li> <li title="blog-2"><a href="disk_log.html#blog-2">blog/2</a></li> <li title="log_terms-2"><a href="disk_log.html#log_terms-2">log_terms/2</a></li> <li title="blog_terms-2"><a href="disk_log.html#blog_terms-2">blog_terms/2</a></li> <li title="open-1"><a href="disk_log.html#open-1">open/1</a></li> <li title="pid2name-1"><a href="disk_log.html#pid2name-1">pid2name/1</a></li> <li title="reopen-2"><a href="disk_log.html#reopen-2">reopen/2</a></li> <li title="reopen-3"><a href="disk_log.html#reopen-3">reopen/3</a></li> <li title="breopen-3"><a href="disk_log.html#breopen-3">breopen/3</a></li> <li title="sync-1"><a href="disk_log.html#sync-1">sync/1</a></li> <li title="truncate-1"><a href="disk_log.html#truncate-1">truncate/1</a></li> <li title="truncate-2"><a href="disk_log.html#truncate-2">truncate/2</a></li> <li title="btruncate-2"><a href="disk_log.html#btruncate-2">btruncate/2</a></li> <li title="unblock-1"><a href="disk_log.html#unblock-1">unblock/1</a></li> </ul> </li> <li id="no" title="erl_boot_server " expanded="false">erl_boot_server<ul> <li><a href="erl_boot_server.html"> Top of manual page </a></li> <li title="start-1"><a href="erl_boot_server.html#start-1">start/1</a></li> <li title="start_link-1"><a href="erl_boot_server.html#start_link-1">start_link/1</a></li> <li title="add_slave-1"><a href="erl_boot_server.html#add_slave-1">add_slave/1</a></li> <li title="delete_slave-1"><a href="erl_boot_server.html#delete_slave-1">delete_slave/1</a></li> <li title="which_slaves-0"><a href="erl_boot_server.html#which_slaves-0">which_slaves/0</a></li> </ul> </li> <li id="no" title="erl_ddll " expanded="false">erl_ddll<ul> <li><a href="erl_ddll.html"> Top of manual page </a></li> <li title="demonitor-1"><a href="erl_ddll.html#demonitor-1">demonitor/1</a></li> <li title="info-0"><a href="erl_ddll.html#info-0">info/0</a></li> <li title="info-1"><a href="erl_ddll.html#info-1">info/1</a></li> <li title="info-2"><a href="erl_ddll.html#info-2">info/2</a></li> <li title="load-2"><a href="erl_ddll.html#load-2">load/2</a></li> <li title="load_driver-2"><a href="erl_ddll.html#load_driver-2">load_driver/2</a></li> <li title="monitor-2"><a href="erl_ddll.html#monitor-2">monitor/2</a></li> <li title="reload-2"><a href="erl_ddll.html#reload-2">reload/2</a></li> <li title="reload_driver-2"><a href="erl_ddll.html#reload_driver-2">reload_driver/2</a></li> <li title="try_load-3"><a href="erl_ddll.html#try_load-3">try_load/3</a></li> <li title="try_unload-2"><a href="erl_ddll.html#try_unload-2">try_unload/2</a></li> <li title="unload-1"><a href="erl_ddll.html#unload-1">unload/1</a></li> <li title="unload_driver-1"><a href="erl_ddll.html#unload_driver-1">unload_driver/1</a></li> <li title="loaded_drivers-0"><a href="erl_ddll.html#loaded_drivers-0">loaded_drivers/0</a></li> <li title="format_error-1"><a href="erl_ddll.html#format_error-1">format_error/1</a></li> </ul> </li> <li title="erl_prim_loader"><a href="erl_prim_loader.html">erl_prim_loader</a></li> <li title="erlang"><a href="erlang.html">erlang</a></li> <li id="no" title="error_handler " expanded="false">error_handler<ul> <li><a href="error_handler.html"> Top of manual page </a></li> <li title="undefined_function-3"><a href="error_handler.html#undefined_function-3">undefined_function/3</a></li> <li title="undefined_lambda-3"><a href="error_handler.html#undefined_lambda-3">undefined_lambda/3</a></li> </ul> </li> <li id="no" title="error_logger " expanded="false">error_logger<ul> <li><a href="error_logger.html"> Top of manual page </a></li> <li title="error_msg-1"><a href="error_logger.html#error_msg-1">error_msg/1</a></li> <li title="error_msg-2"><a href="error_logger.html#error_msg-2">error_msg/2</a></li> <li title="format-2"><a href="error_logger.html#format-2">format/2</a></li> <li title="error_report-1"><a href="error_logger.html#error_report-1">error_report/1</a></li> <li title="error_report-2"><a href="error_logger.html#error_report-2">error_report/2</a></li> <li title="warning_map-0"><a href="error_logger.html#warning_map-0">warning_map/0</a></li> <li title="warning_msg-1"><a href="error_logger.html#warning_msg-1">warning_msg/1</a></li> <li title="warning_msg-2"><a href="error_logger.html#warning_msg-2">warning_msg/2</a></li> <li title="warning_report-1"><a href="error_logger.html#warning_report-1">warning_report/1</a></li> <li title="warning_report-2"><a href="error_logger.html#warning_report-2">warning_report/2</a></li> <li title="info_msg-1"><a href="error_logger.html#info_msg-1">info_msg/1</a></li> <li title="info_msg-2"><a href="error_logger.html#info_msg-2">info_msg/2</a></li> <li title="info_report-1"><a href="error_logger.html#info_report-1">info_report/1</a></li> <li title="info_report-2"><a href="error_logger.html#info_report-2">info_report/2</a></li> <li title="add_report_handler-1"><a href="error_logger.html#add_report_handler-1">add_report_handler/1</a></li> <li title="add_report_handler-2"><a href="error_logger.html#add_report_handler-2">add_report_handler/2</a></li> <li title="delete_report_handler-1"><a href="error_logger.html#delete_report_handler-1">delete_report_handler/1</a></li> <li title="tty-1"><a href="error_logger.html#tty-1">tty/1</a></li> <li title="logfile-1"><a href="error_logger.html#logfile-1">logfile/1</a></li> </ul> </li> <li id="no" title="file " expanded="false">file<ul> <li><a href="file.html"> Top of manual page </a></li> <li title="change_group-2"><a href="file.html#change_group-2">change_group/2</a></li> <li title="change_owner-2"><a href="file.html#change_owner-2">change_owner/2</a></li> <li title="change_owner-3"><a href="file.html#change_owner-3">change_owner/3</a></li> <li title="change_time-2"><a href="file.html#change_time-2">change_time/2</a></li> <li title="change_time-3"><a href="file.html#change_time-3">change_time/3</a></li> <li title="close-1"><a href="file.html#close-1">close/1</a></li> <li title="consult-1"><a href="file.html#consult-1">consult/1</a></li> <li title="copy-2"><a href="file.html#copy-2">copy/2</a></li> <li title="copy-3"><a href="file.html#copy-3">copy/3</a></li> <li title="del_dir-1"><a href="file.html#del_dir-1">del_dir/1</a></li> <li title="delete-1"><a href="file.html#delete-1">delete/1</a></li> <li title="eval-1"><a href="file.html#eval-1">eval/1</a></li> <li title="eval-2"><a href="file.html#eval-2">eval/2</a></li> <li title="file_info-1"><a href="file.html#file_info-1">file_info/1</a></li> <li title="format_error-1"><a href="file.html#format_error-1">format_error/1</a></li> <li title="get_cwd-0"><a href="file.html#get_cwd-0">get_cwd/0</a></li> <li title="get_cwd-1"><a href="file.html#get_cwd-1">get_cwd/1</a></li> <li title="list_dir-1"><a href="file.html#list_dir-1">list_dir/1</a></li> <li title="make_dir-1"><a href="file.html#make_dir-1">make_dir/1</a></li> <li title="make_link-2"><a href="file.html#make_link-2">make_link/2</a></li> <li title="make_symlink-2"><a href="file.html#make_symlink-2">make_symlink/2</a></li> <li title="open-2"><a href="file.html#open-2">open/2</a></li> <li title="path_consult-2"><a href="file.html#path_consult-2">path_consult/2</a></li> <li title="path_eval-2"><a href="file.html#path_eval-2">path_eval/2</a></li> <li title="path_open-3"><a href="file.html#path_open-3">path_open/3</a></li> <li title="path_script-2"><a href="file.html#path_script-2">path_script/2</a></li> <li title="path_script-3"><a href="file.html#path_script-3">path_script/3</a></li> <li title="pid2name-1"><a href="file.html#pid2name-1">pid2name/1</a></li> <li title="position-2"><a href="file.html#position-2">position/2</a></li> <li title="pread-2"><a href="file.html#pread-2">pread/2</a></li> <li title="pread-3"><a href="file.html#pread-3">pread/3</a></li> <li title="pwrite-2"><a href="file.html#pwrite-2">pwrite/2</a></li> <li title="pwrite-3"><a href="file.html#pwrite-3">pwrite/3</a></li> <li title="read-2"><a href="file.html#read-2">read/2</a></li> <li title="read_file-1"><a href="file.html#read_file-1">read_file/1</a></li> <li title="read_file_info-1"><a href="file.html#read_file_info-1">read_file_info/1</a></li> <li title="read_line-1"><a href="file.html#read_line-1">read_line/1</a></li> <li title="read_link-1"><a href="file.html#read_link-1">read_link/1</a></li> <li title="read_link_info-1"><a href="file.html#read_link_info-1">read_link_info/1</a></li> <li title="rename-2"><a href="file.html#rename-2">rename/2</a></li> <li title="script-1"><a href="file.html#script-1">script/1</a></li> <li title="script-2"><a href="file.html#script-2">script/2</a></li> <li title="set_cwd-1"><a href="file.html#set_cwd-1">set_cwd/1</a></li> <li title="sync-1"><a href="file.html#sync-1">sync/1</a></li> <li title="truncate-1"><a href="file.html#truncate-1">truncate/1</a></li> <li title="write-2"><a href="file.html#write-2">write/2</a></li> <li title="write_file-2"><a href="file.html#write_file-2">write_file/2</a></li> <li title="write_file-3"><a href="file.html#write_file-3">write_file/3</a></li> <li title="write_file_info-2"><a href="file.html#write_file_info-2">write_file_info/2</a></li> </ul> </li> <li id="no" title="gen_tcp " expanded="false">gen_tcp<ul> <li><a href="gen_tcp.html"> Top of manual page </a></li> <li title="connect-3"><a href="gen_tcp.html#connect-3">connect/3</a></li> <li title="connect-4"><a href="gen_tcp.html#connect-4">connect/4</a></li> <li title="listen-2"><a href="gen_tcp.html#listen-2">listen/2</a></li> <li title="accept-1"><a href="gen_tcp.html#accept-1">accept/1</a></li> <li title="accept-2"><a href="gen_tcp.html#accept-2">accept/2</a></li> <li title="send-2"><a href="gen_tcp.html#send-2">send/2</a></li> <li title="recv-2"><a href="gen_tcp.html#recv-2">recv/2</a></li> <li title="recv-3"><a href="gen_tcp.html#recv-3">recv/3</a></li> <li title="controlling_process-2"><a href="gen_tcp.html#controlling_process-2">controlling_process/2</a></li> <li title="close-1"><a href="gen_tcp.html#close-1">close/1</a></li> <li title="shutdown-2"><a href="gen_tcp.html#shutdown-2">shutdown/2</a></li> </ul> </li> <li id="no" title="gen_udp " expanded="false">gen_udp<ul> <li><a href="gen_udp.html"> Top of manual page </a></li> <li title="open-1"><a href="gen_udp.html#open-1">open/1</a></li> <li title="open-2"><a href="gen_udp.html#open-2">open/2</a></li> <li title="send-4"><a href="gen_udp.html#send-4">send/4</a></li> <li title="recv-2"><a href="gen_udp.html#recv-2">recv/2</a></li> <li title="recv-3"><a href="gen_udp.html#recv-3">recv/3</a></li> <li title="controlling_process-2"><a href="gen_udp.html#controlling_process-2">controlling_process/2</a></li> <li title="close-1"><a href="gen_udp.html#close-1">close/1</a></li> </ul> </li> <li id="no" title="gen_sctp " expanded="false">gen_sctp<ul> <li><a href="gen_sctp.html"> Top of manual page </a></li> <li title="abort-2"><a href="gen_sctp.html#abort-2">abort/2</a></li> <li title="close-1"><a href="gen_sctp.html#close-1">close/1</a></li> <li title="connect-4"><a href="gen_sctp.html#connect-4">connect/4</a></li> <li title="connect-5"><a href="gen_sctp.html#connect-5">connect/5</a></li> <li title="connect_init-4"><a href="gen_sctp.html#connect_init-4">connect_init/4</a></li> <li title="connect_init-5"><a href="gen_sctp.html#connect_init-5">connect_init/5</a></li> <li title="controlling_process-2"><a href="gen_sctp.html#controlling_process-2">controlling_process/2</a></li> <li title="eof-2"><a href="gen_sctp.html#eof-2">eof/2</a></li> <li title="listen-2"><a href="gen_sctp.html#listen-2">listen/2</a></li> <li title="open-0"><a href="gen_sctp.html#open-0">open/0</a></li> <li title="open-1"><a href="gen_sctp.html#open-1">open/1</a></li> <li title="open-1"><a href="gen_sctp.html#open-1">open/1</a></li> <li title="open-2"><a href="gen_sctp.html#open-2">open/2</a></li> <li title="recv-1"><a href="gen_sctp.html#recv-1">recv/1</a></li> <li title="recv-2"><a href="gen_sctp.html#recv-2">recv/2</a></li> <li title="send-3"><a href="gen_sctp.html#send-3">send/3</a></li> <li title="send-4"><a href="gen_sctp.html#send-4">send/4</a></li> <li title="error_string-1"><a href="gen_sctp.html#error_string-1">error_string/1</a></li> </ul> </li> <li id="no" title="global " expanded="false">global<ul> <li><a href="global.html"> Top of manual page </a></li> <li title="del_lock-1"><a href="global.html#del_lock-1">del_lock/1</a></li> <li title="del_lock-2"><a href="global.html#del_lock-2">del_lock/2</a></li> <li title="notify_all_name-3"><a href="global.html#notify_all_name-3">notify_all_name/3</a></li> <li title="random_exit_name-3"><a href="global.html#random_exit_name-3">random_exit_name/3</a></li> <li title="random_notify_name-3"><a href="global.html#random_notify_name-3">random_notify_name/3</a></li> <li title="register_name-2"><a href="global.html#register_name-2">register_name/2</a></li> <li title="register_name-3"><a href="global.html#register_name-3">register_name/3</a></li> <li title="registered_names-0"><a href="global.html#registered_names-0">registered_names/0</a></li> <li title="re_register_name-2"><a href="global.html#re_register_name-2">re_register_name/2</a></li> <li title="re_register_name-3"><a href="global.html#re_register_name-3">re_register_name/3</a></li> <li title="send-2"><a href="global.html#send-2">send/2</a></li> <li title="set_lock-1"><a href="global.html#set_lock-1">set_lock/1</a></li> <li title="set_lock-2"><a href="global.html#set_lock-2">set_lock/2</a></li> <li title="set_lock-3"><a href="global.html#set_lock-3">set_lock/3</a></li> <li title="sync-0"><a href="global.html#sync-0">sync/0</a></li> <li title="trans-2"><a href="global.html#trans-2">trans/2</a></li> <li title="trans-3"><a href="global.html#trans-3">trans/3</a></li> <li title="trans-4"><a href="global.html#trans-4">trans/4</a></li> <li title="unregister_name-1"><a href="global.html#unregister_name-1">unregister_name/1</a></li> <li title="whereis_name-1"><a href="global.html#whereis_name-1">whereis_name/1</a></li> </ul> </li> <li id="no" title="global_group " expanded="false">global_group<ul> <li><a href="global_group.html"> Top of manual page </a></li> <li title="global_groups-0"><a href="global_group.html#global_groups-0">global_groups/0</a></li> <li title="info-0"><a href="global_group.html#info-0">info/0</a></li> <li title="monitor_nodes-1"><a href="global_group.html#monitor_nodes-1">monitor_nodes/1</a></li> <li title="own_nodes-0"><a href="global_group.html#own_nodes-0">own_nodes/0</a></li> <li title="registered_names-1"><a href="global_group.html#registered_names-1">registered_names/1</a></li> <li title="send-2"><a href="global_group.html#send-2">send/2</a></li> <li title="send-3"><a href="global_group.html#send-3">send/3</a></li> <li title="sync-0"><a href="global_group.html#sync-0">sync/0</a></li> <li title="whereis_name-1"><a href="global_group.html#whereis_name-1">whereis_name/1</a></li> <li title="whereis_name-2"><a href="global_group.html#whereis_name-2">whereis_name/2</a></li> </ul> </li> <li id="no" title="heart " expanded="false">heart<ul> <li><a href="heart.html"> Top of manual page </a></li> <li title="set_cmd-1"><a href="heart.html#set_cmd-1">set_cmd/1</a></li> <li title="clear_cmd-0"><a href="heart.html#clear_cmd-0">clear_cmd/0</a></li> <li title="get_cmd-0"><a href="heart.html#get_cmd-0">get_cmd/0</a></li> </ul> </li> <li id="no" title="inet " expanded="false">inet<ul> <li><a href="inet.html"> Top of manual page </a></li> <li title="close-1"><a href="inet.html#close-1">close/1</a></li> <li title="get_rc-0"><a href="inet.html#get_rc-0">get_rc/0</a></li> <li title="format_error-1"><a href="inet.html#format_error-1">format_error/1</a></li> <li title="getaddr-2"><a href="inet.html#getaddr-2">getaddr/2</a></li> <li title="getaddrs-2"><a href="inet.html#getaddrs-2">getaddrs/2</a></li> <li title="gethostbyaddr-1"><a href="inet.html#gethostbyaddr-1">gethostbyaddr/1</a></li> <li title="gethostbyname-1"><a href="inet.html#gethostbyname-1">gethostbyname/1</a></li> <li title="gethostbyname-2"><a href="inet.html#gethostbyname-2">gethostbyname/2</a></li> <li title="gethostname-0"><a href="inet.html#gethostname-0">gethostname/0</a></li> <li title="getopts-2"><a href="inet.html#getopts-2">getopts/2</a></li> <li title="getstat-1"><a href="inet.html#getstat-1">getstat/1</a></li> <li title="getstat-2"><a href="inet.html#getstat-2">getstat/2</a></li> <li title="peername-1"><a href="inet.html#peername-1">peername/1</a></li> <li title="port-1"><a href="inet.html#port-1">port/1</a></li> <li title="sockname-1"><a href="inet.html#sockname-1">sockname/1</a></li> <li title="setopts-2"><a href="inet.html#setopts-2">setopts/2</a></li> </ul> </li> <li id="no" title="inet_res " expanded="false">inet_res<ul> <li><a href="inet_res.html"> Top of manual page </a></li> <li title="getbyname-2"><a href="inet_res.html#getbyname-2">getbyname/2</a></li> <li title="getbyname-3"><a href="inet_res.html#getbyname-3">getbyname/3</a></li> <li title="gethostbyaddr-1"><a href="inet_res.html#gethostbyaddr-1">gethostbyaddr/1</a></li> <li title="gethostbyaddr-2"><a href="inet_res.html#gethostbyaddr-2">gethostbyaddr/2</a></li> <li title="gethostbyname-1"><a href="inet_res.html#gethostbyname-1">gethostbyname/1</a></li> <li title="gethostbyname-2"><a href="inet_res.html#gethostbyname-2">gethostbyname/2</a></li> <li title="gethostbyname-3"><a href="inet_res.html#gethostbyname-3">gethostbyname/3</a></li> <li title="lookup-3"><a href="inet_res.html#lookup-3">lookup/3</a></li> <li title="lookup-4"><a href="inet_res.html#lookup-4">lookup/4</a></li> <li title="lookup-5"><a href="inet_res.html#lookup-5">lookup/5</a></li> <li title="resolve-3"><a href="inet_res.html#resolve-3">resolve/3</a></li> <li title="resolve-4"><a href="inet_res.html#resolve-4">resolve/4</a></li> <li title="resolve-5"><a href="inet_res.html#resolve-5">resolve/5</a></li> <li title="nslookup-3"><a href="inet_res.html#nslookup-3">nslookup/3</a></li> <li title="nslookup-4"><a href="inet_res.html#nslookup-4">nslookup/4</a></li> <li title="nslookup-4"><a href="inet_res.html#nslookup-4">nslookup/4</a></li> <li title="nnslookup-4"><a href="inet_res.html#nnslookup-4">nnslookup/4</a></li> <li title="nnslookup-5"><a href="inet_res.html#nnslookup-5">nnslookup/5</a></li> </ul> </li> <li title="init"><a href="init.html">init</a></li> <li id="no" title="net_adm " expanded="false">net_adm<ul> <li><a href="net_adm.html"> Top of manual page </a></li> <li title="dns_hostname-1"><a href="net_adm.html#dns_hostname-1">dns_hostname/1</a></li> <li title="host_file-0"><a href="net_adm.html#host_file-0">host_file/0</a></li> <li title="localhost-0"><a href="net_adm.html#localhost-0">localhost/0</a></li> <li title="names-0"><a href="net_adm.html#names-0">names/0</a></li> <li title="names-1"><a href="net_adm.html#names-1">names/1</a></li> <li title="ping-1"><a href="net_adm.html#ping-1">ping/1</a></li> <li title="world-0"><a href="net_adm.html#world-0">world/0</a></li> <li title="world-1"><a href="net_adm.html#world-1">world/1</a></li> <li title="world_list-1"><a href="net_adm.html#world_list-1">world_list/1</a></li> <li title="world_list-2"><a href="net_adm.html#world_list-2">world_list/2</a></li> </ul> </li> <li id="no" title="net_kernel " expanded="false">net_kernel<ul> <li><a href="net_kernel.html"> Top of manual page </a></li> <li title="allow-1"><a href="net_kernel.html#allow-1">allow/1</a></li> <li title="connect_node-1"><a href="net_kernel.html#connect_node-1">connect_node/1</a></li> <li title="monitor_nodes-1"><a href="net_kernel.html#monitor_nodes-1">monitor_nodes/1</a></li> <li title="monitor_nodes-2"><a href="net_kernel.html#monitor_nodes-2">monitor_nodes/2</a></li> <li title="get_net_ticktime-0"><a href="net_kernel.html#get_net_ticktime-0">get_net_ticktime/0</a></li> <li title="set_net_ticktime-1"><a href="net_kernel.html#set_net_ticktime-1">set_net_ticktime/1</a></li> <li title="set_net_ticktime-2"><a href="net_kernel.html#set_net_ticktime-2">set_net_ticktime/2</a></li> <li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li> <li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li> <li title="start-1"><a href="net_kernel.html#start-1">start/1</a></li> <li title="stop-0"><a href="net_kernel.html#stop-0">stop/0</a></li> </ul> </li> <li id="no" title="os " expanded="false">os<ul> <li><a href="os.html"> Top of manual page </a></li> <li title="cmd-1"><a href="os.html#cmd-1">cmd/1</a></li> <li title="find_executable-1"><a href="os.html#find_executable-1">find_executable/1</a></li> <li title="find_executable-2"><a href="os.html#find_executable-2">find_executable/2</a></li> <li title="getenv-0"><a href="os.html#getenv-0">getenv/0</a></li> <li title="getenv-1"><a href="os.html#getenv-1">getenv/1</a></li> <li title="getpid-0"><a href="os.html#getpid-0">getpid/0</a></li> <li title="putenv-2"><a href="os.html#putenv-2">putenv/2</a></li> <li title="timestamp-0"><a href="os.html#timestamp-0">timestamp/0</a></li> <li title="type-0"><a href="os.html#type-0">type/0</a></li> <li title="version-0"><a href="os.html#version-0">version/0</a></li> </ul> </li> <li id="no" title="pg2 " expanded="false">pg2<ul> <li><a href="pg2.html"> Top of manual page </a></li> <li title="create-1"><a href="pg2.html#create-1">create/1</a></li> <li title="delete-1"><a href="pg2.html#delete-1">delete/1</a></li> <li title="get_closest_pid-1"><a href="pg2.html#get_closest_pid-1">get_closest_pid/1</a></li> <li title="get_members-1"><a href="pg2.html#get_members-1">get_members/1</a></li> <li title="get_local_members-1"><a href="pg2.html#get_local_members-1">get_local_members/1</a></li> <li title="join-2"><a href="pg2.html#join-2">join/2</a></li> <li title="leave-2"><a href="pg2.html#leave-2">leave/2</a></li> <li title="which_groups-0"><a href="pg2.html#which_groups-0">which_groups/0</a></li> <li title="start-0"><a href="pg2.html#start-0">start/0</a></li> <li title="start_link-0"><a href="pg2.html#start_link-0">start_link/0</a></li> </ul> </li> <li id="no" title="rpc " expanded="false">rpc<ul> <li><a href="rpc.html"> Top of manual page </a></li> <li title="call-4"><a href="rpc.html#call-4">call/4</a></li> <li title="call-5"><a href="rpc.html#call-5">call/5</a></li> <li title="block_call-4"><a href="rpc.html#block_call-4">block_call/4</a></li> <li title="block_call-5"><a href="rpc.html#block_call-5">block_call/5</a></li> <li title="async_call-4"><a href="rpc.html#async_call-4">async_call/4</a></li> <li title="yield-1"><a href="rpc.html#yield-1">yield/1</a></li> <li title="nb_yield-1"><a href="rpc.html#nb_yield-1">nb_yield/1</a></li> <li title="nb_yield-2"><a href="rpc.html#nb_yield-2">nb_yield/2</a></li> <li title="multicall-3"><a href="rpc.html#multicall-3">multicall/3</a></li> <li title="multicall-4"><a href="rpc.html#multicall-4">multicall/4</a></li> <li title="multicall-4"><a href="rpc.html#multicall-4">multicall/4</a></li> <li title="multicall-5"><a href="rpc.html#multicall-5">multicall/5</a></li> <li title="cast-4"><a href="rpc.html#cast-4">cast/4</a></li> <li title="eval_everywhere-3"><a href="rpc.html#eval_everywhere-3">eval_everywhere/3</a></li> <li title="eval_everywhere-4"><a href="rpc.html#eval_everywhere-4">eval_everywhere/4</a></li> <li title="abcast-2"><a href="rpc.html#abcast-2">abcast/2</a></li> <li title="abcast-3"><a href="rpc.html#abcast-3">abcast/3</a></li> <li title="sbcast-2"><a href="rpc.html#sbcast-2">sbcast/2</a></li> <li title="sbcast-3"><a href="rpc.html#sbcast-3">sbcast/3</a></li> <li title="server_call-4"><a href="rpc.html#server_call-4">server_call/4</a></li> <li title="multi_server_call-2"><a href="rpc.html#multi_server_call-2">multi_server_call/2</a></li> <li title="multi_server_call-3"><a href="rpc.html#multi_server_call-3">multi_server_call/3</a></li> <li title="safe_multi_server_call-2"><a href="rpc.html#safe_multi_server_call-2">safe_multi_server_call/2</a></li> <li title="safe_multi_server_call-3"><a href="rpc.html#safe_multi_server_call-3">safe_multi_server_call/3</a></li> <li title="parallel_eval-1"><a href="rpc.html#parallel_eval-1">parallel_eval/1</a></li> <li title="pmap-3"><a href="rpc.html#pmap-3">pmap/3</a></li> <li title="pinfo-1"><a href="rpc.html#pinfo-1">pinfo/1</a></li> <li title="pinfo-2"><a href="rpc.html#pinfo-2">pinfo/2</a></li> </ul> </li> <li id="no" title="seq_trace " expanded="false">seq_trace<ul> <li><a href="seq_trace.html"> Top of manual page </a></li> <li title="set_token-1"><a href="seq_trace.html#set_token-1">set_token/1</a></li> <li title="set_token-2"><a href="seq_trace.html#set_token-2">set_token/2</a></li> <li title="get_token-0"><a href="seq_trace.html#get_token-0">get_token/0</a></li> <li title="get_token-1"><a href="seq_trace.html#get_token-1">get_token/1</a></li> <li title="print-1"><a href="seq_trace.html#print-1">print/1</a></li> <li title="print-2"><a href="seq_trace.html#print-2">print/2</a></li> <li title="reset_trace-0"><a href="seq_trace.html#reset_trace-0">reset_trace/0</a></li> <li title="set_system_tracer-1"><a href="seq_trace.html#set_system_tracer-1">set_system_tracer/1</a></li> <li title="get_system_tracer-0"><a href="seq_trace.html#get_system_tracer-0">get_system_tracer/0</a></li> </ul> </li> <li title="user"><a href="user.html">user</a></li> <li id="no" title="wrap_log_reader " expanded="false">wrap_log_reader<ul> <li><a href="wrap_log_reader.html"> Top of manual page </a></li> <li title="chunk-1"><a href="wrap_log_reader.html#chunk-1">chunk/1</a></li> <li title="chunk-2"><a href="wrap_log_reader.html#chunk-2">chunk/2</a></li> <li title="close-1"><a href="wrap_log_reader.html#close-1">close/1</a></li> <li title="open-1"><a href="wrap_log_reader.html#open-1">open/1</a></li> <li title="open-2"><a href="wrap_log_reader.html#open-2">open/2</a></li> </ul> </li> <li title="zlib"><a href="zlib.html">zlib</a></li> <li title="app"><a href="app.html">app</a></li> <li title="config"><a href="config.html">config</a></li> <li id="no" title="packages " expanded="false">packages<ul> <li><a href="packages.html"> Top of manual page </a></li> <li title="-0"><a href="packages.html#-0">/0</a></li> </ul> </li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>application</h1></center> <h3>MODULE</h3> <div class="REFBODY">application</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">Generic OTP application functions</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p>In OTP, <strong>application</strong> denotes a component implementing some specific functionality, that can be started and stopped as a unit, and which can be re-used in other systems as well. This module interfaces the <strong>application controller</strong>, a process started at every Erlang runtime system, and contains functions for controlling applications (for example starting and stopping applications), and functions to access information about applications (for example configuration parameters).</p> <p>An application is defined by an <strong>application specification</strong>. The specification is normally located in an <strong>application resource file</strong> called <span class="code">Application.app</span>, where <span class="code">Application</span> is the name of the application. Refer to <span class="bold_code"><a href="app.html">app(4)</a></span> for more information about the application specification.</p> <p>This module can also be viewed as a behaviour for an application implemented according to the OTP design principles as a supervision tree. The definition of how to start and stop the tree should be located in an <strong>application callback module</strong> exporting a pre-defined set of functions.</p> <p>Refer to <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','doc/design_principles','des_princ.html');">OTP Design Principles</a></span> for more information about applications and behaviours.</p> </p></div> <h3>EXPORTS</h3> <p><a name="get_all_env-0"><span class="bold_code">get_all_env() -> Env</span></a><br><a name="get_all_env-1"><span class="bold_code">get_all_env(Application) -> Env</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Env = [{Par,Val}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Par = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Val = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns the configuration parameters and their values for <span class="code">Application</span>. If the argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, or if the process executing the call does not belong to any application, the function returns <span class="code">[]</span>.</p> </p></div> <p><a name="get_all_key-0"><span class="bold_code">get_all_key() -> {ok, Keys} | []</span></a><br><a name="get_all_key-1"><span class="bold_code">get_all_key(Application) -> {ok, Keys} | undefined </span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Keys = [{Key,Val}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Val = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns the application specification keys and their values for <span class="code">Application</span>. If the argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, the function returns <span class="code">undefined</span>. If the process executing the call does not belong to any application, the function returns <span class="code">[]</span>.</p> </p></div> <p><a name="get_application-0"><span class="bold_code">get_application() -> {ok, Application} | undefined</span></a><br><a name="get_application-1"><span class="bold_code">get_application(Pid | Module) -> {ok, Application} | undefined</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Pid = pid()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Module = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns the name of the application to which the process <span class="code">Pid</span> or the module <span class="code">Module</span> belongs. Providing no argument is the same as calling <span class="code">get_application(self())</span>.</p> <p>If the specified process does not belong to any application, or if the specified process or module does not exist, the function returns <span class="code">undefined</span>.</p> </p></div> <p><a name="get_env-1"><span class="bold_code">get_env(Par) -> {ok, Val} | undefined</span></a><br><a name="get_env-2"><span class="bold_code">get_env(Application, Par) -> {ok, Val} | undefined</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Par = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Val = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns the value of the configuration parameter <span class="code">Par</span> for <span class="code">Application</span>. If the application argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, or the configuration parameter does not exist, or if the process executing the call does not belong to any application, the function returns <span class="code">undefined</span>.</p> </p></div> <p><a name="get_key-1"><span class="bold_code">get_key(Key) -> {ok, Val} | undefined</span></a><br><a name="get_key-2"><span class="bold_code">get_key(Application, Key) -> {ok, Val} | undefined</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Val = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns the value of the application specification key <span class="code">Key</span> for <span class="code">Application</span>. If the application argument is omitted, it defaults to the application of the calling process.</p> <p>If the specified application is not loaded, or the specification key does not exist, or if the process executing the call does not belong to any application, the function returns <span class="code">undefined</span>.</p> </p></div> <p><a name="load-1"><span class="bold_code">load(AppDescr) -> ok | {error, Reason}</span></a><br><a name="load-2"><span class="bold_code">load(AppDescr, Distributed) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">AppDescr = Application | AppSpec</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> AppSpec = {application,Application,AppSpecKeys}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> AppSpec = [{Key,Val}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Key = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Val = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Distributed = {Application,Nodes} | {Application,Time,Nodes} | default</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Nodes = [node() | {node(),..,node()}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Time = integer() > 0</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Loads the application specification for an application into the application controller. It will also load the application specifications for any included applications. Note that the function does not load the actual Erlang object code.</p> <p>The application can be given by its name <span class="code">Application</span>. In this case the application controller will search the code path for the application resource file <span class="code">Application.app</span> and load the specification it contains.</p> <p>The application specification can also be given directly as a tuple <span class="code">AppSpec</span>. This tuple should have the format and contents as described in <span class="code">app(4)</span>.</p> <p>If <span class="code">Distributed == {Application,[Time,]Nodes}</span>, the application will be distributed. The argument overrides the value for the application in the Kernel configuration parameter <span class="code">distributed</span>. <span class="code">Application</span> must be the name of the application (same as in the first argument). If a node crashes and <span class="code">Time</span> has been specified, then the application controller will wait for <span class="code">Time</span> milliseconds before attempting to restart the application on another node. If <span class="code">Time</span> is not specified, it will default to 0 and the application will be restarted immediately.</p> <p><span class="code">Nodes</span> is a list of node names where the application may run, in priority from left to right. Node names can be grouped using tuples to indicate that they have the same priority. Example:</p> <div class="example"><pre> Nodes = [cp1@cave, {cp2@cave, cp3@cave}]</pre></div> <p>This means that the application should preferably be started at <span class="code">cp1@cave</span>. If <span class="code">cp1@cave</span> is down, the application should be started at either <span class="code">cp2@cave</span> or <span class="code">cp3@cave</span>.</p> <p>If <span class="code">Distributed == default</span>, the value for the application in the Kernel configuration parameter <span class="code">distributed</span> will be used.</p> </p></div> <p><a name="loaded_applications-0"><span class="bold_code">loaded_applications() -> [{Application, Description, Vsn}]</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Description = string()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Vsn = string()</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns a list with information about the applications which have been loaded using <span class="code">load/1,2</span>, also included applications. <span class="code">Application</span> is the application name. <span class="code">Description</span> and <span class="code">Vsn</span> are the values of its <span class="code">description</span> and <span class="code">vsn</span> application specification keys, respectively.</p> </p></div> <p><a name="permit-2"><span class="bold_code">permit(Application, Bool) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Bool = bool()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Changes the permission for <span class="code">Application</span> to run at the current node. The application must have been loaded using <span class="code">load/1,2</span> for the function to have effect.</p> <p>If the permission of a loaded, but not started, application is set to <span class="code">false</span>, <span class="code">start</span> will return <span class="code">ok</span> but the application will not be started until the permission is set to <span class="code">true</span>.</p> <p>If the permission of a running application is set to <span class="code">false</span>, the application will be stopped. If the permission later is set to <span class="code">true</span>, it will be restarted.</p> <p>If the application is distributed, setting the permission to <span class="code">false</span> means that the application will be started at, or moved to, another node according to how its distribution is configured (see <span class="code">load/2</span> above).</p> <p>The function does not return until the application is started, stopped or successfully moved to another node. However, in some cases where permission is set to <span class="code">true</span> the function may return <span class="code">ok</span> even though the application itself has not started. This is true when an application cannot start because it has dependencies to other applications which have not yet been started. When they have been started, <span class="code">Application</span> will be started as well.</p> <p>By default, all applications are loaded with permission <span class="code">true</span> on all nodes. The permission is configurable by using the Kernel configuration parameter <span class="code">permissions</span>.</p> </p></div> <p><a name="set_env-3"><span class="bold_code">set_env(Application, Par, Val) -> ok</span></a><br><a name="set_env-4"><span class="bold_code">set_env(Application, Par, Val, Timeout) -> ok</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Par = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Val = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Timeout = int() | infinity</span><br> </div> </div> <div class="REFBODY"><p> <p>Sets the value of the configuration parameter <span class="code">Par</span> for <span class="code">Application</span>.</p> <p><span class="code">set_env/3</span> uses the standard <span class="code">gen_server</span> timeout value (5000 ms). A <span class="code">Timeout</span> argument can be provided if another timeout value is useful, for example, in situations where the application controller is heavily loaded.</p> <div class="warning"> <div class="label">Warning</div> <div class="content"><p> <p>Use this function only if you know what you are doing, that is, on your own applications. It is very application and configuration parameter dependent when and how often the value is read by the application, and careless use of this function may put the application in a weird, inconsistent, and malfunctioning state. </p> </p></div> </div> </p></div> <p><a name="start-1"><span class="bold_code">start(Application) -> ok | {error, Reason}</span></a><br><a name="start-2"><span class="bold_code">start(Application, Type) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Type = permanent | transient | temporary</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Starts <span class="code">Application</span>. If it is not loaded, the application controller will first load it using <span class="code">load/1</span>. It will make sure any included applications are loaded, but will not start them. That is assumed to be taken care of in the code for <span class="code">Application</span>.</p> <p>The application controller checks the value of the application specification key <span class="code">applications</span>, to ensure that all applications that should be started before this application are running. If not, <span class="code">{error,{not_started,App}}</span> is returned, where <span class="code">App</span> is the name of the missing application.</p> <p>The application controller then creates an <strong>application master</strong> for the application. The application master is the group leader of all the processes in the application. The application master starts the application by calling the application callback function <span class="code">Module:start/2</span> as defined by the application specification key <span class="code">mod</span>.</p> <p>The <span class="code">Type</span> argument specifies the type of the application. If omitted, it defaults to <span class="code">temporary</span>.</p> <ul> <li>If a permanent application terminates, all other applications and the entire Erlang node are also terminated.</li> <li>If a transient application terminates with <span class="code">Reason == normal</span>, this is reported but no other applications are terminated. If a transient application terminates abnormally, all other applications and the entire Erlang node are also terminated.</li> <li>If a temporary application terminates, this is reported but no other applications are terminated.</li> </ul> <p>Note that it is always possible to stop an application explicitly by calling <span class="code">stop/1</span>. Regardless of the type of the application, no other applications will be affected.</p> <p>Note also that the transient type is of little practical use, since when a supervision tree terminates, the reason is set to <span class="code">shutdown</span>, not <span class="code">normal</span>.</p> </p></div> <p><a name="start_type-0"><span class="bold_code">start_type() -> StartType | local | undefined</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">StartType = normal | {takeover,Node} | {failover,Node}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Node = node()</span><br> </div> </div> <div class="REFBODY"><p> <p>This function is intended to be called by a process belonging to an application, when the application is being started, to determine the start type which is either <span class="code">StartType</span> or <span class="code">local</span>.</p> <p>See <span class="code">Module:start/2</span> for a description of <span class="code">StartType</span>.</p> <p><span class="code">local</span> is returned if only parts of the application is being restarted (by a supervisor), or if the function is called outside a startup.</p> <p>If the process executing the call does not belong to any application, the function returns <span class="code">undefined</span>.</p> </p></div> <p><a name="stop-1"><span class="bold_code">stop(Application) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Stops <span class="code">Application</span>. The application master calls <span class="code">Module:prep_stop/1</span>, if such a function is defined, and then tells the top supervisor of the application to shutdown (see <span class="code">supervisor(3)</span>). This means that the entire supervision tree, including included applications, is terminated in reversed start order. After the shutdown, the application master calls <span class="code">Module:stop/1</span>. <span class="code">Module</span> is the callback module as defined by the application specification key <span class="code">mod</span>.</p> <p>Last, the application master itself terminates. Note that all processes with the application master as group leader, i.e. processes spawned from a process belonging to the application, thus are terminated as well.</p> <p>When stopped, the application is still loaded.</p> <p>In order to stop a distributed application, <span class="code">stop/1</span> has to be called on all nodes where it can execute (that is, on all nodes where it has been started). The call to <span class="code">stop/1</span> on the node where the application currently executes will stop its execution. The application will not be moved between nodes due to <span class="code">stop/1</span> being called on the node where the application currently executes before <span class="code">stop/1</span> is called on the other nodes.</p> </p></div> <p><a name="takeover-2"><span class="bold_code">takeover(Application, Type) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Type = permanent | transient | temporary</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Performs a takeover of the distributed application <span class="code">Application</span>, which executes at another node <span class="code">Node</span>. At the current node, the application is restarted by calling <span class="code">Module:start({takeover,Node},StartArgs)</span>. <span class="code">Module</span> and <span class="code">StartArgs</span> are retrieved from the loaded application specification. The application at the other node is not stopped until the startup is completed, i.e. when <span class="code">Module:start/2</span> and any calls to <span class="code">Module:start_phase/3</span> have returned.</p> <p>Thus two instances of the application will run simultaneously during the takeover, which makes it possible to transfer data from the old to the new instance. If this is not acceptable behavior, parts of the old instance may be shut down when the new instance is started. Note that the application may not be stopped entirely however, at least the top supervisor must remain alive.</p> <p>See <span class="code">start/1,2</span> for a description of <span class="code">Type</span>.</p> </p></div> <p><a name="unload-1"><span class="bold_code">unload(Application) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Reason = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>Unloads the application specification for <span class="code">Application</span> from the application controller. It will also unload the application specifications for any included applications. Note that the function does not purge the actual Erlang object code.</p> </p></div> <p><a name="unset_env-2"><span class="bold_code">unset_env(Application, Par) -> ok</span></a><br><a name="unset_env-3"><span class="bold_code">unset_env(Application, Par, Timeout) -> ok</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Par = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Timeout = int() | infinity</span><br> </div> </div> <div class="REFBODY"><p> <p>Removes the configuration parameter <span class="code">Par</span> and its value for <span class="code">Application</span>.</p> <p><span class="code">unset_env/2</span> uses the standard <span class="code">gen_server</span> timeout value (5000 ms). A <span class="code">Timeout</span> argument can be provided if another timeout value is useful, for example, in situations where the application controller is heavily loaded.</p> <div class="warning"> <div class="label">Warning</div> <div class="content"><p> <p>Use this function only if you know what you are doing, that is, on your own applications. It is very application and configuration parameter dependent when and how often the value is read by the application, and careless use of this function may put the application in a weird, inconsistent, and malfunctioning state. </p> </p></div> </div> </p></div> <p><a name="which_applications-0"><span class="bold_code">which_applications() -> [{Application, Description, Vsn}]</span></a><br><a name="which_applications-1"><span class="bold_code">which_applications(Timeout) -> [{Application, Description, Vsn}]</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Application = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Description = string()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Vsn = string()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Timeout = int() | infinity</span><br> </div> </div> <div class="REFBODY"><p> <p>Returns a list with information about the applications which are currently running. <span class="code">Application</span> is the application name. <span class="code">Description</span> and <span class="code">Vsn</span> are the values of its <span class="code">description</span> and <span class="code">vsn</span> application specification keys, respectively.</p> <p><span class="code">which_applications/0</span> uses the standard <span class="code">gen_server</span> timeout value (5000 ms). A <span class="code">Timeout</span> argument can be provided if another timeout value is useful, for example, in situations where the application controller is heavily loaded.</p> </p></div> <h3><a name="id2297560">CALLBACK MODULE</a></h3> <div class="REFBODY"> <p>The following functions should be exported from an <span class="code">application</span> callback module.</p> </div> <h3>EXPORTS</h3> <p><a name="Module:start-2"><span class="bold_code">Module:start(StartType, StartArgs) -> {ok, Pid} | {ok, Pid, State} | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">StartType = normal | {takeover,Node} | {failover,Node}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Node = node()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">StartArgs = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Pid = pid()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">State = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>This function is called whenever an application is started using <span class="code">application:start/1,2</span>, and should start the processes of the application. If the application is structured according to the OTP design principles as a supervision tree, this means starting the top supervisor of the tree.</p> <p><span class="code">StartType</span> defines the type of start:</p> <ul> <li> <span class="code">normal</span> if its a normal startup.</li> <li> <span class="code">normal</span> also if the application is distributed and started at the current node due to a failover from another node, and the application specification key <span class="code">start_phases == undefined</span>.</li> <li> <span class="code">{takeover,Node}</span> if the application is distributed and started at the current node due to a takeover from <span class="code">Node</span>, either because <span class="code">application:takeover/2</span> has been called or because the current node has higher priority than <span class="code">Node</span>.</li> <li> <span class="code">{failover,Node}</span> if the application is distributed and started at the current node due to a failover from <span class="code">Node</span>, and the application specification key <span class="code">start_phases /= undefined</span>.</li> </ul> <p><span class="code">StartArgs</span> is the <span class="code">StartArgs</span> argument defined by the application specification key <span class="code">mod</span>.</p> <p>The function should return <span class="code">{ok,Pid}</span> or <span class="code">{ok,Pid,State}</span> where <span class="code">Pid</span> is the pid of the top supervisor and <span class="code">State</span> is any term. If omitted, <span class="code">State</span> defaults to <span class="code">[]</span>. If later the application is stopped, <span class="code">State</span> is passed to <span class="code">Module:prep_stop/1</span>.</p> </p></div> <p><a name="Module:start_phase-3"><span class="bold_code">Module:start_phase(Phase, StartType, PhaseArgs) -> ok | {error, Reason}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Phase = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">StartType = normal | {takeover,Node} | {failover,Node}</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Node = node()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">PhaseArgs = term()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Pid = pid()</span><br> </div> <div class="REFTYPES"> <span class="bold_code">State = state()</span><br> </div> </div> <div class="REFBODY"><p> <p>This function is used to start an application with included applications, when there is a need for synchronization between processes in the different applications during startup.</p> <p>The start phases is defined by the application specification key <span class="code">start_phases == [{Phase,PhaseArgs}]</span>. For included applications, the set of phases must be a subset of the set of phases defined for the including application.</p> <p>The function is called for each start phase (as defined for the primary application) for the primary application and all included applications, for which the start phase is defined.</p> <p>See <span class="code">Module:start/2</span> for a description of <span class="code">StartType</span>.</p> </p></div> <p><a name="Module:prep_stop-1"><span class="bold_code">Module:prep_stop(State) -> NewState</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">State = NewState = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>This function is called when an application is about to be stopped, before shutting down the processes of the application.</p> <p><span class="code">State</span> is the state returned from <span class="code">Module:start/2</span>, or <span class="code">[]</span> if no state was returned. <span class="code">NewState</span> is any term and will be passed to <span class="code">Module:stop/1</span>.</p> <p>The function is optional. If it is not defined, the processes will be terminated and then <span class="code">Module:stop(State)</span> is called.</p> </p></div> <p><a name="Module:stop-1"><span class="bold_code">Module:stop(State)</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">State = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>This function is called whenever an application has stopped. It is intended to be the opposite of <span class="code">Module:start/2</span> and should do any necessary cleaning up. The return value is ignored.</p> <p><span class="code">State</span> is the return value of <span class="code">Module:prep_stop/1</span>, if such a function exists. Otherwise <span class="code">State</span> is taken from the return value of <span class="code">Module:start/2</span>.</p> </p></div> <p><a name="Module:config_change-3"><span class="bold_code">Module:config_change(Changed, New, Removed) -> ok</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Changed = [{Par,Val}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">New = [{Par,Val}]</span><br> </div> <div class="REFTYPES"> <span class="bold_code">Removed = [Par]</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Par = atom()</span><br> </div> <div class="REFTYPES"> <span class="bold_code"> Val = term()</span><br> </div> </div> <div class="REFBODY"><p> <p>This function is called by an application after a code replacement, if there are any changes to the configuration parameters.</p> <p><span class="code">Changed</span> is a list of parameter-value tuples with all configuration parameters with changed values, <span class="code">New</span> is a list of parameter-value tuples with all configuration parameters that have been added, and <span class="code">Removed</span> is a list of all parameters that have been removed.</p> </p></div> <h3><a name="id2298012">SEE ALSO</a></h3> <div class="REFBODY"> <p><span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','doc/design_principles','des_princ.html');">OTP Design Principles</a></span>, <span class="bold_code"><a href="kernel_app.html">kernel(6)</a></span>, <span class="bold_code"><a href="app.html">app(4)</a></span></p> </div> </div> <div class="footer"> <hr> <p>Copyright © 1997-2010 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>