aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/sys.erl
AgeCommit message (Collapse)Author
2018-01-22stdlib: Correct contractsHans Bolinder
2017-06-19Update copyright yearHans Nilsson
2017-06-16[stdlib] Open sys debug logs as utf8Siri Hansen
This allows the use of ~ts/~tp/~tw in the formatting fun to sys:handle_debug/4.
2016-03-15update copyright-yearHenrik Nord
2015-06-18Change license text to APLv2Bruce Yinhe
2014-07-10Merge branch 'maint'Siri Hansen
2014-07-03Fix spec of format function in sysSiri Hansen
The argument FormFunc is sys:handle_debug/4war erronously specified as dbg_fun(), which is a debug function. This has now been corrected by adding a new type, format_fun().
2014-05-26Add system message 'terminate'Siri Hansen
This is to be used when implementing synchronous stop of generic behaviours and other 'sys special processes'.
2014-03-21fix sys:get_state/1,2 and sys:replace_state/2,3 when sys suspendedSteve Vinoski
Add two new system callbacks Module:system_get_state/1 and Module:system_replace_state/2 to allow sys:get_state/1,2 and sys:replace_state/2,3 to operate correctly even if a process is sys suspended. Modify gen_server, gen_fsm, and gen_event to support the new callbacks. If a callback module does not export these functions, then by default the Misc value (the same as that passed as the final argument to sys:handle_system_msg/6, and returned as part of the return value of sys:get_status/1,2) is treated as the callback module's state. The previous behaviour of intercepting the system message and passing a tuple of size 2 as the last argument to sys:handle_system_msg/6 is no longer supported. Add tests to verify the correctness of sys:get_state/1,2 and sys:replace_state/2,3 when processes are sys suspended. Add two tests for modules that implement special processes, one that exports system_get_state/1 and system_replace_state/2 and one that doesn't. Much of the credit for this patch goes to James Fish, who reported the initial problem and implemented much of the fix.
2013-05-06Fix unmatched_return warnings in stdlibSiri Hansen
2013-05-06Fix unmatched_returns warnings in STDLIB and KernelHans Bolinder
2013-04-02add sys:get_state/1,2 and sys:replace_state/2,3Steve Vinoski
At Erlang Factory 2013 there was discussion during one of the talks about the sys:get_status functions and how useful they were for debugging. Geoff Cant mentioned it would be very useful if the sys module also provided functions to use while debugging to get just the state of a process and also to be able to replace the state of a process, and many others in the audience appeared to agree. The sys:get_state/1,2 functions return the state of a gen_server, gen_fsm, or gen_event process. The return value varies depending on the process type: process state for a gen_server, state name and state data for a gen_fsm, and handler module, handler id, and handler state for each handler registered in a gen_event process. The sys:replace_state/2,3 functions allow the state of a gen_server, gen_fsm, or gen_event process to be replaced with a new state. These functions take a function argument that updates or replaces the process state; using a function to change the state eliminates the race condition of first reading the state via sys:get_state/1 or sys:get_state/2, using its return value to create a new state, and then replacing the old state with the new state, since during that time the process might have received other calls or messages that could have changed its state. * For a gen_server process, the state replacement function takes the process state as an argument and returns a new state. * For a gen_fsm process, the state replacement function gets a tuple of {StateName, StateData} and returns a similar tuple that specifies a new state name, new state data, or both. * For a gen_event process, the state replacement function is called for each registered event handler. It gets a tuple {Module, Id, HandlerState} and returns a similar tuple that specifies the same Module and Id values but may specify a different value for HandlerState. If the state replacement function crashes or results in an error, the original state of a gen_server or gen_fsm process is maintained; if such a crash occurs for a gen_event process, the original state of the event handler for which the state replacement function was called is maintained, but the states of other event handlers of the same gen_event process may still be updated if no errors or crashes occur while replacing their states. Add documentation for sys:get_state/1,2 and sys:replace_state/2,3. The documentation explicitly notes that the functions are intended for use during debugging. Add new tests for these functions to gen_server_SUITE, gen_fsm_SUITE, and gen_event_SUITE.
2012-12-21[stdlib] Correct and improve specs and types of erl_scan and sysHans Bolinder
Thanks to Kostis Sagonas.
2012-10-05Fix Dialyzer warningsHans Bolinder
Opaque types need to be exported.
2011-08-31Improve and correct types and specifications in Kernel and STDLIBHans Bolinder
Running Dialyzer on the test suites revealed a few type errors.
2011-05-12Types and specifications have been modified and addedHans Bolinder
2009-12-01Teach sys:get_status/1,2 to call Mod:format_status/2Steve Vinoski
Restore the ability for gen_server and gen_fsm callback modules to format their own state for display under the sys:get_status/1,2 calls. This ability is extremely useful for new behavior modules based on gen_server or gen_fsm, so that they can display their status in a more meaningful way than just dumping the state record. It is also generally useful for applications wanting to display their gen_server or gen_fsm callback module state in something other than the default manner. Also document the previously undocumented the gen_server:format_status/2 and gen_fsm:format_status/2 optional callback functions that, if exported by the callback module, are invoked when sys:get_status/1,2 are called. Add unit tests to ensure that format_status/2 functions exported from a gen_fsm callback module and a gen_server callback module are called when sys:get_status/1,2 are called.
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP