File 4741-stdlib-Add-callback-attributes-to-sys.patch of Package erlang
From f57734dd0b293603ca6573c466174f793e367f9f Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Wed, 27 Sep 2023 14:04:20 +0200
Subject: [PATCH 01/10] stdlib: Add callback attributes to sys
---
lib/stdlib/src/gen_event.erl | 2 ++
lib/stdlib/src/gen_server.erl | 2 ++
lib/stdlib/src/gen_statem.erl | 2 ++
lib/stdlib/src/peer.erl | 2 ++
lib/stdlib/src/sys.erl | 27 +++++++++++++++++++++++++++
5 files changed, 35 insertions(+)
diff --git a/lib/stdlib/src/sys.erl b/lib/stdlib/src/sys.erl
index abd025b7f7..95d3d292c1 100644
--- a/lib/stdlib/src/sys.erl
+++ b/lib/stdlib/src/sys.erl
@@ -90,6 +90,33 @@
{Func :: dbg_fun(), FuncState :: term()}
| {FuncId :: term(), Func :: dbg_fun(), FuncState :: term()}}.
+%%-----------------------------------------------------------------
+%% Callbacks
+%%-----------------------------------------------------------------
+
+-callback system_code_change(Misc, Module, OldVsn, Extra) -> {ok, NMisc} when
+ Misc :: term(),
+ OldVsn :: undefined | term(),
+ Module :: atom(),
+ Extra :: term(),
+ NMisc :: term().
+-callback system_continue(Parent, Debug, Misc) -> no_return() when
+ Parent :: pid(),
+ Debug :: [dbg_opt()],
+ Misc :: term().
+-callback system_get_state(Misc) -> {ok, State} when
+ Misc :: term(), State :: term().
+-callback system_replace_state(StateFun, Misc) -> {ok, NState, NMisc} when
+ Misc :: term(),
+ NState :: term(),
+ NMisc :: term(),
+ StateFun :: fun((State :: term()) -> NState).
+-callback system_terminate(Reason, Parent, Debug, Misc) -> no_return() when
+ Reason :: term(),
+ Parent :: pid(),
+ Debug :: [dbg_opt()],
+ Misc :: term().
+
%%-----------------------------------------------------------------
%% System messages
%%-----------------------------------------------------------------
--
2.35.3