summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2021-12-29 00:04:36 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2021-12-29 00:04:36 +0000
commit67e884bb1bda3dd0a9b45a10649e74e78aeef303 (patch)
treefc8d93c05dc8d95e8a71b50d2f37735f25684939
parent562351aec950666a49c6e4e8aea35bb35c556ea2 (diff)
Add unp_dispose() threads to 'unsopassgc' test.
-rw-r--r--regress/sys/kern/unixsockets/unsopassgc.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/regress/sys/kern/unixsockets/unsopassgc.c b/regress/sys/kern/unixsockets/unsopassgc.c
index 9f5d72f58e6..ecce985af77 100644
--- a/regress/sys/kern/unixsockets/unsopassgc.c
+++ b/regress/sys/kern/unixsockets/unsopassgc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unsopassgc.c,v 1.3 2021/12/15 22:29:55 mvs Exp $ */
+/* $OpenBSD: unsopassgc.c,v 1.4 2021/12/29 00:04:35 mvs Exp $ */
/*
* Copyright (c) 2021 Vitaliy Makkoveev <mvs@openbsd.org>
@@ -184,6 +184,20 @@ thr_recv(void *arg)
}
static void *
+thr_dispose(void *arg)
+{
+ uint8_t buf[sizeof(union msg_control)];
+ int *s = ((struct thr_pass_arg *)arg)->s;
+
+ while (1) {
+ if (read(s[1], buf, sizeof(buf)) < 0)
+ therr(1, "read");
+ }
+
+ return NULL;
+}
+
+static void *
thr_gc(void *arg)
{
union msg_control msg_control;
@@ -280,6 +294,10 @@ main(int argc, char *argv[])
thr_recv, &thr_pass_args[i]);
if (error)
therrc(1, error, "pthread_create");
+ error = pthread_create(&thr, NULL,
+ thr_dispose, &thr_pass_args[i]);
+ if (error)
+ therrc(1, error, "pthread_create");
}
if ((error = pthread_create(&thr, NULL, thr_gc, thr_gc_arg)))