diff options
author | Peter Galbavy <peter@cvs.openbsd.org> | 1998-07-22 10:46:59 +0000 |
---|---|---|
committer | Peter Galbavy <peter@cvs.openbsd.org> | 1998-07-22 10:46:59 +0000 |
commit | 1dfa52bc2a08fd6abce250b86ed676ed75e7f9a7 (patch) | |
tree | 552e94cccaeaddcf88e37c344c473b6fe12596fa /lib/libpthread | |
parent | 55fc30f96bf26fbc4ef03930e5ba827c3304c58a (diff) |
o removed more unused or old, left over files
o general changes so that now the library compiles and many of the
tests run correctly
o pthreads/Makefile.inc rebuilt using libc/sys/Makefile.inc as a template.
this should be kept in sync in case of new syscalls
soon TODO:
figure out why remaining tests fail and fix
look at building .so version of library
tidy up arch/i386 directory - no longer uses syscall-template.S
port other arch's from libc syscall templates
Diffstat (limited to 'lib/libpthread')
-rw-r--r-- | lib/libpthread/Makefile | 2 | ||||
-rw-r--r-- | lib/libpthread/arch/i386/syscall.S | 11 | ||||
-rw-r--r-- | lib/libpthread/include/cond.h | 91 | ||||
-rw-r--r-- | lib/libpthread/include/engine.h | 86 | ||||
-rw-r--r-- | lib/libpthread/include/fd.h | 106 | ||||
-rw-r--r-- | lib/libpthread/include/fd_pipe.h | 54 | ||||
-rw-r--r-- | lib/libpthread/include/kernel.h | 50 | ||||
-rw-r--r-- | lib/libpthread/include/mutex.h | 93 | ||||
-rw-r--r-- | lib/libpthread/include/posix.h | 21 | ||||
-rw-r--r-- | lib/libpthread/include/pthread_attr.h | 73 | ||||
-rw-r--r-- | lib/libpthread/include/pthread_once.h | 53 | ||||
-rw-r--r-- | lib/libpthread/include/queue.h | 67 | ||||
-rw-r--r-- | lib/libpthread/include/util.h | 89 | ||||
-rw-r--r-- | lib/libpthread/pthreads/Makefile.inc | 133 | ||||
-rw-r--r-- | lib/libpthread/pthreads/fd_kern.c | 78 | ||||
-rw-r--r-- | lib/libpthread/pthreads/readv.c | 85 | ||||
-rw-r--r-- | lib/libpthread/pthreads/signal.c | 12 | ||||
-rw-r--r-- | lib/libpthread/pthreads/stat.c | 4 | ||||
-rw-r--r-- | lib/libpthread/pthreads/writev.c | 89 | ||||
-rw-r--r-- | lib/libpthread/tests/Makefile | 7 |
20 files changed, 105 insertions, 1099 deletions
diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index 6bd1d145d68..7946b27ac32 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -6,7 +6,7 @@ LIB=pthread NOPIC=no -CPPFLAGS+=-DPTHREAD_KERNEL -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE_ARCH} +CFLAGS+=-DPTHREAD_KERNEL -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE_ARCH} .include "${.CURDIR}/include/Makefile.inc" .include "${.CURDIR}/arch/${MACHINE}/Makefile.inc" diff --git a/lib/libpthread/arch/i386/syscall.S b/lib/libpthread/arch/i386/syscall.S index cfdbbc77f73..8f2060e61e3 100644 --- a/lib/libpthread/arch/i386/syscall.S +++ b/lib/libpthread/arch/i386/syscall.S @@ -235,3 +235,14 @@ _machdep_sys_longjmp:; 1: movl %ecx,0(%esp) ret +/* ========================================================================== + * machdep_sys_pipe() + */ + .globl _machdep_sys_pipe; + +_machdep_sys_pipe:; + movl 4(%esp),%ecx + movl %eax,(%ecx) + movl %edx,4(%ecx) + xorl %eax,%eax + ret diff --git a/lib/libpthread/include/cond.h b/lib/libpthread/include/cond.h deleted file mode 100644 index ed76126cc98..00000000000 --- a/lib/libpthread/include/cond.h +++ /dev/null @@ -1,91 +0,0 @@ -/* ==== cond.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: cond.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: cond.h,v 1.17 1994/02/07 03:31:53 proven Exp $ - * - * Description : mutex header. - * - * 1.00 93/10/30 proven - * -Started coding this file. - */ - -/* - * New cond structures - */ -enum pthread_cond_type { - COND_TYPE_FAST, - COND_TYPE_STATIC_FAST, - COND_TYPE_METERED, - COND_TYPE_DEBUG, /* Debug conds will have lots of options */ - COND_TYPE_MAX -}; - -typedef struct pthread_cond { - enum pthread_cond_type c_type; - struct pthread_queue c_queue; - semaphore c_lock; - void * c_data; - long c_flags; -} pthread_cond_t; - -typedef struct pthread_cond_attr { - enum pthread_cond_type c_type; - long c_flags; -} pthread_condattr_t; - -/* - * Flags for conds. - */ -#define COND_FLAGS_PRIVATE 0x01 -#define COND_FLAGS_INITED 0x02 -#define COND_FLAGS_BUSY 0x04 - -/* - * Static cond initialization values. - */ -#define PTHREAD_COND_INITIALIZER \ -{ COND_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ - NULL, SEMAPHORE_CLEAR, COND_FLAGS_INITED } - -/* - * New functions - */ - -__BEGIN_DECLS - -int pthread_cond_init __P((pthread_cond_t *, pthread_condattr_t *)); -int pthread_cond_wait __P((pthread_cond_t *, pthread_mutex_t *)); -int pthread_cond_signal __P((pthread_cond_t *)); -int pthread_cond_broadcast __P((pthread_cond_t *)); -int pthread_cond_destroy __P((pthread_cond_t *)); - -__END_DECLS - diff --git a/lib/libpthread/include/engine.h b/lib/libpthread/include/engine.h deleted file mode 100644 index 3539686755c..00000000000 --- a/lib/libpthread/include/engine.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ==== engine.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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 <setjmp.h> -#include <sys/time.h> - -#if defined(PTHREAD_KERNEL) -#include "machdep.h" -#endif - -/* - * New types - */ -typedef long semaphore; - -#define SIGMAX 31 - -/* - * New Strutures - */ -struct machdep_pthread { - void *(*start_routine)(void *); - void *start_argument; - void *machdep_stack; - struct itimerval machdep_timer; - jmp_buf machdep_state; -}; - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ -{ NULL, NULL, NULL, { { 0, 0 }, { 0, 0 } }, 0 } - -/* - * Some fd flag defines that are necessary to distinguish between posix - * behavior and bsd4.3 behavior. - */ -#define __FD_NONBLOCK O_NONBLOCK - -/* - * New functions - */ - -__BEGIN_DECLS - -#if defined(PTHREAD_KERNEL) - -int semaphore_text_and_set __P((semaphore *)); -int machdep_save_state __P((void)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/include/fd.h b/lib/libpthread/include/fd.h deleted file mode 100644 index 654a497aa70..00000000000 --- a/lib/libpthread/include/fd.h +++ /dev/null @@ -1,106 +0,0 @@ -/* ==== fd.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: fd.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: fd.h,v 1.17 1994/02/07 03:31:54 proven Exp $ - * - * Description : Basic fd header. - * - * 1.00 93/08/14 proven - * -Started coding this file. - * - * 1.01 93/11/13 proven - * -The functions readv() and writev() added - */ - -/* - * New pthread types. - */ -enum fd_type { - FD_NT, /* Not tested */ - FD_NIU, /* Known to be not in use */ - FD_HALF_DUPLEX, /* Files, and seeking devices */ - FD_FULL_DUPLEX /* pipes, sockets, drivers, ... */ -}; - - -#define FD_READ 0x1 -#define FD_WRITE 0x2 -#define FD_RDWR (FD_READ | FD_WRITE) - -struct fd_ops { - int (*write)(); - int (*read)(); - int (*close)(); - int (*fcntl)(); - int (*writev)(); - int (*readv)(); - int (*seek)(); -}; - -union fd_data { - void *ptr; - int i; -}; - -struct fd_table_entry { - struct pthread_queue r_queue; - struct pthread_queue w_queue; - struct pthread *r_owner; - struct pthread *w_owner; - semaphore lock; - struct fd_table_entry *next; - struct fd_ops *ops; - enum fd_type type; - int lockcount; /* Count for FILE locks */ - int count; - - /* data that needs to be passed to the type dependent fd */ - int flags; - union fd_data fd; -}; - -/* - * Important data structure - */ -extern struct fd_table_entry *fd_table[]; -extern int dtablesize; - -/* - * New functions - */ - -__BEGIN_DECLS - -#if defined(PTHREAD_KERNEL) - -#endif - -__END_DECLS diff --git a/lib/libpthread/include/fd_pipe.h b/lib/libpthread/include/fd_pipe.h deleted file mode 100644 index 6ec808ff687..00000000000 --- a/lib/libpthread/include/fd_pipe.h +++ /dev/null @@ -1,54 +0,0 @@ -/* ==== fd_pipe.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: fd_pipe.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: fd_pipe.h,v 1.17 1994/02/07 03:31:56 proven Exp $ - * - * Description : The new fast ITC pipe header. - * - * 1.00 93/08/14 proven - * -Started coding this file. - */ - -struct __pipe { - semaphore lock; - char * buf; - int size; - int flags; - int count; - int offset; - struct pthread * wait; - char * wait_buf; - size_t wait_size; -}; - -#define RD_CLOSED 0x01 -#define WR_CLOSED 0x02 - diff --git a/lib/libpthread/include/kernel.h b/lib/libpthread/include/kernel.h deleted file mode 100644 index 29e066f7ae7..00000000000 --- a/lib/libpthread/include/kernel.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ==== kernel.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: kernel.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: kernel.h,v 1.17 1994/02/07 03:31:57 proven Exp $ - * - * Description : mutex header. - * - * 1.00 93/07/22 proven - * -Started coding this file. - */ - -/* - * Defines only for the pthread user kernel. - */ -#if defined(PTHREAD_KERNEL) - -#define PANIC() abort() - -/* Time each rr thread gets */ -#define PTHREAD_RR_TIMEOUT 100000000 - -#endif diff --git a/lib/libpthread/include/mutex.h b/lib/libpthread/include/mutex.h deleted file mode 100644 index d8e5d8939d2..00000000000 --- a/lib/libpthread/include/mutex.h +++ /dev/null @@ -1,93 +0,0 @@ -/* ==== mutex.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: mutex.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: mutex.h,v 1.17 1994/02/07 03:31:59 proven Exp $ - * - * Description : mutex header. - * - * 1.00 93/07/20 proven - * -Started coding this file. - */ - -/* - * New mutex structures - */ -enum pthread_mutex_type { - MUTEX_TYPE_FAST, - MUTEX_TYPE_STATIC_FAST, - MUTEX_TYPE_RECURSIVE, - MUTEX_TYPE_METERED, - MUTEX_TYPE_DEBUG, /* Debug mutexes will have lots of options */ - MUTEX_TYPE_MAX -}; - -typedef struct pthread_mutex { - enum pthread_mutex_type m_type; - struct pthread_queue m_queue; - struct pthread *m_owner; - semaphore m_lock; - void *m_data; - long m_flags; -} pthread_mutex_t; - -typedef struct pthread_mutex_attr { - enum pthread_mutex_type m_type; - long m_flags; -} pthread_mutexattr_t; - -/* - * Flags for mutexes. - */ -#define MUTEX_FLAGS_PRIVATE 0x01 -#define MUTEX_FLAGS_INITED 0x02 -#define MUTEX_FLAGS_BUSY 0x04 - -/* - * Static mutex initialization values. - */ -#define PTHREAD_MUTEX_INITIALIZER \ -{ MUTEX_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ - NULL, SEMAPHORE_CLEAR, NULL, MUTEX_FLAGS_INITED } - -/* - * New functions - */ - -__BEGIN_DECLS - -int pthread_mutex_init __P((pthread_mutex_t *, pthread_mutexattr_t *)); -int pthread_mutex_lock __P((pthread_mutex_t *)); -int pthread_mutex_unlock __P((pthread_mutex_t *)); -int pthread_mutex_trylock __P((pthread_mutex_t *)); -int pthread_mutex_destroy __P((pthread_mutex_t *)); - -__END_DECLS - diff --git a/lib/libpthread/include/posix.h b/lib/libpthread/include/posix.h deleted file mode 100644 index a3a8ef049c6..00000000000 --- a/lib/libpthread/include/posix.h +++ /dev/null @@ -1,21 +0,0 @@ -/* ==== posix.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu - * - * Description : Convert an Ultrix-4.2 system to a more or less POSIX system. - * - * $Id: posix.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: posix-netbsd-0.9.h,v 1.17 1994/02/07 03:32:24 proven Exp $ - * - * 1.00 93/07/20 proven - * -Started coding this file. - */ - -#ifndef _PTHREAD_POSIX_H_ -#define _PTHREAD_POSIX_H_ - -#include <sys/cdefs.h> - -/* Make sure we have size_t defined */ -#include <stdlib.h> -#include <stdarg.h> - -#endif diff --git a/lib/libpthread/include/pthread_attr.h b/lib/libpthread/include/pthread_attr.h deleted file mode 100644 index 3cfe54c29c1..00000000000 --- a/lib/libpthread/include/pthread_attr.h +++ /dev/null @@ -1,73 +0,0 @@ -/* ==== pthread_attr.h ======================================================== - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: pthread_attr.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: pthread_attr.h,v 1.17 1994/02/07 03:32:02 proven Exp $ - * - * Description : Basic pthread attributes header. - * - * 1.00 93/11/03 proven - * -Started coding this file. - */ - -#define _POSIX_THREAD_ATTR_STACKSIZE - -#define PTHREAD_STACK_DEFAULT 65536 - -/* - * New pthread attribute types. - */ -enum pthread_sched_attr { - SCHED_RR, - SCHED_IO, - SCHED_FIFO, - SCHED_OTHER, -}; - -typedef struct pthread_attr { - enum pthread_sched_attr sched_attr; - void * stackaddr_attr; - size_t stacksize_attr; -} pthread_attr_t; - -/* - * New functions - */ - -__BEGIN_DECLS - -int pthread_attr_init __P((pthread_attr_t *)); -int pthread_attr_destroy __P((pthread_attr_t *)); -int pthread_attr_setstacksize __P((pthread_attr_t *, size_t)); -int pthread_attr_getstacksize __P((pthread_attr_t *, size_t *)); -int pthread_attr_setstackaddr __P((pthread_attr_t *, void *)); -int pthread_attr_getstackaddr __P((pthread_attr_t *, void **)); - -__END_DECLS diff --git a/lib/libpthread/include/pthread_once.h b/lib/libpthread/include/pthread_once.h deleted file mode 100644 index 971bc493d1b..00000000000 --- a/lib/libpthread/include/pthread_once.h +++ /dev/null @@ -1,53 +0,0 @@ -/* ==== pthread_once.h ======================================================== - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: pthread_once.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: pthread_once.h,v 1.17 1994/02/07 03:32:04 proven Exp $ - * - * Description : mutex header. - * - * 1.00 93/12/12 proven - * -Started coding this file. - */ - -/* New pthread_once structures */ -typedef int pthread_once_t; - -/* Static pthread_once_t initialization value. */ -#define PTHREAD_ONCE_INIT 0 - -/* New functions */ - -__BEGIN_DECLS - -int pthread_once __P((pthread_once_t *, void (*init_routine)(void))); - -__END_DECLS - diff --git a/lib/libpthread/include/queue.h b/lib/libpthread/include/queue.h deleted file mode 100644 index d4d34b53861..00000000000 --- a/lib/libpthread/include/queue.h +++ /dev/null @@ -1,67 +0,0 @@ -/* ==== queue.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: queue.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: queue.h,v 1.17 1994/02/07 03:39:52 proven Exp $ - * - * Description : mutex header. - * - * 1.00 93/07/20 proven - * -Started coding this file. - */ - -/* - * New queue structures - */ -struct pthread_queue { - struct pthread *q_next; - struct pthread *q_last; - void *q_data; -}; - -/* - * Static queue initialization values. - */ -#define PTHREAD_QUEUE_INITIALIZER { NULL, NULL, NULL } - -/* - * New functions - * Should make pthread_queue_get a macro - */ - -__BEGIN_DECLS - -void pthread_queue_init __P((struct pthread_queue *)); -void pthread_queue_enq __P((struct pthread_queue *, struct pthread *)); -void pthread_queue_remove __P((struct pthread_queue *, struct pthread *)); -struct pthread *pthread_queue_get __P((struct pthread_queue *)); -struct pthread *pthread_queue_deq __P((struct pthread_queue *)); - -__END_DECLS diff --git a/lib/libpthread/include/util.h b/lib/libpthread/include/util.h deleted file mode 100644 index 249975df57a..00000000000 --- a/lib/libpthread/include/util.h +++ /dev/null @@ -1,89 +0,0 @@ -/* ==== util.h ============================================================ - * Copyright (c) 1991, 1992, 1993 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * $Id: util.h,v 1.1 1995/10/18 08:43:04 deraadt Exp $ $provenid: util.h,v 1.15 1994/02/07 03:32:07 proven Exp $ - * - * Description : Header file for generic utility functions. - * - * 91/08/31 proven - Added exchange. - * Exchange any two objects of any size in any table. - * - * 91/10/06 proven - Cleaned out all the old junk. - * - * 91/03/06 proven - Added getint. - */ - -#ifndef _PTHREAD_UTIL_H -#define _PTHREAD_UTIL_H - -#ifndef NULL -#define NULL 0 -#endif - -/* Stuff only pthread internals really uses */ -#if defined(PTHREAD_KERNEL) - -#undef FALSE -#undef TRUE - -typedef enum Boolean { - FALSE, - TRUE, -} Boolean; - -#define OK 0 -#define NUL '\0' -#define NOTOK -1 - -#if ! defined(min) -#define min(a,b) (((a)<(b))?(a):(b)) -#define max(a,b) (((a)>(b))?(a):(b)) -#endif - -/* Alingn the size to the next multiple of 4 bytes */ -#define ALIGN4(size) ((size + 3) & ~3) -#define ALIGN8(size) ((size + 7) & ~7) - -#ifdef DEBUG -#define DEBUG0(s) printf(s) -#define DEBUG1(s,a) printf(s,a) -#define DEBUG2(s,a,b) printf(s,a,b) -#define DEBUG3(s,a,b,c) printf(s,a,b,c) -#else -#define DEBUG0(s) -#define DEBUG1(s) -#define DEBUG2(s) -#define DEBUG3(s) -#endif - -#endif - -#endif diff --git a/lib/libpthread/pthreads/Makefile.inc b/lib/libpthread/pthreads/Makefile.inc index 4e3f7d41df6..6e4d8a39d49 100644 --- a/lib/libpthread/pthreads/Makefile.inc +++ b/lib/libpthread/pthreads/Makefile.inc @@ -9,62 +9,99 @@ SRCS+= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c \ pthread_init.c init.cc sig.c info.c mutexattr.c select.c wrapper.c \ dump_state.c pthread_kill.c condattr.c pthread_cancel.c panic.c -OBJS+= syscalls.o +# glue to provide compatibility between GCC 1.X and 2.X and for compat +# with old syscall interfaces. +#SRCS+= ftruncate.c lseek.c mmap.c semctl.c truncate.c \ +# timer_create.c timer_delete.c timer_getoverrun.c timer_gettime.c \ +# timer_settime.c -AVAILABLE_SYSCALLS = open write read creat close fcntl lseek dup pipe fchmod fchown execve fstat lstat link unlink chdir chown chmod stat rename ioctl fstatfs sigsuspend sigaction sigprocmask getdents waitsys poll putmsg getmsg pgrpsys exit readv writev fork +# modules with default implementations on all architectures: +ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \ + chown.o chroot.o clock_gettime.o clock_settime.o clock_getres.o \ + close.o connect.o dup.o dup2.o execve.o fchdir.o \ + fchflags.o fchmod.o fchown.o fcntl.o flock.o fpathconf.o fstat.o \ + fstatfs.o fsync.o futimes.o getdirentries.o getegid.o geteuid.o \ + getfh.o getfsstat.o getgid.o getgroups.o getitimer.o getpeername.o \ + getpgid.o \ + getpgrp.o getpid.o getppid.o getpriority.o getrlimit.o getrusage.o \ + getsid.o \ + getsockname.o getsockopt.o gettimeofday.o getuid.o issetugid.o \ + ioctl.o kill.o \ + ktrace.o lchown.o lfs_bmapv.o lfs_markv.o lfs_segclean.o lfs_segwait.o \ + link.o listen.o lstat.o madvise.o mincore.o minherit.o mkdir.o \ + mkfifo.o mknod.o mlock.o \ + mount.o mprotect.o msgctl.o msgget.o msgrcv.o msgsnd.o msync.o \ + munlock.o munmap.o nanosleep.o nfssvc.o \ + ntp_gettime.o ntp_adjtime.o \ + open.o pathconf.o poll.o profil.o quotactl.o \ + read.o readlink.o readv.o reboot.o recvfrom.o recvmsg.o rename.o \ + revoke.o rfork.o \ + rmdir.o select.o semconfig.o semget.o semop.o sendmsg.o sendto.o \ + setegid.o seteuid.o setgid.o setgroups.o setitimer.o setpgid.o \ + setpriority.o setrlimit.o setsid.o setsockopt.o settimeofday.o \ + setuid.o shmat.o shmctl.o shmdt.o shmget.o shutdown.o sigaction.o \ + sigaltstack.o socket.o socketpair.o stat.o statfs.o swapon.o \ + symlink.o sync.o sysarch.o umask.o undelete.o unlink.o unmount.o \ + utimes.o vadvise.o wait4.o write.o writev.o __semctl.o \ + __sysctl.o -SYSCALL_TEMPLATE = ${.CURDIR}/arch/${MACHINE}/syscall-template.S -SYSCALL_S = ${.CURDIR}/arch/${MACHINE}/syscall.S +PASM= ${ASM:.o=.po} +SASM= ${ASM:.o=.so} -.if !defined(NOPIC) -SOBJS+= syscalls.so -SYSCALL_PIC_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -DPIC -c ${SYSCALL_TEMPLATE} -o ${.OBJDIR}/syscalls/S$$syscall.so -.else -SYSCALL_PIC_COMPILE= true -.endif +PSEUDO= _exit.o _getlogin.o +PPSEUDO=${PSEUDO:.o=.po} +SPSEUDO=${PSEUDO:.o=.so} -.if !defined(NOPROFILE) -POBJS+= syscalls.po -SYSCALL_PROF_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -pg -c ${SYSCALL_TEMPLATE} -o ${.OBJDIR}/syscalls/S$$syscall.po -.else -SYSCALL_PROF_COMPILE= true -.endif +OBJS+= ${ASM} ${PSEUDO} -syscalls.o syscalls.so syscalls.po : ${SYSCALL_TEMPLATE} - -rm -rf ${.OBJDIR}/syscalls - mkdir ${.OBJDIR}/syscalls - for syscall in $(AVAILABLE_SYSCALLS) ; do \ - case " $(SYSCALL_EXCEPTIONS) " in \ - *" "$$syscall" "*) ;; \ - *) echo $$syscall ; \ - $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -c ${SYSCALL_TEMPLATE} -o ${.OBJDIR}/syscalls/S$$syscall.o ; \ - $(SYSCALL_PIC_COMPILE) ; \ - $(SYSCALL_PROF_COMPILE) ;; \ - esac ; \ - done - x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.o *.o && cd $$x -.if !defined(NOPIC) - x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.so *.so && cd $$x -.endif +${PASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o -.if !defined(NOPROFILE) - x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.po *.po && cd $$x +.if (${MACHINE_ARCH} != "mips") +${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET} +.else +${SASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET} .endif - rm -r ${.OBJDIR}/syscalls - -syscall.o: syscall.S - cpp ${CPPFLAGS} ${SYSCALL_S} > syscall.i - as syscall.i - rm syscall.i - mv a.out syscall.o -syscall.po: syscall.S - cpp ${CPPFLAGS} ${SYSCALL_S} > syscall.i - as syscall.i - rm syscall.i - mv a.out syscall.po +${ASM}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' | \ + ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o -MAN2+= +${PPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} -DPROF ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o -MAN3+= +.if (${MACHINE_ARCH} != "mips") +${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -k -o ${.TARGET} +.else +${SPSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} -DPIC ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET} +.endif +${PSEUDO}: ${.CURDIR}/arch/${MACHINE_ARCH}/SYS.h /usr/include/sys/syscall.h + @echo creating ${.TARGET} + @printf '#include "SYS.h"\nPSEUDO(${.PREFIX},${.PREFIX:S/_//})\n' | \ + ${CPP} ${CFLAGS:M-[ID]*} ${AINC} | ${AS} -o ${.TARGET}.o + @${LD} -X -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o diff --git a/lib/libpthread/pthreads/fd_kern.c b/lib/libpthread/pthreads/fd_kern.c index be2fc5ec90f..23b7b074e21 100644 --- a/lib/libpthread/pthreads/fd_kern.c +++ b/lib/libpthread/pthreads/fd_kern.c @@ -39,7 +39,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: fd_kern.c,v 1.2 1998/07/21 19:48:02 peter Exp $"; +static const char rcsid[] = "$Id: fd_kern.c,v 1.3 1998/07/22 10:46:51 peter Exp $"; #endif #include <pthread.h> @@ -57,8 +57,6 @@ static const char rcsid[] = "$Id: fd_kern.c,v 1.2 1998/07/21 19:48:02 peter Exp #include <pthread/posix.h> #include <string.h> -#if defined (HAVE_SYSCALL_SENDTO) && !defined (HAVE_SYSCALL_SEND) - pthread_ssize_t machdep_sys_send (int fd, const void *msg, size_t len, int flags) { @@ -66,18 +64,12 @@ pthread_ssize_t machdep_sys_send (int fd, const void *msg, size_t len, (const struct sockaddr *) 0, 0); } -#endif - -#if defined (HAVE_SYSCALL_RECVFROM) && !defined (HAVE_SYSCALL_RECV) - pthread_ssize_t machdep_sys_recv (int fd, void *buf, size_t len, int flags) { return machdep_sys_recvfrom (fd, buf, len, flags, (struct sockaddr *) 0, (int *) 0); } -#endif - /* ========================================================================== * Check if there is any signal with must be handled. Added by Monty * This could be somewhat system dependent but it should work. @@ -722,7 +714,6 @@ int ftruncate(int fd, off_t length) return(ret); } -#if defined (HAVE_SYSCALL_FLOCK) /* ========================================================================== * flock() * @@ -742,7 +733,6 @@ int flock(int fd, int operation) } return(ret); } -#endif /* ========================================================================== * pipe() @@ -1056,8 +1046,6 @@ void fd_kern_fork() * Here are the berkeley socket functions. These are not POSIX. * ======================================================================= */ -#if defined (HAVE_SYSCALL_SOCKET) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * socket() */ @@ -1087,10 +1075,6 @@ int socket(int af, int type, int protocol) return(NOTOK); } -#endif - -#if defined (HAVE_SYSCALL_BIND) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * bind() */ @@ -1109,10 +1093,6 @@ int bind(int fd, const struct sockaddr *name, int namelen) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_CONNECT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * connect() */ @@ -1161,10 +1141,6 @@ int connect(int fd, const struct sockaddr *name, int namelen) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_ACCEPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * accept() */ @@ -1210,10 +1186,6 @@ int accept(int fd, struct sockaddr *name, int *namelen) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_LISTEN) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * listen() */ @@ -1231,10 +1203,7 @@ int listen(int fd, int backlog) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_SEND) || defined (HAVE_SYSCALL_SOCKETCALL) - +#if 0 /* ========================================================================== * send_timedwait() */ @@ -1308,8 +1277,6 @@ ssize_t send(int fd, const void * msg, size_t len, int flags) #endif -#if defined (HAVE_SYSCALL_SENDTO) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * sendto_timedwait() */ @@ -1381,10 +1348,6 @@ ssize_t sendto(int fd, const void * msg, size_t len, int flags, return(sendto_timedwait(fd, msg, len, flags, to, to_len, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_SENDMSG) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * sendmsg_timedwait() */ @@ -1483,10 +1446,7 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) return(sendmsg_timedwait(fd, msg, flags, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_RECV) || defined (HAVE_SYSCALL_SOCKETCALL) - +#if 0 /* ========================================================================== * recv_timedwait() */ @@ -1559,8 +1519,6 @@ ssize_t recv(int fd, void * buf, size_t len, int flags) #endif -#if defined (HAVE_SYSCALL_RECVFROM) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * recvfrom_timedwait() */ @@ -1633,10 +1591,6 @@ ssize_t recvfrom(int fd, void * buf, size_t len, int flags, return(recvfrom_timedwait(fd, buf, len, flags, from, from_len, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_RECVMSG) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * recvmsg_timedwait() */ @@ -1735,10 +1689,6 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags) return(recvmsg_timedwait(fd, msg, flags, NULL)); } -#endif - -#if defined (HAVE_SYSCALL_SHUTDOWN) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * shutdown() */ @@ -1779,10 +1729,6 @@ int shutdown(int fd, int how) return(ret); } -#endif - -#if defined (HAVE_SYSCALL_SETSOCKOPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * setsockopt() */ @@ -1801,10 +1747,6 @@ int setsockopt(int fd, int level, int optname, const void * optval, int optlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_GETSOCKOPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * getsockopt() */ @@ -1823,10 +1765,6 @@ int getsockopt(int fd, int level, int optname, void * optval, int * optlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_GETSOCKOPT) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * getsockname() */ @@ -1845,10 +1783,6 @@ int getsockname(int fd, struct sockaddr * name, int * naddrlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_GETPEERNAME) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * getpeername() */ @@ -1867,10 +1801,6 @@ int getpeername(int fd, struct sockaddr * peer, int * paddrlen) return ret; } -#endif - -#if defined (HAVE_SYSCALL_SOCKETPAIR) || defined (HAVE_SYSCALL_SOCKETCALL) - /* ========================================================================== * socketpair() */ @@ -1906,5 +1836,3 @@ int socketpair(int af, int type, int protocol, int pair[2]) } return(NOTOK); } - -#endif diff --git a/lib/libpthread/pthreads/readv.c b/lib/libpthread/pthreads/readv.c deleted file mode 100644 index 64ec8704f44..00000000000 --- a/lib/libpthread/pthreads/readv.c +++ /dev/null @@ -1,85 +0,0 @@ -/* ==== readv.c ============================================================ - * Copyright (c) 1995 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * Description : Implementation of readv(). - * - * 1.00 95/06/19 proven - * -Started coding this file. - */ - -#ifndef lint -static const char rcsid[] = "$Id: readv.c,v 1.1 1998/07/21 13:20:22 peter Exp $"; -#endif - -#include "config.h" - -#ifndef HAVE_SYSCALL_READV - -#include <errno.h> -#include <unistd.h> -#include <sys/uio.h> -#include <sys/types.h> - -/* ========================================================================== - * machdep_sys_readv() - */ -int machdep_sys_readv(int fd, struct iovec * vector, int count) -{ - size_t bytes, i; - char *buffer; - int ret = 0; - - /* Find the total number of bytes to be read. */ - for (bytes = 0, i = 0; i < count; ++i) - bytes += vector[i].iov_len; - - if (bytes) { - /* - * Allocate a temporary buffer to hold the data. - * Don't use alloca because threads tend to have smaller stacks. - */ - if ((buffer = (char *)malloc(bytes)) == NULL) { - return(-ENOMEM); - } - ret = (int)machdep_sys_read(fd, buffer, bytes); - - /* Copy the data from memory specified by VECTOR to BUFFER */ - for (i = 0, bytes = 0; ret > 0; ret -= vector[i].iov_len) { - memcpy(vector[i].iov_base, buffer + bytes, - ret > vector[i].iov_len ? vector[i].iov_len : ret); - bytes += vector[i].iov_len; - } - free(buffer); - } - return(ret); -} - -#endif diff --git a/lib/libpthread/pthreads/signal.c b/lib/libpthread/pthreads/signal.c index b96bee7e38f..df0cf153145 100644 --- a/lib/libpthread/pthreads/signal.c +++ b/lib/libpthread/pthreads/signal.c @@ -36,7 +36,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: signal.c,v 1.2 1998/07/21 19:48:04 peter Exp $"; +static const char rcsid[] = "$Id: signal.c,v 1.3 1998/07/22 10:46:54 peter Exp $"; #endif #include <pthread.h> @@ -600,22 +600,16 @@ void sig_init(void) static const int signum_to_ignore[] = { SIGKILL, SIGSTOP, 0 }; int i, j; -#if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION) struct sigaction act; act.sa_handler = sig_handler_real; sigemptyset(&(act.sa_mask)); act.sa_flags = 0; -#endif /* Initialize the important signals */ for (i = 0; signum_to_initialize[i]; i++) { -#if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION) if (sigaction(signum_to_initialize[i], &act, NULL)) { -#else - if (signal(signum_to_initialize[i], sig_handler_real)) { -#endif PANIC(); } } @@ -635,11 +629,7 @@ void sig_init(void) } pthread_signal(j, SIG_DFL); -#if defined(HAVE_SYSCALL_SIGACTION) || defined(HAVE_SYSCALL_KSIGACTION) sigaction(j, &act, NULL); -#else - signal(j, sig_handler_real); -#endif sig_next:; } diff --git a/lib/libpthread/pthreads/stat.c b/lib/libpthread/pthreads/stat.c index 56e65a48c60..3d5872187bf 100644 --- a/lib/libpthread/pthreads/stat.c +++ b/lib/libpthread/pthreads/stat.c @@ -36,7 +36,7 @@ */ #ifndef lint -static const char rcsid[] = "$Id: stat.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +static const char rcsid[] = "$Id: stat.c,v 1.2 1998/07/22 10:46:55 peter Exp $"; #endif #include <pthread.h> @@ -94,7 +94,6 @@ int lstat(const char * path, struct stat * buf) } -#ifdef HAVE_SYSCALL_FSTATFS /* ========================================================================== * fstatfs() * @@ -113,4 +112,3 @@ int fstatfs(int fd, struct statfs *buf) } return(ret); } -#endif diff --git a/lib/libpthread/pthreads/writev.c b/lib/libpthread/pthreads/writev.c deleted file mode 100644 index 9bc3cba870d..00000000000 --- a/lib/libpthread/pthreads/writev.c +++ /dev/null @@ -1,89 +0,0 @@ -/* ==== writev.c ============================================================ - * Copyright (c) 1995 by Chris Provenzano, 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. - * 4. The name of Chris Provenzano may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``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 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. - * - * Description : Implementation of writev(). - * - * 1.00 95/06/19 proven - * -Started coding this file. - */ - -#ifndef lint -static const char rcsid[] = "$Id: writev.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; -#endif - -#include "config.h" - -#ifndef HAVE_SYSCALL_WRITEV - -#include <errno.h> -#include <unistd.h> -#include <sys/uio.h> -#include <sys/types.h> - -/* ========================================================================== - * machdep_sys_writev() - * - * modified from the GNU C Library posix/writev.c - */ -int machdep_sys_writev(int fd, struct iovec * vector, int count) -{ - size_t bytes, i; - char *buffer; - int ret; - - /* Find the total number of bytes to be written. */ - for (bytes = 0, i = 0; i < count; ++i) - bytes += vector[i].iov_len; - - if (bytes) { - /* - * Allocate a temporary buffer to hold the data. - * Don't use alloca because threads tend to have smaller stacks. - */ - if ((buffer = (char *)malloc(bytes)) == NULL) { - return(-ENOMEM); - } - /* Copy the data from memory specified by VECTOR to BUFFER */ - for (ret = 0, i = 0; i < count; ++i) { - memcpy(buffer + ret, vector[i].iov_base, vector[i].iov_len); - ret += vector[i].iov_len; - } - } else { - buffer = NULL; - } - - ret = (int)machdep_sys_write(fd, buffer, bytes); - if (buffer) - free(buffer); - return(ret); -} - -#endif diff --git a/lib/libpthread/tests/Makefile b/lib/libpthread/tests/Makefile index 626cc39e93f..97f81b5d4e3 100644 --- a/lib/libpthread/tests/Makefile +++ b/lib/libpthread/tests/Makefile @@ -9,10 +9,9 @@ # CDEBUGFLAGS = -g -O2 -Werror - -INCLUDES= -I../arch/${MACHINE} -I../include -I.. -I$(srctop)/include -CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(ADDL_CFLAGS) -DSRCDIR=\"$(srcdir)\" -LIBS = -static -lm -lgcc -L../obj.${MACHINE}/ -lpthread +INCLUDES= -I/usr/include/pthread +CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) -DSRCDIR="\"${.CURDIR}\"" +LIBS = -static -lm -lgcc -L${.CURDIR}/../obj.${MACHINE}/ -lpthread # This list used to include test_select, but that test doesn't terminate. TESTS = test_create test_pthread_join test_switch test_sleep test_readdir \ |