From a1e0e750d49aab579d7b64b4c173656dcc420c02 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sun, 3 Jan 2021 04:21:16 +0700 Subject: [PATCH] Remove F_SETSIG (#164) * Remove F_SETSIG call from Linux on X11 display. Presumably, this was added to be like the `I_SETSIG` call on Solaris. But it is the only `F_SETSIG` done on Linux and there isn't an equivalent on the other platforms that we support as it is a GNU extension. Also, `F_SETSIG` with an argument of `0`, as here, means to send the `SIGIO` signal, which is what is done by default. From the man page: F_SETSIG (int) Set the signal sent when input or output becomes possible to the value given in arg. A value of zero means to send the default SIGIO signal. Any other value (including SIGIO) is the signal to send instead, and in this case additional info is available to the signal handler if installed with SA_SIGINFO. By using F_SETSIG with a nonzero value, and setting SA_SIGINFO for the signal handler (see sigaction(2)), extra information about I/O events is passed to the handler in a siginfo_t structure. If the si_code field indicates the source is SI_SIGIO, the si_fd field gives the file descriptor associated with the event. Otherwise, there is no indication which file descriptors are pending, and you should use the usual mechanisms (select(2), poll(2), read(2) with O_NONBLOCK set etc.) to determine which file descriptors are available for I/O. We aren't setting a non-zero value and we aren't establishing signal handlers via `sigaction` with `SA_SIGINFO` set, so this shouldn't be doing anything important for us. * Stop setting _GNU_SOURCE for GNU libc extensions. We were previously doing this to get access to the `F_SETSIG` flag for `fcntl`, but this isn't being used any longer. --- bin/makefile-cygwin.x86_64-x | 3 +-- bin/makefile-linux.386-x | 3 +-- bin/makefile-linux.armv7l-x | 3 +-- bin/makefile-linux.x86_64-x | 3 +-- src/timer.c | 9 +-------- 5 files changed, 5 insertions(+), 16 deletions(-) diff --git a/bin/makefile-cygwin.x86_64-x b/bin/makefile-cygwin.x86_64-x index 667802e..2c9acb0 100644 --- a/bin/makefile-cygwin.x86_64-x +++ b/bin/makefile-cygwin.x86_64-x @@ -24,8 +24,7 @@ DISPOPTFLAGS = -O2 -g3 FPFLAGS = DFLAGS = -DLINUX -DAIX -DOLD_CURSOR \ -DBYTESWAP -DFORKCOMM -DNOFORN -DLOGINT $(XFLAGS) \ - -DRELEASE=351 -DSYSVSIGNALS \ - -D_GNU_SOURCE + -DRELEASE=351 -DSYSVSIGNALS LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt diff --git a/bin/makefile-linux.386-x b/bin/makefile-linux.386-x index 2d61eb5..ce82bd8 100644 --- a/bin/makefile-linux.386-x +++ b/bin/makefile-linux.386-x @@ -23,8 +23,7 @@ DISPOPTFLAGS = -O2 -g3 FPFLAGS = DFLAGS = -DLINUX -DAIX -DOLD_CURSOR \ -DBYTESWAP -DFORKCOMM -DNOFORN -DLOGINT $(XFLAGS) \ - -DRELEASE=351 -DSYSVSIGNALS \ - -D_GNU_SOURCE + -DRELEASE=351 -DSYSVSIGNALS LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt diff --git a/bin/makefile-linux.armv7l-x b/bin/makefile-linux.armv7l-x index 059e15c..4959d81 100644 --- a/bin/makefile-linux.armv7l-x +++ b/bin/makefile-linux.armv7l-x @@ -23,8 +23,7 @@ DISPOPTFLAGS = -O2 -g3 FPFLAGS = DFLAGS = -DLINUX -DAIX -DOLD_CURSOR \ -DBYTESWAP -DFORKCOMM -DNOFORN -DLOGINT $(XFLAGS) \ - -DRELEASE=351 -DSYSVSIGNALS \ - -D_GNU_SOURCE + -DRELEASE=351 -DSYSVSIGNALS LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt diff --git a/bin/makefile-linux.x86_64-x b/bin/makefile-linux.x86_64-x index 667802e..2c9acb0 100644 --- a/bin/makefile-linux.x86_64-x +++ b/bin/makefile-linux.x86_64-x @@ -24,8 +24,7 @@ DISPOPTFLAGS = -O2 -g3 FPFLAGS = DFLAGS = -DLINUX -DAIX -DOLD_CURSOR \ -DBYTESWAP -DFORKCOMM -DNOFORN -DLOGINT $(XFLAGS) \ - -DRELEASE=351 -DSYSVSIGNALS \ - -D_GNU_SOURCE + -DRELEASE=351 -DSYSVSIGNALS LDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt LDELDFLAGS = -L/usr/X11/lib -lX11 -lc -lm -lcrypt diff --git a/src/timer.c b/src/timer.c index 4e77eda..8bbbb70 100644 --- a/src/timer.c +++ b/src/timer.c @@ -577,17 +577,10 @@ static void int_io_init() { #else /* SYSVSIGNALS in effect... */ #ifndef DOS SIGERRCHK(sigset(SIGIO, getsignaldata), "sigset io"); -#ifdef XWINDOW -#ifndef __CYGWIN__ -#ifdef LINUX - if (fcntl(ConnectionNumber(currentdsp->display_id), F_SETSIG, 0) < 0) - perror("fcntl on X fd - SETSIG for input handling failed"); -#else +#if defined(XWINDOW) && defined(I_SETSIG) if (ioctl(ConnectionNumber(currentdsp->display_id), I_SETSIG, S_INPUT) < 0) perror("ioctl on X fd - SETSIG for input handling failed"); #endif -#endif /* __CYGWIN__ */ -#endif /* XWINDOW */ #ifdef USE_DLPI DBPRINT(("INIT ETHER: Doing I_SETSIG.\n"));