all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 419cae927ae1892a51118014c5773a5671931fb0 2262 bytes (raw)
name: gnu/packages/patches/lsof-compat-linux-6.9.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
From c1678e3f6e4b4d984cb3078b7bf0c9e24bedb8ca Mon Sep 17 00:00:00 2001
From: Jiajie Chen <c@jia.je>
Date: Fri, 17 May 2024 15:22:35 +0800
Subject: [PATCH] [linux] Maintain original output for pidfd in linux 6.9

---
 00DIST                     |  3 +++
 lib/dialects/linux/dproc.c | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/00DIST b/00DIST
index d5a0349..9a29611 100644
--- a/00DIST
+++ b/00DIST
@@ -5605,6 +5605,9 @@ Supplement	Regenerated the 4.04 distribution to correct a non-
 
 		[linux] Do not embed kernel version in CFLAGS (#314)
 
+		[linux] Linux 6.9 changed the pidfs appearence in procfs. Try
+		to maintain original output in lsof (#317)
+
 
 Vic Abell <abe@purdue.edu>
 July 14, 2018
diff --git a/lib/dialects/linux/dproc.c b/lib/dialects/linux/dproc.c
index cb6bb64..3a7a120 100644
--- a/lib/dialects/linux/dproc.c
+++ b/lib/dialects/linux/dproc.c
@@ -1273,6 +1273,10 @@ static int process_id(struct lsof_context *ctx, /* context */
 #endif     /* defined(HASEPTOPTS) */
                 if (rest && rest[0] == '[' && rest[1] == 'p')
                     fdinfo_mask |= FDINFO_PID;
+                else if (Lf->ntype == N_REGLR && rest && *rest && strcmp(pbuf, "pidfd") == 0) {
+                    // https://github.com/lsof-org/lsof/issues/317
+                    fdinfo_mask |= FDINFO_PID;
+                }
 
                 if ((av = get_fdinfo(ctx, pathi, fdinfo_mask, &fi)) &
                     FDINFO_POS) {
@@ -1338,6 +1342,15 @@ static int process_id(struct lsof_context *ctx, /* context */
                     Lf->sf |= SELPTYINFO;
                 }
 #endif /* defined(HASEPTOPTS) && defined(HASPTYEPT) */
+                else if (Lf->ntype == N_REGLR && rest && *rest && Lf->nm &&
+                         strcmp(Lf->nm, "pidfd") == 0) {
+                    // https://github.com/lsof-org/lsof/issues/317
+                    // pidfd since Linux 6.9 becomes a regular file:
+                    // /proc/PID/fd/FD -> pidfd:[INODE]
+                    (void)snpf(rest, sizeof(pbuf) - (rest - pbuf),
+                                "[pidfd:%d]", fi.pid);
+                    enter_nm(ctx, rest);
+                }
 
                 if (Lf->sf)
                     link_lfile(ctx);
-- 
2.45.2


debug log:

solving 419cae927a ...
found 419cae927a in https://yhetil.org/guix/0e032dbca5f08b3e0ea45748a4290336306e639e.1728566057.git.ekaitz@elenq.tech/

applying [1/1] https://yhetil.org/guix/0e032dbca5f08b3e0ea45748a4290336306e639e.1728566057.git.ekaitz@elenq.tech/
diff --git a/gnu/packages/patches/lsof-compat-linux-6.9.patch b/gnu/packages/patches/lsof-compat-linux-6.9.patch
new file mode 100644
index 0000000000..419cae927a

1:22: trailing whitespace.
 
1:23: space before tab in indent.
 		[linux] Do not embed kernel version in CFLAGS (#314)
1:24: trailing whitespace.
 
1:28: trailing whitespace.
 
1:43: trailing whitespace.
 
Checking patch gnu/packages/patches/lsof-compat-linux-6.9.patch...
Applied patch gnu/packages/patches/lsof-compat-linux-6.9.patch cleanly.
warning: squelched 3 whitespace errors
warning: 8 lines add whitespace errors.

index at:
100644 419cae927ae1892a51118014c5773a5671931fb0	gnu/packages/patches/lsof-compat-linux-6.9.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.