From 5432d7381934efa249ea78fb5867c522854d08b6 Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Thu, 11 Dec 2025 09:18:40 -0800 Subject: [PATCH] Adds generation of SIGIO on X11 connection if O_ASYNC defined --- src/xinit.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xinit.c b/src/xinit.c index 8ad1db7..a0b2772 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -17,6 +17,8 @@ #include // for false, bool, true #include // for NULL #include // for exit +#include // for fcntl, O_ASYNC, ... +#include // for getpid #include "adr68k.h" // for NativeAligned4FromLAddr #include "dbprint.h" // for TPRINT #include "devif.h" // for (anonymous), MRegion, DspInterface, OUTER_S... @@ -248,6 +250,7 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u unsigned depth_hint) { Screen *Xscreen; + int xfd; dsp->identifier = Display_Name; /* This is a hack. The display name */ /* has to dealt with in a more */ @@ -360,5 +363,12 @@ DspInterface X_init(DspInterface dsp, LispPTR lispbitmap, unsigned width_hint, u break; } XInitImage(&dsp->ScreenBitmap); + +#if defined(O_ASYNC) + xfd = ConnectionNumber(dsp->display_id); + if (fcntl(xfd, F_SETOWN, getpid()) == -1) perror("X_init: fcntl F_SETOWN error"); + if (fcntl(xfd, F_SETFL, fcntl(xfd, F_GETFL, 0) | O_ASYNC) == -1) perror("X_init: fcntl F_SETFL O_ASYNC error"); +#endif + return (dsp); }