File 1136-erts-Fix-erts_poll_get_selected_events-on-some-platf.patch of Package erlang

From fc3295b1ebeed1235d12983184ba806f2ce2f525 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org>
Date: Wed, 7 Dec 2022 11:20:11 +0100
Subject: [PATCH 1/2] erts: Fix erts_poll_get_selected_events on some platforms

Linux 5.15.0 has an extra line with `ino` before `tfd`, which
needs to be skipped before parsing the latter.
---
 erts/emulator/sys/common/erl_poll.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/erts/emulator/sys/common/erl_poll.c b/erts/emulator/sys/common/erl_poll.c
index 3667a03512..b41f3cdad7 100644
--- a/erts/emulator/sys/common/erl_poll.c
+++ b/erts/emulator/sys/common/erl_poll.c
@@ -2466,7 +2466,7 @@ ERTS_POLL_EXPORT(erts_poll_get_selected_events)(ErtsPollSet *ps,
     char fname[30];
     char s[256];
     FILE *f;
-    unsigned int pos, flags, mnt_id;
+    unsigned int pos, flags, mnt_id, ino;
     int hdr_lines, line = 1;
     sprintf(fname,"/proc/%d/fdinfo/%d",getpid(), ps->kp_fd);
     for (fd = 0; fd < len; fd++)
@@ -2476,14 +2476,16 @@ ERTS_POLL_EXPORT(erts_poll_get_selected_events)(ErtsPollSet *ps,
         fprintf(stderr,"failed to open file %s, errno = %d\n", fname, errno);
         return;
     }
-    hdr_lines = fscanf(f,"pos:\t%x\nflags:\t%x\nmnt_id:\t%x\n",
-                       &pos, &flags, &mnt_id);
+
+    hdr_lines = fscanf(f,"pos:\t%x\nflags:\t%x\nmnt_id:\t%x\nino:\t%x\n",
+                       &pos, &flags, &mnt_id, &ino);
     if (hdr_lines < 2) {
         fprintf(stderr,"failed to parse file %s, errno = %d\n", fname, errno);
         ASSERT(0);
         fclose(f);
         return;
     }
+
     line += hdr_lines;
     while (fgets(s, sizeof(s) / sizeof(*s), f)) {
         /* tfd:       10 events: 40000019 data:       180000000a */
-- 
2.35.3

openSUSE Build Service is sponsored by