diff options
| author | scottr <scottr@NetBSD.org> | 1997-10-08 17:14:35 +0000 |
|---|---|---|
| committer | scottr <scottr@NetBSD.org> | 1997-10-08 17:14:35 +0000 |
| commit | a1d96607f3776fbf5719a3dfc2961ad58ba6466e (patch) | |
| tree | b9250cc9d4a484489cb495674f97adb64b0702bf /lib/libpthread/include | |
| parent | 3dffd3e74ad5a689000ed43fac3b4cd149976ebc (diff) | |
This incarnation of the pthreads library is ancient and not useful, and
should have been mothballed some time ago...
Diffstat (limited to 'lib/libpthread/include')
| -rw-r--r-- | lib/libpthread/include/Makefile.inc | 25 | ||||
| -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 | 107 | ||||
| -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.h | 148 | ||||
| -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/stdio.h | 356 | ||||
| -rw-r--r-- | lib/libpthread/include/util.h | 89 |
14 files changed, 0 insertions, 1313 deletions
diff --git a/lib/libpthread/include/Makefile.inc b/lib/libpthread/include/Makefile.inc deleted file mode 100644 index b8ac0e9bc18..00000000000 --- a/lib/libpthread/include/Makefile.inc +++ /dev/null @@ -1,25 +0,0 @@ -# from: @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91 - -# Doing a make install builds /usr/include/pthread -# -# The ``rm -rf''s used below are safe because rm doesn't follow symbolic -# links. - - -FILES= cond.h copyright.h fd.h fd_pipe.h kernel.h mutex.h posix.h \ - pthread.h pthread_attr.h queue.h util.h engine.h pthread_once.h - -realinstall: - if [ ! -d ${DESTDIR}/usr/include/pthread ]; then \ - mkdir ${DESTDIR}/usr/include/pthread; \ - fi - @echo installing ${FILES} - @-for i in ${FILES}; do \ - cmp -s $$i ${DESTDIR}/usr/include/pthread/$$i || \ - ${INSTALL} -c -m 644 $$i ${DESTDIR}/usr/include/$$i; \ - done - rm -rf ${DESTDIR}/usr/include/pthread.h - ln -s /usr/include/pthread/pthread.h ${DESTDIR}/usr/include/pthread.h - @chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include/pthread - @chmod -R a-w ${DESTDIR}/usr/include/pthread - diff --git a/lib/libpthread/include/cond.h b/lib/libpthread/include/cond.h deleted file mode 100644 index aa64bb0ec33..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.3 1994/02/07 22:02:28 proven 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 9446f138333..00000000000 --- a/lib/libpthread/include/fd.h +++ /dev/null @@ -1,107 +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.4 1997/10/08 00:33:40 christos 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 iovec; -union fd_data { - void *ptr; - int i; -}; - -struct fd_ops { - ssize_t (*write) __P((union fd_data, int, const void *, size_t)); - ssize_t (*read) __P((union fd_data, int, void *, size_t)); - int (*close) __P((union fd_data, int )); - int (*fcntl) __P((union fd_data, int, int, ...)); - int (*writev) __P((union fd_data, int, const struct iovec *, int)); - int (*readv) __P((union fd_data, int, const struct iovec *, int)); - off_t (*seek) __P((union fd_data, int, off_t, int)); -}; - -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 59aa20de554..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.3 1994/02/07 22:02:29 proven 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 e0c2d776641..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.3 1994/02/07 22:02:30 proven 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 885b927e5ee..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.3 1994/02/07 22:02:31 proven 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 a393f3207f4..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.3 1994/02/07 22:02:32 proven 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.h b/lib/libpthread/include/pthread.h deleted file mode 100644 index 3675be7df20..00000000000 --- a/lib/libpthread/include/pthread.h +++ /dev/null @@ -1,148 +0,0 @@ -/* ==== pthread.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.h,v 1.4 1994/02/07 22:02:33 proven Exp $ $provenid: pthread.h,v 1.17 1994/02/07 03:32:00 proven Exp $ - * - * Description : Basic pthread header. - * - * 1.00 93/07/20 proven - * -Started coding this file. - */ - -#include <pthread/engine.h> -#include <pthread/kernel.h> -#include <pthread/queue.h> -#include <pthread/mutex.h> -#include <pthread/cond.h> -#include <pthread/fd.h> - -#include <pthread/util.h> -#include <errno.h> - -/* More includes */ -#include <pthread/pthread_once.h> - -/* More includes, that need size_t */ -#include <pthread/pthread_attr.h> - -enum pthread_state { - PS_RUNNING, - PS_MUTEX_WAIT, - PS_COND_WAIT, - PS_FDLR_WAIT, - PS_FDLW_WAIT, - PS_FDR_WAIT, - PS_FDW_WAIT, - PS_SLEEP_WAIT, - PS_JOIN, - PS_DEAD -}; - -#define PF_DETACHED 0x00000001 - -struct pthread { - struct machdep_pthread machdep_data; - enum pthread_state state; - pthread_attr_t attr; - - /* Other flags */ - int flags; - - /* Time until timeout */ - int time_sec; - int time_usec; - - /* Join queue for waiting threads */ - struct pthread_queue join_queue; - - /* Queue thread is waiting on, (mutexes, cond. etc.) */ - struct pthread_queue *queue; - - /* - * Thread implementations are just multiple queue type implemenations, - * Below are the various link lists currently necessary - * It is possible for a thread to be on multiple, or even all the - * queues at once, much care must be taken during queue manipulation. - * - * The pthread structure must be locked before you can even look at - * the link lists. - */ - - struct pthread *pll; /* ALL threads, in any state */ - /* struct pthread *rll; Current run queue, before resced */ - struct pthread *sll; /* For sleeping threads */ - struct pthread *next; /* Standard for mutexes, etc ... */ - /* struct pthread *fd_next; For kernel fd operations */ - - int fd; /* Used when thread waiting on fd */ - - semaphore lock; - void *ret; - int error; -}; - -typedef struct pthread* pthread_t; - -/* - * Globals - */ -extern struct pthread *pthread_run; -extern struct pthread *pthread_initial; -extern struct pthread *pthread_link_list; -extern pthread_attr_t pthread_default_attr; -extern struct pthread_queue pthread_current_queue; -extern struct fd_table_entry *fd_table[]; - -/* - * New functions - */ - -__BEGIN_DECLS - -void pthread_init __P((void)); -int pthread_create __P((pthread_t *, const pthread_attr_t *, - void * (*start_routine)(void *), void *)); -void pthread_exit __P((void *)); -pthread_t pthread_self __P((void)); -int pthread_equal __P((pthread_t, pthread_t)); -int pthread_join __P((pthread_t, void **)); -int pthread_detach __P((pthread_t)); - -#if defined(PTHREAD_KERNEL) - -void pthread_yield __P((void)); - -/* Not valid, but I can't spell so this will be caught at compile time */ -#define pthread_yeild(notvalid) - -#endif - -__END_DECLS diff --git a/lib/libpthread/include/pthread_attr.h b/lib/libpthread/include/pthread_attr.h deleted file mode 100644 index f4718e1def5..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.3 1994/02/07 22:02:34 proven 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 aeb14e35f6a..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 1994/02/07 22:02:35 proven 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 367e26be717..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.3 1994/02/07 22:02:36 proven 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/stdio.h b/lib/libpthread/include/stdio.h deleted file mode 100644 index ed8b72dae8b..00000000000 --- a/lib/libpthread/include/stdio.h +++ /dev/null @@ -1,356 +0,0 @@ -/* ==== stdio.h ============================================================ - * Copyright (c) 1990 The Regents of the University of California. - * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * 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 the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University 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 REGENTS 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. - * - * from: @(#)stdio.h 5.17 (Berkeley) 6/3/91 - * $Id: stdio.h,v 1.2 1997/10/08 00:35:50 christos Exp $ $provenid: stdio.h,v 1.18 1994/02/07 03:32:06 proven Exp $ - */ - -#ifndef _STDIO_H_ -#define _STDIO_H_ - -#include <sys/cdefs.h> -#include <pthread/posix.h> - -#ifndef NULL -#define NULL 0 -#endif - -typedef long fpos_t; /* Must match off_t <sys/types.h> */ - -#define _FSTDIO /* Define for new stdio with functions. */ - -/* - * NB: to fit things in six character monocase externals, the stdio - * code uses the prefix `__s' for stdio objects, typically followed - * by a three-character attempt at a mnemonic. - */ - -/* stdio buffers */ -struct __sbuf { - unsigned char *_base; - int _size; -}; - -/* - * stdio state variables. - * - * The following always hold: - * - * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), - * _lbfsize is -_bf._size, else _lbfsize is 0 - * if _flags&__SRD, _w is 0 - * if _flags&__SWR, _r is 0 - * - * This ensures that the getc and putc macros (or inline functions) never - * try to write or read from a file that is in `read' or `write' mode. - * (Moreover, they can, and do, automatically switch from read mode to - * write mode, and back, on "r+" and "w+" files.) - * - * _lbfsize is used only to make the inline line-buffered output stream - * code as compact as possible. - * - * _ub, _up, and _ur are used when ungetc() pushes back more characters - * than fit in the current _bf, or when ungetc() pushes back a character - * that does not match the previous one in _bf. When this happens, - * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff - * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. - */ -typedef struct __sFILE { - unsigned char *_p; /* current position in (some) buffer */ - int _r; /* read space left for getc() */ - int _w; /* write space left for putc() */ - short _flags; /* flags, below; this FILE is free if 0 */ - short _file; /* fileno, if Unix descriptor, else -1 */ - struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ - int _lbfsize; /* 0 or -_bf._size, for inline putc */ - - /* separate buffer for long sequences of ungetc() */ - struct __sbuf _ub; /* ungetc buffer */ - unsigned char *_up; /* saved _p when _p is doing ungetc data */ - int _ur; /* saved _r when _r is counting ungetc data */ - - /* tricks to meet minimum requirements even when malloc() fails */ - unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ - unsigned char _nbuf[1]; /* guarantee a getc() buffer */ - - /* separate buffer for fgetline() when line crosses buffer boundary */ - struct __sbuf _lb; /* buffer for fgetline() */ - - /* Unix stdio files get aligned to block boundaries on fseek() */ - int _blksize; /* stat.st_blksize (may be != _bf._size) */ - int _offset; /* current lseek offset */ -} FILE; - -__BEGIN_DECLS -extern FILE __sF[]; -__END_DECLS - -#define __SLBF 0x0001 /* line buffered */ -#define __SNBF 0x0002 /* unbuffered */ -#define __SRD 0x0004 /* OK to read */ -#define __SWR 0x0008 /* OK to write */ - /* RD and WR are never simultaneously asserted */ -#define __SRW 0x0010 /* open for reading & writing */ -#define __SEOF 0x0020 /* found EOF */ -#define __SERR 0x0040 /* found error */ -#define __SMBF 0x0080 /* _buf is from malloc */ -#define __SAPP 0x0100 /* fdopen()ed in append mode */ -#define __SSTR 0x0200 /* this is an sprintf/snprintf string */ -#define __SOPT 0x0400 /* do fseek() optimisation */ -#define __SNPT 0x0800 /* do not do fseek() optimisation */ -#define __SOFF 0x1000 /* set iff _offset is in fact correct */ -#define __SMOD 0x2000 /* true => fgetline modified _p text */ - -/* - * The following three definitions are for ANSI C, which took them - * from System V, which brilliantly took internal interface macros and - * made them official arguments to setvbuf(), without renaming them. - * Hence, these ugly _IOxxx names are *supposed* to appear in user code. - * - * Although numbered as their counterparts above, the implementation - * does not rely on this. - */ -#define _IOFBF 0 /* setvbuf should set fully buffered */ -#define _IOLBF 1 /* setvbuf should set line buffered */ -#define _IONBF 2 /* setvbuf should set unbuffered */ - -#define BUFSIZ 1024 /* size of buffer used by setbuf */ -#define EOF (-1) - -/* - * FOPEN_MAX is a minimum maximum, and should be the number of descriptors - * that the kernel can provide without allocation of a resource that can - * fail without the process sleeping. Do not use this for anything. - */ -#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */ -#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */ - -/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ -#ifndef _ANSI_SOURCE -#define P_tmpdir "/var/tmp/" -#endif -#define L_tmpnam 1024 /* XXX must be == PATH_MAX */ -#ifndef TMP_MAX -#define TMP_MAX 308915776 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 /* set file offset to offset */ -#endif -#ifndef SEEK_CUR -#define SEEK_CUR 1 /* set file offset to current plus offset */ -#endif -#ifndef SEEK_END -#define SEEK_END 2 /* set file offset to EOF plus offset */ -#endif - -#define stdin (&__sF[0]) -#define stdout (&__sF[1]) -#define stderr (&__sF[2]) - -/* - * Functions defined in ANSI C standard. - */ -__BEGIN_DECLS -void clearerr __P((FILE *)); -int fclose __P((FILE *)); -int feof __P((FILE *)); -int ferror __P((FILE *)); -int fflush __P((FILE *)); -int fgetc __P((FILE *)); -int fgetpos __P((FILE *, fpos_t *)); -char * fgets __P((char *, size_t, FILE *)); -FILE * fopen __P((const char *, const char *)); -int fprintf __P((FILE *, const char *, ...)); -int fputc __P((int, FILE *)); -int fputs __P((const char *, FILE *)); -size_t fread __P((void *, size_t, size_t, FILE *)); -FILE * freopen __P((const char *, const char *, FILE *)); -int fscanf __P((FILE *, const char *, ...)); -int fseek __P((FILE *, long, int)); -int fsetpos __P((FILE *, const fpos_t *)); -long ftell __P((const FILE *)); -size_t fwrite __P((const void *, size_t, size_t, FILE *)); -int getc __P((FILE *)); -int getchar __P((void)); -char * gets __P((char *)); - -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -extern int sys_nerr; /* perror(3) external variables */ -extern const char *const sys_errlist[]; -#endif - -void perror __P((const char *)); -int printf __P((const char *, ...)); -int putc __P((int, FILE *)); -int putchar __P((int)); -int puts __P((const char *)); -int remove __P((const char *)); -int rename __P((const char *, const char *)); -void rewind __P((FILE *)); -int scanf __P((const char *, ...)); -void setbuf __P((FILE *, char *)); -int setvbuf __P((FILE *, char *, int, size_t)); -int sprintf __P((char *, const char *, ...)); -int sscanf __P((const char *, const char *, ...)); -FILE *tmpfile __P((void)); -char *tmpnam __P((char *)); -int ungetc __P((int, FILE *)); -int vfprintf __P((FILE *, const char *, va_list)); -int vprintf __P((const char *, va_list)); -int vsprintf __P((char *, const char *, va_list)); -__END_DECLS - -/* - * Functions defined in POSIX 1003.1. - */ -#ifndef _ANSI_SOURCE -#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */ -#define L_cuserid 9 /* size for cuserid(); UT_NAMESIZE + 1 */ - -__BEGIN_DECLS -char *ctermid __P((char *)); -char *cuserid __P((char *)); -FILE *fdopen __P((int, const char *)); -int fileno __P((FILE *)); -__END_DECLS -#endif /* not ANSI */ - -/* - * Routines that are purely local. - */ -#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -__BEGIN_DECLS -char *fgetline __P((FILE *, size_t *)); -int fpurge __P((FILE *)); -int getw __P((FILE *)); -int pclose __P((FILE *)); -FILE *popen __P((const char *, const char *)); -int putw __P((int, FILE *)); -void setbuffer __P((FILE *, char *, int)); -int setlinebuf __P((FILE *)); -char *tempnam __P((const char *, const char *)); -int snprintf __P((char *, size_t, const char *, ...)); -int vsnprintf __P((char *, size_t, const char *, va_list)); -int vscanf __P((const char *, va_list)); -int vsscanf __P((const char *, const char *, va_list)); -__END_DECLS - -/* - * This is a #define because the function is used internally and - * (unlike vfscanf) the name __svfscanf is guaranteed not to collide - * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. - */ -#define vfscanf __svfscanf - -/* - * Stdio function-access interface. - */ -__BEGIN_DECLS -FILE *funopen __P((const void *, - int (*)(void *, char *, int), - int (*)(void *, const char *, int), - fpos_t (*)(void *, fpos_t, int), - int (*)(void *))); -__END_DECLS -#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) -#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) -#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ - -/* - * Functions internal to the implementation. - */ -__BEGIN_DECLS -int __srget __P((FILE *)); -int __svfscanf __P((FILE *, const char *, va_list)); -int __swbuf __P((int, FILE *)); -void flockfile __P((const FILE *)); -void funlockfile __P((const FILE *)); -__END_DECLS - -/* - * The __sfoo macros are here so that we can - * define function versions in the C library. - */ -#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) -static __inline int __getc(FILE *_p) -{ - int ret; - flockfile(_p); - ret = __sgetc(_p); - funlockfile(_p); - return(ret); -} - -#define getc(fp) __gets(fp) -#define getchar() getc(stdin) -#define getc_unlocked(fp) __sgetc(fp) -#define getchar_unlocked() getc_unlocked(stdin) - -static __inline int __sputc(int _c, FILE *_p) -{ - if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) - return (*_p->_p++ = _c); - else - return (__swbuf(_c, _p)); -} - -static __inline int __putc(int _c, FILE *_p) -{ - int ret; - flockfile(_p); - ret = __sputc(_c, _p); - funlockfile(_p); - return(ret); -} - -#define putc(x, fp) __putc(x, fp); -#define putchar(x) putc(x, stdout) -#define putc_unlocked(x, fp) __sputc(x, fp) -#define putchar_unlocked(x) putc_unlocked(x, stdout) - -#define __sfeof(p) (((p)->_flags & __SEOF) != 0) -#define __sferror(p) (((p)->_flags & __SERR) != 0) -#define __sfileno(p) ((p)->_file) - -#define feof(p) __sfeof(p) -#define ferror(p) __sferror(p) - -#ifndef _ANSI_SOURCE -#define fileno(p) __sfileno(p) -#endif - -#endif diff --git a/lib/libpthread/include/util.h b/lib/libpthread/include/util.h deleted file mode 100644 index bdd9106efef..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.3 1994/02/07 22:02:38 proven 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 |
