summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/erl_monitor_link.h
diff options
context:
space:
mode:
authorRickard Green <rickard@erlang.org>2022-08-12 18:57:06 +0200
committerRickard Green <rickard@erlang.org>2022-08-12 18:57:06 +0200
commit7cecc2564a12662a3413cb9f9058be0747e5d23a (patch)
treec8a9439037ff8fee7851210d714201e23906906c /erts/emulator/beam/erl_monitor_link.h
parent89c04fb1836fb865565125a4d5880b93e784d856 (diff)
parentad8742311cab2f56f8702fc2206d29d0ceca922e (diff)
downloaderlang-7cecc2564a12662a3413cb9f9058be0747e5d23a.tar.gz
Merge branch 'rickard/monitor-3-noproc-fix/24.3.4/GH-6185/OTP-18190' into rickard/monitor-3-noproc-fix/25.0.3/GH-6185/OTP-18190
* rickard/monitor-3-noproc-fix/24.3.4/GH-6185/OTP-18190: [erts] Fix immediate noproc scenarios of erlang:monitor/3 BIF
Diffstat (limited to 'erts/emulator/beam/erl_monitor_link.h')
-rw-r--r--erts/emulator/beam/erl_monitor_link.h61
1 files changed, 46 insertions, 15 deletions
diff --git a/erts/emulator/beam/erl_monitor_link.h b/erts/emulator/beam/erl_monitor_link.h
index f1efffb835..72512fee3e 100644
--- a/erts/emulator/beam/erl_monitor_link.h
+++ b/erts/emulator/beam/erl_monitor_link.h
@@ -93,7 +93,8 @@
* Key: Reference
* Name: Name (atom) if by name
*
- * Valid keys are only ordinary internal references.
+ * Valid keys are only ordinary internal references or internal
+ * pid-reference.
*
* Origin part of the monitor is stored in the monitor tree of
* origin process and target part of the monitor is stored in
@@ -112,7 +113,8 @@
* Key: Reference
* Name: Name (atom) if by name
*
- * Valid keys are only ordinary internal references.
+ * Valid keys are only ordinary internal references or internal
+ * pid-reference.
*
* Origin part of the monitor is stored in the monitor tree of
* origin process/port and target part of the monitor is stored
@@ -130,7 +132,8 @@
* Shared:
* Key: Reference
*
- * Valid keys are only ordinary internal references.
+ * Valid keys are only ordinary internal references or internal
+ * pid-reference.
*
* Origin part of the monitor is stored in the monitor tree of
* origin process and target part of the monitor is stored in
@@ -153,7 +156,8 @@
* Name: Name (atom) if by name
* Dist: Pointer to dist structure
*
- * Valid keys are only ordinary internal references.
+ * Valid keys are only ordinary internal references or internal
+ * pid-reference.
*
* Origin part of the monitor is stored in the monitor tree of
* origin process and target part of the monitor is stored in
@@ -182,6 +186,30 @@
* process.
*
*
+ * --- ERTS_MON_TYPE_DIST_PORT -----------------------------------
+ *
+ * A local process (origin) monitors a port (target) on an old
+ * incarnation of the local node. Note that it is currently only
+ * for this since operations against remote ports is not
+ * supported.
+ *
+ * Origin:
+ * Other Item: Monitored port identifier
+ * Target:
+ * Other Item: Local process identifier
+ * Shared:
+ * Key: Reference
+ * Dist: NULL
+ *
+ * Valid keys are only ordinary internal references or internal
+ * pid-reference.
+ *
+ * Origin part of the monitor is stored in the monitor tree of
+ * origin process and target part is currently only used when
+ * passing monitor down signal (monitors against old incarnations
+ * will always immediately trigger monitor down noproc since the
+ * process wont be alive).
+ *
* --- ERTS_MON_TYPE_RESOURCE ------------------------------------
*
* A NIF resource (origin) monitors a process (target).
@@ -425,16 +453,17 @@
#define ERTS_ML_STATE_ALIAS_DEMONITOR (((Uint16) 2) << ERTS_ML_STATE_ALIAS_SHIFT)
#define ERTS_ML_STATE_ALIAS_ONCE (((Uint16) 3) << ERTS_ML_STATE_ALIAS_SHIFT)
-#define ERTS_MON_TYPE_MAX ((Uint16) 8)
+#define ERTS_MON_TYPE_MAX ((Uint16) 9)
#define ERTS_MON_TYPE_PROC ((Uint16) 0)
#define ERTS_MON_TYPE_PORT ((Uint16) 1)
#define ERTS_MON_TYPE_TIME_OFFSET ((Uint16) 2)
#define ERTS_MON_TYPE_DIST_PROC ((Uint16) 3)
-#define ERTS_MON_TYPE_RESOURCE ((Uint16) 4)
-#define ERTS_MON_TYPE_NODE ((Uint16) 5)
-#define ERTS_MON_TYPE_NODES ((Uint16) 6)
-#define ERTS_MON_TYPE_SUSPEND ((Uint16) 7)
+#define ERTS_MON_TYPE_DIST_PORT ((Uint16) 4)
+#define ERTS_MON_TYPE_RESOURCE ((Uint16) 5)
+#define ERTS_MON_TYPE_NODE ((Uint16) 6)
+#define ERTS_MON_TYPE_NODES ((Uint16) 7)
+#define ERTS_MON_TYPE_SUSPEND ((Uint16) 8)
#define ERTS_MON_TYPE_ALIAS ERTS_MON_TYPE_MAX
#define ERTS_MON_LNK_TYPE_MAX (ERTS_MON_TYPE_MAX + ((Uint16) 3))
@@ -1166,12 +1195,13 @@ int erts_monitor_list_foreach_delete_yielding(ErtsMonitor **list,
* Can create all types of monitors
*
* When the function is called it is assumed that:
- * - 'ref' is an internal ordinary reference if type is ERTS_MON_TYPE_PROC,
- * ERTS_MON_TYPE_PORT, ERTS_MON_TYPE_TIME_OFFSET, or ERTS_MON_TYPE_RESOURCE
+ * - 'ref' is an ordinary internal reference or internal pid-reference if type
+ * is ERTS_MON_TYPE_PROC, ERTS_MON_TYPE_PORT, ERTS_MON_TYPE_DIST_PORT,
+ * ERTS_MON_TYPE_TIME_OFFSET, or ERTS_MON_TYPE_RESOURCE
* - 'ref' is NIL if type is ERTS_MON_TYPE_NODE, ERTS_MON_TYPE_NODES, or
* ERTS_MON_TYPE_SUSPEND
- * - 'ref' is and ordinary internal reference or an external reference if
- * type is ERTS_MON_TYPE_DIST_PROC
+ * - 'ref' is and ordinary internal reference, internal pid-reference or an
+ * external reference if type is ERTS_MON_TYPE_DIST_PROC
* - 'name' is an atom or NIL if type is ERTS_MON_TYPE_PROC,
* ERTS_MON_TYPE_PORT, or ERTS_MON_TYPE_DIST_PROC
* - 'name is NIL if type is ERTS_MON_TYPE_TIME_OFFSET, ERTS_MON_TYPE_RESOURCE,
@@ -1180,8 +1210,9 @@ int erts_monitor_list_foreach_delete_yielding(ErtsMonitor **list,
*
* @param[in] type ERTS_MON_TYPE_PROC, ERTS_MON_TYPE_PORT,
* ERTS_MON_TYPE_TIME_OFFSET, ERTS_MON_TYPE_DIST_PROC,
- * ERTS_MON_TYPE_RESOURCE, ERTS_MON_TYPE_NODE,
- * ERTS_MON_TYPE_NODES, or ERTS_MON_TYPE_SUSPEND
+ * ERTS_MON_TYPE_DIST_PORT, ERTS_MON_TYPE_RESOURCE,
+ * ERTS_MON_TYPE_NODE, ERTS_MON_TYPE_NODES, or
+ * ERTS_MON_TYPE_SUSPEND
*
* @param[in] ref A reference or NIL depending on type
*