summaryrefslogtreecommitdiff
path: root/src/env/__libc_start_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env/__libc_start_main.c')
-rw-r--r--src/env/__libc_start_main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c
index d7481c25..c10a3f35 100644
--- a/src/env/__libc_start_main.c
+++ b/src/env/__libc_start_main.c
@@ -1,6 +1,7 @@
#include <elf.h>
#include <poll.h>
#include <fcntl.h>
+#include <signal.h>
#include "syscall.h"
#include "atomic.h"
#include "libc.h"
@@ -48,7 +49,11 @@ void __init_libc(char **envp, char *pn)
&& !aux[AT_SECURE]) return;
struct pollfd pfd[3] = { {.fd=0}, {.fd=1}, {.fd=2} };
+#ifdef SYS_poll
__syscall(SYS_poll, pfd, 3, 0);
+#else
+ __syscall(SYS_ppoll, pfd, 3, &(struct timespec){0}, 0, _NSIG/8);
+#endif
for (i=0; i<3; i++) if (pfd[i].revents&POLLNVAL)
if (__sys_open("/dev/null", O_RDWR)<0)
a_crash();