summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-01-19 23:09:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-01-19 23:09:24 +0000
commitc55c27afc5b3f1669d001934542a2101f49a6648 (patch)
tree19591eb24d1964dbb293fcc0ee331a9ddb34293f /regress
parentfbd275bc3a6941b17dea61a0bb698f9977e9e5e3 (diff)
repository move to libpthread
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libc_r/Makefile13
-rw-r--r--regress/lib/libc_r/Makefile.inc16
-rw-r--r--regress/lib/libc_r/cancel/Makefile5
-rw-r--r--regress/lib/libc_r/cancel/cancel.c180
-rw-r--r--regress/lib/libc_r/cancel2/Makefile5
-rw-r--r--regress/lib/libc_r/cancel2/cancel2.c43
-rw-r--r--regress/lib/libc_r/close/Makefile5
-rw-r--r--regress/lib/libc_r/close/close.c157
-rw-r--r--regress/lib/libc_r/cwd/Makefile5
-rw-r--r--regress/lib/libc_r/cwd/cwd.c56
-rw-r--r--regress/lib/libc_r/execve/Makefile5
-rw-r--r--regress/lib/libc_r/execve/execve.c82
-rw-r--r--regress/lib/libc_r/fcntl/Makefile5
-rw-r--r--regress/lib/libc_r/fcntl/fcntl.c70
-rw-r--r--regress/lib/libc_r/fork/Makefile5
-rw-r--r--regress/lib/libc_r/fork/fork.c137
-rw-r--r--regress/lib/libc_r/getaddrinfo/Makefile5
-rw-r--r--regress/lib/libc_r/getaddrinfo/getaddrinfo.c91
-rw-r--r--regress/lib/libc_r/group/Makefile5
-rw-r--r--regress/lib/libc_r/group/group.c186
-rw-r--r--regress/lib/libc_r/include/test.h123
-rw-r--r--regress/lib/libc_r/malloc_duel/Makefile5
-rw-r--r--regress/lib/libc_r/malloc_duel/malloc_duel.c70
-rw-r--r--regress/lib/libc_r/netdb/Makefile5
-rw-r--r--regress/lib/libc_r/netdb/netdb.c85
-rw-r--r--regress/lib/libc_r/pause/Makefile5
-rw-r--r--regress/lib/libc_r/pause/pause.c73
-rw-r--r--regress/lib/libc_r/pcap/Makefile14
-rw-r--r--regress/lib/libc_r/pcap/pcap.c72
-rw-r--r--regress/lib/libc_r/poll/Makefile5
-rw-r--r--regress/lib/libc_r/poll/poll.c137
-rw-r--r--regress/lib/libc_r/preemption/Makefile5
-rw-r--r--regress/lib/libc_r/preemption/preemption.c74
-rw-r--r--regress/lib/libc_r/preemption_float/Makefile7
-rw-r--r--regress/lib/libc_r/preemption_float/preemption_float.c136
-rw-r--r--regress/lib/libc_r/pthread_cond_timedwait/Makefile5
-rw-r--r--regress/lib/libc_r/pthread_cond_timedwait/pthread_cond_timedwait.c114
-rw-r--r--regress/lib/libc_r/pthread_create/Makefile5
-rw-r--r--regress/lib/libc_r/pthread_create/pthread_create.c67
-rw-r--r--regress/lib/libc_r/pthread_join/Makefile5
-rw-r--r--regress/lib/libc_r/pthread_join/pthread_join.c99
-rw-r--r--regress/lib/libc_r/pthread_kill/Makefile5
-rw-r--r--regress/lib/libc_r/pthread_kill/pthread_kill.c82
-rw-r--r--regress/lib/libc_r/pthread_mutex/Makefile5
-rw-r--r--regress/lib/libc_r/pthread_mutex/pthread_mutex.c197
-rw-r--r--regress/lib/libc_r/pthread_specific/Makefile5
-rw-r--r--regress/lib/libc_r/pthread_specific/pthread_specific.c87
-rw-r--r--regress/lib/libc_r/pw/Makefile5
-rw-r--r--regress/lib/libc_r/pw/pw.c61
-rw-r--r--regress/lib/libc_r/readdir/Makefile5
-rw-r--r--regress/lib/libc_r/readdir/readdir.c66
-rw-r--r--regress/lib/libc_r/select/Makefile5
-rw-r--r--regress/lib/libc_r/select/select.c153
-rw-r--r--regress/lib/libc_r/setjmp/Makefile5
-rw-r--r--regress/lib/libc_r/setjmp/setjmp.c93
-rw-r--r--regress/lib/libc_r/sigdeliver/Makefile5
-rw-r--r--regress/lib/libc_r/sigdeliver/sigdeliver.c66
-rw-r--r--regress/lib/libc_r/siginfo/Makefile5
-rw-r--r--regress/lib/libc_r/siginfo/siginfo.c47
-rw-r--r--regress/lib/libc_r/signal/Makefile5
-rw-r--r--regress/lib/libc_r/signal/signal.c58
-rw-r--r--regress/lib/libc_r/signodefer/Makefile5
-rw-r--r--regress/lib/libc_r/signodefer/signodefer.c67
-rw-r--r--regress/lib/libc_r/sigsuspend/Makefile5
-rw-r--r--regress/lib/libc_r/sigsuspend/sigsuspend.c246
-rw-r--r--regress/lib/libc_r/sigwait/Makefile5
-rw-r--r--regress/lib/libc_r/sigwait/sigwait.c270
-rw-r--r--regress/lib/libc_r/sleep/Makefile5
-rw-r--r--regress/lib/libc_r/sleep/sleep.c84
-rw-r--r--regress/lib/libc_r/socket/1/Makefile6
-rw-r--r--regress/lib/libc_r/socket/1/socket1.c194
-rw-r--r--regress/lib/libc_r/socket/2/Makefile7
-rw-r--r--regress/lib/libc_r/socket/2/socket2.c191
-rw-r--r--regress/lib/libc_r/socket/2a/Makefile19
-rw-r--r--regress/lib/libc_r/socket/2a/socket2a.c119
-rw-r--r--regress/lib/libc_r/socket/3/Makefile6
-rw-r--r--regress/lib/libc_r/socket/3/socket3.c121
-rw-r--r--regress/lib/libc_r/socket/Makefile5
-rw-r--r--regress/lib/libc_r/socket/Makefile.inc3
-rw-r--r--regress/lib/libc_r/stdarg/Makefile9
-rw-r--r--regress/lib/libc_r/stdarg/stdarg.c89
-rw-r--r--regress/lib/libc_r/stdio/Makefile5
-rw-r--r--regress/lib/libc_r/stdio/stdio.c111
-rw-r--r--regress/lib/libc_r/switch/Makefile5
-rw-r--r--regress/lib/libc_r/switch/switch.c133
-rw-r--r--regress/lib/libc_r/system/Makefile5
-rw-r--r--regress/lib/libc_r/system/system.c19
87 files changed, 0 insertions, 4881 deletions
diff --git a/regress/lib/libc_r/Makefile b/regress/lib/libc_r/Makefile
deleted file mode 100644
index 6165d505244..00000000000
--- a/regress/lib/libc_r/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-# $OpenBSD: Makefile,v 1.15 2003/01/19 21:23:45 marc Exp $
-
-SUBDIR= cancel cancel2 close cwd execve fork group malloc_duel netdb pcap poll \
- preemption preemption_float pthread_cond_timedwait pthread_create \
- pthread_join pthread_kill pthread_mutex pthread_specific readdir \
- select setjmp signal sigdeliver siginfo signodefer sigsuspend \
- sigwait sleep socket stdarg stdio switch system
-
-# Not available or disabled: fcntl, pause, preemption_float and pw
-
-install:
-
-.include <bsd.subdir.mk>
diff --git a/regress/lib/libc_r/Makefile.inc b/regress/lib/libc_r/Makefile.inc
deleted file mode 100644
index 306a37d132c..00000000000
--- a/regress/lib/libc_r/Makefile.inc
+++ /dev/null
@@ -1,16 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.8 2003/01/14 20:04:44 marc Exp $
-# Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu
-
-LIBPTHREAD= /usr/lib/libpthread.a
-
-LDADD+= -pthread
-DPADD+= ${LIBPTHREAD}
-
-CFLAGS+= -Wall # -Werror
-#DEBUG= -ggdb
-CFLAGS+= -DSRCDIR='"${.CURDIR}"'
-CFLAGS+= -I${.CURDIR}/../include
-
-NOMAN=
-
-REGRESS_MAXTIME?=30
diff --git a/regress/lib/libc_r/cancel/Makefile b/regress/lib/libc_r/cancel/Makefile
deleted file mode 100644
index de275c5e13a..00000000000
--- a/regress/lib/libc_r/cancel/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= cancel
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/cancel/cancel.c b/regress/lib/libc_r/cancel/cancel.c
deleted file mode 100644
index 4c70a229bcd..00000000000
--- a/regress/lib/libc_r/cancel/cancel.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* $OpenBSD: cancel.c,v 1.5 2002/02/17 05:44:38 marc Exp $ */
-/* David Leonard <d@openbsd.org>, 1999. Public Domain. */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include "test.h"
-
-static pthread_cond_t cond;
-static pthread_mutex_t mutex;
-static struct timespec expiretime;
-
-static volatile int pv_state = 0;
-
-void p() {
- CHECKr(pthread_mutex_lock(&mutex));
- if (pv_state <= 0) {
- CHECKr(pthread_cond_timedwait(&cond, &mutex, &expiretime));
- }
- pv_state--;
- CHECKr(pthread_mutex_unlock(&mutex));
-}
-
-void v() {
- int needsignal;
-
- CHECKr(pthread_mutex_lock(&mutex));
- pv_state++;
- needsignal = (pv_state == 1);
- if (needsignal)
- CHECKr(pthread_cond_signal(&cond));
- CHECKr(pthread_mutex_unlock(&mutex));
-}
-
-void
-c1handler(void *arg)
-{
- CHECKe(close(*(int *)arg));
- v();
-}
-
-void *
-child1fn(arg)
- void *arg;
-{
- int fd;
- char buf[1024];
- int len;
-
- SET_NAME("c1");
- CHECKr(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL));
- /* something that will block */
- CHECKe(fd = open("/dev/tty", O_RDONLY));
- pthread_cleanup_push(c1handler, (void *)&fd);
- v();
- while (1) {
- CHECKe(len = read(fd, &buf, sizeof buf));
- printf("child 1 read %d bytes\n", len);
- }
- PANIC("child 1");
-}
-
-static int c2_in_test = 0;
-
-void
-c2handler(void *arg)
-{
- ASSERT(c2_in_test);
- v();
-}
-
-static int message_seen = 0;
-void *
-child2fn(arg)
- void *arg;
-{
- SET_NAME("c2");
-
- CHECKr(pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL));
- pthread_cleanup_push(c2handler, NULL);
- v();
-
- while (1) {
- struct timespec now;
- struct timespec end;
-
- /*
- * XXX Be careful not to call any cancellation points
- * until pthread_testcancel()
- */
-
- CHECKe(clock_gettime(CLOCK_REALTIME, &end));
- end.tv_sec ++;
-
- while (1) {
- CHECKe(clock_gettime(CLOCK_REALTIME, &now));
- if (timespeccmp(&now, &end, >=))
- break;
- pthread_yield();
- }
-
- /* XXX write() contains a cancellation point */
- /* printf("child 2 testing for cancel\n"); */
-
- c2_in_test = 1;
- pthread_testcancel();
- printf("you should see this message exactly once\n");
- message_seen++;
- c2_in_test = 0;
- ASSERT(message_seen == 1);
- v();
- }
- PANIC("child 2");
-}
-
-static int c3_cancel_survived;
-
-void
-c3handler(void *arg)
-{
- printf("(fyi, cancellation of self %s instantaneous)\n",
- (c3_cancel_survived ? "was not" : "was"));
- v();
-}
-
-void *
-child3fn(arg)
- void *arg;
-{
- SET_NAME("c3");
- pthread_cleanup_push(c3handler, NULL);
-
- /* Cancel myself */
- CHECKr(pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL));
- c3_cancel_survived = 0;
- pthread_cancel(pthread_self());
- c3_cancel_survived = 1;
- pthread_testcancel();
-
- PANIC("child 3");
-}
-
-int
-main()
-{
- pthread_t child1, child2, child3;
-
- /* Set up our control flow */
- CHECKr(pthread_mutex_init(&mutex, NULL));
- CHECKr(pthread_cond_init(&cond, NULL));
- CHECKe(clock_gettime(CLOCK_REALTIME, &expiretime));
- expiretime.tv_sec += 5; /* this test shouldn't run over 5 seconds */
-
- CHECKr(pthread_create(&child1, NULL, child1fn, NULL));
- CHECKr(pthread_create(&child2, NULL, child2fn, NULL));
- p();
- p();
-
- CHECKr(pthread_cancel(child1));
- p();
-
- /* Give thread 2 a chance to go through its deferred loop once */
- p();
- CHECKr(pthread_cancel(child2));
- p();
-
- /* Child 3 cancels itself */
- CHECKr(pthread_create(&child3, NULL, child3fn, NULL));
- p();
-
- /* Make sure they're all gone */
- CHECKr(pthread_join(child3, NULL));
- CHECKr(pthread_join(child2, NULL));
- CHECKr(pthread_join(child1, NULL));
-
- exit(0);
-}
diff --git a/regress/lib/libc_r/cancel2/Makefile b/regress/lib/libc_r/cancel2/Makefile
deleted file mode 100644
index 8cf71cfe4c0..00000000000
--- a/regress/lib/libc_r/cancel2/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2003/01/19 21:23:46 marc Exp $
-
-PROG= cancel2
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/cancel2/cancel2.c b/regress/lib/libc_r/cancel2/cancel2.c
deleted file mode 100644
index 275ad8d8b61..00000000000
--- a/regress/lib/libc_r/cancel2/cancel2.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $OpenBSD: cancel2.c,v 1.1 2003/01/19 21:23:46 marc Exp $ */
-/* PUBLIC DOMAIN <marc@snafu.org> */
-
-/*
- * Check that a thread waiting on a select without timeout can be
- * cancelled.
- */
-
-#include <sys/types.h>
-#include <sys/time.h>
-
-#include <pthread.h>
-#include <unistd.h>
-
-#include "test.h"
-
-void *
-select_thread(void *arg)
-{
- int read_fd = *(int*) arg;
- fd_set read_fds;
- int result;
-
- FD_ZERO(&read_fds);
- FD_SET(read_fd, &read_fds);
- result = select(read_fd + 1, &read_fds, NULL, NULL, NULL);
- printf("select returned %d\n", result);
- return 0;
-}
-
-int
-main(int argc, char *argv[])
-{
- pthread_t thread;
- int pipe_fd[2];
-
- CHECKe(pipe(pipe_fd));
- CHECKr(pthread_create(&thread, NULL, select_thread, pipe_fd));
- sleep(2);
- CHECKr(pthread_cancel(thread));
- CHECKr(pthread_join(thread, NULL));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/close/Makefile b/regress/lib/libc_r/close/Makefile
deleted file mode 100644
index 68692366ab7..00000000000
--- a/regress/lib/libc_r/close/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= close
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/close/close.c b/regress/lib/libc_r/close/close.c
deleted file mode 100644
index e92c5c3f9c2..00000000000
--- a/regress/lib/libc_r/close/close.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* $OpenBSD: close.c,v 1.3 2002/02/15 23:36:52 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Test the semantics of close() while a select() is happening.
- * Not a great test.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include "test.h"
-
-#define BUFSIZE 4096
-
-int fd;
-
-/*
- * meat of inetd discard service -- ignore data
- */
-void
-discard(int s)
-{
- char buffer[BUFSIZE];
-
- while ((errno = 0, read(s, buffer, sizeof(buffer)) > 0) ||
- errno == EINTR)
- ;
-}
-
-/*
- * Listen on localhost:TEST_PORT for a connection
- */
-#define TEST_PORT 9876
-
-void
-server(void)
-{
- int sock;
- int client;
- int client_addr_len;
- struct sockaddr_in serv_addr;
- struct sockaddr client_addr;
-
- CHECKe(sock = socket(AF_INET, SOCK_STREAM, 0));
- bzero((char *) &serv_addr, sizeof serv_addr);
- serv_addr.sin_family = AF_INET;
- serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- serv_addr.sin_port = htons(TEST_PORT);
- CHECKe(bind(sock, (struct sockaddr *) &serv_addr, sizeof serv_addr));
- CHECKe(listen(sock,3));
-
- client_addr_len = sizeof client_addr;
- CHECKe(client = accept(sock, &client_addr, &client_addr_len ));
- CHECKe(close(sock));
- discard(client);
- CHECKe(close(client));
- exit(0);
-}
-
-void* new_thread(void* arg)
-{
- fd_set r;
- int ret;
- char garbage[] = "blah blah blah";
-
- FD_ZERO(&r);
- FD_SET(fd, &r);
-
- printf("child: writing some garbage to fd %d\n", fd);
- CHECKe(write(fd, garbage, sizeof garbage));
- printf("child: calling select() with fd %d\n", fd);
- CHECKe(ret = select(fd + 1, &r, NULL, NULL, NULL));
- printf("child: select() returned %d\n", ret);
- return NULL;
-}
-
-int
-main()
-{
- pthread_t thread;
- pthread_attr_t attr;
- struct sockaddr_in addr;
- int ret;
-
- /* fork and have the child open a listener */
- signal(SIGCHLD, SIG_IGN);
- switch (fork()) {
- case 0:
- server();
- exit(0);
- case -1:
- exit(errno);
- default:
- sleep(2);
- }
-
- /* Open up a TCP connection to the local discard port */
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- addr.sin_port = htons(TEST_PORT);
-
- CHECKe(fd = socket(AF_INET, SOCK_STREAM, 0));
- printf("main: connecting to test port with fd %d\n", fd);
- ret = connect(fd, (struct sockaddr *)&addr, sizeof addr);
- if (ret == -1)
- fprintf(stderr, "connect() failed: ensure that the discard port is enabled for inetd(8)\n");
- CHECKe(ret);
- printf("main: connected on fd %d\n", fd);
-
- CHECKr(pthread_attr_init(&attr));
- CHECKe(pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED));
- printf("starting child thread\n");
- CHECKr(pthread_create(&thread, &attr, new_thread, NULL));
- sleep(1);
- printf("main: closing fd %d\n", fd);
- CHECKe(close(fd));
- printf("main: closed\n");
- sleep(1);
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/cwd/Makefile b/regress/lib/libc_r/cwd/Makefile
deleted file mode 100644
index 77118de45f3..00000000000
--- a/regress/lib/libc_r/cwd/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= cwd
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/cwd/cwd.c b/regress/lib/libc_r/cwd/cwd.c
deleted file mode 100644
index 925e337a728..00000000000
--- a/regress/lib/libc_r/cwd/cwd.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* $OpenBSD: cwd.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * 'Test' getcwd() and getwd()
- */
-
-#include <stdio.h>
-#include <sys/param.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "test.h"
-
-int
-main(int argc, char **argv)
-{
- char wd[MAXPATHLEN];
- char *path;
-
- ASSERT(path = getcwd(wd, sizeof wd));
- printf("getcwd => %s\n", path);
- ASSERT(path = getwd(wd));
- printf("getwd => %s\n", path);
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/execve/Makefile b/regress/lib/libc_r/execve/Makefile
deleted file mode 100644
index 32df4e49111..00000000000
--- a/regress/lib/libc_r/execve/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= execve
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/execve/execve.c b/regress/lib/libc_r/execve/execve.c
deleted file mode 100644
index 75e2083f796..00000000000
--- a/regress/lib/libc_r/execve/execve.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: execve.c,v 1.2 2002/12/13 20:21:04 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu
- *
- * Test execve() and dup2() calls.
- */
-
-#include <pthread.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include "test.h"
-
-extern char **environ;
-char *argv[] = {
- "/bin/echo",
- "This line should appear after the execve",
- NULL
-};
-
-char * should_succeed = "This line should be displayed\n";
-
-int
-main()
-{
- int fd;
-
- printf("This is the first message\n");
- if (isatty(STDOUT_FILENO)) {
- char *ttynm;
-
- CHECKn(ttynm = ttyname(STDOUT_FILENO));
- printf("tty is %s\n", ttynm);
- CHECKe(fd = open(ttynm, O_RDWR));
- } else {
- printf("IGNORED: stdout is not a tty: this test needs a tty\n");
- SUCCEED;
- }
-
- CHECKn(printf("This output is necessary to set the stdout fd to NONBLOCKING\n"));
-
- /* do a dup2 */
- CHECKe(dup2(fd, STDOUT_FILENO));
- CHECKe(write(STDOUT_FILENO, should_succeed,
- (size_t)strlen(should_succeed)));
- CHECKe(execve(argv[0], argv, environ));
- DIE(errno, "execve %s", argv[0]);
-}
diff --git a/regress/lib/libc_r/fcntl/Makefile b/regress/lib/libc_r/fcntl/Makefile
deleted file mode 100644
index 19867a16512..00000000000
--- a/regress/lib/libc_r/fcntl/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= fcntl
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/fcntl/fcntl.c b/regress/lib/libc_r/fcntl/fcntl.c
deleted file mode 100644
index 7106a301b89..00000000000
--- a/regress/lib/libc_r/fcntl/fcntl.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: fcntl.c,v 1.1 2001/08/15 14:37:11 fgsch Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Test fcntl() flag inheritance across a fork()
- */
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <unistd.h>
-#include "test.h"
-
-int
-main()
-{
- int flags, newflags, child;
-
- CHECKe(flags = fcntl(0, F_GETFL));
- printf("flags = %x\n", flags);
-
- CHECKe(child = fork());
- switch(child) {
- case 0: /* child */
- CHECKe(execlp("./pthread_create", "./pthread_create",
- (char *)NULL));
- /* NOTREACHED */
- default: /* parent */
- CHECKe(wait(NULL));
- break;
- }
-
- while(1){
- CHECKe(newflags = fcntl(0, F_GETFL));
- printf ("parent %d flags = %x\n", child, newflags);
- sleep(1);
- }
-}
diff --git a/regress/lib/libc_r/fork/Makefile b/regress/lib/libc_r/fork/Makefile
deleted file mode 100644
index 7d0b80bd968..00000000000
--- a/regress/lib/libc_r/fork/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= fork
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/fork/fork.c b/regress/lib/libc_r/fork/fork.c
deleted file mode 100644
index 3a5d9ac24cd..00000000000
--- a/regress/lib/libc_r/fork/fork.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $OpenBSD: fork.c,v 1.3 2002/12/08 04:16:19 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu
- *
- * Test the fork system call.
- */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <sys/wait.h>
-#include "test.h"
-
-
-void *
-empty(void *arg)
-{
-
- return (void *)0x12345678;
-}
-
-void *
-sleeper(void *arg)
-{
-
- pthread_set_name_np(pthread_self(), "slpr");
- sleep(10);
- PANIC("sleeper timed out");
-}
-
-
-int
-main()
-{
- int flags;
- pthread_t sleeper_thread;
- void *result;
- int status;
- pid_t parent_pid;
- pid_t child_pid;
-
- parent_pid = getpid();
-
- CHECKe(flags = fcntl(STDOUT_FILENO, F_GETFL));
- if ((flags & (O_NONBLOCK | O_NDELAY))) {
- /* This fails when stdout is /dev/null!? */
- /*CHECKe*/(fcntl(STDOUT_FILENO, F_SETFL,
- flags & ~(O_NONBLOCK | O_NDELAY)));
- }
-
- CHECKr(pthread_create(&sleeper_thread, NULL, sleeper, NULL));
- sleep(1);
-
- printf("forking from pid %d\n", getpid());
-
- CHECKe(child_pid = fork());
- if (child_pid == 0) {
- /* child: */
- printf("child = pid %d\n", getpid());
- /* Our pid should change */
- ASSERT(getpid() != parent_pid);
- /* Our sleeper thread should have disappeared */
- printf("sleeper should have disappeared\n");
-
- /*
- * The following is bogus. The sleeper thread was
- * freed before the fork returned. Calling pthread_join
- * dereferences the 'sleeper_thread' pointer which no
- * longer points to a valid thread structure. If the
- * function returns ESRCH it's only because the freed
- * memory hasn't been reused yet.
- ASSERT(ESRCH == pthread_join(sleeper_thread, &result));
- printf("sleeper disappeared correctly\n");
- */
-
- /* Test starting another thread */
- CHECKr(pthread_create(&sleeper_thread, NULL, empty, NULL));
- sleep(1);
- CHECKr(pthread_join(sleeper_thread, &result));
- ASSERT(result == (void *)0x12345678);
- printf("child ok\n");
- _exit(0);
- PANIC("child _exit");
- }
-
- /* parent: */
- printf("parent = pid %d\n", getpid());
- /* Our pid should stay the same */
- ASSERT(getpid() == parent_pid);
- /* wait for the child */
- ASSERTe(wait(&status), == child_pid);
- /* the child should have called exit(0) */
- ASSERT(WIFEXITED(status));
- ASSERT(WEXITSTATUS(status) == 0);
- /* Our sleeper thread should still be around */
- CHECKr(pthread_detach(sleeper_thread));
- printf("parent ok\n");
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/getaddrinfo/Makefile b/regress/lib/libc_r/getaddrinfo/Makefile
deleted file mode 100644
index 59f66ed04ef..00000000000
--- a/regress/lib/libc_r/getaddrinfo/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/02/01 18:51:44 todd Exp $
-
-PROG= getaddrinfo
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/getaddrinfo/getaddrinfo.c b/regress/lib/libc_r/getaddrinfo/getaddrinfo.c
deleted file mode 100644
index 9629022fbdd..00000000000
--- a/regress/lib/libc_r/getaddrinfo/getaddrinfo.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $OpenBSD: getaddrinfo.c,v 1.3 2003/01/18 01:48:21 marc Exp $ */
-/*
- * Copyright (c) 2002 Todd T. Fries <todd@OpenBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include <netdb.h>
-#include <resolv.h>
-
-#include "test.h"
-
-#define STACK_SIZE (2 * 1024 * 1024)
-
-void *func(void *);
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- pthread_attr_t attr;
- pthread_t threads[2];
- int i;
-
- CHECKr(pthread_attr_init(&attr));
- CHECKr(pthread_attr_setstacksize(&attr, (size_t) STACK_SIZE));
- for (i = 0; i < 2; i++) {
- CHECKr(pthread_create(&threads[i], &attr, func, NULL));
- }
-
- pthread_yield();
- for (i = 0; i < 2; i++) {
- CHECKr(pthread_join(threads[i], NULL));
- }
-
- SUCCEED;
-}
-
-void *
-func(arg)
- void *arg;
-{
- struct addrinfo hints, *res;
- char h[NI_MAXHOST];
- int i;
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
- hints.ai_flags = AI_CANONNAME;
-
- printf("Starting thread %p\n", pthread_self());
-
- for(i = 0; i < 50; i++) {
- if (getaddrinfo("www.openbsd.org", "0", &hints, &res))
- printf("error on thread %p\n", pthread_self());
- else {
- getnameinfo(res->ai_addr, res->ai_addrlen, h, sizeof h,
- NULL, 0, NI_NUMERICHOST);
- printf("success on thread %p: %s is %s\n",
- pthread_self(), res->ai_canonname, h);
- freeaddrinfo(res);
- }
- }
- return (NULL);
-}
-
diff --git a/regress/lib/libc_r/group/Makefile b/regress/lib/libc_r/group/Makefile
deleted file mode 100644
index 7dbeea25ff7..00000000000
--- a/regress/lib/libc_r/group/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= group
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/group/group.c b/regress/lib/libc_r/group/group.c
deleted file mode 100644
index cec7667e516..00000000000
--- a/regress/lib/libc_r/group/group.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* $OpenBSD: group.c,v 1.4 2001/09/12 12:07:39 fgsch Exp $ */
-
-/* David Leonard <d@openbsd.org>, 2001. Public Domain. */
-
-/*
- * Test getgrgid_r() across multiple threads to see if the members list changes.
- */
-
-#include <sys/types.h>
-#include <grp.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-int getgrgid_r(gid_t, struct group *, char *, size_t, struct group **);
-
-char fail[] = "fail";
-
-pthread_cond_t done;
-volatile int done_count;
-
-pthread_mutex_t display;
-pthread_mutex_t display2;
-
-void *
-test(void *arg)
-{
- gid_t gid = *(gid_t *)arg;
- gid_t ogid;
- struct group grpbuf;
- struct group *grp;
- char **p;
- char buffer[5000];
- char buf[2048];
- char *cpy[128];
- int i;
- int count1, count2;
- char *s;
- char *oname;
- char *opasswd;
-
- /* Acquire lock for running first part. */
- CHECKr(pthread_mutex_lock(&display));
-
- /* Store magic name to test for non-alteration */
- grpbuf.gr_name = fail;
-
- /* Call getgrgid_r() */
- printf("gid %d\n", gid);
- CHECKr(getgrgid_r(gid, &grpbuf, buffer, sizeof(buffer), &grp));
-
- /* Test for non-alteration of group structure */
- ASSERT(grp->gr_name != fail);
-
- /* We must get the right group */
- ASSERT(grp->gr_gid == gid);
-
- s = buf; /* Keep our private buffer on the stack */
-
- /* copy gr_name */
- strcpy(oname = s, grp->gr_name);
- s += 1 + strlen(s);
-
- /* copy gr_passwd */
- strcpy(opasswd = s, grp->gr_passwd);
- s += 1 + strlen(s);
-
- /* copy gr_gid */
- ogid = grp->gr_gid;
-
- /* copy gr_mem */
- for (i = 0, p = grp->gr_mem; *p; p++) {
- strcpy(cpy[i] = s, *p); i++;
- s += 1 + strlen(s);
- }
- cpy[i] = NULL;
-
-#if 0
- printf("now: %s:%s:%d:", grp->gr_name, grp->gr_passwd, grp->gr_gid);
- for (p = grp->gr_mem; *p; p++)
- printf("%s%s", *p, *(p+1) == NULL ? "": ",");
- printf("\n");
-#endif
-
-#ifdef DEBUG /* debugging this program */
- printf("buf = \"");
- for (i = 0; i < s - buf; i++)
- if (buf[i] == '\0') printf("\\0");
- else printf("%c", buf[i]);
- printf("\"\n");
-#endif
-
- /* Inform main that we have finished */
- done_count++;
- CHECKr(pthread_cond_signal(&done));
-
- /* Allow other threads to run first part */
- CHECKr(pthread_mutex_unlock(&display));
-
- /* Acquire lock for the second part */
- CHECKr(pthread_mutex_lock(&display2));
-
- count1 = 0;
- printf("before: %s:%s:%d:", oname, opasswd, ogid);
- for (p = cpy; *p; p++) {
- count1++;
- printf("%s%s", *p, *(p+1) == NULL ? "": ",");
- }
- printf("\n");
-
- count2 = 0;
- printf("after: %s:%s:%d:", grp->gr_name, grp->gr_passwd, grp->gr_gid);
- for (p = grp->gr_mem; *p; p++) {
- count2++;
- printf("%s%s", *p, *(p+1) == NULL ? "": ",");
- }
- printf("\n");
-
- CHECKr(pthread_mutex_unlock(&display2));
-
- if (count1 != count2)
- return "gr_mem length changed";
- for (i = 0; i < count1; i++)
- if (strcmp(cpy[i], grp->gr_mem[i]) != 0)
- return "gr_mem list changed";
- if (strcmp(grp->gr_name, oname) != 0)
- return "gr_name changed";
- if (strcmp(grp->gr_passwd, opasswd) != 0)
- return "gr_passwd changed";
- if (grp->gr_gid != ogid)
- return "gr_gid changed";
- return NULL;
-}
-
-
-#define NGRPS 5
-int
-main()
-{
- pthread_t thread[NGRPS];
- int gid;
- int failed;
- void *result;
-
- CHECKr(pthread_mutex_init(&display, NULL));
- CHECKr(pthread_mutex_init(&display2, NULL));
-
- CHECKr(pthread_cond_init(&done, NULL));
- done_count = 0;
-
- pthread_mutex_lock(&display);
- pthread_mutex_lock(&display2);
-
- /* Get separate threads to do a group open separately */
- for (gid = 0; gid < NGRPS; gid++) {
- int *n = (int *)malloc(sizeof(int));
- *n = gid;
-
- CHECKr(pthread_create(&thread[gid], NULL, test, (void *)n));
- }
-
- /* Allow all threads to run their first part */
- while (done_count < NGRPS)
- pthread_cond_wait(&done, &display);
-
- /* Allow each thread to run the 2nd part of its test */
- CHECKr(pthread_mutex_unlock(&display2));
-
- /* Wait for each thread to terminate, collecting results. */
- failed = 0;
- for (gid = 0; gid < NGRPS; gid++) {
- CHECKr(pthread_join(thread[gid], &result));
- if (result != NULL) {
- fprintf(stderr, "gid %d: %s\n", gid, (char *)result);
- failed++;
- }
- }
-
- if (!failed) {
- SUCCEED;
- } else {
- exit(1);
- }
-}
diff --git a/regress/lib/libc_r/include/test.h b/regress/lib/libc_r/include/test.h
deleted file mode 100644
index 58fdc8fb554..00000000000
--- a/regress/lib/libc_r/include/test.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $OpenBSD: test.h,v 1.4 2002/02/17 19:42:27 millert Exp $ */
-
-#ifndef _h_test_
-#define _h_test_
-
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-#include <stdarg.h>
-
-int _thread_sys_write(int, const char*, size_t);
-__dead void _thread_sys__exit(int) __attribute__((__noreturn__));
-
-static __dead void __vpanic(const char *, const char *, const char *,
- int, const char *, va_list) __attribute__((__noreturn__));
-static __dead void __panic(const char *, const char *, const char *,
- int, const char *, ...) __attribute__((__noreturn__));
-
-#if defined(__OpenBSD__) || defined(__FreeBSD__)
-#include <pthread.h>
-#include <pthread_np.h>
-void _thread_dump_info(void);
-#define SET_NAME(x) pthread_set_name_np(pthread_self(), x)
-#define DUMP_INFO() _thread_dump_info()
-#else
-#define SET_NAME(x) /* nada */
-#define DUMP_INFO() /* nada */
-#endif
-
-static void
-__vpanic(type, errstr, filenm, lineno, fmt, ap)
- const char *type;
- const char *errstr;
- const char *filenm;
- int lineno;
- const char *fmt;
- va_list ap;
-{
- char buf[1024];
-
- /* "<type> at <filenm>:<lineno>: <fmt ap...>:<errstr>" */
- snprintf(buf, sizeof buf, "%s at %s:%d\n", type, filenm, lineno);
- _thread_sys_write(2, buf, strlen(buf));
- vsnprintf(buf, sizeof buf, fmt, ap);
- if (errstr != NULL) {
- strlcat(buf, ": ", sizeof buf);
- strlcat(buf, errstr, sizeof buf);
- }
- strlcat(buf, "\n", sizeof buf);
- _thread_sys_write(2, buf, strlen(buf));
-
- DUMP_INFO();
- _thread_sys__exit(1);
-
- _thread_sys_write(2, "[locking]\n", 10);
- while(1);
-}
-
-static void
-__panic(type, errstr, filenm, lineno, fmt)
- const char *type;
- const char *errstr;
- const char *filenm;
- int lineno;
- const char *fmt;
-{
- va_list ap;
-
- va_start(ap, fmt);
- __vpanic(type, errstr, filenm, lineno, fmt, ap);
- va_end(ap);
-}
-
-#define DIE(e, m, args...) \
- __panic("died", strerror(e), __FILE__, __LINE__, m , ## args)
-
-#define PANIC(m, args...) \
- __panic("panic", NULL, __FILE__, __LINE__, m, ## args)
-
-#define ASSERT(x) do { \
- if (!(x)) \
- __panic("assert failed", NULL, __FILE__, __LINE__, "%s", #x); \
-} while(0)
-
-#define ASSERTe(x,rhs) do { \
- int _x; \
- _x = (x); \
- if (!(_x rhs)) { \
- if (_x > 0) \
- __panic("assert failed", strerror(_x), __FILE__, __LINE__, \
- "%s %s", #x, #rhs); \
- else \
- __panic("assert failed", NULL, __FILE__, __LINE__, \
- "%s [=%d] %s", #x, _x, #rhs); \
- } \
-} while(0)
-
-#define _T(x) __builtin_classify_type(x)
-
-#define _CHECK(x, rhs, efn) do { \
- typeof(x) _x; \
- _x = (x); \
- if (!(_x rhs)) \
- __panic("check failed", efn, __FILE__, __LINE__, \
- ((_T(0) == _T(_x) )? "failed check %s (=%d) %s " : \
- (_T("") == _T(_x) )? "failed check %s (=%s) %s " : \
- (_T('x') == _T(_x) )? "failed check %s (=%c) %s " : \
- (_T(0L) == _T(_x) )? "failed check %s (=%ld) %s " : "?") \
- , #x, _x, #rhs); \
-} while(0)
-
-#define CHECKr(x) _CHECK(x, == 0, strerror(_x))
-#define CHECKe(x) _CHECK(x, != -1, strerror(errno))
-#define CHECKn(x) _CHECK(x, != 0, strerror(errno))
-#define CHECKhn(x) _CHECK(x, != 0, hstrerror(h_errno))
-
-#define SUCCEED exit(0)
-
-#define OK (0)
-#define NOTOK (-1)
-
-#endif /* _h_test_ */
diff --git a/regress/lib/libc_r/malloc_duel/Makefile b/regress/lib/libc_r/malloc_duel/Makefile
deleted file mode 100644
index 7626a3878e4..00000000000
--- a/regress/lib/libc_r/malloc_duel/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/11/12 03:17:16 marc Exp $
-
-PROG= malloc_duel
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/malloc_duel/malloc_duel.c b/regress/lib/libc_r/malloc_duel/malloc_duel.c
deleted file mode 100644
index c7733f63b45..00000000000
--- a/regress/lib/libc_r/malloc_duel/malloc_duel.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* $OpenBSD: malloc_duel.c,v 1.1 2002/11/12 03:17:16 marc Exp $ */
-/* PUBLIC DOMAIN Nov 2002 <marc@snafu.org> */
-
-/*
- * Dueling malloc in different threads
- */
-
-#include <signal.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "test.h"
-
-volatile sig_atomic_t done;
-
-#define MALLOC_COUNT 1024
-
-/*
- * sigalrm handler. Initiate end-of-test
- */
-static void
-alarm_handler(int sig)
-{
- done = 1;
-}
-
-/*
- * A function that does lots of mallocs, called by all threads.
- */
-void
-malloc_loop(void)
-{
- int i;
- int **a;
-
- a = calloc(MALLOC_COUNT, sizeof(int*));
- ASSERT(a != NULL);
- while (!done) {
- for (i = 0; i < MALLOC_COUNT; i++) {
- a[i] = malloc(sizeof(int));
- ASSERT(a[i] != NULL);
- }
- for (i = 0; i < MALLOC_COUNT; i++) {
- free(a[i]);
- }
- }
-}
-
-/*
- * A thread that does a lot of mallocs
- */
-void *
-thread(void *arg)
-{
- malloc_loop();
- return NULL;
-}
-
-int
-main(int argc, char **argv)
-{
- pthread_t child;
-
- CHECKr(pthread_create(&child, NULL, thread, NULL));
- ASSERT(signal(SIGALRM, alarm_handler) != SIG_ERR);
- CHECKe(alarm(20));
- malloc_loop();
- CHECKr(pthread_join(child, NULL));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/netdb/Makefile b/regress/lib/libc_r/netdb/Makefile
deleted file mode 100644
index 70b963db05c..00000000000
--- a/regress/lib/libc_r/netdb/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= netdb
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/netdb/netdb.c b/regress/lib/libc_r/netdb/netdb.c
deleted file mode 100644
index 9f764d87827..00000000000
--- a/regress/lib/libc_r/netdb/netdb.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* $OpenBSD: netdb.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1995 by Greg Hudson, ghudson@.mit.edu
- *
- * Test netdb calls.
- */
-
-#include <pthread.h>
-#include <string.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <errno.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "test.h"
-
-static void test_serv()
-{
- struct servent *serv;
-
- CHECKhn(serv = getservbyname("telnet", "tcp"));
- printf("getservbyname -> port %d\n", ntohs(serv->s_port));
-}
-
-static void test_host()
-{
- struct hostent *host;
- struct in_addr addr;
-
- CHECKhn(host = gethostbyname("localhost"));
- memcpy(&addr, host->h_addr, sizeof(addr));
- printf("gethostbyname -> %s\n", inet_ntoa(addr));
-}
-
-static void test_localhost()
-{
- struct hostent *host;
-
- CHECKhn(host = gethostbyname("127.0.0.1"));
-}
-
-int
-main(int argc, char **argv)
-{
- test_serv();
- test_localhost();
- test_host();
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pause/Makefile b/regress/lib/libc_r/pause/Makefile
deleted file mode 100644
index 97f13c0d205..00000000000
--- a/regress/lib/libc_r/pause/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= pause
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pause/pause.c b/regress/lib/libc_r/pause/pause.c
deleted file mode 100644
index 20a49f061a6..00000000000
--- a/regress/lib/libc_r/pause/pause.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* $OpenBSD: pause.c,v 1.2 2001/11/11 23:26:35 deraadt Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Test pause()
- */
-
-#include <stdio.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include "test.h"
-
-int gotsig = 0;
-
-void
-handler(sig)
- int sig;
-{
- int save_errno = errno;
- char buf[8192];
-
- snprintf(buf, sizeof buf, "%s\n", strsignal(sig));
- write(STDOUT_FILENO, buf, strlen(buf));
- errno = save_errno;
-}
-
-int
-main()
-{
- sigset_t all;
- pid_t self;
-
- ASSERT(signal(SIGHUP, handler) != SIG_ERR);
- CHECKe(self = getpid());
- CHECKe(sigemptyset(&all));
- CHECKe(sigaddset(&all, SIGHUP));
- CHECKe(sigprocmask(SIG_BLOCK, &all, NULL));
- CHECKe(kill(self, SIGHUP));
- CHECKe(pause());
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pcap/Makefile b/regress/lib/libc_r/pcap/Makefile
deleted file mode 100644
index 8e28bd914da..00000000000
--- a/regress/lib/libc_r/pcap/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-# $OpenBSD: Makefile,v 1.8 2002/09/02 20:01:43 avsm Exp $
-
-PROG= pcap
-
-DPADD+= ${LIBPCAP}
-LDADD+= -lpcap
-
-REGRESS_TARGETS= sudo-regress-${PROG}
-REGRESS_ROOT_TARGETS= ${REGRESS_TARGETS}
-
-sudo-regress-${PROG}: ${PROG}
- ${SUDO} ./${PROG}
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pcap/pcap.c b/regress/lib/libc_r/pcap/pcap.c
deleted file mode 100644
index 7bbadf93c6f..00000000000
--- a/regress/lib/libc_r/pcap/pcap.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $OpenBSD: pcap.c,v 1.4 2002/01/08 18:55:46 marc Exp $ */
-/*
- * Placed in the PUBLIC DOMAIN
- */
-
-#include <pcap.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "test.h"
-
-#define LOOPBACK_IF "lo0"
-#define SNAPLEN 96
-#define NO_PROMISC 0
-#define PKTCNT 3
-
-volatile int packet_count = 0;
-pthread_mutex_t dummy;
-pthread_cond_t syncer;
-
-void
-packet_ignore(u_char *tag, const struct pcap_pkthdr *hdr, const u_char *data)
-{
- packet_count += 1;
-}
-
-void *
-pcap_thread(void *arg)
-{
- char errbuf[PCAP_ERRBUF_SIZE];
- pcap_t *handle;
-
- SET_NAME("pcap_thread");
- CHECKr(pthread_mutex_lock(&dummy));
- handle = pcap_open_live(LOOPBACK_IF, SNAPLEN, NO_PROMISC, 0, errbuf);
- if (!handle)
- PANIC("You may need to run this test as UID 0 (root)");
- CHECKr(pthread_mutex_unlock(&dummy));
- CHECKr(pthread_cond_signal(&syncer));
- ASSERT(pcap_loop(handle, PKTCNT, packet_ignore, 0) != -1);
- return 0;
-}
-
-void *
-ping_thread(void *arg)
-{
- SET_NAME("ping_thread");
- CHECKr(pthread_mutex_lock(&dummy));
- ASSERT(system("ping -c 3 127.0.0.1") == 0);
- CHECKr(pthread_mutex_unlock(&dummy));
- CHECKr(pthread_cond_signal(&syncer));
- return 0;
-}
-
-int
-main(int argc, char **argv)
-{
- pthread_t pcap;
- pthread_t ping;
-
- CHECKr(pthread_mutex_init(&dummy, NULL));
- CHECKr(pthread_cond_init(&syncer, NULL));
- CHECKr(pthread_mutex_lock(&dummy));
- CHECKr(pthread_create(&pcap, NULL, pcap_thread, NULL));
- CHECKr(pthread_cond_wait(&syncer, &dummy));
- CHECKr(pthread_create(&ping, NULL, ping_thread, NULL));
- CHECKr(pthread_cond_wait(&syncer, &dummy));
- CHECKr(pthread_mutex_unlock(&dummy));
- ASSERT(packet_count == 3);
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/poll/Makefile b/regress/lib/libc_r/poll/Makefile
deleted file mode 100644
index 6a0229ac6c7..00000000000
--- a/regress/lib/libc_r/poll/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= poll
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/poll/poll.c b/regress/lib/libc_r/poll/poll.c
deleted file mode 100644
index 3ed5b52d01f..00000000000
--- a/regress/lib/libc_r/poll/poll.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* $OpenBSD: poll.c,v 1.3 2001/09/20 16:43:15 todd Exp $ */
-/* David Leonard <d@openbsd.org>, 2001. Public Domain. */
-
-#include <pthread.h>
-#include <fcntl.h>
-#include <poll.h>
-#include <paths.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "test.h"
-
-
-#define POLLALL (POLLIN|POLLOUT|POLLERR|POLLNVAL)
-
-static void
-print_pollfd(p)
- struct pollfd *p;
-{
-
- printf("{fd=%d, events=< %s%s%s> revents=< %s%s%s%s%s>}",
- p->fd,
- p->events & POLLIN ? "in " : "",
- p->events & POLLOUT ? "out " : "",
- p->events & ~(POLLIN|POLLOUT) ? "XXX " : "",
- p->revents & POLLIN ? "in " : "",
- p->revents & POLLOUT ? "out " : "",
- p->revents & POLLERR ? "err " : "",
- p->revents & POLLHUP ? "hup " : "",
- p->revents & POLLNVAL ? "nval " : ""
- );
-}
-
-static void *
-writer(arg)
- void *arg;
-{
- int fd = *(int *)arg;
- const char msg[1] = { '!' };
-
- ASSERTe(write(fd, &msg, sizeof msg), == sizeof msg);
- return NULL;
-}
-
-static void *
-reader(arg)
- void *arg;
-{
- int fd = *(int *)arg;
- char buf[1];
-
- ASSERTe(read(fd, &buf, sizeof buf), == sizeof buf);
- return NULL;
-}
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- pthread_t t;
- void *result;
- int null, zero, tty;
- int tube[2];
- struct pollfd p[3];
-
- /* Try an empty poll set */
- ASSERTe(poll(NULL, 0, 0), == 0);
-
- CHECKe(zero = open(_PATH_DEV "zero", O_RDONLY));
- CHECKe(null = open(_PATH_DEV "null", O_WRONLY));
- CHECKe(tty = open(_PATH_DEV "tty", O_WRONLY));
-
- /* Try both descriptors being ready */
- p[0].fd = zero;
- p[0].events = POLLIN|POLLOUT;
- p[0].revents = 0;
- p[1].fd = null;
- p[1].events = POLLIN|POLLOUT;
- p[1].revents = 0;
-
- ASSERTe(poll(p, 2, 0), == 2); /* if 4 then bug in kernel not fixed */
- printf("zero p[0]="); print_pollfd(&p[0]); putchar('\n');
- printf("null p[1]="); print_pollfd(&p[1]); putchar('\n');
- ASSERT((p[0].revents & POLLIN) == POLLIN);
- ASSERT((p[1].revents & POLLOUT) == POLLOUT);
-
- /*
- * Try one of the descriptors being invalid
- * and the other ready
- */
- printf("closing zero\n");
- close(zero);
-
- p[0].fd = zero;
- p[0].events = POLLIN|POLLOUT;
- p[1].fd = null;
- p[1].events = POLLIN|POLLOUT;
- ASSERTe(poll(p, 2, 0), == 2); /* again, old kernels had this bug */
- printf("zero p[0]="); print_pollfd(&p[0]); putchar('\n');
- printf("null p[1]="); print_pollfd(&p[1]); putchar('\n');
- ASSERT((p[0].revents & POLLNVAL) == POLLNVAL);
- ASSERT((p[1].revents & POLLOUT) == POLLOUT);
-
- printf("closing null\n");
- close(null);
-
- /*
- * New pipes. the write end should be writable (buffered)
- */
- CHECKe(pipe(tube));
- CHECKe(fcntl(tube[0], F_SETFL, O_NONBLOCK));
- CHECKe(fcntl(tube[1], F_SETFL, O_NONBLOCK));
-
- p[0].fd = tube[0];
- p[0].events = POLLIN;
- p[1].fd = tube[1];
- p[1].events = POLLOUT;
- ASSERTe(poll(p, 2, 0), == 1);
- printf("rpipe p[0]="); print_pollfd(&p[0]); putchar('\n');
- printf("wpipe p[1]="); print_pollfd(&p[1]); putchar('\n');
- ASSERT(p[0].revents == 0);
- ASSERT(p[1].revents == POLLOUT);
-
- /* Start a writing thread to the write end [1] */
- printf("bg writing to wpipe\n");
- CHECKr(pthread_create(&t, NULL, writer, (void *)&tube[1]));
- /* The read end [0] should soon be ready for read (POLLIN) */
- p[0].fd = tube[0];
- p[0].events = POLLIN;
- ASSERTe(poll(p, 1, INFTIM), == 1);
- printf("rpipe p[0]="); print_pollfd(&p[0]); putchar('\n');
- ASSERT(p[0].revents == POLLIN);
- reader((void *)&tube[0]); /* consume */
- CHECKr(pthread_join(t, &result));
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/preemption/Makefile b/regress/lib/libc_r/preemption/Makefile
deleted file mode 100644
index 167f6211568..00000000000
--- a/regress/lib/libc_r/preemption/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= preemption
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/preemption/preemption.c b/regress/lib/libc_r/preemption/preemption.c
deleted file mode 100644
index 5224630a918..00000000000
--- a/regress/lib/libc_r/preemption/preemption.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* $OpenBSD: preemption.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_pthread_cond.c =========================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_cond(). Run this after test_create()
- *
- * 1.23 94/05/04 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-void *
-new_thread(void * new_buf)
-{
- int i;
-
- printf("yielding:");
- for (i = 0; i < 10; i++) {
- printf(" %d", i);
- fflush(stdout);
- pthread_yield();
- }
- printf("\n");
- SUCCEED;
-}
-
-int
-main()
-{
- pthread_t thread;
-
- CHECKr(pthread_create(&thread, NULL, new_thread, NULL));
-
- while(1)
- ;
- PANIC("while");
-}
diff --git a/regress/lib/libc_r/preemption_float/Makefile b/regress/lib/libc_r/preemption_float/Makefile
deleted file mode 100644
index 18cead3fbe5..00000000000
--- a/regress/lib/libc_r/preemption_float/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2002/01/03 00:43:47 art Exp $
-
-PROG= preemption_float
-DPADD= ${LIBM}
-LDADD= -lm
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/preemption_float/preemption_float.c b/regress/lib/libc_r/preemption_float/preemption_float.c
deleted file mode 100644
index b91ca4b8c71..00000000000
--- a/regress/lib/libc_r/preemption_float/preemption_float.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $OpenBSD: preemption_float.c,v 1.2 2002/06/23 20:21:22 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Test to see if floating point state is being properly maintained
- for each thread. Different threads doing floating point operations
- simultaneously should not interfere with one another. This
- includes operations that might change some FPU flags, such as
- rounding modes, at least implicitly. */
-
-#include <pthread.h>
-#include <math.h>
-#include <stdio.h>
-#include "test.h"
-
-int limit = 2;
-int float_passed = 0;
-int float_failed = 1;
-
-void *log_loop (void *x) {
- int i;
- double d, d1, d2;
- /* sleep (1); */
- for (i = 0; i < limit; i++) {
- d = 42.0;
- d = log (exp (d));
- d = (d + 39.0) / d;
- if (i == 0)
- d1 = d;
- else {
- d2 = d;
- d = sin(d);
- /* if (d2 != d1) { */
- if (memcmp (&d2, &d1, 8)) {
- pthread_exit(&float_failed);
- }
- }
- }
- pthread_exit(&float_passed);
-}
-
-void *trig_loop (void *x) {
- int i;
- double d, d1, d2;
- /* sleep (1); */
- for (i = 0; i < limit; i++) {
- d = 35.0;
- d *= M_PI;
- d /= M_LN2;
- d = sin (d);
- d = cos (1 / d);
- if (i == 0)
- d1 = d;
- else {
- d2 = d;
- d = sin(d);
- /* if (d2 != d1) { */
- if (memcmp (&d2, &d1, 8)) {
- pthread_exit(&float_failed);
- }
- }
- }
- pthread_exit(&float_passed);
-}
-
-int
-floatloop(void)
-{
- pthread_t thread[2];
- int *x, *y;
-
- CHECKr(pthread_create (&thread[0], NULL, trig_loop, NULL));
- CHECKr(pthread_create (&thread[1], NULL, log_loop, NULL));
- CHECKr(pthread_join(thread[0], (void **) &x));
- CHECKr(pthread_join(thread[1], (void **) &y));
-
- /* Return 0 for success */
- return ((*y == float_failed)?2:0) |
- ((*x == float_failed)?1:0);
-}
-
-int
-main()
-{
- pthread_t thread;
- int *result;
-
- /* single active thread, trig test */
- for(limit = 2; limit < 100000; limit *=4) {
- CHECKr(pthread_create (&thread, NULL, trig_loop, NULL));
- CHECKr(pthread_join(thread, (void **) &result));
- ASSERT(*result == 0);
- }
-
- /* single active thread, log test */
- for(limit = 2; limit < 100000; limit *=4) {
- CHECKr(pthread_create (&thread, NULL, log_loop, NULL));
- CHECKr(pthread_join(thread, (void **) &result));
- ASSERT(*result == 0);
- }
-
- /* run both threads concurrently using a higher limit */
- limit *= 4;
- ASSERT(floatloop() == 0);
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pthread_cond_timedwait/Makefile b/regress/lib/libc_r/pthread_cond_timedwait/Makefile
deleted file mode 100644
index ec62fc93bc6..00000000000
--- a/regress/lib/libc_r/pthread_cond_timedwait/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= pthread_cond_timedwait
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pthread_cond_timedwait/pthread_cond_timedwait.c b/regress/lib/libc_r/pthread_cond_timedwait/pthread_cond_timedwait.c
deleted file mode 100644
index ffe3f5f63a1..00000000000
--- a/regress/lib/libc_r/pthread_cond_timedwait/pthread_cond_timedwait.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $OpenBSD: pthread_cond_timedwait.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_pthread_cond.c =========================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_cond(). Run this after test_create()
- *
- * 1.23 94/05/04 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "test.h"
-
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-
-void* thread_1(void * new_buf)
-{
- CHECKr(pthread_mutex_lock(&mutex));
- CHECKr(pthread_cond_signal(&cond));
- CHECKr(pthread_mutex_unlock(&mutex));
- pthread_exit(NULL);
-}
-
-void* thread_2(void * new_buf)
-{
- sleep(1);
- CHECKr(pthread_mutex_lock(&mutex));
- CHECKr(pthread_cond_signal(&cond));
- CHECKr(pthread_mutex_unlock(&mutex));
- pthread_exit(NULL);
-}
-
-int
-main()
-{
- struct timespec abstime = { 0, 0 };
- struct timeval curtime;
- pthread_t thread;
- int ret;
-
- printf("pthread_cond_timedwait START\n");
-
- CHECKr(pthread_mutex_lock(&mutex));
- CHECKe(gettimeofday(&curtime, NULL));
- abstime.tv_sec = curtime.tv_sec + 5;
-
- /* Test a condition timeout */
- switch((ret = pthread_cond_timedwait(&cond, &mutex, &abstime))) {
- case 0:
- PANIC("pthread_cond_timedwait #0 failed to timeout");
- /* NOTREACHED */
- case ETIMEDOUT:
- /* expected behaviour */
- printf("Got first timeout ok\n"); /* Added by monty */
- break;
- default:
- DIE(ret, "pthread_cond_timedwait");
- /* NOTREACHED */
- }
-
- /* Test a normal condition signal */
- CHECKr(pthread_create(&thread, NULL, thread_1, NULL));
-
- abstime.tv_sec = curtime.tv_sec + 10;
- CHECKr(pthread_cond_timedwait(&cond, &mutex, &abstime));
-
- /* Test a normal condition signal after a sleep */
- CHECKr(pthread_create(&thread, NULL, thread_2, NULL));
-
- pthread_yield();
-
- abstime.tv_sec = curtime.tv_sec + 10;
- CHECKr(pthread_cond_timedwait(&cond, &mutex, &abstime));
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pthread_create/Makefile b/regress/lib/libc_r/pthread_create/Makefile
deleted file mode 100644
index ac499b0615a..00000000000
--- a/regress/lib/libc_r/pthread_create/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= pthread_create
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pthread_create/pthread_create.c b/regress/lib/libc_r/pthread_create/pthread_create.c
deleted file mode 100644
index 9b82d0945f5..00000000000
--- a/regress/lib/libc_r/pthread_create/pthread_create.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: pthread_create.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Test pthread_create() and pthread_exit() calls.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-void* new_thread(void* arg)
-{
- int i;
-
- printf("New thread was passed arg address %p\n", arg);
- printf("New thread stack at %p\n", &i);
- return(NULL);
- PANIC("return");
-}
-
-int
-main()
-{
- pthread_t thread;
- int i;
-
- printf("Original thread stack at %p\n", &i);
- CHECKr(pthread_create(&thread, NULL, new_thread,
- (void *)0xdeadbeef));
- CHECKr(pthread_join(thread, NULL));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pthread_join/Makefile b/regress/lib/libc_r/pthread_join/Makefile
deleted file mode 100644
index 694f7d3efe4..00000000000
--- a/regress/lib/libc_r/pthread_join/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= pthread_join
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pthread_join/pthread_join.c b/regress/lib/libc_r/pthread_join/pthread_join.c
deleted file mode 100644
index 2bda5a4045b..00000000000
--- a/regress/lib/libc_r/pthread_join/pthread_join.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $OpenBSD: pthread_join.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_pthread_join.c =================================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_join(). Run this after test_create()
- *
- * 1.23 94/05/04 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-/* This thread yields so the creator has a live thread to wait on */
-void* new_thread_1(void * new_buf)
-{
- int i;
-
- sprintf((char *)new_buf, "New thread %%d stack at %p\n", &i);
- pthread_yield(); /* (ensure parent can wait on live thread) */
- sleep(1);
- return(new_buf);
- PANIC("return");
-}
-
-/* This thread doesn't yield so the creator has a dead thread to wait on */
-void* new_thread_2(void * new_buf)
-{
- int i;
-
- sprintf((char *)new_buf, "New thread %%d stack at %p\n", &i);
- return(new_buf);
- PANIC("return");
-}
-
-int
-main()
-{
- char buf[256], *status;
- pthread_t thread;
- int debug = 1;
- int i = 0;
-
- if (debug)
- printf("Original thread stack at %p\n", &i);
-
- CHECKr(pthread_create(&thread, NULL, new_thread_1, (void *)buf));
- CHECKr(pthread_join(thread, (void **)(&status)));
- if (debug)
- printf(status, ++i);
-
- /* Now have the created thread finishing before the join. */
- CHECKr(pthread_create(&thread, NULL, new_thread_2, (void *)buf));
- pthread_yield();
- sleep(1); /* (ensure thread is dead) */
- CHECKr(pthread_join(thread, (void **)(&status)));
-
- if (debug)
- printf(status, ++i);
-
- SUCCEED;
-}
-
diff --git a/regress/lib/libc_r/pthread_kill/Makefile b/regress/lib/libc_r/pthread_kill/Makefile
deleted file mode 100644
index 40a86c33909..00000000000
--- a/regress/lib/libc_r/pthread_kill/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/10/21 18:44:11 marc Exp $
-
-PROG= pthread_kill
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pthread_kill/pthread_kill.c b/regress/lib/libc_r/pthread_kill/pthread_kill.c
deleted file mode 100644
index b0457a2dfb1..00000000000
--- a/regress/lib/libc_r/pthread_kill/pthread_kill.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $OpenBSD: pthread_kill.c,v 1.2 2002/10/23 22:30:04 marc Exp $ */
-/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */
-
-/*
- * Verify that pthread_kill does the right thing, i.e. the signal
- * is delivered to the correct thread and proper signal processing
- * is performed.
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "test.h"
-
-void
-act_handler(int signal, siginfo_t *siginfo, void *context)
-{
- struct sigaction sa;
- char *str;
-
- CHECKe(sigaction(SIGUSR1, NULL, &sa));
- ASSERT(sa.sa_handler == SIG_DFL);
- ASSERT(siginfo != NULL);
- asprintf(&str, "act_handler: signal %d, siginfo %p, context %p\n",
- signal, siginfo, context);
- write(STDOUT_FILENO, str, strlen(str));
-}
-
-void *
-thread(void * arg)
-{
- sigset_t run_mask;
- sigset_t suspender_mask;
-
- /* wait for sigusr1 */
- SET_NAME(arg);
-
- /* Run with all signals blocked, then suspend for SIGUSR1 */
- sigfillset(&run_mask);
- CHECKe(sigprocmask(SIG_SETMASK, &run_mask, NULL));
- sigfillset(&suspender_mask);
- sigdelset(&suspender_mask, SIGUSR1);
- for (;;) {
- sigsuspend(&suspender_mask);
- ASSERT(errno == EINTR);
- printf("Thread %s woke up\n", (char*) arg);
- }
-
-}
-
-int
-main(int argc, char **argv)
-{
- pthread_t thread1;
- pthread_t thread2;
- struct sigaction act;
-
- act.sa_sigaction = act_handler;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO | SA_RESETHAND | SA_NODEFER;
- CHECKe(sigaction(SIGUSR1, &act, NULL));
- CHECKr(pthread_create(&thread1, NULL, thread, "T1"));
- CHECKr(pthread_create(&thread2, NULL, thread, "T2"));
- sleep(1);
-
- /* Signal handler should run once, both threads should awaken */
- CHECKe(kill(getpid(), SIGUSR1));
- sleep(1);
-
- /* Signal handler run once, only T1 should awaken */
- CHECKe(sigaction(SIGUSR1, &act, NULL));
- CHECKr(pthread_kill(thread1, SIGUSR1));
- sleep(1);
-
- /* Signal handler run once, only T2 should awaken */
- CHECKe(sigaction(SIGUSR1, &act, NULL));
- CHECKr(pthread_kill(thread2, SIGUSR1));
- sleep(1);
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pthread_mutex/Makefile b/regress/lib/libc_r/pthread_mutex/Makefile
deleted file mode 100644
index d2dc643d581..00000000000
--- a/regress/lib/libc_r/pthread_mutex/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= pthread_mutex
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pthread_mutex/pthread_mutex.c b/regress/lib/libc_r/pthread_mutex/pthread_mutex.c
deleted file mode 100644
index 311688d0259..00000000000
--- a/regress/lib/libc_r/pthread_mutex/pthread_mutex.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/* $OpenBSD: pthread_mutex.c,v 1.3 2001/11/03 04:33:48 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_pthread_cond.c =========================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_mutex(). Run this after test_create()
- *
- * 1.23 94/05/04 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-int contention_variable;
-
-void *
-thread_contention(arg)
- void *arg;
-{
- pthread_mutex_t *mutex = arg;
-
- SET_NAME("cntntn");
-
- CHECKr(pthread_mutex_lock(mutex));
- ASSERT(contention_variable == 1);
- contention_variable = 2;
- CHECKr(pthread_mutex_unlock(mutex));
- pthread_exit(NULL);
-}
-
-void
-test_contention_lock(mutex)
- pthread_mutex_t *mutex;
-{
- pthread_t thread;
-
- printf(" test_contention_lock()\n");
- CHECKr(pthread_mutex_lock(mutex));
- contention_variable = 0;
- CHECKr(pthread_create(&thread, NULL, thread_contention, mutex));
- pthread_yield();
- contention_variable = 1;
- CHECKr(pthread_mutex_unlock(mutex));
- CHECKr(pthread_mutex_lock(mutex));
- ASSERT(contention_variable == 2);
- CHECKr(pthread_mutex_unlock(mutex));
-}
-
-void
-test_nocontention_lock(mutex)
- pthread_mutex_t *mutex;
-{
- printf(" test_nocontention_lock()\n");
- CHECKr(pthread_mutex_lock(mutex));
- CHECKr(pthread_mutex_unlock(mutex));
-}
-
-void
-test_debug_double_lock(mutex)
- pthread_mutex_t *mutex;
-{
- printf(" test_debug_double_lock()\n");
- CHECKr(pthread_mutex_lock(mutex));
- ASSERTe(pthread_mutex_lock(mutex), == EDEADLK);
- CHECKr(pthread_mutex_unlock(mutex));
-}
-
-void
-test_debug_double_unlock(mutex)
- pthread_mutex_t *mutex;
-{
- printf(" test_debug_double_unlock()\n");
- CHECKr(pthread_mutex_lock(mutex));
- CHECKr(pthread_mutex_unlock(mutex));
- /* Posix D10 says undefined behaviour? */
- ASSERTe(pthread_mutex_unlock(mutex), != 0);
-}
-
-void
-test_nocontention_trylock(mutex)
- pthread_mutex_t *mutex;
-{
- printf(" test_nocontention_trylock()\n");
- CHECKr(pthread_mutex_trylock(mutex));
- CHECKr(pthread_mutex_unlock(mutex));
-}
-
-void
-test_mutex_static()
-{
- pthread_mutex_t mutex_static = PTHREAD_MUTEX_INITIALIZER;
-
- printf("test_mutex_static()\n");
- test_nocontention_lock(&mutex_static);
- test_contention_lock(&mutex_static);
-}
-
-void
-test_mutex_fast(void)
-{
- pthread_mutex_t mutex_fast;
-
- printf("test_mutex_fast()\n");
- CHECKr(pthread_mutex_init(&mutex_fast, NULL));
- test_nocontention_lock(&mutex_fast);
- test_contention_lock(&mutex_fast);
- CHECKr(pthread_mutex_destroy(&mutex_fast));
-}
-
-void
-test_mutex_debug()
-{
- pthread_mutexattr_t mutex_debug_attr;
- pthread_mutex_t mutex_debug;
-
- printf("test_mutex_debug()\n");
- CHECKr(pthread_mutexattr_init(&mutex_debug_attr));
- CHECKr(pthread_mutexattr_settype(&mutex_debug_attr,
- PTHREAD_MUTEX_ERRORCHECK));
- CHECKr(pthread_mutex_init(&mutex_debug, &mutex_debug_attr));
- test_nocontention_lock(&mutex_debug);
- test_contention_lock(&mutex_debug);
- test_debug_double_lock(&mutex_debug);
- test_debug_double_unlock(&mutex_debug);
- CHECKr(pthread_mutex_destroy(&mutex_debug));
-}
-
-void
-test_mutex_recursive()
-{
- pthread_mutexattr_t mutex_recursive_attr;
- pthread_mutex_t mutex_recursive;
- int i;
- int j = 9;
-
- printf("test_mutex_recursive()\n");
- CHECKr(pthread_mutexattr_init(&mutex_recursive_attr));
- CHECKr(pthread_mutexattr_settype(&mutex_recursive_attr,
- PTHREAD_MUTEX_RECURSIVE));
- CHECKr(pthread_mutex_init(&mutex_recursive, &mutex_recursive_attr));
-
- CHECKr(pthread_mutex_lock(&mutex_recursive));
- for (i = 0; i < j; i++)
- CHECKr(pthread_mutex_lock(&mutex_recursive));
- for (i = 0; i < j; i++)
- CHECKr(pthread_mutex_unlock(&mutex_recursive));
- CHECKr(pthread_mutex_unlock(&mutex_recursive));
- /* Posix D10 says undefined behaviour? */
- ASSERTe(pthread_mutex_unlock(&mutex_recursive), != 0);
- CHECKr(pthread_mutex_destroy(&mutex_recursive));
-}
-
-int
-main()
-{
- test_mutex_static();
- test_mutex_fast();
- test_mutex_debug();
- test_mutex_recursive();
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pthread_specific/Makefile b/regress/lib/libc_r/pthread_specific/Makefile
deleted file mode 100644
index 93bba05a419..00000000000
--- a/regress/lib/libc_r/pthread_specific/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/05/03 10:08:55 wcobb Exp $
-
-PROG= pthread_specific
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pthread_specific/pthread_specific.c b/regress/lib/libc_r/pthread_specific/pthread_specific.c
deleted file mode 100644
index 7c030bacabc..00000000000
--- a/regress/lib/libc_r/pthread_specific/pthread_specific.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* $OpenBSD: pthread_specific.c,v 1.2 2002/06/16 23:05:14 marc Exp $ */
-
-/*
- * Copyright (c) 2002 CubeSoft Communications, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Neither the name of CubeSoft Communications, nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
- * USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "test.h"
-
-#define NTHREADS 128
-
-pthread_key_t key;
-int destroy_run = 0;
-
-void *
-run_thread(void *arg)
-{
- int i;
-
- CHECKe(write(STDOUT_FILENO, ".", 1));
- for (i = 0; i < 32767; i++) {
- void *p;
-
- p = pthread_getspecific(key);
- if (p == NULL) {
- CHECKr(pthread_setspecific(key, pthread_self()));
- } else {
- ASSERT(p == pthread_self());
- }
- fflush(stderr);
- }
-
- return (NULL);
-}
-
-void
-destroy_key(void *keyp)
-{
- destroy_run++;
-}
-
-int
-main()
-{
- pthread_t threads[NTHREADS];
- int i;
-
- CHECKr(pthread_key_create(&key, destroy_key));
- for (i = 0; i < NTHREADS; i++) {
- CHECKr(pthread_create(&threads[i], NULL, run_thread, NULL));
- }
- for (i = 0; i < NTHREADS; i++) {
- CHECKr(pthread_join(threads[i], NULL));
- }
- CHECKe(write(STDOUT_FILENO, "\n", 1));
-
- CHECKr(pthread_key_delete(key));
-
- ASSERT(destroy_run > 0);
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/pw/Makefile b/regress/lib/libc_r/pw/Makefile
deleted file mode 100644
index 6cea3b688f3..00000000000
--- a/regress/lib/libc_r/pw/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= pw
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/pw/pw.c b/regress/lib/libc_r/pw/pw.c
deleted file mode 100644
index bc9ced3b0ce..00000000000
--- a/regress/lib/libc_r/pw/pw.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: pw.c,v 1.2 2002/06/23 03:11:09 deraadt Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pwd.h>
-#include "test.h"
-
-int
-main()
-{
- struct passwd *pw;
- struct passwd pwbuf;
- char buf[8192];
- char name[16];
-
- CHECKn(pw = getpwuid(getuid()));
- printf("getpwuid(%u) => %p\n", getuid(), pw);
- printf(" name: %s\n uid: %u\n gid: %u\n"
- "class: %s\ngecos: %s\n dir: %s\nshell: %s\n",
- pw->pw_name, pw->pw_uid, pw->pw_gid,
- pw->pw_class, pw->pw_gecos, pw->pw_dir, pw->pw_shell);
-
- strlcpy(name, pw->pw_name, sizeof name);
- CHECKe(getpwnam_r(name, &pwbuf, buf, sizeof buf, &pw));
- ASSERT(pwbuf.pw_uid == getuid());
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/readdir/Makefile b/regress/lib/libc_r/readdir/Makefile
deleted file mode 100644
index 6c4ea73bc67..00000000000
--- a/regress/lib/libc_r/readdir/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= readdir
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/readdir/readdir.c b/regress/lib/libc_r/readdir/readdir.c
deleted file mode 100644
index c3eea4d4379..00000000000
--- a/regress/lib/libc_r/readdir/readdir.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: readdir.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_readdir.c ========================================================
- * Copyright (c) 1993, 1994 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_create() and pthread_exit() calls.
- *
- * 1.00 94/05/19 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "test.h"
-
-int
-main()
-{
- struct dirent * file;
- DIR * dot_dir;
- int found = 0;
-
- CHECKn(dot_dir = opendir("."));
- while ((file = readdir(dot_dir)) != NULL)
- if (strcmp("readdir", file->d_name) == 0)
- found = 1;
- CHECKe(closedir(dot_dir));
- ASSERT(found);
- SUCCEED;
-}
-
diff --git a/regress/lib/libc_r/select/Makefile b/regress/lib/libc_r/select/Makefile
deleted file mode 100644
index 87a2da6e3d5..00000000000
--- a/regress/lib/libc_r/select/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= select
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/select/select.c b/regress/lib/libc_r/select/select.c
deleted file mode 100644
index e7ab6b86792..00000000000
--- a/regress/lib/libc_r/select/select.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $OpenBSD: select.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Rudimentary test of select().
- */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include <stdio.h>
-#include <sys/fcntl.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "test.h"
-
-#define NLOOPS 10000
-
-int ntouts = 0;
-
-void *
-bg_routine(arg)
- void *arg;
-{
- char dot = '.';
- int n;
-
- SET_NAME("bg");
-
- /* Busy loop, printing dots */
- for (;;) {
- pthread_yield();
- write(STDOUT_FILENO, &dot, sizeof dot);
- pthread_yield();
- n = NLOOPS;
- while (n-- > 0)
- pthread_yield();
- }
-}
-
-void *
-fg_routine(arg)
- void *arg;
-{
- int flags;
- int n;
- fd_set r;
- int fd = fileno((FILE *) arg);
- int tty = isatty(fd);
- int maxfd;
- int nb;
- char buf[128];
-
- SET_NAME("fg");
-
- /* Set the file descriptor to non-blocking */
- flags = fcntl(fd, F_GETFL);
- CHECKr(fcntl(fd, F_SETFL, flags | O_NONBLOCK));
-
- for (;;) {
-
- /* Print a prompt if it's a tty: */
- if (tty) {
- printf("type something> ");
- fflush(stdout);
- }
-
- /* Select on the fdesc: */
- FD_ZERO(&r);
- FD_SET(fd, &r);
- maxfd = fd;
- errno = 0;
- CHECKe(n = select(maxfd + 1, &r, (fd_set *) 0, (fd_set *) 0,
- (struct timeval *) 0));
-
- if (n > 0) {
- /* Something was ready for read. */
- printf("select returned %d\n", n);
- while ((nb = read(fd, buf, sizeof(buf) - 1)) > 0) {
- printf("read %d: `%.*s'\n", nb, nb, buf);
- }
- printf("last read was %d, errno = %d %s\n", nb, errno,
- errno == 0 ? "success" : strerror(errno));
- if (nb < 0)
- ASSERTe(errno, == EWOULDBLOCK ||
- errno == EAGAIN);
- if (nb == 0)
- break;
- } else
- ntouts++;
- }
- printf("read finished\n");
- return (NULL);
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- pthread_t bg_thread, fg_thread;
- FILE * slpr;
-
- /* Create a fdesc that will block for a while on read: */
- CHECKn(slpr = popen("sleep 2; echo foo", "r"));
-
- /* Create a busy loop thread that yields a lot: */
- CHECKr(pthread_create(&bg_thread, NULL, bg_routine, 0));
-
- /* Create the thread that reads the fdesc: */
- CHECKr(pthread_create(&fg_thread, NULL, fg_routine, (void *) slpr));
-
- /* Wait for the reader thread to finish */
- CHECKr(pthread_join(fg_thread, NULL));
-
- /* Clean up*/
- CHECKe(pclose(slpr));
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/setjmp/Makefile b/regress/lib/libc_r/setjmp/Makefile
deleted file mode 100644
index c3f0f635cca..00000000000
--- a/regress/lib/libc_r/setjmp/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:47 art Exp $
-
-PROG= setjmp
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/setjmp/setjmp.c b/regress/lib/libc_r/setjmp/setjmp.c
deleted file mode 100644
index fa3f4867b8e..00000000000
--- a/regress/lib/libc_r/setjmp/setjmp.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* $OpenBSD: setjmp.c,v 1.2 2001/09/20 16:43:15 todd Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <setjmp.h>
-#include <stdlib.h>
-#include "test.h"
-
-int reached;
-
-void *
-_jump(arg)
- void *arg;
-{
- jmp_buf foo;
-
- reached = 0;
- if (_setjmp(foo)) {
- ASSERT(reached);
- return NULL;
- }
- reached = 1;
- _longjmp(foo, 1);
- PANIC("_longjmp");
-}
-
-void *
-jump(arg)
- void *arg;
-{
- jmp_buf foo;
-
- reached = 0;
- if (setjmp(foo)) {
- ASSERT(reached);
- return NULL;
- }
- reached = 1;
- longjmp(foo, 1);
- PANIC("longjmp");
-}
-
-int
-main()
-{
- pthread_t child;
- void *res;
-
- printf("jumping in main thread\n");
- (void)jump(NULL);
- printf("_jumping in main thread\n");
- (void)_jump(NULL);
-
- printf("jumping in child thread\n");
- CHECKr(pthread_create(&child, NULL, jump, NULL));
- CHECKr(pthread_join(child, &res));
-
- printf("_jumping in child thread\n");
- CHECKr(pthread_create(&child, NULL, _jump, NULL));
- CHECKr(pthread_join(child, &res));
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/sigdeliver/Makefile b/regress/lib/libc_r/sigdeliver/Makefile
deleted file mode 100644
index f20b827cd8a..00000000000
--- a/regress/lib/libc_r/sigdeliver/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/10/12 03:37:45 marc Exp $
-
-PROG= sigdeliver
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/sigdeliver/sigdeliver.c b/regress/lib/libc_r/sigdeliver/sigdeliver.c
deleted file mode 100644
index b5cd76f875e..00000000000
--- a/regress/lib/libc_r/sigdeliver/sigdeliver.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $OpenBSD: sigdeliver.c,v 1.1 2002/10/12 03:39:21 marc Exp $ */
-/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */
-
-/*
- * test signal delivery of pending signals
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "test.h"
-
-static pthread_mutex_t sync_mutex;
-
-volatile sig_atomic_t got_signal;
-
-/*
- * sigusr1 signal handler.
- */
-static void
-sighandler(int signo)
-{
- got_signal += 1;
-}
-
-/*
- * Install a signal handler for sigusr1 and then wait for it to
- * occur.
- */
-static void *
-do_nothing (void *arg)
-{
- SET_NAME("nothing");
-
- ASSERT(signal(SIGUSR1, sighandler) != SIG_ERR);
- CHECKr(pthread_mutex_lock(&sync_mutex));
- ASSERT(got_signal != 0);
- CHECKr(pthread_mutex_unlock(&sync_mutex));
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- pthread_t pthread;
-
- /* Initialize and lock a mutex. */
- CHECKr(pthread_mutex_init(&sync_mutex, NULL));
- CHECKr(pthread_mutex_lock(&sync_mutex));
-
- /* start a thread that will wait on the mutex we now own */
- CHECKr(pthread_create(&pthread, NULL, do_nothing, NULL));
-
- /*
- * Give the thread time to run and install its signal handler.
- * The thread should be blocked waiting for the mutex we own.
- * Give it a signal and then release the mutex and see if the
- * signal is ever processed.
- */
- sleep(2);
- CHECKr(pthread_kill(pthread, SIGUSR1));
- CHECKr(pthread_mutex_unlock(&sync_mutex));
- CHECKr(pthread_join(pthread, NULL));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/siginfo/Makefile b/regress/lib/libc_r/siginfo/Makefile
deleted file mode 100644
index 421ddecdb53..00000000000
--- a/regress/lib/libc_r/siginfo/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/10/07 21:27:16 marc Exp $
-
-PROG= siginfo
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/siginfo/siginfo.c b/regress/lib/libc_r/siginfo/siginfo.c
deleted file mode 100644
index 03429b28c9b..00000000000
--- a/regress/lib/libc_r/siginfo/siginfo.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $OpenBSD: siginfo.c,v 1.8 2002/10/27 21:49:45 marc Exp $ */
-/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */
-
-/*
- * test SA_SIGINFO support. Also check that SA_RESETHAND does the right
- * thing.
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "test.h"
-
-#define BOGUS (char *)0x987230
-
-void
-act_handler(int signal, siginfo_t *siginfo, void *context)
-{
- struct sigaction sa;
- char * str;
-
- CHECKe(sigaction(SIGSEGV, NULL, &sa));
- ASSERT(sa.sa_handler == SIG_DFL);
- ASSERT(siginfo != NULL);
- asprintf(&str, "act_handler: signal %d, siginfo %p, context %p\n"
- "addr %p, code %d, trap %d\n", signal, siginfo, context,
- siginfo->si_addr, siginfo->si_code, siginfo->si_trapno);
- write(STDOUT_FILENO, str, strlen(str));
- ASSERT(siginfo->si_addr == BOGUS);
- ASSERT(siginfo->si_code != SI_USER);
- ASSERT(siginfo->si_code > 0 && siginfo->si_code <= NSIGSEGV);
- SUCCEED;
-}
-
-int
-main(int argc, char **argv)
-{
- struct sigaction act;
-
- act.sa_sigaction = act_handler;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO | SA_RESETHAND | SA_NODEFER;
- CHECKe(sigaction(SIGSEGV, &act, NULL));
- *BOGUS = 1;
- PANIC("How did we get here?");
-}
diff --git a/regress/lib/libc_r/signal/Makefile b/regress/lib/libc_r/signal/Makefile
deleted file mode 100644
index ae0e5be1f63..00000000000
--- a/regress/lib/libc_r/signal/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= signal
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/signal/signal.c b/regress/lib/libc_r/signal/signal.c
deleted file mode 100644
index 815052db03d..00000000000
--- a/regress/lib/libc_r/signal/signal.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $OpenBSD: signal.c,v 1.4 2002/06/16 23:06:15 marc Exp $ */
-/* David Leonard <d@openbsd.org>, 2001. Public Domain. */
-
-/*
- * This program tests signal handler re-entrancy.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include "test.h"
-
-volatile int alarmed;
-
-void *
-sleeper(arg)
- void *arg;
-{
- sigset_t mask;
-
- /* Ignore all signals in this thread */
- sigfillset(&mask);
- CHECKe(sigprocmask(SIG_SETMASK, &mask, NULL));
- ASSERT(sleep(3) == 0);
- CHECKe(write(STDOUT_FILENO, "\n", 1));
- SUCCEED;
-}
-
-void
-handler(sig)
- int sig;
-{
- int save_errno = errno;
-
- alarmed = 1;
- alarm(1);
- signal(SIGALRM, handler);
- errno = save_errno;
-}
-
-int
-main()
-{
- pthread_t slpr;
-
- ASSERT(signal(SIGALRM, handler) != SIG_ERR);
- CHECKe(alarm(1));
- CHECKr(pthread_create(&slpr, NULL, sleeper, NULL));
- /* ASSERT(sleep(1) == 0); */
- for (;;) {
- if (alarmed) {
- alarmed = 0;
- CHECKe(write(STDOUT_FILENO, "!", 1));
- }
- }
-}
diff --git a/regress/lib/libc_r/signodefer/Makefile b/regress/lib/libc_r/signodefer/Makefile
deleted file mode 100644
index 52c04c28cd2..00000000000
--- a/regress/lib/libc_r/signodefer/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/10/21 18:46:35 marc Exp $
-
-PROG= signodefer
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/signodefer/signodefer.c b/regress/lib/libc_r/signodefer/signodefer.c
deleted file mode 100644
index 211cc648ce0..00000000000
--- a/regress/lib/libc_r/signodefer/signodefer.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $OpenBSD: signodefer.c,v 1.2 2002/10/23 22:30:04 marc Exp $ */
-/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */
-
-/*
- * test signal delivery of active signals (SA_NODEFER)
- */
-
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "test.h"
-
-volatile sig_atomic_t sigactive;
-volatile sig_atomic_t sigcount;
-volatile sig_atomic_t was_active;
-
-void
-act_handler(int signal, siginfo_t *siginfo, void *context)
-{
- char *str;
-
- /* how many times has the handler been called */
- was_active += sigactive++;
- sigcount += 1;
-
- /* verify siginfo since we asked for it. */
- ASSERT(siginfo != NULL);
-
- asprintf(&str,
- "%sact_handler/%d, signal %d, siginfo %p, context %p\n",
- was_active ? "[recurse] " : "",
- sigcount, signal, siginfo, context);
- CHECKe(write(STDOUT_FILENO, str, strlen(str)));
- /* Odd times entered send ourself the same signal */
- if (sigcount & 1)
- CHECKe(kill(getpid(), SIGUSR1));
-
- sigactive = 0;
-}
-
-int
-main(int argc, char **argv)
-{
- struct sigaction act;
-
- act.sa_sigaction = act_handler;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_SIGINFO;
- ASSERT(sigaction(SIGUSR1, &act, NULL) == 0);
-
- /* see if the signal handler recurses */
- CHECKe(kill(getpid(), SIGUSR1));
- sleep(1);
- ASSERT(was_active == 0);
-
- /* allow recursive handlers, see that it is handled right */
- act.sa_flags |= SA_NODEFER;
- ASSERT(sigaction(SIGUSR1, &act, NULL) == 0);
-
- /* see if the signal handler recurses */
- CHECKe(kill(getpid(), SIGUSR1));
- sleep(1);
- ASSERT(was_active == 1);
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/sigsuspend/Makefile b/regress/lib/libc_r/sigsuspend/Makefile
deleted file mode 100644
index 6d1ff90bb31..00000000000
--- a/regress/lib/libc_r/sigsuspend/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= sigsuspend
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/sigsuspend/sigsuspend.c b/regress/lib/libc_r/sigsuspend/sigsuspend.c
deleted file mode 100644
index 25f22730ae2..00000000000
--- a/regress/lib/libc_r/sigsuspend/sigsuspend.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* $OpenBSD: sigsuspend.c,v 1.3 2002/10/21 18:58:57 marc Exp $ */
-/*
- * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Daniel M. Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL M. EISCHEN AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <pthread_np.h>
-#include "test.h"
-
-static int sigcounts[NSIG + 1];
-static int sigfifo[NSIG + 1];
-static int fifo_depth = 0;
-static sigset_t suspender_mask;
-static pthread_t suspender_tid;
-
-
-static void *
-sigsuspender (void *arg)
-{
- int save_count, status, i;
- sigset_t run_mask;
-
- SET_NAME("sigsuspender");
-
- /* Run with all signals blocked. */
- sigfillset (&run_mask);
- CHECKe(sigprocmask (SIG_SETMASK, &run_mask, NULL));
-
- /* Allow these signals to wake us up during a sigsuspend. */
- sigfillset (&suspender_mask); /* Default action */
- sigdelset (&suspender_mask, SIGINT); /* terminate */
- sigdelset (&suspender_mask, SIGHUP); /* terminate */
- sigdelset (&suspender_mask, SIGQUIT); /* create core image */
- sigdelset (&suspender_mask, SIGURG); /* ignore */
- sigdelset (&suspender_mask, SIGIO); /* ignore */
- sigdelset (&suspender_mask, SIGUSR2); /* terminate */
-
- while (sigcounts[SIGINT] == 0) {
- save_count = sigcounts[SIGUSR2];
-
- status = sigsuspend (&suspender_mask);
- if ((status == 0) || (errno != EINTR)) {
- DIE(errno, "Unable to suspend for signals, "
- "return value %d\n",
- status);
- }
- for (i = 0; i < fifo_depth; i++)
- printf ("Sigsuspend woke up by signal %d (%s)\n",
- sigfifo[i], strsignal(sigfifo[i]));
- fifo_depth = 0;
- }
-
- return (arg);
-}
-
-
-static void
-sighandler (int signo)
-{
- int save_errno = errno;
- char buf[8192];
- sigset_t set;
- pthread_t self;
-
- if ((signo >= 0) && (signo <= NSIG))
- sigcounts[signo]++;
-
- /*
- * If we are running on behalf of the suspender thread,
- * ensure that we have the correct mask set.
- */
- self = pthread_self ();
- if (self == suspender_tid) {
- sigfifo[fifo_depth] = signo;
- fifo_depth++;
- snprintf(buf, sizeof buf,
- " -> Suspender thread signal handler caught "
- "signal %d (%s)\n", signo, strsignal(signo));
- write(STDOUT_FILENO, buf, strlen(buf));
- sigprocmask (SIG_SETMASK, NULL, &set);
- ASSERT(set == suspender_mask);
- } else {
- snprintf(buf, sizeof buf,
- " -> Main thread signal handler caught "
- "signal %d (%s)\n", signo, strsignal(signo));
- write(STDOUT_FILENO, buf, strlen(buf));
- }
- errno = save_errno;
-}
-
-
-int main (int argc, char *argv[])
-{
- pthread_attr_t pattr;
- struct sigaction act;
- sigset_t oldset;
- sigset_t newset;
-
- /* Initialize our signal counts. */
- memset ((void *) sigcounts, 0, NSIG * sizeof (int));
-
- /* Ignore signal SIGIO. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGIO);
- act.sa_handler = SIG_IGN;
- act.sa_flags = 0;
- CHECKe(sigaction (SIGIO, &act, NULL));
-
- /* Install a signal handler for SIGURG. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGURG);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- CHECKe(sigaction (SIGURG, &act, NULL));
-
- /* Install a signal handler for SIGXCPU */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGXCPU);
- CHECKe(sigaction (SIGXCPU, &act, NULL));
-
- /* Get our current signal mask. */
- CHECKe(sigprocmask (SIG_SETMASK, NULL, &oldset));
-
- /* Mask out SIGUSR1 and SIGUSR2. */
- newset = oldset;
- sigaddset (&newset, SIGUSR1);
- sigaddset (&newset, SIGUSR2);
- CHECKe(sigprocmask (SIG_SETMASK, &newset, NULL));
-
- /* Install a signal handler for SIGUSR1 and SIGUSR2 */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGUSR1);
- sigaddset (&act.sa_mask, SIGUSR2);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- CHECKe(sigaction (SIGUSR1, &act, NULL));
- CHECKe(sigaction (SIGUSR2, &act, NULL));
-
- /*
- * Initialize the thread attribute.
- */
- CHECKr(pthread_attr_init (&pattr));
- CHECKr(pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE));
-
- /*
- * Create the sigsuspender thread.
- */
- CHECKr(pthread_create (&suspender_tid, &pattr, sigsuspender, NULL));
-
- /*
- * Verify that an ignored signal doesn't cause a wakeup.
- * We don't have a handler installed for SIGIO.
- */
- CHECKr(pthread_kill (suspender_tid, SIGIO));
- sleep (1);
- CHECKe(kill (getpid (), SIGIO));
- sleep (1);
- /* sigsuspend should not wake up for ignored signal SIGIO */
- ASSERT(sigcounts[SIGIO] == 0);
-
- /*
- * Verify that a signal with a default action of ignore, for
- * which we have a signal handler installed, will release a
- * sigsuspend.
- */
- CHECKr(pthread_kill (suspender_tid, SIGURG));
- sleep (1);
- CHECKe(kill (getpid (), SIGURG));
- sleep (1);
- /* sigsuspend should wake up for SIGURG */
- ASSERT(sigcounts[SIGURG] == 2);
-
- /*
- * Verify that a SIGUSR2 signal will release a sigsuspended
- * thread.
- */
- CHECKr(pthread_kill (suspender_tid, SIGUSR2));
- sleep (1);
- CHECKe(kill (getpid (), SIGUSR2));
- sleep (1);
- /* sigsuspend should wake yp for SIGUSR2 */
- ASSERT(sigcounts[SIGUSR2] == 2);
-
- /*
- * Verify that a signal, blocked in both the main and
- * sigsuspender threads, does not cause the signal handler
- * to be called.
- */
- CHECKr(pthread_kill (suspender_tid, SIGUSR1));
- sleep (1);
- CHECKe(kill (getpid (), SIGUSR1));
- sleep (1);
- /* signal handler should not be called for USR1 */
- ASSERT(sigcounts[SIGUSR1] == 0);
-#if 0
- /*
- * Verify that we can still kill the process for a signal
- * not being waited on by sigwait.
- */
- CHECKe(kill (getpid (), SIGPIPE));
- PANIC("SIGPIPE did not terminate process");
-
- /*
- * Wait for the thread to finish.
- */
- CHECKr(pthread_join (suspender_tid, NULL));
-#endif
- SUCCEED;
-}
-
diff --git a/regress/lib/libc_r/sigwait/Makefile b/regress/lib/libc_r/sigwait/Makefile
deleted file mode 100644
index 271d35b166c..00000000000
--- a/regress/lib/libc_r/sigwait/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= sigwait
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/sigwait/sigwait.c b/regress/lib/libc_r/sigwait/sigwait.c
deleted file mode 100644
index b83a3552c51..00000000000
--- a/regress/lib/libc_r/sigwait/sigwait.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* $OpenBSD: sigwait.c,v 1.3 2002/10/12 03:00:11 marc Exp $ */
-/*
- * Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Daniel M. Eischen.
- * 4. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY DANIEL M. EISCHEN AND CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <errno.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <pthread_np.h>
-#include "test.h"
-
-static int sigcounts[NSIG + 1];
-static sigset_t wait_mask;
-static pthread_mutex_t waiter_mutex;
-
-
-static void *
-sigwaiter (void *arg)
-{
- int signo;
-
- SET_NAME("sigwaiter");
-
- /* Block all of the signals that the function will wait for */
- CHECKe(sigprocmask (SIG_BLOCK, &wait_mask, NULL));
-
- while (sigcounts[SIGINT] == 0) {
- printf("Sigwait waiting (thread %p)\n", pthread_self());
- CHECKe(sigwait (&wait_mask, &signo));
- sigcounts[signo]++;
- printf ("Sigwait caught signal %d (%s)\n", signo,
- strsignal(signo));
-
- /* Allow the main thread to prevent the sigwait. */
- CHECKr(pthread_mutex_lock (&waiter_mutex));
- CHECKr(pthread_mutex_unlock (&waiter_mutex));
- }
-
- return (arg);
-}
-
-
-static void
-sighandler (int signo)
-{
- int save_errno = errno;
- char buf[8192];
-
- snprintf(buf, sizeof buf,
- " -> Signal handler caught signal %d (%s) in thread %p\n",
- signo, strsignal(signo), pthread_self());
- write(STDOUT_FILENO, buf, strlen(buf));
-
- if ((signo >= 0) && (signo <= NSIG))
- sigcounts[signo]++;
- errno = save_errno;
-}
-
-int main (int argc, char *argv[])
-{
- pthread_mutexattr_t mattr;
- pthread_attr_t pattr;
- pthread_t tid;
- struct sigaction act;
-
- /* Initialize our signal counts. */
- memset ((void *) sigcounts, 0, NSIG * sizeof (int));
-
- /* Setupt our wait mask. */
- sigemptyset (&wait_mask); /* Default action */
- sigaddset (&wait_mask, SIGHUP); /* terminate */
- sigaddset (&wait_mask, SIGINT); /* terminate */
- sigaddset (&wait_mask, SIGQUIT); /* create core image */
- sigaddset (&wait_mask, SIGURG); /* ignore */
- sigaddset (&wait_mask, SIGIO); /* ignore */
- sigaddset (&wait_mask, SIGUSR1); /* terminate */
-
- /* Ignore signals SIGHUP and SIGIO. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGHUP);
- sigaddset (&act.sa_mask, SIGIO);
- act.sa_handler = SIG_IGN;
- act.sa_flags = 0;
- CHECKe(sigaction (SIGHUP, &act, NULL));
- CHECKe(sigaction (SIGIO, &act, NULL));
-
- /* Install a signal handler for SIGURG */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGURG);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- CHECKe(sigaction (SIGURG, &act, NULL));
-
- /* Install a signal handler for SIGXCPU */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGXCPU);
- CHECKe(sigaction (SIGXCPU, &act, NULL));
-
- /*
- * Initialize the thread attribute.
- */
- CHECKr(pthread_attr_init (&pattr));
- CHECKr(pthread_attr_setdetachstate (&pattr, PTHREAD_CREATE_JOINABLE));
-
- /*
- * Initialize and create a mutex.
- */
- CHECKr(pthread_mutexattr_init (&mattr));
- CHECKr(pthread_mutex_init (&waiter_mutex, &mattr));
-
- /*
- * Create the sigwaiter thread.
- */
- CHECKr(pthread_create (&tid, &pattr, sigwaiter, NULL));
-
- /*
- * Verify that an ignored signal doesn't cause a wakeup.
- * We don't have a handler installed for SIGIO.
- */
- CHECKr(pthread_kill (tid, SIGIO));
- sleep (1);
- CHECKe(kill(getpid(), SIGIO));
- sleep (1);
- /* sigwait should not wake up for ignored signal SIGIO */
- ASSERT(sigcounts[SIGIO] == 0);
-
- /*
- * Verify that a signal with a default action of ignore, for
- * which we have a signal handler installed, will release a sigwait.
- */
- CHECKr(pthread_kill (tid, SIGURG));
- sleep (1);
- CHECKe(kill(getpid(), SIGURG));
- sleep (1);
- /* sigwait should wake up for SIGURG */
- ASSERT(sigcounts[SIGURG] == 2);
-
- /*
- * Verify that a signal with a default action that terminates
- * the process will release a sigwait.
- */
- CHECKr(pthread_kill (tid, SIGUSR1));
- sleep (1);
- CHECKe(kill(getpid(), SIGUSR1));
- sleep (1);
- if (sigcounts[SIGUSR1] != 2)
- printf ("FAIL: sigwait doesn't wake up for SIGUSR1.\n");
-
- /*
- * Verify that if we install a signal handler for a previously
- * ignored signal, an occurrence of this signal will release
- * the (already waiting) sigwait.
- */
-
- /* Install a signal handler for SIGHUP. */
- sigemptyset (&act.sa_mask);
- sigaddset (&act.sa_mask, SIGHUP);
- act.sa_handler = sighandler;
- act.sa_flags = SA_RESTART;
- CHECKe(sigaction (SIGHUP, &act, NULL));
-
- /* Sending SIGHUP should release the sigwait. */
- CHECKe(kill(getpid(), SIGHUP));
- sleep (1);
- CHECKr(pthread_kill (tid, SIGHUP));
- sleep (1);
- /* sigwait should wake up for SIGHUP */
- ASSERT(sigcounts[SIGHUP] == 2);
-
- /*
- * Verify that a pending signal in the waiters mask will
- * cause sigwait to return the pending signal. We do this
- * by taking the waiters mutex and signaling the waiter to
- * release him from the sigwait. The waiter will block
- * on taking the mutex, and we can then send the waiter a
- * signal which should be added to his pending signals.
- * The next time the waiter does a sigwait, he should
- * return with the pending signal.
- */
- sigcounts[SIGHUP] = 0;
- CHECKr(pthread_mutex_lock (&waiter_mutex));
- /* Release the waiter from sigwait. */
- CHECKe(kill(getpid(), SIGHUP));
- sleep (1);
- /* signal handler should wake up for SIGHUP */
- ASSERT(sigcounts[SIGHUP] == 1);
- /*
- * Add SIGHUP to all threads pending signals. Since there is
- * a signal handler installed for SIGHUP and this signal is
- * blocked from the waiter thread and unblocked in the main
- * thread, the signal handler should be called once for SIGHUP.
- */
- CHECKe(kill(getpid(), SIGHUP));
- /* Release the waiter thread and allow him to run. */
- CHECKr(pthread_mutex_unlock (&waiter_mutex));
- sleep (1);
- /*
- * sigwait should NOT return for pending SIGHUP. Nothing is pending
- * because the signal was processed by the SIGHUP signal handler.
- */
- ASSERT(sigcounts[SIGHUP] == 2);
-
- /*
- * Repeat the above test using pthread_kill and SIGUSR1
- */
- sigcounts[SIGUSR1] = 0;
- CHECKr(pthread_mutex_lock (&waiter_mutex));
- /* Release the waiter from sigwait. */
- CHECKr(pthread_kill (tid, SIGUSR1));
- sleep (1);
- /* sigwait should wake up for SIGUSR1 */
- ASSERT(sigcounts[SIGUSR1] == 1);
- /* Add SIGUSR1 to the waiters pending signals. */
- CHECKr(pthread_kill (tid, SIGUSR1));
- /* Release the waiter thread and allow him to run. */
- CHECKe(pthread_mutex_unlock (&waiter_mutex));
- sleep (1);
- /* sigwait should return for pending SIGUSR1 */
- ASSERT(sigcounts[SIGUSR1] == 2);
-
-#if 0
- /*
- * Verify that we can still kill the process for a signal
- * not being waited on by sigwait.
- */
- CHECKe(kill(getpid(), SIGPIPE));
- PANIC("SIGPIPE did not terminate process");
-
- /*
- * Wait for the thread to finish.
- */
- CHECKr(pthread_join (tid, NULL));
-#endif
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/sleep/Makefile b/regress/lib/libc_r/sleep/Makefile
deleted file mode 100644
index 26876e2b922..00000000000
--- a/regress/lib/libc_r/sleep/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= sleep
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/sleep/sleep.c b/regress/lib/libc_r/sleep/sleep.c
deleted file mode 100644
index e2da9992f7f..00000000000
--- a/regress/lib/libc_r/sleep/sleep.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* $OpenBSD: sleep.c,v 1.3 2002/06/16 23:06:28 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_sleep.c =========================================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test context switch functionality.
- *
- * 1.00 93/08/04 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "test.h"
-
-const char buf[] = "abcdefghijklimnopqrstuvwxyz";
-int fd = 1;
-
-void* new_thread(void* arg)
-{
- int i;
-
- for (i = 0; i < 10; i++) {
- write(fd, buf + (long) arg, 1);
- sleep(1);
- }
- return NULL;
-}
-
-int
-main()
-{
- pthread_t thread[2];
- int count = sizeof thread/sizeof thread[0];
- long i;
-
- printf("Going to sleep\n");
- sleep(3);
- printf("Done sleeping\n");
-
- for(i = 0; i < count; i++)
- CHECKr(pthread_create(&thread[i], NULL, new_thread,
- (void *) i));
-
- for (i = 0; i < count; i++)
- CHECKr(pthread_join(thread[i], NULL));
-
- CHECKe(write(STDOUT_FILENO, "\n", 1));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/socket/1/Makefile b/regress/lib/libc_r/socket/1/Makefile
deleted file mode 100644
index d523ed1e2a3..00000000000
--- a/regress/lib/libc_r/socket/1/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= socket1
-CFLAGS+= -I${.CURDIR}/../../include
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/socket/1/socket1.c b/regress/lib/libc_r/socket/1/socket1.c
deleted file mode 100644
index ee41bf1db48..00000000000
--- a/regress/lib/libc_r/socket/1/socket1.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* $OpenBSD: socket1.c,v 1.1 2001/08/15 14:37:10 fgsch Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_sock_1.c =========================================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_create() and pthread_exit() calls.
- *
- * 1.00 93/08/03 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include "test.h"
-#include <sched.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct sockaddr_in a_sout;
-int success = 0;
-pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_attr_t attr;
-
-static int counter = 0;
-
-void *
-sock_connect(arg)
- void *arg;
-{
- char buf[1024];
- int fd;
-
- /* Ensure sock_read runs first */
- CHECKr(pthread_mutex_lock(&mutex));
-
- a_sout.sin_addr.s_addr = htonl(0x7f000001); /* loopback */
- CHECKe(fd = socket(AF_INET, SOCK_STREAM, 0));
-
- ASSERT(++counter == 2);
-
- /* connect to the socket */
- CHECKe(connect(fd, (struct sockaddr *) &a_sout, sizeof(a_sout)));
- CHECKe(close(fd));
-
- CHECKr(pthread_mutex_unlock(&mutex));
-
- CHECKe(fd = socket(AF_INET, SOCK_STREAM, 0));
- ASSERT(++counter == 3);
- CHECKe(connect(fd, (struct sockaddr *) &a_sout, sizeof(a_sout)));
-
- /* Ensure sock_read runs again */
- pthread_yield();
- sleep(1);
-
- CHECKr(pthread_mutex_lock(&mutex));
- CHECKe(read(fd, buf, 1024));
-
- write(fd, "6", 1);
-
- ASSERT(++counter == atoi(buf));
- CHECKe(close(fd));
- success++;
- CHECKr(pthread_mutex_unlock(&mutex));
-
- return(NULL);
-}
-
-void *
-sock_write(arg)
- void *arg;
-{
- int fd = *(int *)arg;
-
- CHECKe(write(fd, "5", 1));
- return(NULL);
-}
-
-void *
-sock_accept(arg)
- void *arg;
-{
- pthread_t thread;
- struct sockaddr a_sin;
- int a_sin_size, a_fd, fd;
- short port;
- char buf[1024];
-
- port = 3276;
- a_sout.sin_family = AF_INET;
- a_sout.sin_port = htons(port);
- a_sout.sin_addr.s_addr = INADDR_ANY;
-
- CHECKe(a_fd = socket(AF_INET, SOCK_STREAM, 0));
-
- while (1) {
- if(0 == bind(a_fd, (struct sockaddr *) &a_sout, sizeof(a_sout)))
- break;
- if (errno == EADDRINUSE) {
- a_sout.sin_port = htons((++port));
- continue;
- }
- DIE(errno, "bind");
- }
- CHECKe(listen(a_fd, 2));
-
- ASSERT(++counter == 1);
-
- CHECKr(pthread_create(&thread, &attr, sock_connect,
- (void *)0xdeadbeaf));
-
- a_sin_size = sizeof(a_sin);
- CHECKe(fd = accept(a_fd, &a_sin, &a_sin_size));
- CHECKr(pthread_mutex_lock(&mutex));
- CHECKe(close(fd));
-
- ASSERT(++counter == 4);
-
- a_sin_size = sizeof(a_sin);
- CHECKe(fd = accept(a_fd, &a_sin, &a_sin_size));
- CHECKr(pthread_mutex_unlock(&mutex));
-
- /* Setup a write thread */
- CHECKr(pthread_create(&thread, &attr, sock_write, &fd));
- CHECKe(read(fd, buf, 1024));
-
- ASSERT(++counter == atoi(buf));
-
- CHECKe(close(fd));
-
- CHECKr(pthread_mutex_lock(&mutex));
- success++;
- CHECKr(pthread_mutex_unlock(&mutex));
-
- CHECKr(pthread_join(thread, NULL));
- return(NULL);
-}
-
-int
-main()
-{
- pthread_t thread;
-
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-
- CHECKr(pthread_attr_init(&attr));
-#if 0
- CHECKr(pthread_attr_setschedpolicy(&attr, SCHED_FIFO));
-#endif
- CHECKr(pthread_create(&thread, &attr, sock_accept,
- (void *)0xdeadbeaf));
-
- CHECKr(pthread_join(thread, NULL));
-
- ASSERT(success == 2);
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/socket/2/Makefile b/regress/lib/libc_r/socket/2/Makefile
deleted file mode 100644
index 9fc7ca397ea..00000000000
--- a/regress/lib/libc_r/socket/2/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= socket2
-CFLAGS+= -I${.CURDIR}/../../include
-CLEANFILES+= socket2a
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/socket/2/socket2.c b/regress/lib/libc_r/socket/2/socket2.c
deleted file mode 100644
index 7ba7d19df7d..00000000000
--- a/regress/lib/libc_r/socket/2/socket2.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $OpenBSD: socket2.c,v 1.3 2002/01/02 16:15:32 fgsch Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_sock_1.c =========================================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_create() and pthread_exit() calls.
- *
- * 1.00 93/08/03 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <pthread_np.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include "test.h"
-
-struct sockaddr_in a_sout;
-
-#define MESSAGE5 "This should be message #5"
-#define MESSAGE6 "This should be message #6"
-
-void *
-sock_write(arg)
- void *arg;
-{
- int fd = *(int *)arg;
-
- SET_NAME("writer");
- CHECKe(write(fd, MESSAGE5, sizeof(MESSAGE5)));
- return(NULL);
-}
-
-static pthread_mutex_t waiter_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-void*
-waiter(sig)
-{
- int status;
- pid_t pid;
-
- SET_NAME("waiter");
- CHECKr(pthread_mutex_lock(&waiter_mutex));
- printf("waiting for child\n");
- CHECKe(pid = wait(&status));
- ASSERT(WIFEXITED(status));
- ASSERT(WEXITSTATUS(status) == 0);
- printf("child exited\n");
- CHECKr(pthread_mutex_unlock(&waiter_mutex));
- return (NULL);
-}
-
-void *
-sock_accept(arg)
- void *arg;
-{
- pthread_t thread, wthread;
- struct sockaddr a_sin;
- int a_sin_size, a_fd, fd;
- u_int16_t port;
- char buf[1024];
- pid_t pid;
-
- port = 3276;
- a_sout.sin_family = AF_INET;
- a_sout.sin_port = htons(port);
- a_sout.sin_addr.s_addr = INADDR_ANY;
-
- CHECKe(a_fd = socket(AF_INET, SOCK_STREAM, 0));
-
- while(1) {
- if (bind(a_fd, (struct sockaddr *)&a_sout, sizeof(a_sout))==0)
- break;
- if (errno == EADDRINUSE) {
- a_sout.sin_port = htons((++port));
- continue;
- }
- DIE(errno, "bind");
- }
-
- printf("listening on port %d\n", port);
-
- CHECKe(listen(a_fd, 2));
-
- printf("%d: This should be message #1\n", getpid());
-
- CHECKr(pthread_mutex_init(&waiter_mutex, NULL));
- CHECKr(pthread_mutex_lock(&waiter_mutex));
- CHECKr(pthread_create(&wthread, NULL, waiter, NULL));
-
- sprintf(buf, "%d", port);
-
- CHECKe(pid = fork());
- switch(pid) {
- case 0:
- execl("socket2a", "socket2a", "fork okay", buf, (char *)NULL);
- DIE(errno, "execl");
- default:
- break;
- }
- CHECKr(pthread_mutex_unlock(&waiter_mutex));
- pthread_yield();
-
- a_sin_size = sizeof(a_sin);
- CHECKe(fd = accept(a_fd, &a_sin, &a_sin_size));
- CHECKe(close(fd));
-
- sleep(1);
-
- printf("%d: This should be message #4\n", getpid());
-
- a_sin_size = sizeof(a_sin);
- memset(&a_sin, 0, sizeof(a_sin));
- CHECKe(fd = accept(a_fd, &a_sin, &a_sin_size));
-
- /* Setup a write thread */
-
- CHECKr(pthread_create(&thread, NULL, sock_write, &fd));
- CHECKe(read(fd, buf, 1024));
-
- printf("%d: %s\n", getpid(), buf); /* message 6 */
-
- CHECKe(close(fd));
-
- if (pthread_mutex_trylock(&waiter_mutex) == EBUSY) {
- sleep(2);
- if (pthread_mutex_trylock(&waiter_mutex) == EBUSY) {
- /* forcibly kill child */
- CHECKe(kill(pid, SIGKILL));
- PANIC("child %d took too long to exit", pid);
- }
- }
- CHECKr(pthread_join(wthread, NULL));
-
- return(NULL);
-}
-
-int
-main()
-{
- pthread_t thread;
-
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-
- CHECKr(pthread_create(&thread, NULL, sock_accept,
- (void *)0xdeadbeaf));
-
- CHECKr(pthread_join(thread, NULL));
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/socket/2a/Makefile b/regress/lib/libc_r/socket/2a/Makefile
deleted file mode 100644
index 10dda960750..00000000000
--- a/regress/lib/libc_r/socket/2a/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# $OpenBSD: Makefile,v 1.5 2002/10/09 20:09:15 marc Exp $
-
-PROG= socket2a
-CFLAGS+= -I${.CURDIR}/../../include
-
-REGRESS_TARGETS=dummy
-
-# build prog and link into test 2 directory. Code is used by test 2
-#
-dummy: ${PROG}
- @cd ${.CURDIR}/../2; \
- if test -d ${__objdir} ; then \
- cd ${__objdir} ; \
- fi; \
- ln -sf ${.OBJDIR}/${PROG}
- @echo ${PROG} ready
-
-.include <bsd.regress.mk>
-
diff --git a/regress/lib/libc_r/socket/2a/socket2a.c b/regress/lib/libc_r/socket/2a/socket2a.c
deleted file mode 100644
index 67b8a07c4fb..00000000000
--- a/regress/lib/libc_r/socket/2a/socket2a.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $OpenBSD: socket2a.c,v 1.3 2002/01/02 16:15:32 fgsch Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_sock_1.c =========================================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test pthread_create() and pthread_exit() calls.
- *
- * 1.00 93/08/03 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include "test.h"
-
-struct sockaddr_in a_sout;
-
-#define MESSAGE5 "This should be message #5"
-#define MESSAGE6 "This should be message #6"
-
-void *
-sock_connect(arg)
- void *arg;
-{
- char buf[1024];
- int fd;
- short port;
-
- port = atoi(arg);
- a_sout.sin_family = AF_INET;
- a_sout.sin_port = htons(port);
- a_sout.sin_addr.s_addr = htonl(INADDR_LOOPBACK); /* loopback */
-
- CHECKe(fd = socket(AF_INET, SOCK_STREAM, 0));
-
- printf("%d: This should be message #2\n", getpid());
-
- CHECKe(connect(fd, (struct sockaddr *) &a_sout, sizeof(a_sout)));
- CHECKe(close(fd));
-
- CHECKe(fd = socket(AF_INET, SOCK_STREAM, 0));
-
- printf("%d: This should be message #3\n", getpid());
-
- CHECKe(connect(fd, (struct sockaddr *) &a_sout, sizeof(a_sout)));
-
- /* Ensure sock_read runs again */
-
- CHECKe(read(fd, buf, 1024));
- CHECKe(write(fd, MESSAGE6, sizeof(MESSAGE6)));
-
- printf("%d: %s\n", getpid(), buf);
-
- CHECKe(close(fd));
- return (NULL);
-}
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- pthread_t thread;
-
- if (argc == 3 && (!strcmp(argv[1], "fork okay"))) {
- sleep(1);
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
-
- CHECKr(pthread_create(&thread, NULL, sock_connect,
- (void *)argv[2]));
- CHECKr(pthread_join(thread, NULL));
- SUCCEED;
- } else {
- fprintf(stderr, "test_sock_2a needs to be exec'ed from "
- "test_sock_2.\n");
- fprintf(stderr, "It is not a stand alone test.\n");
- PANIC("usage");
- }
-}
diff --git a/regress/lib/libc_r/socket/3/Makefile b/regress/lib/libc_r/socket/3/Makefile
deleted file mode 100644
index a958deccdec..00000000000
--- a/regress/lib/libc_r/socket/3/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# $OpenBSD: Makefile,v 1.1 2002/10/10 00:45:20 marc Exp $
-
-PROG= socket3
-CFLAGS+= -I${.CURDIR}/../../include
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/socket/3/socket3.c b/regress/lib/libc_r/socket/3/socket3.c
deleted file mode 100644
index 5f17bf9571c..00000000000
--- a/regress/lib/libc_r/socket/3/socket3.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* $OpenBSD: socket3.c,v 1.2 2002/10/12 19:02:51 marc Exp $ */
-/* PUBLIC DOMAIN Oct 2002 <marc@snafu.org> */
-
-/* Test blocking/non-blocking mode inheritance on accept */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <fcntl.h>
-#include <poll.h>
-#include <pthread.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "test.h"
-
-/*
- * connect to the test port passed in arg, then close the connection
- * and return.
- */
-void *
-sock_connect(void *arg)
-{
- struct sockaddr_in sin;
- int port;
- int sock;
-
- SET_NAME("connect");
- port = (int)arg;
- CHECKe(sock = socket(AF_INET, SOCK_STREAM, 0));
- sin.sin_family = AF_INET;
- sin.sin_port = htons(port);
- sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- CHECKe(connect(sock, (struct sockaddr *)&sin, sizeof sin));
- CHECKe(close(sock));
- return NULL;
-}
-
-/*
- * listen for a connection, accept it using a non-blocking socket, and
- * verify that the blocking mode of the socket returned from accept is
- * also non-blocking
- */
-void *
-sock_accept(void *arg)
-{
- pthread_t connect_thread;
- struct pollfd fds;
- struct sockaddr_in sa;
- struct sockaddr accept_sa;
- int accept_fd;
- int accept_sa_size;
- int flags;
- int listen_fd;
- int port;
-
- SET_NAME("accept");
-
- /* listen for a connection */
-
- port = 6543;
- memset(&sa, 0, sizeof sa);
- sa.sin_family = AF_INET;
- sa.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- sa.sin_port = htons(port);
- CHECKe(listen_fd = socket(AF_INET, SOCK_STREAM, 0));
- printf("listen_fd = %d\n", listen_fd);
- while (1) {
- if (bind(listen_fd, (struct sockaddr *)&sa, sizeof(sa)) == 0)
- break;
- if (errno == EADDRINUSE) {
- sa.sin_port = htons(++port);
- continue;
- }
- DIE(errno, "bind");
- }
- CHECKe(listen(listen_fd, 2));
-
- /* Create another thread to connect to the listening socket. */
- CHECKr(pthread_create(&connect_thread, NULL, sock_connect,
- (void*)port));
-
- /*
- * Use poll to check for a pending connection as the socket
- * passed to accept will be in non-blocking mode.
- */
- fds.fd = listen_fd;
- fds.events = POLLIN;
- CHECKe(poll(&fds, 1, INFTIM));
-
- /*
- * set non blocking mode on the listening socket and close stdin
- * (fd 0) so the accept will use fd 0 (needed to test boundary
- * condition in the pthread accept code).
- */
- flags = fcntl(listen_fd, F_GETFL);
- CHECKr(fcntl(listen_fd, F_SETFL, flags |= O_NONBLOCK));
- CHECKe(close(STDIN_FILENO));
- accept_sa_size = sizeof accept_sa;
- CHECKe(accept_fd = accept(listen_fd, &accept_sa, &accept_sa_size));
- /* verify O_NONBLOCK on the accepted fd */
- flags = fcntl(accept_fd, F_GETFL);
- printf("accept_fd = %d, flags = %x\n", accept_fd, flags);
- ASSERT(flags & O_NONBLOCK);
- CHECKe(close(listen_fd));
- CHECKe(close(accept_fd));
- CHECKr(pthread_join(connect_thread, NULL));
- return NULL;
-}
-
-int
-main(int argc, char * argv[])
-{
- pthread_t accept_thread;
-
- CHECKr(pthread_create(&accept_thread, NULL, sock_accept, NULL));
- CHECKr(pthread_join(accept_thread, NULL));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/socket/Makefile b/regress/lib/libc_r/socket/Makefile
deleted file mode 100644
index 5b242a0faaf..00000000000
--- a/regress/lib/libc_r/socket/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2002/10/10 00:45:20 marc Exp $
-
-SUBDIR= 1 2a 2 3
-
-.include <bsd.subdir.mk>
diff --git a/regress/lib/libc_r/socket/Makefile.inc b/regress/lib/libc_r/socket/Makefile.inc
deleted file mode 100644
index 051138b01c5..00000000000
--- a/regress/lib/libc_r/socket/Makefile.inc
+++ /dev/null
@@ -1,3 +0,0 @@
-# $OpenBSD: Makefile.inc,v 1.1 2001/08/15 14:37:10 fgsch Exp $
-
-.include "${.CURDIR}/../../Makefile.inc"
diff --git a/regress/lib/libc_r/stdarg/Makefile b/regress/lib/libc_r/stdarg/Makefile
deleted file mode 100644
index 42769f3d63a..00000000000
--- a/regress/lib/libc_r/stdarg/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2002/09/02 20:01:43 avsm Exp $
-
-PROG= stdarg
-
-CFLAGS+= -I${.CURDIR}/../include
-
-REGRESS_MAXTIME= 10
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/stdarg/stdarg.c b/regress/lib/libc_r/stdarg/stdarg.c
deleted file mode 100644
index 3d677db3715..00000000000
--- a/regress/lib/libc_r/stdarg/stdarg.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* $OpenBSD: stdarg.c,v 1.4 2001/12/12 21:18:34 fgsch Exp $ */
-/* David Leonard <d@openbsd.org>, 2001. Public Domain. */
-
-/*
- * Test <stdarg.h>
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include "test.h"
-
-#define EQ(v,exp) _CHECK(v, == exp, NULL)
-
-int thing;
-
-int
-test1(char *fmt, ...)
-{
- va_list ap;
-
- char ch;
- int i;
- int c;
- long l;
- void *p;
- char *ofmt = fmt;
-
- va_start(ap, fmt);
- for (; *fmt; fmt++)
- switch ((ch =*fmt)) {
- case 'i':
- i = va_arg(ap, int);
- EQ(i, 1234);
- break;
- case 'c':
- c = va_arg(ap, int);
- EQ(c, 'x');
- break;
- case 'l':
- l = va_arg(ap, long);
- EQ(l, 123456789L);
- break;
- case 'p':
- p = va_arg(ap, void *);
- EQ(p, &thing);
- break;
- default:
- fprintf(stderr,
- "unexpected character 0x%02x `%c' in %s(%p) at %p\n",
- ch, ch, ofmt, ofmt, fmt);
- ASSERT(0);
- }
- va_end(ap);
- return 9;
-}
-
-void *
-run_test(arg)
- void *arg;
-{
- char *msg = (char *)arg;
- int i;
-
- SET_NAME(msg);
-
- puts(msg);
- for (i = 0; i < 1000000; i++) {
- ASSERT(test1("iclp", 1234, 'x', 123456789L, &thing) == 9);
- }
- printf("ok\n");
- return NULL;
-}
-
-int
-main()
-{
- pthread_t t1, t2;
-
- printf("trying loop in single-threaded mode:\n");
- run_test("main");
- printf("now running loop with 2 threads:\n");
- CHECKr(pthread_create(&t1, NULL, run_test, "child 1"));
- CHECKr(pthread_create(&t2, NULL, run_test, "child 2"));
- CHECKr(pthread_join(t1, NULL));
- CHECKr(pthread_join(t2, NULL));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/stdio/Makefile b/regress/lib/libc_r/stdio/Makefile
deleted file mode 100644
index bd02972816e..00000000000
--- a/regress/lib/libc_r/stdio/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= stdio
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/stdio/stdio.c b/regress/lib/libc_r/stdio/stdio.c
deleted file mode 100644
index 9f3246d516b..00000000000
--- a/regress/lib/libc_r/stdio/stdio.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* $OpenBSD: stdio.c,v 1.1 2001/08/15 14:37:16 fgsch Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "test.h"
-
-char * base_name = "stdio.c";
-char * dir_name = SRCDIR;
-char * fullname;
-
-/* Test fopen()/ftell()/getc() */
-void
-test_1()
-{
- struct stat statbuf;
- FILE * fp;
- int i;
-
- CHECKe(stat(fullname, &statbuf));
-
- CHECKn((fp = fopen(fullname, "r")));
-
- /* Get the entire file */
- while ((i = getc(fp)) != EOF)
- ;
-
- ASSERT(ftell(fp) == statbuf.st_size);
-
- CHECKe(fclose(fp));
-}
-
-/* Test fopen()/fclose() */
-void
-test_2()
-{
- FILE *fp1, *fp2;
-
- CHECKn(fp1 = fopen(fullname, "r"));
- CHECKe(fclose(fp1));
-
- CHECKn(fp2 = fopen(fullname, "r"));
- CHECKe(fclose(fp2));
-
- ASSERT(fp1 == fp2);
-}
-
-/* Test sscanf()/sprintf() */
-void
-test_3(void)
-{
- char * str = "10 4.53";
- char buf[64];
- double d;
- int i;
-
- ASSERT(sscanf(str, "%d %lf", &i, &d) == 2);
-
- /* Should have a check */
- sprintf(buf, "%d %2.2f", i, d);
- ASSERT(strcmp(buf, str) == 0);
-}
-
-int
-main()
-{
-
- CHECKn(fullname = malloc (strlen (dir_name) + strlen (base_name) + 2));
- sprintf (fullname, "%s/%s", dir_name, base_name);
-
- test_1();
- test_2();
- test_3();
-
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/switch/Makefile b/regress/lib/libc_r/switch/Makefile
deleted file mode 100644
index e15cfa97be8..00000000000
--- a/regress/lib/libc_r/switch/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= switch
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/switch/switch.c b/regress/lib/libc_r/switch/switch.c
deleted file mode 100644
index 1d150a461af..00000000000
--- a/regress/lib/libc_r/switch/switch.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* $OpenBSD: switch.c,v 1.3 2002/10/12 18:59:13 marc Exp $ */
-/*
- * Copyright (c) 1993, 1994, 1995, 1996 by Chris Provenzano and contributors,
- * proven@mit.edu All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Chris Provenzano,
- * the University of California, Berkeley, and contributors.
- * 4. Neither the name of Chris Provenzano, the University, nor the names of
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO, THE REGENTS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* ==== test_switch.c ========================================================
- * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
- *
- * Description : Test context switch functionality.
- *
- * 1.00 93/08/04 proven
- * -Started coding this file.
- */
-
-#include <pthread.h>
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include "test.h"
-
-const char buf[] = "abcdefghijklmnopqrstuvwxyz";
-char x[sizeof(buf)];
-int fd = 1;
-
-volatile int ending = 0;
-
-/* ==========================================================================
- * usage();
- */
-void usage(void)
-{
- extern char *__progname;
- printf("usage: %s [-?] [-c count]\n", __progname);
- printf("count must be between 2 and 26\n");
- errno = 0;
-}
-
-void *
-new_thread(arg)
- void *arg;
-{
- int i;
-
- SET_NAME("writer");
- while (!ending) {
- CHECKe(write (fd, (char *) arg, 1));
- x[(char *)arg - buf] = 1;
- for (i = 0; i < 999999; i += 1)
- ;
- }
- return NULL;
-}
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- pthread_t thread;
- int count = 4;
- int eof = 0;
- long i;
-
- /* Getopt variables. */
- extern int optind, opterr;
- extern char *optarg;
-
- while (!eof)
- switch (getopt (argc, argv, "c:d?"))
- {
- case EOF:
- eof = 1;
- break;
- case 'c':
- count = atoi(optarg);
- if ((count > 26) || (count < 2)) {
- count = 2;
- }
- break;
- case '?':
- usage();
- return(OK);
- default:
- usage();
- return(NOTOK);
- }
-
- /* create the threads */
- for (i = 0; i < count; i++)
- CHECKr(pthread_create(&thread, NULL, new_thread,
- (void*)(buf+i)));
-
- /* give all threads a chance to run */
- sleep (2);
-
- ending = 1;
- for (i = 0; i < count; i++)
- ASSERT(x[i]); /* make sure each thread ran */
-
- CHECKe(write(STDOUT_FILENO, "\n", 1));
- SUCCEED;
-}
diff --git a/regress/lib/libc_r/system/Makefile b/regress/lib/libc_r/system/Makefile
deleted file mode 100644
index f2d82ee8005..00000000000
--- a/regress/lib/libc_r/system/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2002/01/03 00:43:48 art Exp $
-
-PROG= system
-
-.include <bsd.regress.mk>
diff --git a/regress/lib/libc_r/system/system.c b/regress/lib/libc_r/system/system.c
deleted file mode 100644
index cf9a8defac6..00000000000
--- a/regress/lib/libc_r/system/system.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $OpenBSD: system.c,v 1.2 2001/11/11 19:57:43 marc Exp $ */
-/*
- * Placed in the PUBLIC DOMAIN
- */
-
-/*
- * system checks the threads system interface and that waitpid/wait4
- * works correctly.
- */
-
-#include <stdlib.h>
-#include "test.h"
-
-int
-main(int argc, char **argv)
-{
- ASSERT(system("ls") == 0);
- SUCCEED;
-}