diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2021-11-29 21:25:10 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2021-11-29 21:25:10 +0000 |
commit | 52293ca1eebe52b466cf0e994399c4b3a1b4512e (patch) | |
tree | cce40083b8daf6514912eb2e1c489f1b3be57743 /regress | |
parent | b05cf8542e420d2b3020f9c051da4678ad42eaf3 (diff) |
Use nanosleep(3) instead of select(2) for test run time delay. Use ~10
years interval as operational infinity.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/sys/kern/unconacc/unconacc.c | 12 | ||||
-rw-r--r-- | regress/sys/kern/undgram_conclose/undgram_conclose.c | 12 | ||||
-rw-r--r-- | regress/sys/kern/unsendrecvthr/unsendrecvthr.c | 12 |
3 files changed, 18 insertions, 18 deletions
diff --git a/regress/sys/kern/unconacc/unconacc.c b/regress/sys/kern/unconacc/unconacc.c index 6b875fd0986..c687091260f 100644 --- a/regress/sys/kern/unconacc/unconacc.c +++ b/regress/sys/kern/unconacc/unconacc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unconacc.c,v 1.2 2021/11/29 21:21:26 mvs Exp $ */ +/* $OpenBSD: unconacc.c,v 1.3 2021/11/29 21:25:09 mvs Exp $ */ /* * Copyright (c) 2021 Vitaliy Makkoveev <mvs@openbsd.org> @@ -33,6 +33,7 @@ #include <errno.h> #include <pthread.h> #include <string.h> +#include <time.h> #include <unistd.h> static pthread_mutex_t therr_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -121,11 +122,10 @@ thr_conn(void *arg) int main(int argc, char *argv[]) { - struct timeval testtime = { + struct timespec testtime = { .tv_sec = 60, - .tv_usec = 0, + .tv_nsec = 0, }; - struct timeval *tv = &testtime; struct sockaddr_un sun; int s; @@ -138,7 +138,7 @@ main(int argc, char *argv[]) umask(0077); if (argc == 2 && !strcmp(argv[1], "--infinite")) - tv = NULL; + testtime.tv_sec = (10 * 365 * 86400); mib[0] = CTL_HW; mib[1] = HW_NCPUONLINE; @@ -180,7 +180,7 @@ main(int argc, char *argv[]) therrc(1, error, "pthread_create"); } - select(0, NULL, NULL, NULL, tv); + nanosleep(&testtime, NULL); return 0; } diff --git a/regress/sys/kern/undgram_conclose/undgram_conclose.c b/regress/sys/kern/undgram_conclose/undgram_conclose.c index 85258a51375..678021d5714 100644 --- a/regress/sys/kern/undgram_conclose/undgram_conclose.c +++ b/regress/sys/kern/undgram_conclose/undgram_conclose.c @@ -1,4 +1,4 @@ -/* $OpenBSD: undgram_conclose.c,v 1.2 2021/11/29 21:21:26 mvs Exp $ */ +/* $OpenBSD: undgram_conclose.c,v 1.3 2021/11/29 21:25:09 mvs Exp $ */ /* * Copyright (c) 2021 Vitaliy Makkoveev <mvs@openbsd.org> @@ -33,6 +33,7 @@ #include <err.h> #include <pthread.h> #include <string.h> +#include <time.h> #include <unistd.h> static pthread_mutex_t therr_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -99,11 +100,10 @@ thr_conn(void *arg) int main(int argc, char *argv[]) { - struct timeval testtime = { + struct timespec testtime = { .tv_sec = 60, - .tv_usec = 0, + .tv_nsec = 0, }; - struct timeval *tv = &testtime; int mib[2], ncpu; size_t len; @@ -116,7 +116,7 @@ main(int argc, char *argv[]) umask(0077); if (argc == 2 && !strcmp(argv[1], "--infinite")) - tv = NULL; + testtime.tv_sec = (10 * 365 * 86400); mib[0] = CTL_HW; mib[1] = HW_NCPUONLINE; @@ -141,7 +141,7 @@ main(int argc, char *argv[]) therrc(1, error, "pthread_create"); } - select(0, NULL, NULL, NULL, tv); + nanosleep(&testtime, NULL); return 0; } diff --git a/regress/sys/kern/unsendrecvthr/unsendrecvthr.c b/regress/sys/kern/unsendrecvthr/unsendrecvthr.c index 45e81c051c6..a56848f5139 100644 --- a/regress/sys/kern/unsendrecvthr/unsendrecvthr.c +++ b/regress/sys/kern/unsendrecvthr/unsendrecvthr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unsendrecvthr.c,v 1.1 2021/11/19 17:07:10 mvs Exp $ */ +/* $OpenBSD: unsendrecvthr.c,v 1.2 2021/11/29 21:25:09 mvs Exp $ */ /* * Copyright (c) 2021 Vitaliy Makkoveev <mvs@openbsd.org> @@ -34,6 +34,7 @@ #include <err.h> #include <pthread.h> #include <string.h> +#include <time.h> #include <unistd.h> static pthread_mutex_t therr_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -149,11 +150,10 @@ thr_rx(void *arg) int main(int argc, char *argv[]) { - struct timeval testtime = { + struct timespec testtime = { .tv_sec = 60, - .tv_usec = 0, + .tv_nsec = 0, }; - struct timeval *tv = &testtime; int mib[2], ncpu; size_t len; @@ -165,7 +165,7 @@ main(int argc, char *argv[]) int s[2], i, j; if (argc == 2 && !strcmp(argv[1], "--infinite")) - tv = NULL; + testtime.tv_sec = (10 * 365 * 86400); mib[0] = CTL_HW; mib[1] = HW_NCPUONLINE; @@ -224,7 +224,7 @@ main(int argc, char *argv[]) } } - select(0, NULL, NULL, NULL, tv); + nanosleep(&testtime, NULL); return 0; } |