File 5161-Deprecate-file-pid2name-1.patch of Package erlang

From 2a4e3216a35bc2dae219a4e03bc519d787814d7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Fri, 27 Jan 2023 13:23:28 +0100
Subject: [PATCH 1/2] Deprecate file:pid2name/1

The `file:pid2name/1` function is limited in that it does not work for
files opened in `raw` mode or for files opened on a remote file
server. The implementation also adds overhead for each open and close
operation because an ETS table must be updated.

Therefore, deprecate the `file:pid2name/1` now, and schedule it for
removal in Erlang/OTP 27.
---
 lib/kernel/doc/src/file.xml          | 3 +++
 lib/kernel/src/file.erl              | 1 +
 system/doc/general_info/DEPRECATIONS | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/lib/kernel/doc/src/file.xml b/lib/kernel/doc/src/file.xml
index 131eba8284..8b11cc1c71 100644
--- a/lib/kernel/doc/src/file.xml
+++ b/lib/kernel/doc/src/file.xml
@@ -1214,6 +1214,9 @@ f.txt:  {person, "kalle", 25}.
       <name name="pid2name" arity="1" since=""/>
       <fsummary>Return the name of the file handled by a pid.</fsummary>
       <desc>
+        <change>
+          <p>This function is deprecated and will be removed in Erlang/OTP 27.</p>
+        </change>
         <p>If <c><anno>Pid</anno></c> is an I/O device, that is, a pid returned from
           <c>open/2</c>, this function returns the filename, or rather:</p>
         <taglist>
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl
index 49ad387a3a..9e5d3fcfbe 100644
--- a/lib/kernel/src/file.erl
+++ b/lib/kernel/src/file.erl
@@ -18,6 +18,7 @@
 %% %CopyrightEnd%
 %%
 -module(file).
+-deprecated([{pid2name,1,"this functionality is no longer supported"}]).
 
 %% Interface module for the file server and the file io servers.
 
diff --git a/system/doc/general_info/DEPRECATIONS b/system/doc/general_info/DEPRECATIONS
index 2f83cbb9d3..c163ecb322 100644
--- a/system/doc/general_info/DEPRECATIONS
+++ b/system/doc/general_info/DEPRECATIONS
@@ -17,6 +17,11 @@
 # is scheduled to be removed in OTP 25.
 #
 
+#
+# Added in OTP 26.
+#
+file:pid2name/1 since=26 remove=27
+
 #
 # Added in OTP 25.
 #
-- 
2.35.3

openSUSE Build Service is sponsored by