95 lines
2.2 KiB
Diff
95 lines
2.2 KiB
Diff
--- src/lib/libast/features/lib
|
|
+++ src/lib/libast/features/lib
|
|
@@ -86,27 +86,6 @@
|
|
}
|
|
}end
|
|
|
|
-tst lib_poll_fd_2 note{ fd is second arg to poll() }end execute{
|
|
- #include <poll.h>
|
|
- _BEGIN_EXTERNS_
|
|
- extern int pipe _ARG_((int*));
|
|
- _END_EXTERNS_
|
|
- int
|
|
- main()
|
|
- { int rw[2];
|
|
- struct pollfd fd;
|
|
- if (pipe(rw) < 0) return 1;
|
|
- fd.fd = rw[0];
|
|
- fd.events = POLLIN;
|
|
- fd.revents = 0;
|
|
- return poll(1, &fd, 0) < 0;
|
|
- if (poll(1, &fd, 0) < 0 || fd.revents != 0) return 1;
|
|
- if (write(rw[1], "x", 1) != 1) return 1;
|
|
- if (poll(1, &fd, 0) < 0 || fd.revents == 0) return 1;
|
|
- return 0;
|
|
- }
|
|
-}end
|
|
-
|
|
exp _lib_poll _lib_poll_fd_1||_lib_poll_fd_2
|
|
|
|
tst lib_poll_notimer note{ poll with no fds ignores timeout }end execute{
|
|
@@ -220,63 +199,6 @@
|
|
}
|
|
}end
|
|
|
|
-tst lib_posix_spawn unistd.h stdlib.h spawn.h note{ posix_spawn exists and it works and its worth using }end execute{
|
|
- #include <spawn.h>
|
|
- #include <signal.h>
|
|
- #include <stdio.h>
|
|
- /* if it uses fork() why bother? */
|
|
- int fork() { return -1; }
|
|
- int _fork() { return -1; }
|
|
- int __fork() { return -1; }
|
|
- int
|
|
- main(argc, argv)
|
|
- int argc;
|
|
- char** argv;
|
|
- {
|
|
- char* s;
|
|
- pid_t pid;
|
|
- posix_spawnattr_t attr;
|
|
- int n;
|
|
- int status;
|
|
- char* cmd[3];
|
|
- char tmp[1024];
|
|
- if (argv[1])
|
|
- _exit(signal(SIGHUP, SIG_DFL) != SIG_IGN);
|
|
- signal(SIGHUP, SIG_IGN);
|
|
- if (posix_spawnattr_init(&attr))
|
|
- _exit(1);
|
|
- if (posix_spawnattr_setpgroup(&attr, 0))
|
|
- _exit(1);
|
|
- /* first try an a.out and verify that SIGHUP is ignored */
|
|
- cmd[0] = argv[0];
|
|
- cmd[1] = "test";
|
|
- cmd[2] = 0;
|
|
- if (posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
|
|
- _exit(1);
|
|
- status = 1;
|
|
- if (wait(&status) < 0 || status != 0)
|
|
- _exit(1);
|
|
- /* passing ENOEXEC to the shell is bogus */
|
|
- n = strlen(cmd[0]);
|
|
- if (n >= (sizeof(tmp) - 3))
|
|
- _exit(1);
|
|
- strcpy(tmp, cmd[0]);
|
|
- tmp[n] = '.';
|
|
- tmp[n+1] = 's';
|
|
- tmp[n+2] = 'h';
|
|
- tmp[n+3] = 0;
|
|
- if (close(creat(tmp, 0777)) < 0 || chmod(tmp, 0777) < 0)
|
|
- _exit(1);
|
|
- cmd[0] = tmp;
|
|
- if (!posix_spawn(&pid, cmd[0], 0, &attr, cmd, 0))
|
|
- {
|
|
- wait(&status);
|
|
- _exit(1);
|
|
- }
|
|
- _exit(0);
|
|
- }
|
|
-}end
|
|
-
|
|
tst lib_spawn_mode unistd.h stdlib.h note{ first spawn arg is mode and it works }end execute{
|
|
#include <signal.h>
|
|
#include <process.h>
|