Subject: bug#54245: 29.0.50; select usage in GNUstep

From: Robert Pluim <[email-masked]>
Date: Fri, 04 Mar 2022 17:15:27 +0100

>>>>> On Fri, 04 Mar 2022 16:30:38 +0100, Lars Ingebrigtsen <[email-masked]> said:

    Lars> Paul noted in bug#32452 that:

    Lars> ---
    Lars> I notice that Emacs's GNUstep code calls 'select'. For completeness this 
    Lars> should be 'pselect' instead, so that Emacs never calls 'select'.
    Lars> ---

    Lars> So that should be fixed.  (I open a new bug report, because that bug
    Lars> report was already way too long.)

Iʼve been running with the following for a whole two days with no ill
effects (and the resulting emacs binary does not contain any calls to
'select'). Last time I looked, emacs never seems to use the sigmask
parameter to 'pselect' anyway, so itʼs kind of a moot point.

diff --git a/src/nsterm.m b/src/nsterm.m
index 670f8971df..4eb32de654 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5830,7 +5830,7 @@ - (void)fd_handler:(id)unused
           fd_set fds;
           FD_ZERO (&fds);
           FD_SET (selfds[0], &fds);
-          result = select (selfds[0]+1, &fds, NULL, NULL, NULL);
+          result = pselect (selfds[0]+1, &fds, NULL, NULL, NULL, NULL);
           if (result > 0 && read (selfds[0], &c, 1) == 1 && c == 'g')
 	    waiting = 0;
         }

Robert
--