This commit adds the patch that fixes: The issue was triggering the following error in the `test` phase that resulted in a build failure in Linux 6.9 or higher: FAIL: lib/dialects/linux/tests/case-20-pidfd-pid.bash From c1678e3f6e4b4d984cb3078b7bf0c9e24bedb8ca Mon Sep 17 00:00:00 2001 From: Jiajie Chen 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 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 /services/admin.scm?id=f4453df9a5742ef47cad79254b33bfaa1ff15d24&showmsg=1'>Expand)Author 2017-06-12services: rottlog: Make extensible....* gnu/services/admin.scm (rottlog-service-type)[compose, extend]: New fields. * doc/guix.texi (Log Rotation): Mention extension. Ludovic Courtès 2017-06-12services: rottlog: Define <log-rotation> objects....* gnu/services/admin.scm (<log-rotation>): New record type. (syslog-rotation-config, simple-rotation-config): Remove. (%default-rotations): Define as a list of <log-rotation> objects. (log-rotation->config, log-rotations->/etc-entries): New procedures. (<rottlog-configuration>)[periodic-rotations]: Remove. [rotations]: New field. (rottlog-etc): Use 'log-rotations->/etc-entries'. * doc/guix.texi (Log Rotation): Update accordingly. Ludovic Courtès 2017-04-16services: Add a default value to various service types....* gnu/services/admin.scm (rottlog-service-type)[default-value]: New field. * gnu/services/base.scm (guix-service-type)[default-value]: New field. (guix-publish-service-type)[default-value]: New field. * gnu/services/cups.scm (cups-service-type)[default-value]: New field. * gnu/services/dict.scm (dicod-service-type)[default-value]: New field. * gnu/services/mcron.scm (mcron-service-type)[default-value]: New field. * gnu/services/networking.scm (<tor-configuration>)[config-file]: Add default value. (tor-service-type)[default-value]: New field. (<bitlbee-configuration>)[interface, port, extra-settings]: Add default values. (bitlbee-service-type)[default-value]: New field. (wpa-supplicant-service-type)[default-value]: New field. (tlp-service-type)[default-value]: New field. (openssh-service-type)[default-value]: New field. * doc/guix.texi (Base Services, Log Rotation) (Networking Services, Printing Services): (Power management Services): Adjust examples accordingly. Ludovic Courtès 2016-12-19services: guix: Add 'log-file' configuration option....* gnu/services/base.scm (<guix-configuration>)[log-file]: New field. (guix-shepherd-service): Pass #:log-file to 'make-forkexec-constructor'. * gnu/services/admin.scm (simple-rotation-config): Take a list of files and join them with commas. (%default-rotations): Add /var/log/guix-daemon.log. * doc/guix.texi (Base Services): Document it. Ludovic Courtès 2016-10-03services: rottlog: Add Rottlog to the global profile....* gnu/services/admin.scm (rottlog-service-type): Extend PROFILE-SERVICE-TYPE. Ludovic Courtès 2016-10-03services: rottlog: Improve default weekly rotations....* gnu/services/admin.scm (%rotated-files): Add "/var/log/maillog". (syslog-rotation-config): Change parameter to 'files'. Return a string-append gexp for all of FILES. (simple-rotation-config): Remove unnecessary 'postrotate' and 'endscript'. (%default-rotations): Adjust accordingly. Ludovic Courtès 2016-10-03services: Add rottlog....* gnu/services/admin.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * doc/guix.texi (Log Rotation): New node. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Jan Nieuwenhuizen