From 81fd2f6134d694f55af27ff4bc16a9cbe5fedade Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 21 Mar 2020 18:19:52 +0100
Subject: [PATCH] Renamed sched.{c,h} to eventqueue.{c,h}

There is a <sched.h> system header that got shadowed by "sched.h".
While Screen itself doesn't include <sched.h>, other system headers
might include it indirectly. This broke the build when using uClibc
with pthread support.

[Retrieved (and slightly updated to also rename sched.c) from:
https://git.buildroot.net/buildroot/tree/package/screen/0005-rename-sched_h.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 src/Makefile.in               | 68 +++++++++++++++++------------------
 src/canvas.h                  |  2 +-
 src/{sched.c => eventqueue.c} |  2 +-
 src/{sched.h => eventqueue.h} |  6 ++--
 src/screen.h                  |  2 +-
 src/window.h                  |  2 +-
 src/winmsg.c                  |  2 +-
 7 files changed, 42 insertions(+), 42 deletions(-)
 rename src/{sched.c => eventqueue.c} (99%)
 rename src/{sched.h => eventqueue.h} (95%)

diff --git a/src/Makefile.in b/src/Makefile.in
index 2d96983..bdf13d0 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -52,7 +52,7 @@ CFILES=	screen.c \
 	acls.c ansi.c attacher.c backtick.c canvas.c comm.c \
 	display.c encoding.c fileio.c help.c input.c kmapdef.c layer.c \
 	layout.c list_display.c list_generic.c list_license.o list_window.c logfile.c mark.c \
-	misc.c process.c pty.c resize.c sched.c search.c socket.c telnet.c \
+	misc.c process.c pty.c resize.c eventqueue.c search.c socket.c telnet.c \
 	term.c termcap.c tty.c utmp.c viewport.c window.c winmsg.c \
 	winmsgbuf.c winmsgcond.c
 OFILES=$(CFILES:c=o)
@@ -167,116 +167,116 @@ depend.in: $(CFILES) term.h
 ###############################################################################
 
 ### Dependencies:
-screen.o: screen.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+screen.o: screen.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h \
  fileio.h mark.h attacher.h encoding.h help.h misc.h process.h socket.h \
  termcap.h tty.h utmp.h
-ansi.o: ansi.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+ansi.o: ansi.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h encoding.h \
  fileio.h help.h mark.h misc.h process.h resize.h
-fileio.o: fileio.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+fileio.o: fileio.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h fileio.h misc.h process.h winmsgbuf.h termcap.h encoding.h
-mark.o: mark.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+mark.o: mark.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h encoding.h fileio.h mark.h process.h winmsgbuf.h search.h
-misc.o: misc.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+misc.o: misc.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h
-resize.o: resize.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+resize.o: resize.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h process.h winmsgbuf.h resize.h telnet.h
-socket.o: socket.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+socket.o: socket.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h encoding.h fileio.h list_generic.h misc.h process.h \
  winmsgbuf.h resize.h socket.h termcap.h tty.h utmp.h
-search.o: search.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+search.o: search.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h mark.h input.h
-tty.o: tty.c config.h screen.h os.h ansi.h sched.h acls.h comm.h layer.h \
+tty.o: tty.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h layer.h \
  term.h image.h canvas.h display.h layout.h viewport.h window.h logfile.h \
  fileio.h misc.h pty.h telnet.h tty.h
 term.o: term.c term.h
-window.o: window.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+window.o: window.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h fileio.h help.h \
  input.h mark.h misc.h process.h pty.h resize.h telnet.h termcap.h tty.h \
  utmp.h
-utmp.o: utmp.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+utmp.o: utmp.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h misc.h tty.h utmp.h
-help.o: help.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+help.o: help.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h misc.h list_generic.h process.h winmsgbuf.h
-termcap.o: termcap.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+termcap.o: termcap.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h encoding.h misc.h process.h winmsgbuf.h resize.h termcap.h
-input.o: input.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+input.o: input.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h misc.h
-attacher.o: attacher.c config.h screen.h os.h ansi.h sched.h acls.h \
+attacher.o: attacher.c config.h screen.h os.h ansi.h eventqueue.h acls.h \
  comm.h layer.h term.h image.h canvas.h display.h layout.h viewport.h \
  window.h logfile.h misc.h socket.h tty.h
-pty.o: pty.c config.h screen.h os.h ansi.h sched.h acls.h comm.h layer.h \
+pty.o: pty.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h layer.h \
  term.h image.h canvas.h display.h layout.h viewport.h window.h logfile.h
-process.o: process.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+process.o: process.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h encoding.h \
  fileio.h help.h input.h kmapdef.h list_generic.h mark.h misc.h process.h \
  resize.h search.h socket.h telnet.h termcap.h tty.h utmp.h
-display.o: display.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+display.o: display.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h encoding.h mark.h \
  misc.h process.h pty.h resize.h termcap.h tty.h
-comm.o: comm.c config.h os.h screen.h ansi.h sched.h acls.h comm.h \
+comm.o: comm.c config.h os.h screen.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h
 kmapdef.o: kmapdef.c config.h
-acls.o: acls.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+acls.o: acls.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h mark.h misc.h process.h winmsgbuf.h
-logfile.o: logfile.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+logfile.o: logfile.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h misc.h
-layer.o: layer.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+layer.o: layer.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h encoding.h mark.h tty.h
-winmsg.o: winmsg.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+winmsg.o: winmsg.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h fileio.h \
  process.h mark.h
-winmsgbuf.o: winmsgbuf.c winmsgbuf.h screen.h os.h ansi.h sched.h acls.h \
+winmsgbuf.o: winmsgbuf.c winmsgbuf.h screen.h os.h ansi.h eventqueue.h acls.h \
  comm.h layer.h term.h image.h canvas.h display.h layout.h viewport.h \
  window.h logfile.h
 winmsgcond.o: winmsgcond.c winmsgcond.h
-backtick.o: backtick.c backtick.h screen.h os.h ansi.h sched.h acls.h \
+backtick.o: backtick.c backtick.h screen.h os.h ansi.h eventqueue.h acls.h \
  comm.h layer.h term.h image.h canvas.h display.h layout.h viewport.h \
  window.h logfile.h fileio.h
-sched.o: sched.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+eventqueue.o: eventqueue.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h
 telnet.o: telnet.c config.h comm.h
-encoding.o: encoding.c config.h screen.h os.h ansi.h sched.h acls.h \
+encoding.o: encoding.c config.h screen.h os.h ansi.h eventqueue.h acls.h \
  comm.h layer.h term.h image.h canvas.h display.h layout.h viewport.h \
  window.h logfile.h encoding.h fileio.h
-canvas.o: canvas.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+canvas.o: canvas.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h help.h list_generic.h resize.h
-layout.o: layout.c config.h screen.h os.h ansi.h sched.h acls.h comm.h \
+layout.o: layout.c config.h screen.h os.h ansi.h eventqueue.h acls.h comm.h \
  layer.h term.h image.h canvas.h display.h layout.h viewport.h window.h \
  logfile.h fileio.h misc.h process.h winmsgbuf.h resize.h
-viewport.o: viewport.c config.h screen.h os.h ansi.h sched.h acls.h \
+viewport.o: viewport.c config.h screen.h os.h ansi.h eventqueue.h acls.h \
  comm.h layer.h term.h image.h canvas.h display.h layout.h viewport.h \
  window.h logfile.h
-list_display.o: list_display.c config.h screen.h os.h ansi.h sched.h \
+list_display.o: list_display.c config.h screen.h os.h ansi.h eventqueue.h \
  acls.h comm.h layer.h term.h image.h canvas.h display.h layout.h \
  viewport.h window.h logfile.h list_generic.h misc.h
-list_generic.o: list_generic.c config.h screen.h os.h ansi.h sched.h \
+list_generic.o: list_generic.c config.h screen.h os.h ansi.h eventqueue.h \
  acls.h comm.h layer.h term.h image.h canvas.h display.h layout.h \
  viewport.h window.h logfile.h input.h list_generic.h misc.h
-list_window.o: list_window.c config.h screen.h os.h ansi.h sched.h acls.h \
+list_window.o: list_window.c config.h screen.h os.h ansi.h eventqueue.h acls.h \
  comm.h layer.h term.h image.h canvas.h display.h layout.h viewport.h \
  window.h logfile.h winmsg.h winmsgbuf.h winmsgcond.h backtick.h input.h \
  list_generic.h misc.h process.h
diff --git a/src/canvas.h b/src/canvas.h
index 8460d9a..ec5fdaa 100644
--- a/src/canvas.h
+++ b/src/canvas.h
@@ -31,7 +31,7 @@
 #define SCREEN_CANVAS_H
 
 #include "layer.h"
-#include "sched.h"
+#include "eventqueue.h"
 
 #define SLICE_UNKN 0
 #define SLICE_VERT (1 << 0)
diff --git a/src/sched.c b/src/eventqueue.c
similarity index 99%
rename from src/sched.c
rename to src/eventqueue.c
index 3618f11..dc59b11 100644
--- a/src/sched.c
+++ b/src/eventqueue.c
@@ -28,7 +28,7 @@
 
 #include "config.h"
 
-#include "sched.h"
+#include "eventqueue.h"
 
 #include <poll.h>
 #include <stdint.h>
diff --git a/src/sched.h b/src/eventqueue.h
similarity index 95%
rename from src/sched.h
rename to src/eventqueue.h
index 5bd1b3a..797d7d0 100644
--- a/src/sched.h
+++ b/src/eventqueue.h
@@ -27,8 +27,8 @@
  * $Id$ GNU
  */
 
-#ifndef SCREEN_SCHED_H
-#define SCREEN_SCHED_H
+#ifndef SCREEN_EVENTQUEUE_H
+#define SCREEN_EVENTQUEUE_H
 
 #include <stdbool.h>
 #include <sys/time.h>
@@ -59,4 +59,4 @@ void evdeq (Event *);
 void SetTimeout (Event *, int);
 void sched (void) __attribute__((__noreturn__));
 
-#endif /* SCREEN_SCHED_H */
+#endif /* SCREEN_EVENTQUEUE_H */
diff --git a/src/screen.h b/src/screen.h
index 5f6f373..0bd472f 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -67,7 +67,7 @@ struct mode {
 #include "ansi.h"
 #include "image.h"
 #include "layer.h"
-#include "sched.h"
+#include "eventqueue.h"
 #include "term.h"
 #include "window.h"
 
diff --git a/src/window.h b/src/window.h
index bc08c6c..294aa64 100644
--- a/src/window.h
+++ b/src/window.h
@@ -35,7 +35,7 @@
 
 #include "config.h"
 
-#include "sched.h"
+#include "eventqueue.h"
 #include "logfile.h"
 #include "screen.h"
 #include "layer.h"
diff --git a/src/winmsg.c b/src/winmsg.c
index 53f3261..39542aa 100644
--- a/src/winmsg.c
+++ b/src/winmsg.c
@@ -42,7 +42,7 @@
 #include "logfile.h"
 #include "mark.h"
 #include "process.h"
-#include "sched.h"
+#include "eventqueue.h"
 
 /* TODO: rid global variable (has been renamed to point this out; see commit
  * history) */
-- 
2.25.1

