Skip to content

Commit d1a1f35

Browse files
committed
iopause: assume poll() is available
Since poll() is available on all platforms we care about, we don't need to check if it is. This gets rid of trypoll.c, the last configure-time check that required to be run on the host (messing with cross). We also get rid of trysysel.c, since select() was only used as a fallback when poll() isn't avaialble.
1 parent ddd49d7 commit d1a1f35

10 files changed

Lines changed: 2 additions & 150 deletions

File tree

src/Makefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,7 @@ hassgprm.h: choose compile hassgprm.h1 hassgprm.h2 load trysgprm.c
229229
haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c
230230
./choose cl trywaitp haswaitp.h1 haswaitp.h2 > haswaitp.h
231231

232-
iopause.h: choose compile iopause.h1 iopause.h2 load trypoll.c
233-
./choose clr trypoll iopause.h1 iopause.h2 > iopause.h
234-
235-
iopause.o: compile iopause.c iopause.h select.h tai.h taia.h
232+
iopause.o: compile iopause.c tai.h taia.h
236233
./compile iopause.c
237234

238235
load: conf-ld print-ld.sh warn-auto.sh
@@ -291,9 +288,6 @@ scan_ulong.o: compile scan.h scan_ulong.c
291288
seek_set.o: compile seek.h seek_set.c
292289
./compile seek_set.c
293290

294-
select.h: choose compile select.h1 select.h2 trysysel.c
295-
./choose c trysysel select.h1 select.h2 > select.h
296-
297291
sgetopt.o: buffer.h compile sgetopt.c sgetopt.h subgetopt.h
298292
./compile sgetopt.c
299293

@@ -358,16 +352,14 @@ subgetopt.o: compile subgetopt.c subgetopt.h
358352
./compile subgetopt.c
359353

360354
sysdeps: compile direntry.h hasflock.h hasmkffo.h hassgact.h \
361-
hassgprm.h haswaitp.h iopause.h load select.h \
355+
hassgprm.h haswaitp.h load \
362356
reboot_system.h uw_tmp.h socket.lib
363357
rm -f sysdeps
364358
cat compile load socket.lib >>sysdeps
365359
grep sysdep direntry.h >>sysdeps
366360
grep sysdep haswaitp.h >>sysdeps
367361
grep sysdep hassgact.h >>sysdeps
368362
grep sysdep hassgprm.h >>sysdeps
369-
grep sysdep select.h >>sysdeps
370-
grep sysdep iopause.h >>sysdeps
371363
grep sysdep hasmkffo.h >>sysdeps
372364
grep sysdep hasflock.h >>sysdeps
373365
grep sysdep reboot_system.h >>sysdeps

src/TARGETS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ hasmkffo.h
6767
hassgact.h
6868
hassgprm.h
6969
haswaitp.h
70-
iopause.h
7170
iopause.o
7271
load
7372
lock_ex.o
@@ -85,7 +84,6 @@ pathexec_run.o
8584
readclose.o
8685
scan_ulong.o
8786
seek_set.o
88-
select.h
8987
sgetopt.o
9088
sig.o
9189
sig_block.o

src/iopause.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* Public domain. */
22

33
#include "taia.h"
4-
#include "select.h"
54
#include "iopause.h"
65

76
void iopause(iopause_fd *x,unsigned int len,struct taia *deadline,struct taia *stamp)
@@ -24,55 +23,9 @@ void iopause(iopause_fd *x,unsigned int len,struct taia *deadline,struct taia *s
2423
for (i = 0;i < len;++i)
2524
x[i].revents = 0;
2625

27-
#ifdef IOPAUSE_POLL
28-
2926
poll(x,len,millisecs);
3027
/* XXX: some kernels apparently need x[0] even if len is 0 */
3128
/* XXX: how to handle EAGAIN? are kernels really this dumb? */
3229
/* XXX: how to handle EINVAL? when exactly can this happen? */
3330

34-
#else
35-
{
36-
37-
struct timeval tv;
38-
fd_set rfds;
39-
fd_set wfds;
40-
int nfds;
41-
int fd;
42-
43-
FD_ZERO(&rfds);
44-
FD_ZERO(&wfds);
45-
46-
nfds = 1;
47-
for (i = 0;i < len;++i) {
48-
fd = x[i].fd;
49-
if (fd < 0) continue;
50-
if (fd >= 8 * sizeof(fd_set)) continue; /*XXX*/
51-
52-
if (fd >= nfds) nfds = fd + 1;
53-
if (x[i].events & IOPAUSE_READ) FD_SET(fd,&rfds);
54-
if (x[i].events & IOPAUSE_WRITE) FD_SET(fd,&wfds);
55-
}
56-
57-
tv.tv_sec = millisecs / 1000;
58-
tv.tv_usec = 1000 * (millisecs % 1000);
59-
60-
if (select(nfds,&rfds,&wfds,(fd_set *) 0,&tv) <= 0)
61-
return;
62-
/* XXX: for EBADF, could seek out and destroy the bad descriptor */
63-
64-
for (i = 0;i < len;++i) {
65-
fd = x[i].fd;
66-
if (fd < 0) continue;
67-
if (fd >= 8 * sizeof(fd_set)) continue; /*XXX*/
68-
69-
if (x[i].events & IOPAUSE_READ)
70-
if (FD_ISSET(fd,&rfds)) x[i].revents |= IOPAUSE_READ;
71-
if (x[i].events & IOPAUSE_WRITE)
72-
if (FD_ISSET(fd,&wfds)) x[i].revents |= IOPAUSE_WRITE;
73-
}
74-
75-
}
76-
#endif
77-
7831
}

src/iopause.h2 renamed to src/iopause.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#ifndef IOPAUSE_H
44
#define IOPAUSE_H
55

6-
/* sysdep: +poll */
7-
#define IOPAUSE_POLL
8-
96
#include <sys/types.h>
107
#include <poll.h>
118

src/iopause.h1

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/runit.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ int main (int argc, const char * const *argv, char * const *envp) {
4747
int wstat;
4848
int st;
4949
iopause_fd x;
50-
#ifndef IOPAUSE_POLL
51-
fd_set rfds;
52-
struct timeval t;
53-
#endif
5450
char ch;
5551
int ttyfd;
5652
struct stat s;
@@ -145,14 +141,7 @@ int main (int argc, const char * const *argv, char * const *envp) {
145141
sig_unblock(sig_child);
146142
sig_unblock(sig_cont);
147143
sig_unblock(sig_int);
148-
#ifdef IOPAUSE_POLL
149144
poll(&x, 1, 14000);
150-
#else
151-
t.tv_sec =14; t.tv_usec =0;
152-
FD_ZERO(&rfds);
153-
FD_SET(x.fd, &rfds);
154-
select(x.fd +1, &rfds, (fd_set*)0, (fd_set*)0, &t);
155-
#endif
156145
sig_block(sig_cont);
157146
sig_block(sig_child);
158147
sig_block(sig_int);

src/select.h1

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/select.h2

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/trypoll.c

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/trysysel.c

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)