From e2fd3d3f05809ebcc08e7edfea34f12442e95d8c Mon Sep 17 00:00:00 2001 From: Peter Galbavy Date: Tue, 21 Jul 1998 16:28:49 +0000 Subject: move unchanged files from machdep/ into appropriate arch/${MACHINE} directories. These files have been renamed as appropriate, but hackers of these files should note those that started off as netbsd files (alpha and sparc). also moved machdep/openbsd-2.0/ to include/sys/ --- lib/libpthread/Makefile | 19 +- lib/libpthread/arch/alpha/machdep.c | 204 ++++++++++++++++++ lib/libpthread/arch/alpha/machdep.h | 111 ++++++++++ lib/libpthread/arch/alpha/syscall-template.S | 46 ++++ lib/libpthread/arch/alpha/syscall.S | 224 +++++++++++++++++++ lib/libpthread/arch/i386/machdep.c | 115 ++++++++-- lib/libpthread/arch/i386/machdep.h | 99 ++++++--- lib/libpthread/arch/i386/syscall-template.S | 48 +++++ lib/libpthread/arch/i386/syscall.S | 211 +++++++++++------- lib/libpthread/arch/m68k/machdep.h | 52 +++-- lib/libpthread/arch/sparc/syscall-template.S | 40 ++++ lib/libpthread/arch/sparc/syscall.S | 102 +++++++++ lib/libpthread/gen/Makefile.inc | 24 +-- lib/libpthread/include/sys/__math.h | 6 + lib/libpthread/include/sys/__path.h | 14 ++ lib/libpthread/include/sys/__signal.h | 8 + lib/libpthread/include/sys/__stdio.h | 8 + lib/libpthread/include/sys/__stdlib.h | 66 ++++++ lib/libpthread/include/sys/__string.h | 21 ++ lib/libpthread/include/sys/__time.h | 70 ++++++ lib/libpthread/include/sys/__unistd.h | 109 ++++++++++ lib/libpthread/include/sys/compat.h | 43 ++++ lib/libpthread/include/sys/dirent.h | 64 ++++++ lib/libpthread/include/sys/errno.h | 160 ++++++++++++++ lib/libpthread/include/sys/timers.h | 45 ++++ lib/libpthread/include/sys/wait.h | 162 ++++++++++++++ lib/libpthread/machdep/engine-alpha-netbsd-1.3.c | 204 ------------------ lib/libpthread/machdep/engine-alpha-netbsd-1.3.h | 111 ---------- lib/libpthread/machdep/engine-i386-openbsd-2.0.c | 215 ------------------- lib/libpthread/machdep/engine-i386-openbsd-2.0.h | 97 --------- lib/libpthread/machdep/engine-m68000-netbsd.h | 77 ------- lib/libpthread/machdep/openbsd-2.0/__math.h | 6 - lib/libpthread/machdep/openbsd-2.0/__path.h | 14 -- lib/libpthread/machdep/openbsd-2.0/__signal.h | 8 - lib/libpthread/machdep/openbsd-2.0/__stdio.h | 8 - lib/libpthread/machdep/openbsd-2.0/__stdlib.h | 66 ------ lib/libpthread/machdep/openbsd-2.0/__string.h | 21 -- lib/libpthread/machdep/openbsd-2.0/__time.h | 70 ------ lib/libpthread/machdep/openbsd-2.0/__unistd.h | 109 ---------- lib/libpthread/machdep/openbsd-2.0/compat.h | 43 ---- lib/libpthread/machdep/openbsd-2.0/dirent.h | 64 ------ lib/libpthread/machdep/openbsd-2.0/errno.h | 160 -------------- lib/libpthread/machdep/openbsd-2.0/timers.h | 45 ---- lib/libpthread/machdep/openbsd-2.0/wait.h | 162 -------------- lib/libpthread/machdep/posix-openbsd-2.0.h | 31 --- lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S | 224 ------------------- lib/libpthread/machdep/syscall-i386-openbsd-2.0.S | 237 --------------------- lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S | 102 --------- .../machdep/syscall-template-alpha-netbsd-1.3.S | 46 ---- .../machdep/syscall-template-i386-openbsd-2.0.S | 48 ----- .../machdep/syscall-template-sparc-netbsd-1.1.S | 40 ---- lib/libpthread/net/Makefile.inc | 5 +- lib/libpthread/pthreads/Makefile.inc | 64 +++++- lib/libpthread/stdio/Makefile.inc | 16 +- lib/libpthread/stdlib/Makefile.inc | 7 +- lib/libpthread/string/Makefile.inc | 4 +- 56 files changed, 1982 insertions(+), 2393 deletions(-) create mode 100644 lib/libpthread/arch/alpha/machdep.c create mode 100644 lib/libpthread/arch/alpha/machdep.h create mode 100644 lib/libpthread/arch/alpha/syscall-template.S create mode 100644 lib/libpthread/arch/alpha/syscall.S create mode 100644 lib/libpthread/arch/i386/syscall-template.S create mode 100644 lib/libpthread/arch/sparc/syscall-template.S create mode 100644 lib/libpthread/arch/sparc/syscall.S create mode 100644 lib/libpthread/include/sys/__math.h create mode 100644 lib/libpthread/include/sys/__path.h create mode 100644 lib/libpthread/include/sys/__signal.h create mode 100644 lib/libpthread/include/sys/__stdio.h create mode 100644 lib/libpthread/include/sys/__stdlib.h create mode 100644 lib/libpthread/include/sys/__string.h create mode 100644 lib/libpthread/include/sys/__time.h create mode 100644 lib/libpthread/include/sys/__unistd.h create mode 100644 lib/libpthread/include/sys/compat.h create mode 100644 lib/libpthread/include/sys/dirent.h create mode 100644 lib/libpthread/include/sys/errno.h create mode 100644 lib/libpthread/include/sys/timers.h create mode 100644 lib/libpthread/include/sys/wait.h delete mode 100644 lib/libpthread/machdep/engine-alpha-netbsd-1.3.c delete mode 100644 lib/libpthread/machdep/engine-alpha-netbsd-1.3.h delete mode 100644 lib/libpthread/machdep/engine-i386-openbsd-2.0.c delete mode 100644 lib/libpthread/machdep/engine-i386-openbsd-2.0.h delete mode 100644 lib/libpthread/machdep/engine-m68000-netbsd.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__math.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__path.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__signal.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__stdio.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__stdlib.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__string.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__time.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/__unistd.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/compat.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/dirent.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/errno.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/timers.h delete mode 100755 lib/libpthread/machdep/openbsd-2.0/wait.h delete mode 100644 lib/libpthread/machdep/posix-openbsd-2.0.h delete mode 100644 lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S delete mode 100644 lib/libpthread/machdep/syscall-i386-openbsd-2.0.S delete mode 100644 lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S delete mode 100644 lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S delete mode 100644 lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S delete mode 100644 lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index 0af5927b9b2..866c4456a5c 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -2,16 +2,19 @@ # @(#)Makefile 5.2 (Berkeley) 3/5/91 # +.include + LIB=pthread NOPIC= no -CPPFLAGS+= -DPTHREAD_KERNEL -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE_ARCH} +CPPFLAGS+= -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE_ARCH} -.include "${srcdir}/pthreads/Makefile.inc" -.include "${srcdir}/stdlib/Makefile.inc" -.include "${srcdir}/stdio/Makefile.inc" -.include "${srcdir}/string/Makefile.inc" -.include "${srcdir}/gen/Makefile.inc" -.include "${srcdir}/net/Makefile.inc" -.include "${srcdir}/scripts/Makefile.inc" +.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc" +#.include "${.CURDIR}/pthreads/Makefile.inc" +#.include "${.CURDIR}/stdlib/Makefile.inc" +#.include "${.CURDIR}/stdio/Makefile.inc" +#.include "${.CURDIR}/string/Makefile.inc" +#.include "${.CURDIR}/gen/Makefile.inc" +#.include "${.CURDIR}/net/Makefile.inc" +#.include "${.CURDIR}/scripts/Makefile.inc" .include diff --git a/lib/libpthread/arch/alpha/machdep.c b/lib/libpthread/arch/alpha/machdep.c new file mode 100644 index 00000000000..0932c421ea2 --- /dev/null +++ b/lib/libpthread/arch/alpha/machdep.c @@ -0,0 +1,204 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for NetBSD/Alpha 1.1(+) + * + * 1.00 93/08/04 proven + * -Started coding this file. + * + * 95/04/22 cgd + * -Modified to make it go with NetBSD/Alpha + */ + +#ifndef lint +static const char rcsid[] = "engine-alpha-osf1.c,v 1.4.4.1 1995/12/13 05:41:37 proven Exp"; +#endif + +#include +#include +#include +#include +#include +#include +#include + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return __machdep_save_int_state(pthread_run->machdep_data.machdep_istate); +} + +void machdep_restore_state(void) +{ + __machdep_restore_int_state(pthread_run->machdep_data.machdep_istate); +} + +void machdep_save_float_state (void) +{ + __machdep_save_fp_state(pthread_run->machdep_data.machdep_fstate); +} + +void machdep_restore_float_state (void) +{ + __machdep_restore_fp_state(pthread_run->machdep_data.machdep_fstate); +} + +/* ========================================================================== + * machdep_set_thread_timer() + */ +void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) +{ + if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) { + PANIC(); + } +} + +/* ========================================================================== + * machdep_unset_thread_timer() + */ +void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) +{ + struct itimerval zeroval = { { 0, 0 }, { 0, 0} }; + + if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { + PANIC(); + } +} + +/* ========================================================================== + * machdep_pthread_cleanup() + */ +void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) +{ + return(machdep_pthread->machdep_stack); +} + +/* ========================================================================== + * machdep_pthread_start() + */ +void machdep_pthread_start(void) +{ + context_switch_done(); + pthread_sched_resume (); + + /* Run current threads start routine with argument */ + pthread_exit(pthread_run->machdep_data.start_routine + (pthread_run->machdep_data.start_argument)); + + /* should never reach here */ + PANIC(); +} + +/* ========================================================================== + * __machdep_stack_free() + */ +void __machdep_stack_free(void * stack) +{ + free(stack); +} + +/* ========================================================================== + * __machdep_stack_alloc() + */ +void * __machdep_stack_alloc(size_t size) +{ + void * stack; + + return(malloc(size)); +} + +/* ========================================================================== + * __machdep_pthread_create() + */ +void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, + long stack_size, long nsec, long flags) +{ + machdep_pthread->start_routine = start_routine; + machdep_pthread->start_argument = start_argument; + + machdep_pthread->machdep_timer.it_value.tv_sec = 0; + machdep_pthread->machdep_timer.it_interval.tv_sec = 0; + machdep_pthread->machdep_timer.it_interval.tv_usec = 0; + machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; + + /* Set up new stack frame so that it looks like it returned from a + longjmp() to the beginning of machdep_pthread_start(). */ + machdep_pthread->machdep_istate[8/*ISTATE_RA*/] = 0; + machdep_pthread->machdep_istate[0/*ISTATE_PC*/] = (long)machdep_pthread_start; + machdep_pthread->machdep_istate[10/*ISTATE_PV*/] = (long)machdep_pthread_start; + + /* Alpha stack starts high and builds down. */ + { + long stk_addr = (long) machdep_pthread->machdep_stack; + stk_addr += stack_size - 1024; + stk_addr &= ~15; + machdep_pthread->machdep_istate[9/*ISTATE_SP*/] = stk_addr; + } +} + +int safe_store (loc, new) + int *loc; + int new; +{ + int locked, old; + asm ("mb" : : : "memory"); + do { + asm ("ldl_l %0,%1" : "=r" (old) : "m" (*loc)); + asm ("stl_c %0,%1" : "=r" (locked), "=m" (*loc) : "0" (new)); + } while (!locked); + asm ("mb" : : : "memory"); + return old; +} + +/* ========================================================================== + * machdep_sys_creat() + */ +machdep_sys_creat(char * path, int mode) +{ + return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +machdep_sys_wait3(int * b, int c, int * d) +{ + return(machdep_sys_wait4(0, b, c, d)); +} + +/* ========================================================================== + * machdep_sys_waitpid() + */ +machdep_sys_waitpid(int a, int * b, int c) +{ + return(machdep_sys_wait4(a, b, c, NULL)); +} + +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +machdep_sys_getdtablesize() +{ + return(sysconf(_SC_OPEN_MAX)); +} + +/* ========================================================================== + * machdep_sys_lseek() + */ +off_t machdep_sys_lseek(int fd, off_t offset, int whence) +{ + extern off_t __syscall(); + + return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); +} + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + return(machdep_sys_getdents(fd, buf, len)); +} diff --git a/lib/libpthread/arch/alpha/machdep.h b/lib/libpthread/arch/alpha/machdep.h new file mode 100644 index 00000000000..50c872da7b6 --- /dev/null +++ b/lib/libpthread/arch/alpha/machdep.h @@ -0,0 +1,111 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1994 Chris Provenzano (proven@athena.mit.edu) and + * Ken Raeburn (raeburn@mit.edu). + * + * engine-alpha-osf1.h,v 1.4.4.1 1995/12/13 05:41:42 proven Exp + * + */ + +#include +#include +#include +#include + +/* The first machine dependent functions are the SEMAPHORES needing + the test and set instruction. + + On the Alpha, the actual values here are irrelevant; they just have + to be different. */ +#define SEMAPHORE_CLEAR 0 +#define SEMAPHORE_SET 1 + +#if 0 +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ int *_sem_lock = (lock), locked, old; \ + asm ("mb" : : : "memory"); \ + do { asm ("ldl_l %0,%1" : "=r" (old) : "m" (*_sem_lock)); \ + /* ?? if (old != SEMAPHORE_CLEAR) break; */ \ + asm ("stl_c %0,%1" : "=r" (locked), "=m" (*_sem_lock) \ + : "0" (SEMAPHORE_SET)); \ + } while (!locked); \ + asm ("mb" : : : "memory"); \ + old == SEMAPHORE_CLEAR; }) + +#define SEMAPHORE_RESET(lock) \ +({ int *_sem_lock = (lock); \ + *_sem_lock = SEMAPHORE_CLEAR; \ + asm ("mb" : : : "memory"); }) +#endif + +/* + * New types + */ +typedef int semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#define SIGMAX 31 + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + unsigned long machdep_istate[11]; + unsigned long machdep_fstate[9]; +}; + +/* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ + { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } + +/* + * Minimum stack size + */ +#define PTHREAD_STACK_MIN 2048 + +/* + * 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) + +#define __machdep_stack_get(x) (x)->machdep_stack +#define __machdep_stack_set(x, y) (x)->machdep_stack = y +#define __machdep_stack_repl(x, y) \ +{ \ + if (stack = __machdep_stack_get(x)) { \ + __machdep_stack_free(stack); \ + } \ + __machdep_stack_set(x, y); \ +} + +void * __machdep_stack_alloc __P_((size_t)); +void __machdep_stack_free __P_((void *)); + +int machdep_save_state __P_((void)); + +int __machdep_save_int_state __P_((unsigned long *)); +void __machdep_restore_int_state __P_((unsigned long *)); +void __machdep_save_fp_state __P_((unsigned long *)); +void __machdep_restore_fp_state __P_((unsigned long *)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/arch/alpha/syscall-template.S b/lib/libpthread/arch/alpha/syscall-template.S new file mode 100644 index 00000000000..a2941ece7c9 --- /dev/null +++ b/lib/libpthread/arch/alpha/syscall-template.S @@ -0,0 +1,46 @@ +#include +#define COMPAT_43 +#include +#define CHMK() call_pal 0x83 + +#undef SYSCALL + +/* Kernel syscall interface: + Input: + v0 - system call number + a* - arguments, as in C + Output: + a3 - zero iff successful + v0 - errno value on failure, else result + + This macro is similar to SYSCALL in asm.h, but not completely. + There's room for optimization, if we assume this will continue to + be assembled as one file. + + This macro expansions does not include the return instruction. + If there's no other work to be done, use something like: + SYSCALL(foo) ; ret + If there is other work to do (in fork, maybe?), do it after the + SYSCALL invocation. */ + +#define SYSCALL(x) \ + .align 4 ;\ + .globl machdep_sys_##x ;\ + .ent machdep_sys_##x, 0 ;\ +machdep_sys_##x: ;\ + .frame sp,0,ra ;\ + ldiq v0, SYS_##x ;\ + CHMK() ;\ + beq a3, Lsys_noerr_##x ;\ + br gp, Lsys_err_##x ;\ +Lsys_err_##x: ;\ + /* Load gp so we can find cerror to jump to. */;\ + ldgp gp, 0(gp) ;\ + jmp zero, machdep_cerror ;\ +Lsys_noerr_##x: + +#define SIMPLE_SYSCALL(x) SYSCALL(x) ; ret ; .end machdep_sys_##x + +#define XSYSCALL(x) SIMPLE_SYSCALL(x) + +XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/arch/alpha/syscall.S b/lib/libpthread/arch/alpha/syscall.S new file mode 100644 index 00000000000..eda44311281 --- /dev/null +++ b/lib/libpthread/arch/alpha/syscall.S @@ -0,0 +1,224 @@ +#include +#define CHMK() call_pal 0x83 +#define COMPAT_43 +#include +#ifndef __CONCAT +#include +#endif +#define CONCAT __CONCAT + +#undef SYSCALL + +/* Kernel syscall interface: + Input: + v0 - system call number + a* - arguments, as in C + Output: + a3 - zero iff successful + v0 - errno value on failure, else result + + This macro is similar to SYSCALL in asm.h, but not completely. + There's room for optimization, if we assume this will continue to + be assembled as one file. + + This macro expansions does not include the return instruction. + If there's no other work to be done, use something like: + SYSCALL(foo) ; ret + If there is other work to do (in fork, maybe?), do it after the + SYSCALL invocation. */ + +#define SYSCALL(x) \ + .align 4 ;\ + .globl CONCAT(machdep_sys_,x) ;\ + .ent CONCAT(machdep_sys_,x), 0 ;\ +CONCAT(machdep_sys_,x): ;\ + .frame sp,0,ra ;\ + ldiq v0, CONCAT(SYS_,x) ;\ + CHMK() ;\ + beq a3, CONCAT(Lsys_noerr_,x) ;\ + br gp, CONCAT(Lsys_err_,x) ;\ +CONCAT(Lsys_err_,x): ;\ + /* Load gp so we can find cerror to jump to. */;\ + ldgp gp, 0(gp) ;\ + jmp zero, machdep_cerror ;\ +CONCAT(Lsys_noerr_,x): + +#define XSYSCALL(x) SYSCALL(x) ; RET ; .end CONCAT(machdep_sys_,x) + + .globl machdep_cerror +machdep_cerror: + br t0, Lmachdep_cerror_setgp +Lmachdep_cerror_setgp: + ldgp gp, 0(t0) + stl v0, errno +#if 0 + ldiq v0, -1 +#else + subq zero, v0, v0 +#endif + RET + +/* The fork system call is special... */ +SYSCALL(fork) + cmovne a4, 0, v0 + RET + .end machdep_sys_fork + +/* The pipe system call is special... */ +SYSCALL(pipe) + stl v0, 0(a0) + stl a4, 4(a0) + mov zero, v0 + RET + .end machdep_sys_pipe + +/* The sigsuspend system call is special... */ + .align 4 + .globl machdep_sys_sigsuspend + .ent machdep_sys_sigsuspend, 0 +machdep_sys_sigsuspend: + ldl a0, 0(a0) /* pass *mask instead of mask */ + ldiq v0, SYS_sigsuspend + CHMK() + mov zero, v0 /* shouldn't need; just in case... */ + RET + .end machdep_sys_sigsuspend + +/* The sigprocmask system call is special... */ + .align 4 + .globl machdep_sys_sigprocmask + .ent machdep_sys_sigprocmask, 0 +machdep_sys_sigprocmask: + mov a2, a5 /* safe */ + cmoveq a1, 1, a0 /* if set == NULL, how = SIG_BLOCK */ + beq a1, Ldoit /* and set = 0, and do it. */ + ldl a1, 0(a1) /* load the set from *set */ +Ldoit: ldiq v0, SYS_sigprocmask + CHMK() + beq a5, Lret /* if they don't want old mask, done */ + stl v0, 0(a5) /* otherwise, give it to them. */ +Lret: mov zero, v0 + RET + .end machdep_sys_sigprocmask + +/* More stuff ... */ + .align 4 + .global __machdep_save_int_state + .ent __machdep_save_int_state, 0 +__machdep_save_int_state: + .frame sp, 16, ra + ldgp gp, 0(t12) + lda sp, -16(sp) + stq ra, 0(sp) + + /* save integer registers */ + stq ra, ( 0 * 8)(a0) /* return address */ + stq s0, ( 1 * 8)(a0) /* callee-saved registers */ + stq s1, ( 2 * 8)(a0) + stq s2, ( 3 * 8)(a0) + stq s3, ( 4 * 8)(a0) + stq s4, ( 5 * 8)(a0) + stq s5, ( 6 * 8)(a0) + stq s6, ( 7 * 8)(a0) + stq sp, ( 9 * 8)(a0) + stq ra, ( 8 * 8)(a0) /* RA on return */ + stq pv, (10 * 8)(a0) /* and PV; we restore it */ + + mov zero, v0 + lda sp, 16(sp) + RET + .end __machdep_save_int_state + + .align 4 + .global __machdep_restore_int_state + .ent __machdep_restore_int_state, 0 +__machdep_restore_int_state: + .frame sp, 16, ra + ldgp gp, 0(t12) + lda sp, -16(sp) + stq ra, 0(sp) + + /* restore integer registers */ + ldq t0, ( 0 * 8)(a0) /* return address */ + ldq s0, ( 1 * 8)(a0) /* callee-saved registers */ + ldq s1, ( 2 * 8)(a0) + ldq s2, ( 3 * 8)(a0) + ldq s3, ( 4 * 8)(a0) + ldq s4, ( 5 * 8)(a0) + ldq s5, ( 6 * 8)(a0) + ldq s6, ( 7 * 8)(a0) + ldq ra, ( 8 * 8)(a0) /* RA after return */ + ldq sp, ( 9 * 8)(a0) + ldq pv, (10 * 8)(a0) /* and PV; we restore it */ + + ldiq v0, 1 + ret zero,(t0),1 + .end __machdep_restore_int_state + + .align 4 + .global __machdep_save_fp_state + .ent __machdep_save_fp_state, 0 +__machdep_save_fp_state: + .frame sp, 16, ra + ldgp gp, 0(t12) + lda sp, -16(sp) + stq ra, 0(sp) + + /* save FP registers */ + stt fs0, (0 * 8)(a0) /* callee-saved registers */ + stt fs1, (1 * 8)(a0) + stt fs2, (2 * 8)(a0) + stt fs3, (3 * 8)(a0) + stt fs4, (4 * 8)(a0) + stt fs5, (5 * 8)(a0) + stt fs6, (6 * 8)(a0) + stt fs7, (7 * 8)(a0) + mf_fpcr ft0 /* and FP control reg */ + stt ft0, (8 * 8)(a0) + + lda sp, 16(sp) + RET + .end __machdep_save_fp_state + + .align 4 + .global __machdep_restore_fp_state + .ent __machdep_restore_fp_state, 0 +__machdep_restore_fp_state: + .frame sp, 16, ra + ldgp gp, 0(t12) + lda sp, -16(sp) + stq ra, 0(sp) + + /* restore FP registers */ + ldt fs0, (0 * 8)(a0) /* callee-saved registers */ + ldt fs1, (1 * 8)(a0) + ldt fs2, (2 * 8)(a0) + ldt fs3, (3 * 8)(a0) + ldt fs4, (4 * 8)(a0) + ldt fs5, (5 * 8)(a0) + ldt fs6, (6 * 8)(a0) + ldt fs7, (7 * 8)(a0) + ldt ft0, (8 * 8)(a0) + mt_fpcr ft0 /* and FP control reg */ + + lda sp, 16(sp) + RET + .end __machdep_restore_fp_state + +/* For fstat() we actually syscall fstat13. */ + .align 4 + .globl machdep_sys_fstat + .ent machdep_sys_fstat, 0 +machdep_sys_fstat: + .frame sp,0,ra + ldiq v0, SYS___fstat13 + CHMK() + beq a3, Lsys_noerr_fstat + br gp, Lsys_err_fstat +Lsys_err_fstat: + /* Load gp so we can find cerror to jump to. */ + ldgp gp, 0(gp) + jmp zero, machdep_cerror +Lsys_noerr_fstat: + RET + .end machdep_sys_fstat diff --git a/lib/libpthread/arch/i386/machdep.c b/lib/libpthread/arch/i386/machdep.c index 2437cead1b1..09ff0072fdc 100644 --- a/lib/libpthread/arch/i386/machdep.c +++ b/lib/libpthread/arch/i386/machdep.c @@ -1,7 +1,5 @@ /* ==== machdep.c ============================================================ - * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu - * - * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,17 +36,32 @@ */ #ifndef lint -static const char rcsid[] = "$Id: machdep.c,v 1.1 1995/10/18 08:43:03 deraadt Exp $"; +static const char rcsid[] = "engine-i386-freebsd-2.0.c,v 1.1 1995/03/01 01:21:20 proven Exp"; #endif -#include "pthread.h" +#include +#include +#include +#include +#include +#include /* ========================================================================== * machdep_save_state() */ int machdep_save_state(void) { - return(_setjmp(pthread_run->machdep_data.machdep_state)); + return(machdep_sys_setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_float_state(struct pthread * pthread) +{ + char * fdata = (char *)pthread->machdep_data.machdep_float_state; + + __asm__ ("fsave %0"::"m" (*fdata)); } /* ========================================================================== @@ -56,7 +69,17 @@ int machdep_save_state(void) */ void machdep_restore_state(void) { - _longjmp(pthread_run->machdep_data.machdep_state, 1); + machdep_sys_longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * machdep_restore_float_state() + */ +int machdep_restore_float_state(void) +{ + char * fdata = (char *)pthread_run->machdep_data.machdep_float_state; + + __asm__ ("frstor %0"::"m" (*fdata)); } /* ========================================================================== @@ -74,11 +97,19 @@ void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) */ void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) { - struct itimerval zeroval = { { 0, 0 }, { 0, 0} }; - - if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { - PANIC(); + struct itimerval zeroval = { { 0, 0 }, { 0, 0 } }; + int ret; + + if (machdep_pthread) { + ret = setitimer(ITIMER_VIRTUAL, &zeroval, + &(machdep_pthread->machdep_timer)); + } else { + ret = setitimer(ITIMER_VIRTUAL, &zeroval, NULL); } + + if (ret) { + PANIC(); + } } /* ========================================================================== @@ -95,7 +126,7 @@ void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) void machdep_pthread_start(void) { context_switch_done(); - sig_check_and_resume(); + pthread_sched_resume(); /* Run current threads start routine with argument */ pthread_exit(pthread_run->machdep_data.start_routine @@ -106,14 +137,30 @@ void machdep_pthread_start(void) } /* ========================================================================== - * machdep_pthread_create() + * __machdep_stack_free() + */ +void __machdep_stack_free(void * stack) +{ + free(stack); +} + +/* ========================================================================== + * __machdep_stack_alloc() */ -void machdep_pthread_create(struct machdep_pthread *machdep_pthread, - void *(* start_routine)(), void *start_argument, long stack_size, - void *stack_start, long nsec) +void * __machdep_stack_alloc(size_t size) { - machdep_pthread->machdep_stack = stack_start; + void * stack; + + return(malloc(size)); +} +/* ========================================================================== + * __machdep_pthread_create() + */ +void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, + long stack_size, long nsec, long flags) +{ machdep_pthread->start_routine = start_routine; machdep_pthread->start_argument = start_argument; @@ -122,7 +169,7 @@ void machdep_pthread_create(struct machdep_pthread *machdep_pthread, machdep_pthread->machdep_timer.it_interval.tv_usec = 0; machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; - _setjmp(machdep_pthread->machdep_state); + machdep_sys_setjmp(machdep_pthread->machdep_state); /* * Set up new stact frame so that it looks like it * returned from a longjmp() to the beginning of @@ -134,3 +181,35 @@ void machdep_pthread_create(struct machdep_pthread *machdep_pthread, machdep_pthread->machdep_state[2] = (int)machdep_pthread->machdep_stack + stack_size; } + +/* ========================================================================== + * machdep_sys_creat() + */ +machdep_sys_creat(char * path, int mode) +{ + return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +machdep_sys_wait3(int * b, int c, int * d) +{ + return(machdep_sys_wait4(0, b, c, d)); +} + +/* ========================================================================== + * machdep_sys_waitpid() + */ +machdep_sys_waitpid(int a, int * b, int c) +{ + return(machdep_sys_wait4(a, b, c, NULL)); +} + +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +machdep_sys_getdtablesize() +{ + return(sysconf(_SC_OPEN_MAX)); +} diff --git a/lib/libpthread/arch/i386/machdep.h b/lib/libpthread/arch/i386/machdep.h index 10521b02235..41a3a553cc0 100644 --- a/lib/libpthread/arch/i386/machdep.h +++ b/lib/libpthread/arch/i386/machdep.h @@ -1,36 +1,13 @@ /* ==== machdep.h ============================================================ - * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu - * All rights reserved. + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu * - * 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: machdep.h,v 1.2 1998/07/21 16:28:02 peter Exp $ * */ +#include +#include +#include /* * The first machine dependent functions are the SEMAPHORES @@ -41,9 +18,9 @@ #define SEMAPHORE_TEST_AND_SET(lock) \ ({ \ -volatile long temp = SEMAPHORE_SET; \ +long temp = SEMAPHORE_SET; \ \ -__asm__("xchgl %0,(%2)" \ +__asm__ volatile ("xchgl %0,(%2)" \ :"=r" (temp) \ :"0" (temp),"r" (lock)); \ temp; \ @@ -51,8 +28,70 @@ temp; \ #define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR +/* + * New types + */ +typedef long semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#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; + char machdep_float_state[108]; +}; + +/* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ +{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } + /* * Minimum stack size */ #define PTHREAD_STACK_MIN 1024 +/* + * 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) + +#define __machdep_stack_get(x) (x)->machdep_stack +#define __machdep_stack_set(x, y) (x)->machdep_stack = y +#define __machdep_stack_repl(x, y) \ +{ \ + if (stack = __machdep_stack_get(x)) { \ + __machdep_stack_free(stack); \ + } \ + __machdep_stack_set(x, y); \ +} + +void * __machdep_stack_alloc __P_((size_t)); +void __machdep_stack_free __P_((void *)); + +int machdep_save_state __P_((void)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/arch/i386/syscall-template.S b/lib/libpthread/arch/i386/syscall-template.S new file mode 100644 index 00000000000..34fb5caaa43 --- /dev/null +++ b/lib/libpthread/arch/i386/syscall-template.S @@ -0,0 +1,48 @@ +#include + +#ifdef __STDC__ + +#define SYSCALL(x) \ + .globl _machdep_sys_##x##; \ + \ +_machdep_sys_##x:##; \ + \ + movl $(SYS_##x##), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jb 1b; \ + ret; + +#else + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +_machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jb 1b; \ + ret; + +#endif + + +/* + * Initial asm stuff for all functions. + */ + .text + .align 2 + + +/* ========================================================================== + * error code for all syscalls. The error value is returned as the negative + * of the errno value. + */ + +1: + neg %eax + ret + +#define XSYSCALL(NAME) SYSCALL(NAME) + +XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/arch/i386/syscall.S b/lib/libpthread/arch/i386/syscall.S index 1b91abed0c8..cfdbbc77f73 100644 --- a/lib/libpthread/arch/i386/syscall.S +++ b/lib/libpthread/arch/i386/syscall.S @@ -1,6 +1,6 @@ /* ==== syscall.S ============================================================ * Copyright (c) 1990 The Regents of the University of California. - * Copyright (c) 1993 Chris Provenzano, proven@mit.edu + * Copyright (c) 1995 Chris Provenzano, proven@mit.edu * All rights reserved. * * This code is derived from software contributed to Berkeley by @@ -36,25 +36,33 @@ * * Description : Machine dependent syscalls for i386/i486/i586 * - * 1.00 93/08/26 proven - * -Started coding this file. - * - * 1.01 93/11/13 proven - * -The functions readv() and writev() added. */ #ifndef lint - .text - .asciz "$Id: syscall.S,v 1.1 1995/10/18 08:43:03 deraadt Exp $"; + .text + .asciz "syscall-i386-freebsd-2.0.S,v 1.2 1995/05/26 07:44:29 proven Exp"; #endif #if defined(SYSLIBC_SCCS) && !defined(lint) .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" #endif /* SYSLIBC_SCCS and not lint */ -#include #include +#ifdef __STDC__ + +#define SYSCALL(x) \ + .globl _machdep_sys_##x##; \ + \ +_machdep_sys_##x##:; \ + \ + movl $(SYS_##x##), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jb 1b; \ + ret; + +#else + #define SYSCALL(x) \ .globl _machdep_sys_/**/x; \ \ @@ -65,6 +73,9 @@ _machdep_sys_/**/x:; \ jb 1b; \ ret; +#endif + + /* * Initial asm stuff for all functions. */ @@ -82,93 +93,145 @@ _machdep_sys_/**/x:; \ ret /* ========================================================================== - * machdep_sys_write() - */ -SYSCALL(write) - -/* ========================================================================== - * machdep_sys_read() + * machdep_sys_fork() */ -SYSCALL(read) + .globl _machdep_sys_fork; + +_machdep_sys_fork:; + + movl $(SYS_fork), %eax; + .byte 0x9a; .long 0; .word 7; + cmpl $0, %edx + je 2f + movl $0, %eax +2: + ret; /* ========================================================================== - * machdep_sys_open() + * machdep_sys___syscall() */ -SYSCALL(open) -/* ========================================================================== - * machdep_sys_close() - */ -SYSCALL(close) +_machdep_sys___syscall:; -/* ========================================================================== - * machdep_sys_fcntl() - */ -SYSCALL(fcntl) + movl $(SYS___syscall), %eax; + .byte 0x9a; .long 0; .word 7; + jb 3f; + ret /* ========================================================================== - * machdep_sys_lseek() - */ -SYSCALL(lseek) - -/* ========================================================================== - * Nonstandard calls used to make the system work - * - * ========================================================================== - * machdep_sys_select() + * machdep_sys_sigsuspend() */ -SYSCALL(select) + .globl _machdep_sys_sigsuspend; -/* ========================================================================== - * Berkeley socket stuff - * - * ========================================================================== - * machdep_sys_socket() - */ -SYSCALL(socket) +_machdep_sys_sigsuspend:; -/* ========================================================================== - * machdep_sys_bind() - */ -SYSCALL(bind) + movl 4(%esp),%eax # fetch mask arg + movl (%eax),%eax # indirect to mask arg + movl %eax,4(%esp) + movl $(SYS_sigsuspend), %eax; + .byte 0x9a; .long 0; .word 7; + jb 3f; + ret -/* ========================================================================== - * machdep_sys_connect() - */ -SYSCALL(connect) +3: + + neg %eax + movl $0xffffffff,%edx + ret /* ========================================================================== - * machdep_sys_accept() + * machdep_sys_sigprocmask() */ -SYSCALL(accept) + .globl _machdep_sys_sigprocmask; -/* ========================================================================== - * machdep_sys_listen() - */ -SYSCALL(listen) +_machdep_sys_sigprocmask:; -/* ========================================================================== - * machdep_sys_getsockopt() - */ -SYSCALL(getsockopt) - -/* ========================================================================== - * machdep_sys_readv() - */ -SYSCALL(readv) + movl 8(%esp),%ecx + movl (%ecx),%ecx + movl %ecx,8(%esp) + movl $ SYS_sigprocmask , %eax + .byte 0x9a; .long 0; .word 7; + jb 4f; + ret -/* ========================================================================== - * machdep_sys_writev() - */ -SYSCALL(writev) +4: + neg %eax + movl $0xffffffff,%edx + ret /* ========================================================================== - * machdep_sys_getpeername() + * machdep_sys_lseek() */ -SYSCALL(getpeername) + .globl _machdep_sys_lseek; + +_machdep_sys_lseek:; + + pushl %ebp; + movl %esp,%ebp; + pushl 0x14(%ebp); + pushl 0x10(%ebp); + pushl 0xc(%ebp); + pushl $0x0; + pushl 0x8(%ebp); + pushl $0x0; + pushl $(SYS_lseek); + call _machdep_sys___syscall; + leave + ret /* ========================================================================== - * machdep_sys_getsockname() + * machdep_sys_ftruncate() ; Added by Monty */ -SYSCALL(getsockname) + .globl _machdep_sys_ftruncate; + +_machdep_sys_ftruncate:; + + pushl %ebp; + movl %esp,%ebp; + pushl 0x10(%ebp); + pushl 0xc(%ebp); + pushl $0x0; # Why this? + pushl 0x8(%ebp); + pushl $0x0; # And this? + pushl $(SYS_ftruncate); + call _machdep_sys___syscall; + leave + ret + +/* ========================================================================== + * machdep_sys_setjmp() + */ + .globl _machdep_sys_setjmp; + +_machdep_sys_setjmp:; + movl 4(%esp),%eax + movl 0(%esp),%edx + movl %edx, 0(%eax) /* rta */ + movl %ebx, 4(%eax) + movl %esp, 8(%eax) + movl %ebp,12(%eax) + movl %esi,16(%eax) + movl %edi,20(%eax) + xorl %eax,%eax + ret + +/* ========================================================================== + * machdep_sys_longjmp() + */ + .globl _machdep_sys_longjmp; + +_machdep_sys_longjmp:; + movl 4(%esp),%edx + movl 8(%esp),%eax + movl 0(%edx),%ecx + movl 4(%edx),%ebx + movl 8(%edx),%esp + movl 12(%edx),%ebp + movl 16(%edx),%esi + movl 20(%edx),%edi + testl %eax,%eax + jnz 1f + incl %eax +1: movl %ecx,0(%esp) + ret diff --git a/lib/libpthread/arch/m68k/machdep.h b/lib/libpthread/arch/m68k/machdep.h index a63e77de0d3..72b42e45c7b 100644 --- a/lib/libpthread/arch/m68k/machdep.h +++ b/lib/libpthread/arch/m68k/machdep.h @@ -1,11 +1,10 @@ -/* $OpenBSD */ - /* ==== machdep.h ============================================================ * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu * - * $ I d: engine-m68000-netbsd.h,v 1.51 1994/11/08 15:39:15 proven Exp $ + * $Id: machdep.h,v 1.2 1998/07/21 16:28:05 peter Exp $ * */ + #include #include #include @@ -17,23 +16,52 @@ #define SEMAPHORE_CLEAR 0 #define SEMAPHORE_SET 0x80; -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ \ - volatile long temp = SEMAPHORE_CLEAR; \ - __asm__ volatile( \ - "tas %2; bpl 0f; movl #1,%0; 0:" \ - :"=r" (temp) \ - :"0" (temp),"m" (*lock)); \ - temp; \ +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ +volatile long temp = SEMAPHORE_CLEAR; \ + \ +__asm__ volatile("tas (%2); bpl 0f; movl #1,%0; 0:" \ + :"=r" (temp) \ + :"0" (temp),"r" (lock)); \ +temp; \ }) #define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR +/* + * New types + */ +typedef char semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#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; +}; + /* * Min pthread stacksize */ #define PTHREAD_STACK_MIN 1024 +/* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ +{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } + /* * New functions */ @@ -42,7 +70,7 @@ __BEGIN_DECLS #if defined(PTHREAD_KERNEL) -int machdep_save_state __P((void)); +int machdep_save_state __P_((void)); #endif diff --git a/lib/libpthread/arch/sparc/syscall-template.S b/lib/libpthread/arch/sparc/syscall-template.S new file mode 100644 index 00000000000..2d07892a315 --- /dev/null +++ b/lib/libpthread/arch/sparc/syscall-template.S @@ -0,0 +1,40 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#include + +#define SYSCALL(x) \ + .globl _machdep_sys_##x; \ + \ +_machdep_sys_##x:; \ + \ + mov SYS_##x, %g1; \ + ta 0; \ + bcs,a 2b; \ + sub %r0,%o0,%o0; \ + retl; \ + nop + +/* + * Initial asm stuff for all functions. + */ + .text + .align 4 + +/* ========================================================================== + * error code for all syscalls. The error value is returned as the negative + * of the errno value. + */ + +1: + sub %r0, %o0, %o0 +2: + retl + nop + +#define XSYSCALL(NAME) SYSCALL(NAME) + +XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/arch/sparc/syscall.S b/lib/libpthread/arch/sparc/syscall.S new file mode 100644 index 00000000000..9312ef7352a --- /dev/null +++ b/lib/libpthread/arch/sparc/syscall.S @@ -0,0 +1,102 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#ifndef lint + .text + .asciz "$Id: syscall.S,v 1.1 1998/07/21 16:28:06 peter Exp $"; +#endif + +#include + +#define SYSCALL(x) \ + .globl _machdep_sys_##x; \ + \ +_machdep_sys_##x:; \ + \ + mov SYS_##x, %g1; \ + ta 0; \ + bcs,a 2b; \ + sub %r0,%o0,%o0; \ + retl + + +/* + * Initial asm stuff for all functions. + */ + .text + .align 4 + +/* ========================================================================== + * error code for all syscalls. The error value is returned as the negative + * of the errno value. + */ + +1: + sub %r0, %o0, %o0 +2: + retl + nop + +/* ========================================================================== + * machdep_sys_pipe() + */ + .globl _machdep_sys_pipe + +_machdep_sys_pipe: + mov %o0, %o2 + mov SYS_pipe, %g1 + ta 0 + bcs 1b + nop + st %o0, [ %o2 ] + st %o1, [ %o2 + 4 ] + retl + mov %g0, %o0 + +/* ========================================================================== + * machdep_sys_fork() + */ + .globl _machdep_sys_fork; + +_machdep_sys_fork:; + + mov SYS_fork, %g1; + ta 0; + bcs 1b; + nop; + dec %o1; + retl; + and %o0, %o1, %o0; ! return 0 in child, pid in parent + +/* ========================================================================== + * machdep_sys_sigprocmask() + */ + .globl _machdep_sys_sigprocmask; + +_machdep_sys_sigprocmask:; + + ld [%o1], %o1; + mov SYS_sigprocmask, %g1; + ta 0; + bcs 1b; + nop; + retl + nop + +/* ========================================================================== + * machdep_sys_sigsuspend() + */ + .globl _machdep_sys_sigsuspend; + +_machdep_sys_sigsuspend:; + + ld [%o0], %o0; + mov SYS_sigsuspend, %g1; + ta 0; + bcs 1b; + nop; + retl + nop diff --git a/lib/libpthread/gen/Makefile.inc b/lib/libpthread/gen/Makefile.inc index 275955e9c86..a2e13b4a205 100644 --- a/lib/libpthread/gen/Makefile.inc +++ b/lib/libpthread/gen/Makefile.inc @@ -1,24 +1,8 @@ # from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 -# $Id: Makefile.inc,v 1.1 1998/07/21 13:19:02 peter Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:06 peter Exp $ -# gen sources -.PATH: ${srcdir}/gen +.PATH: ${.CURDIR}/gen SRCS+= ttyname.c isatty.c directory.c popen.c time.c ctime.c difftime.c \ - syslog.c eprintf.c getpwent.c getpwnamuid.c pwd_internal.c - -#SRCS+= alarm.c assert.c clock.c crypt.c ctermid.c ctype_.c \ -# disklabel.c err.c errlst.c exec.c fnmatch.c frexp.c \ -# fstab.c fts.c getcap.c getcwd.c getgrent.c getlogin.c getmntinfo.c \ -# getpass.c getpwent.c getsubopt.c getttyent.c getusershell.c glob.c \ -# infinity.c initgroups.c isatty.c isctype.c isinf.c mktemp.c nice.c \ -# nlist.c pause.c psignal.c raise.c \ -# scandir.c setjmperr.c \ -# setmode.c setrgid.c setruid.c siginterrupt.c \ -# siglist.c signal.c sigsetops.c syslog.c \ -# termios.c time.c times.c timezone.c ttyslot.c \ -# ualarm.c unvis.c utime.c valloc.c vis.c -# -# gen/regexp sources -#SRCS+= regerror.c regexp.c regsub.c - + syslog.c eprintf.c getpwent.c getpwnamuid.c pwd_internal.c getcwd.c \ + getwd.c diff --git a/lib/libpthread/include/sys/__math.h b/lib/libpthread/include/sys/__math.h new file mode 100644 index 00000000000..27ed0f2575d --- /dev/null +++ b/lib/libpthread/include/sys/__math.h @@ -0,0 +1,6 @@ +/* + * ANSI/POSIX + */ +extern char __infinity[]; +#define HUGE_VAL (*(double *) __infinity) + diff --git a/lib/libpthread/include/sys/__path.h b/lib/libpthread/include/sys/__path.h new file mode 100644 index 00000000000..e5a48d8ab73 --- /dev/null +++ b/lib/libpthread/include/sys/__path.h @@ -0,0 +1,14 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: __path.h,v 1.1 1998/07/21 16:28:08 peter Exp $ + */ + +#ifndef _SYS__PATH_H_ +#define _SYS__PATH_H_ + +#define _PATH_PTY "/dev/" +#define _PATH_TZDIR "/usr/share/zoneinfo" +#define _PATH_TZFILE "/etc/localtime" + +#endif /* !_SYS__PATH_H_ */ + diff --git a/lib/libpthread/include/sys/__signal.h b/lib/libpthread/include/sys/__signal.h new file mode 100644 index 00000000000..918955c9948 --- /dev/null +++ b/lib/libpthread/include/sys/__signal.h @@ -0,0 +1,8 @@ +#include + +#define __SIGEMPTYSET 0 +#define __SIGFILLSET 0xffffffff +#define __SIGADDSET(s, n) (*(s) |= 1 << ((n) - 1), 0) +#define __SIGDELSET(s, n) (*(s) &= ~(1 << ((n) - 1)), 0) +#define __SIGISMEMBER(s, n) ((*(s) & (1 << ((n) - 1))) != 0) + diff --git a/lib/libpthread/include/sys/__stdio.h b/lib/libpthread/include/sys/__stdio.h new file mode 100644 index 00000000000..d60b9df7a54 --- /dev/null +++ b/lib/libpthread/include/sys/__stdio.h @@ -0,0 +1,8 @@ + +#include +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +typedef pthread_fpos_t fpos_t; /* Must match off_t */ diff --git a/lib/libpthread/include/sys/__stdlib.h b/lib/libpthread/include/sys/__stdlib.h new file mode 100644 index 00000000000..cfcbe91867c --- /dev/null +++ b/lib/libpthread/include/sys/__stdlib.h @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * 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 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: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 + * $Id: __stdlib.h,v 1.1 1998/07/21 16:28:08 peter Exp $ + */ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#ifdef _BSD_WCHAR_T_ +typedef _BSD_WCHAR_T_ wchar_t; +#ifdef _BSD_RUNE_T_ +typedef _BSD_RUNE_T_ rune_t; +#undef _BSD_RUNE_T_ +#else +typedef _BSD_WCHAR_T_ rune_t; +#endif +#undef _BSD_WCHAR_T_ +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif /* _STDLIB_H_ */ diff --git a/lib/libpthread/include/sys/__string.h b/lib/libpthread/include/sys/__string.h new file mode 100644 index 00000000000..93d4fcf9dd2 --- /dev/null +++ b/lib/libpthread/include/sys/__string.h @@ -0,0 +1,21 @@ + +#include +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +/* Non-standard NetBSD string routines. */ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +__BEGIN_DECLS +int bcmp __P_((const void *, const void *, size_t)); +void bcopy __P_((const void *, void *, size_t)); +void bzero __P_((void *, size_t)); +char *index __P_((const char *, int)); +char *rindex __P_((const char *, int)); +char *strdup __P_((const char *)); +void strmode __P_((int, char *)); +char *strsep __P_((char **, const char *)); +__END_DECLS +#endif + diff --git a/lib/libpthread/include/sys/__time.h b/lib/libpthread/include/sys/__time.h new file mode 100644 index 00000000000..536ec0400ad --- /dev/null +++ b/lib/libpthread/include/sys/__time.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: __time.h,v 1.1 1998/07/21 16:28:08 peter Exp $ + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include +#include + +#ifdef _BSD_CLOCK_T_ +typedef _BSD_CLOCK_T_ clock_t; +#undef _BSD_CLOCK_T_ +#endif + +#ifdef _BSD_TIME_T_ +typedef _BSD_TIME_T_ time_t; +#undef _BSD_TIME_T_ +#endif + +#ifdef _BSD_SIZE_T_ +typedef _BSD_SIZE_T_ size_t; +#undef _BSD_SIZE_T_ +#endif + +#define CLOCKS_PER_SEC 100 + +#if !defined(CLK_TCK) +#define CLK_TCK 100 +#endif /* not CLK_TCK */ + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/include/sys/__unistd.h b/lib/libpthread/include/sys/__unistd.h new file mode 100644 index 00000000000..d4d621a8618 --- /dev/null +++ b/lib/libpthread/include/sys/__unistd.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 1990 The Regents of the University of California. + * 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 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: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 + * $Id: __unistd.h,v 1.1 1998/07/21 16:28:08 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include + +#ifndef NULL +#define NULL 0 +#endif + +#define ioctl_request_type unsigned long /* For fd.c */ + +/* compile-time symbolic constants */ +#define _POSIX_JOB_CONTROL /* implementation supports job control */ + +#ifdef _NOT_AVAILABLE +#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ +#endif + +#define _POSIX_VERSION 198808L +#define _POSIX2_VERSION 199212L + +/* execution-time symbolic constants */ + /* chown requires appropriate privileges */ +#define _POSIX_CHOWN_RESTRICTED 1 + /* too-long path components generate errors */ +#define _POSIX_NO_TRUNC 1 + /* may disable terminal special characters */ +/* #define _POSIX_VDISABLE 0xff */ + +/* configurable pathname variables */ +#define _PC_LINK_MAX 1 +#define _PC_MAX_CANON 2 +#define _PC_MAX_INPUT 3 +#define _PC_NAME_MAX 4 +#define _PC_PATH_MAX 5 +#define _PC_PIPE_BUF 6 +#define _PC_CHOWN_RESTRICTED 7 +#define _PC_NO_TRUNC 8 +#define _PC_VDISABLE 9 + +/* configurable system variables */ +#define _SC_ARG_MAX 1 +#define _SC_CHILD_MAX 2 +#define _SC_CLK_TCK 3 +#define _SC_NGROUPS_MAX 4 +#define _SC_OPEN_MAX 5 +#define _SC_JOB_CONTROL 6 +#define _SC_SAVED_IDS 7 +#define _SC_VERSION 8 +#define _SC_BC_BASE_MAX 9 +#define _SC_BC_DIM_MAX 10 +#define _SC_BC_SCALE_MAX 11 +#define _SC_BC_STRING_MAX 12 +#define _SC_COLL_WEIGHTS_MAX 13 +#define _SC_EXPR_NEST_MAX 14 +#define _SC_LINE_MAX 15 +#define _SC_RE_DUP_MAX 16 +#define _SC_2_VERSION 17 +#define _SC_2_C_BIND 18 +#define _SC_2_C_DEV 19 +#define _SC_2_CHAR_TERM 20 +#define _SC_2_FORT_DEV 21 +#define _SC_2_FORT_RUN 22 +#define _SC_2_LOCALEDEF 23 +#define _SC_2_SW_DEV 24 +#define _SC_2_UPE 25 +#define _SC_STREAM_MAX 26 +#define _SC_TZNAME_MAX 27 + +/* configurable system strings */ +#define _CS_PATH 1 + +#endif diff --git a/lib/libpthread/include/sys/compat.h b/lib/libpthread/include/sys/compat.h new file mode 100644 index 00000000000..604b61e3907 --- /dev/null +++ b/lib/libpthread/include/sys/compat.h @@ -0,0 +1,43 @@ +/* ==== compat.h ============================================================ + * Copyright (c) 1994 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: compat.h,v 1.1 1998/07/21 16:28:08 peter Exp $ + * + * Description : COmpat header to make socket code compile. + * + * 1.00 94/08/01 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#endif diff --git a/lib/libpthread/include/sys/dirent.h b/lib/libpthread/include/sys/dirent.h new file mode 100644 index 00000000000..5226443f86b --- /dev/null +++ b/lib/libpthread/include/sys/dirent.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 1989 The Regents of the University of California. + * 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 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. + * + * @(#)dirent.h 5.18 (Berkeley) 2/23/91 + */ + +#ifndef _SYS_DIRENT_H_ +#define _SYS_DIRENT_H_ + +/* + * A directory entry has a struct dirent at the front of it, containing its + * inode number, the length of the entry, and the length of the name + * contained in the entry. These are followed by the name padded to a 4 + * byte boundary with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + */ + +struct dirent { + u_long d_fileno; /* file number of entry */ + u_short d_reclen; /* length of this record */ + u_short d_namlen; /* length of string in d_name */ +#ifdef _POSIX_SOURCE + char d_name[255 + 1]; /* name must be no longer than this */ +#else +#define MAXNAMLEN 255 + char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */ +#endif +}; + +#define d_ino d_fileno /* backward compatibility */ + +/* definitions for library routines operating on directories. */ +#define DIRBLKSIZ 1024 + +#endif /* !_DIRENT_H_ */ diff --git a/lib/libpthread/include/sys/errno.h b/lib/libpthread/include/sys/errno.h new file mode 100644 index 00000000000..3da61d692a3 --- /dev/null +++ b/lib/libpthread/include/sys/errno.h @@ -0,0 +1,160 @@ +/* $NetBSD: errno.h,v 1.8 1994/06/29 06:44:02 cgd Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. + * + * @(#)errno.h 8.5 (Berkeley) 1/21/94 + */ + +#ifndef _SYS_ERRNO_H_ +#define _SYS_ERRNO_H_ + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ +#define E2BIG 7 /* Argument list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EDEADLK 11 /* Resource deadlock avoided */ + /* 11 was EAGAIN */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#ifndef _POSIX_SOURCE +#define ENOTBLK 15 /* Block device required */ +#endif +#define EBUSY 16 /* Device busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* Operation not supported by device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate ioctl for device */ +#ifndef _POSIX_SOURCE +#define ETXTBSY 26 /* Text file busy */ +#endif +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ + +/* math software */ +#define EDOM 33 /* Numerical argument out of domain */ +#define ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define EAGAIN 35 /* Resource temporarily unavailable */ +#ifndef _POSIX_SOURCE +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define EINPROGRESS 36 /* Operation now in progress */ +#define EALREADY 37 /* Operation already in progress */ + +/* ipc/network software -- argument errors */ +#define ENOTSOCK 38 /* Socket operation on non-socket */ +#define EDESTADDRREQ 39 /* Destination address required */ +#define EMSGSIZE 40 /* Message too long */ +#define EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 42 /* Protocol not available */ +#define EPROTONOSUPPORT 43 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define EOPNOTSUPP 45 /* Operation not supported */ +#define EPFNOSUPPORT 46 /* Protocol family not supported */ +#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define EADDRINUSE 48 /* Address already in use */ +#define EADDRNOTAVAIL 49 /* Can't assign requested address */ + +/* ipc/network software -- operational errors */ +#define ENETDOWN 50 /* Network is down */ +#define ENETUNREACH 51 /* Network is unreachable */ +#define ENETRESET 52 /* Network dropped connection on reset */ +#define ECONNABORTED 53 /* Software caused connection abort */ +#define ECONNRESET 54 /* Connection reset by peer */ +#define ENOBUFS 55 /* No buffer space available */ +#define EISCONN 56 /* Socket is already connected */ +#define ENOTCONN 57 /* Socket is not connected */ +#define ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define ETOOMANYREFS 59 /* Too many references: can't splice */ +#define ETIMEDOUT 60 /* Operation timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + +#define ELOOP 62 /* Too many levels of symbolic links */ +#endif /* _POSIX_SOURCE */ +#define ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#ifndef _POSIX_SOURCE +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ +#endif /* _POSIX_SOURCE */ +#define ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#ifndef _POSIX_SOURCE +#define EPROCLIM 67 /* Too many processes */ +#define EUSERS 68 /* Too many users */ +#define EDQUOT 69 /* Disc quota exceeded */ + +/* Network File System */ +#define ESTALE 70 /* Stale NFS file handle */ +#define EREMOTE 71 /* Too many levels of remote in path */ +#define EBADRPC 72 /* RPC struct is bad */ +#define ERPCMISMATCH 73 /* RPC version wrong */ +#define EPROGUNAVAIL 74 /* RPC prog. not avail */ +#define EPROGMISMATCH 75 /* Program version wrong */ +#define EPROCUNAVAIL 76 /* Bad procedure for program */ +#endif /* _POSIX_SOURCE */ + +#define ENOLCK 77 /* No locks available */ +#define ENOSYS 78 /* Function not implemented */ + +#ifndef _POSIX_SOURCE +#define EFTYPE 79 /* Inappropriate file type or format */ +#define EAUTH 80 /* Authentication error */ +#define ENEEDAUTH 81 /* Need authenticator */ +#define ELAST 81 /* Must be equal largest errno */ +#endif /* _POSIX_SOURCE */ + +#endif diff --git a/lib/libpthread/include/sys/timers.h b/lib/libpthread/include/sys/timers.h new file mode 100644 index 00000000000..c15b91d34ba --- /dev/null +++ b/lib/libpthread/include/sys/timers.h @@ -0,0 +1,45 @@ +/* ==== timers.h ============================================================ + * Copyright (c) 1994 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: timers.h,v 1.1 1998/07/21 16:28:09 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_TIMERS_H_ +#define _SYS_TIMERS_H_ + +#include + +#endif diff --git a/lib/libpthread/include/sys/wait.h b/lib/libpthread/include/sys/wait.h new file mode 100644 index 00000000000..063dc3d766c --- /dev/null +++ b/lib/libpthread/include/sys/wait.h @@ -0,0 +1,162 @@ +/* + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. 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 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. + * + * @(#)wait.h 8.1 (Berkeley) 6/2/93 + * $Id: wait.h,v 1.1 1998/07/21 16:28:09 peter Exp $ + */ + +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +/* + * This file holds definitions relevent to the wait4 system call + * and the alternate interfaces that use it (wait, wait3, waitpid). + */ + +/* + * Macros to test the exit status returned by wait + * and extract the relevant values. + */ +#ifdef _POSIX_SOURCE +#define _W_INT(i) (i) +#else +#define _W_INT(w) (*(int *)&(w)) /* convert union wait to int */ +#define WCOREFLAG 0200 +#endif + +#define _WSTATUS(x) (_W_INT(x) & 0177) +#define _WSTOPPED 0177 /* _WSTATUS if process is stopped */ +#define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED) +#define WSTOPSIG(x) (_W_INT(x) >> 8) +#define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0) +#define WTERMSIG(x) (_WSTATUS(x)) +#define WIFEXITED(x) (_WSTATUS(x) == 0) +#define WEXITSTATUS(x) (_W_INT(x) >> 8) +#ifndef _POSIX_SOURCE +#define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG) + +#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) +#define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED) +#endif + +/* + * Option bits for the third argument of wait4. WNOHANG causes the + * wait to not hang if there are no stopped or terminated processes, rather + * returning an error indication in this case (pid==0). WUNTRACED + * indicates that the caller should receive status about untraced children + * which stop due to signals. If children are stopped and a wait without + * this option is done, it is as though they were still running... nothing + * about them is returned. + */ +#define WNOHANG 1 /* dont hang in wait */ +#define WUNTRACED 2 /* tell about stopped, untraced children */ + +#ifndef _POSIX_SOURCE +/* POSIX extensions and 4.2/4.3 compatability: */ + +/* + * Tokens for special values of the "pid" parameter to wait4. + */ +#define WAIT_ANY (-1) /* any process */ +#define WAIT_MYPGRP 0 /* any process in my process group */ + +#include + +/* + * Deprecated: + * Structure of the information in the status word returned by wait4. + * If w_stopval==WSTOPPED, then the second structure describes + * the information returned, else the first. + */ +union wait { + int w_status; /* used in syscall */ + /* + * Terminated process status. + */ + struct { +#if BYTE_ORDER == LITTLE_ENDIAN + unsigned int w_Termsig:7, /* termination signal */ + w_Coredump:1, /* core dump indicator */ + w_Retcode:8, /* exit code if w_termsig==0 */ + w_Filler:16; /* upper bits filler */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + unsigned int w_Filler:16, /* upper bits filler */ + w_Retcode:8, /* exit code if w_termsig==0 */ + w_Coredump:1, /* core dump indicator */ + w_Termsig:7; /* termination signal */ +#endif + } w_T; + /* + * Stopped process status. Returned + * only for traced children unless requested + * with the WUNTRACED option bit. + */ + struct { +#if BYTE_ORDER == LITTLE_ENDIAN + unsigned int w_Stopval:8, /* == W_STOPPED if stopped */ + w_Stopsig:8, /* signal that stopped us */ + w_Filler:16; /* upper bits filler */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + unsigned int w_Filler:16, /* upper bits filler */ + w_Stopsig:8, /* signal that stopped us */ + w_Stopval:8; /* == W_STOPPED if stopped */ +#endif + } w_S; +}; +#define w_termsig w_T.w_Termsig +#define w_coredump w_T.w_Coredump +#define w_retcode w_T.w_Retcode +#define w_stopval w_S.w_Stopval +#define w_stopsig w_S.w_Stopsig + +#define WSTOPPED _WSTOPPED +#endif /* _POSIX_SOURCE */ + +#ifndef KERNEL +#include +#include + +__BEGIN_DECLS +struct rusage; /* forward declaration */ + +pid_t wait __P_((int *)); +pid_t waitpid __P_((pid_t, int *, int)); +#ifndef _POSIX_SOURCE +pid_t wait3 __P_((int *, int, void *)); +pid_t wait4 __P_((pid_t, int *, int, void *)); +#endif +__END_DECLS +#endif + +#endif diff --git a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.c b/lib/libpthread/machdep/engine-alpha-netbsd-1.3.c deleted file mode 100644 index 0932c421ea2..00000000000 --- a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.c +++ /dev/null @@ -1,204 +0,0 @@ -/* ==== machdep.c ============================================================ - * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu - * - * Description : Machine dependent functions for NetBSD/Alpha 1.1(+) - * - * 1.00 93/08/04 proven - * -Started coding this file. - * - * 95/04/22 cgd - * -Modified to make it go with NetBSD/Alpha - */ - -#ifndef lint -static const char rcsid[] = "engine-alpha-osf1.c,v 1.4.4.1 1995/12/13 05:41:37 proven Exp"; -#endif - -#include -#include -#include -#include -#include -#include -#include - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_state(void) -{ - return __machdep_save_int_state(pthread_run->machdep_data.machdep_istate); -} - -void machdep_restore_state(void) -{ - __machdep_restore_int_state(pthread_run->machdep_data.machdep_istate); -} - -void machdep_save_float_state (void) -{ - __machdep_save_fp_state(pthread_run->machdep_data.machdep_fstate); -} - -void machdep_restore_float_state (void) -{ - __machdep_restore_fp_state(pthread_run->machdep_data.machdep_fstate); -} - -/* ========================================================================== - * machdep_set_thread_timer() - */ -void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) -{ - if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) { - PANIC(); - } -} - -/* ========================================================================== - * machdep_unset_thread_timer() - */ -void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) -{ - struct itimerval zeroval = { { 0, 0 }, { 0, 0} }; - - if (setitimer(ITIMER_VIRTUAL, &zeroval, NULL)) { - PANIC(); - } -} - -/* ========================================================================== - * machdep_pthread_cleanup() - */ -void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) -{ - return(machdep_pthread->machdep_stack); -} - -/* ========================================================================== - * machdep_pthread_start() - */ -void machdep_pthread_start(void) -{ - context_switch_done(); - pthread_sched_resume (); - - /* Run current threads start routine with argument */ - pthread_exit(pthread_run->machdep_data.start_routine - (pthread_run->machdep_data.start_argument)); - - /* should never reach here */ - PANIC(); -} - -/* ========================================================================== - * __machdep_stack_free() - */ -void __machdep_stack_free(void * stack) -{ - free(stack); -} - -/* ========================================================================== - * __machdep_stack_alloc() - */ -void * __machdep_stack_alloc(size_t size) -{ - void * stack; - - return(malloc(size)); -} - -/* ========================================================================== - * __machdep_pthread_create() - */ -void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, - void *(* start_routine)(), void *start_argument, - long stack_size, long nsec, long flags) -{ - machdep_pthread->start_routine = start_routine; - machdep_pthread->start_argument = start_argument; - - machdep_pthread->machdep_timer.it_value.tv_sec = 0; - machdep_pthread->machdep_timer.it_interval.tv_sec = 0; - machdep_pthread->machdep_timer.it_interval.tv_usec = 0; - machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; - - /* Set up new stack frame so that it looks like it returned from a - longjmp() to the beginning of machdep_pthread_start(). */ - machdep_pthread->machdep_istate[8/*ISTATE_RA*/] = 0; - machdep_pthread->machdep_istate[0/*ISTATE_PC*/] = (long)machdep_pthread_start; - machdep_pthread->machdep_istate[10/*ISTATE_PV*/] = (long)machdep_pthread_start; - - /* Alpha stack starts high and builds down. */ - { - long stk_addr = (long) machdep_pthread->machdep_stack; - stk_addr += stack_size - 1024; - stk_addr &= ~15; - machdep_pthread->machdep_istate[9/*ISTATE_SP*/] = stk_addr; - } -} - -int safe_store (loc, new) - int *loc; - int new; -{ - int locked, old; - asm ("mb" : : : "memory"); - do { - asm ("ldl_l %0,%1" : "=r" (old) : "m" (*loc)); - asm ("stl_c %0,%1" : "=r" (locked), "=m" (*loc) : "0" (new)); - } while (!locked); - asm ("mb" : : : "memory"); - return old; -} - -/* ========================================================================== - * machdep_sys_creat() - */ -machdep_sys_creat(char * path, int mode) -{ - return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); -} - -/* ========================================================================== - * machdep_sys_wait3() - */ -machdep_sys_wait3(int * b, int c, int * d) -{ - return(machdep_sys_wait4(0, b, c, d)); -} - -/* ========================================================================== - * machdep_sys_waitpid() - */ -machdep_sys_waitpid(int a, int * b, int c) -{ - return(machdep_sys_wait4(a, b, c, NULL)); -} - -/* ========================================================================== - * machdep_sys_getdtablesize() - */ -machdep_sys_getdtablesize() -{ - return(sysconf(_SC_OPEN_MAX)); -} - -/* ========================================================================== - * machdep_sys_lseek() - */ -off_t machdep_sys_lseek(int fd, off_t offset, int whence) -{ - extern off_t __syscall(); - - return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence)); -} - -/* ========================================================================== - * machdep_sys_getdirentries() - */ -machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) -{ - return(machdep_sys_getdents(fd, buf, len)); -} diff --git a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.h b/lib/libpthread/machdep/engine-alpha-netbsd-1.3.h deleted file mode 100644 index 50c872da7b6..00000000000 --- a/lib/libpthread/machdep/engine-alpha-netbsd-1.3.h +++ /dev/null @@ -1,111 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1994 Chris Provenzano (proven@athena.mit.edu) and - * Ken Raeburn (raeburn@mit.edu). - * - * engine-alpha-osf1.h,v 1.4.4.1 1995/12/13 05:41:42 proven Exp - * - */ - -#include -#include -#include -#include - -/* The first machine dependent functions are the SEMAPHORES needing - the test and set instruction. - - On the Alpha, the actual values here are irrelevant; they just have - to be different. */ -#define SEMAPHORE_CLEAR 0 -#define SEMAPHORE_SET 1 - -#if 0 -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ int *_sem_lock = (lock), locked, old; \ - asm ("mb" : : : "memory"); \ - do { asm ("ldl_l %0,%1" : "=r" (old) : "m" (*_sem_lock)); \ - /* ?? if (old != SEMAPHORE_CLEAR) break; */ \ - asm ("stl_c %0,%1" : "=r" (locked), "=m" (*_sem_lock) \ - : "0" (SEMAPHORE_SET)); \ - } while (!locked); \ - asm ("mb" : : : "memory"); \ - old == SEMAPHORE_CLEAR; }) - -#define SEMAPHORE_RESET(lock) \ -({ int *_sem_lock = (lock); \ - *_sem_lock = SEMAPHORE_CLEAR; \ - asm ("mb" : : : "memory"); }) -#endif - -/* - * New types - */ -typedef int semaphore; - -/* - * sigset_t macros - */ -#define SIG_ANY(sig) (sig) -#define SIGMAX 31 - -/* - * New Strutures - */ -struct machdep_pthread { - void *(*start_routine)(void *); - void *start_argument; - void *machdep_stack; - struct itimerval machdep_timer; - unsigned long machdep_istate[11]; - unsigned long machdep_fstate[9]; -}; - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ - { NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } - -/* - * Minimum stack size - */ -#define PTHREAD_STACK_MIN 2048 - -/* - * 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) - -#define __machdep_stack_get(x) (x)->machdep_stack -#define __machdep_stack_set(x, y) (x)->machdep_stack = y -#define __machdep_stack_repl(x, y) \ -{ \ - if (stack = __machdep_stack_get(x)) { \ - __machdep_stack_free(stack); \ - } \ - __machdep_stack_set(x, y); \ -} - -void * __machdep_stack_alloc __P_((size_t)); -void __machdep_stack_free __P_((void *)); - -int machdep_save_state __P_((void)); - -int __machdep_save_int_state __P_((unsigned long *)); -void __machdep_restore_int_state __P_((unsigned long *)); -void __machdep_save_fp_state __P_((unsigned long *)); -void __machdep_restore_fp_state __P_((unsigned long *)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/machdep/engine-i386-openbsd-2.0.c b/lib/libpthread/machdep/engine-i386-openbsd-2.0.c deleted file mode 100644 index 09ff0072fdc..00000000000 --- a/lib/libpthread/machdep/engine-i386-openbsd-2.0.c +++ /dev/null @@ -1,215 +0,0 @@ -/* ==== machdep.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 : Machine dependent functions for NetBSD on i386 - * - * 1.00 93/08/04 proven - * -Started coding this file. - */ - -#ifndef lint -static const char rcsid[] = "engine-i386-freebsd-2.0.c,v 1.1 1995/03/01 01:21:20 proven Exp"; -#endif - -#include -#include -#include -#include -#include -#include - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_state(void) -{ - return(machdep_sys_setjmp(pthread_run->machdep_data.machdep_state)); -} - -/* ========================================================================== - * machdep_save_state() - */ -int machdep_save_float_state(struct pthread * pthread) -{ - char * fdata = (char *)pthread->machdep_data.machdep_float_state; - - __asm__ ("fsave %0"::"m" (*fdata)); -} - -/* ========================================================================== - * machdep_restore_state() - */ -void machdep_restore_state(void) -{ - machdep_sys_longjmp(pthread_run->machdep_data.machdep_state, 1); -} - -/* ========================================================================== - * machdep_restore_float_state() - */ -int machdep_restore_float_state(void) -{ - char * fdata = (char *)pthread_run->machdep_data.machdep_float_state; - - __asm__ ("frstor %0"::"m" (*fdata)); -} - -/* ========================================================================== - * machdep_set_thread_timer() - */ -void machdep_set_thread_timer(struct machdep_pthread *machdep_pthread) -{ - if (setitimer(ITIMER_VIRTUAL, &(machdep_pthread->machdep_timer), NULL)) { - PANIC(); - } -} - -/* ========================================================================== - * machdep_unset_thread_timer() - */ -void machdep_unset_thread_timer(struct machdep_pthread *machdep_pthread) -{ - struct itimerval zeroval = { { 0, 0 }, { 0, 0 } }; - int ret; - - if (machdep_pthread) { - ret = setitimer(ITIMER_VIRTUAL, &zeroval, - &(machdep_pthread->machdep_timer)); - } else { - ret = setitimer(ITIMER_VIRTUAL, &zeroval, NULL); - } - - if (ret) { - PANIC(); - } -} - -/* ========================================================================== - * machdep_pthread_cleanup() - */ -void *machdep_pthread_cleanup(struct machdep_pthread *machdep_pthread) -{ - return(machdep_pthread->machdep_stack); -} - -/* ========================================================================== - * machdep_pthread_start() - */ -void machdep_pthread_start(void) -{ - context_switch_done(); - pthread_sched_resume(); - - /* Run current threads start routine with argument */ - pthread_exit(pthread_run->machdep_data.start_routine - (pthread_run->machdep_data.start_argument)); - - /* should never reach here */ - PANIC(); -} - -/* ========================================================================== - * __machdep_stack_free() - */ -void __machdep_stack_free(void * stack) -{ - free(stack); -} - -/* ========================================================================== - * __machdep_stack_alloc() - */ -void * __machdep_stack_alloc(size_t size) -{ - void * stack; - - return(malloc(size)); -} - -/* ========================================================================== - * __machdep_pthread_create() - */ -void __machdep_pthread_create(struct machdep_pthread *machdep_pthread, - void *(* start_routine)(), void *start_argument, - long stack_size, long nsec, long flags) -{ - machdep_pthread->start_routine = start_routine; - machdep_pthread->start_argument = start_argument; - - machdep_pthread->machdep_timer.it_value.tv_sec = 0; - machdep_pthread->machdep_timer.it_interval.tv_sec = 0; - machdep_pthread->machdep_timer.it_interval.tv_usec = 0; - machdep_pthread->machdep_timer.it_value.tv_usec = nsec / 1000; - - machdep_sys_setjmp(machdep_pthread->machdep_state); - /* - * Set up new stact frame so that it looks like it - * returned from a longjmp() to the beginning of - * machdep_pthread_start(). - */ - machdep_pthread->machdep_state[0] = (int)machdep_pthread_start; - - /* Stack starts high and builds down. */ - machdep_pthread->machdep_state[2] = - (int)machdep_pthread->machdep_stack + stack_size; -} - -/* ========================================================================== - * machdep_sys_creat() - */ -machdep_sys_creat(char * path, int mode) -{ - return(machdep_sys_open(path, O_WRONLY | O_CREAT | O_TRUNC, mode)); -} - -/* ========================================================================== - * machdep_sys_wait3() - */ -machdep_sys_wait3(int * b, int c, int * d) -{ - return(machdep_sys_wait4(0, b, c, d)); -} - -/* ========================================================================== - * machdep_sys_waitpid() - */ -machdep_sys_waitpid(int a, int * b, int c) -{ - return(machdep_sys_wait4(a, b, c, NULL)); -} - -/* ========================================================================== - * machdep_sys_getdtablesize() - */ -machdep_sys_getdtablesize() -{ - return(sysconf(_SC_OPEN_MAX)); -} diff --git a/lib/libpthread/machdep/engine-i386-openbsd-2.0.h b/lib/libpthread/machdep/engine-i386-openbsd-2.0.h deleted file mode 100644 index 71ac156b20c..00000000000 --- a/lib/libpthread/machdep/engine-i386-openbsd-2.0.h +++ /dev/null @@ -1,97 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu - * - * $Id: engine-i386-openbsd-2.0.h,v 1.1 1998/07/21 13:19:19 peter Exp $ - * - */ - -#include -#include -#include - -/* - * The first machine dependent functions are the SEMAPHORES - * needing the test and set instruction. - */ -#define SEMAPHORE_CLEAR 0 -#define SEMAPHORE_SET 1 - -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ \ -long temp = SEMAPHORE_SET; \ - \ -__asm__ volatile ("xchgl %0,(%2)" \ - :"=r" (temp) \ - :"0" (temp),"r" (lock)); \ -temp; \ -}) - -#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR - -/* - * New types - */ -typedef long semaphore; - -/* - * sigset_t macros - */ -#define SIG_ANY(sig) (sig) -#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; - char machdep_float_state[108]; -}; - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ -{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } - -/* - * Minimum stack size - */ -#define PTHREAD_STACK_MIN 1024 - -/* - * 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) - -#define __machdep_stack_get(x) (x)->machdep_stack -#define __machdep_stack_set(x, y) (x)->machdep_stack = y -#define __machdep_stack_repl(x, y) \ -{ \ - if (stack = __machdep_stack_get(x)) { \ - __machdep_stack_free(stack); \ - } \ - __machdep_stack_set(x, y); \ -} - -void * __machdep_stack_alloc __P_((size_t)); -void __machdep_stack_free __P_((void *)); - -int machdep_save_state __P_((void)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/machdep/engine-m68000-netbsd.h b/lib/libpthread/machdep/engine-m68000-netbsd.h deleted file mode 100644 index 0cf0b035d6f..00000000000 --- a/lib/libpthread/machdep/engine-m68000-netbsd.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ==== machdep.h ============================================================ - * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu - * - * $Id: engine-m68000-netbsd.h,v 1.1 1998/07/21 13:19:14 peter Exp $ - * - */ - -#include -#include -#include - -/* - * The first machine dependent functions are the SEMAPHORES - * needing the test and set instruction. - */ -#define SEMAPHORE_CLEAR 0 -#define SEMAPHORE_SET 0x80; - -#define SEMAPHORE_TEST_AND_SET(lock) \ -({ \ -volatile long temp = SEMAPHORE_CLEAR; \ - \ -__asm__ volatile("tas (%2); bpl 0f; movl #1,%0; 0:" \ - :"=r" (temp) \ - :"0" (temp),"r" (lock)); \ -temp; \ -}) - -#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR - -/* - * New types - */ -typedef char semaphore; - -/* - * sigset_t macros - */ -#define SIG_ANY(sig) (sig) -#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; -}; - -/* - * Min pthread stacksize - */ -#define PTHREAD_STACK_MIN 1024 - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ -{ NULL, NULL, NULL, { { 0, 0 }, { 0, 100000 } }, 0 } - -/* - * New functions - */ - -__BEGIN_DECLS - -#if defined(PTHREAD_KERNEL) - -int machdep_save_state __P_((void)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/machdep/openbsd-2.0/__math.h b/lib/libpthread/machdep/openbsd-2.0/__math.h deleted file mode 100755 index 27ed0f2575d..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__math.h +++ /dev/null @@ -1,6 +0,0 @@ -/* - * ANSI/POSIX - */ -extern char __infinity[]; -#define HUGE_VAL (*(double *) __infinity) - diff --git a/lib/libpthread/machdep/openbsd-2.0/__path.h b/lib/libpthread/machdep/openbsd-2.0/__path.h deleted file mode 100755 index 3f3e8f826f5..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__path.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * from: @(#)time.h 5.12 (Berkeley) 3/9/91 - * $Id: __path.h,v 1.1 1998/07/21 13:19:42 peter Exp $ - */ - -#ifndef _SYS__PATH_H_ -#define _SYS__PATH_H_ - -#define _PATH_PTY "/dev/" -#define _PATH_TZDIR "/usr/share/zoneinfo" -#define _PATH_TZFILE "/etc/localtime" - -#endif /* !_SYS__PATH_H_ */ - diff --git a/lib/libpthread/machdep/openbsd-2.0/__signal.h b/lib/libpthread/machdep/openbsd-2.0/__signal.h deleted file mode 100755 index 918955c9948..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__signal.h +++ /dev/null @@ -1,8 +0,0 @@ -#include - -#define __SIGEMPTYSET 0 -#define __SIGFILLSET 0xffffffff -#define __SIGADDSET(s, n) (*(s) |= 1 << ((n) - 1), 0) -#define __SIGDELSET(s, n) (*(s) &= ~(1 << ((n) - 1)), 0) -#define __SIGISMEMBER(s, n) ((*(s) & (1 << ((n) - 1))) != 0) - diff --git a/lib/libpthread/machdep/openbsd-2.0/__stdio.h b/lib/libpthread/machdep/openbsd-2.0/__stdio.h deleted file mode 100755 index d60b9df7a54..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__stdio.h +++ /dev/null @@ -1,8 +0,0 @@ - -#include -#ifdef _BSD_SIZE_T_ -typedef _BSD_SIZE_T_ size_t; -#undef _BSD_SIZE_T_ -#endif - -typedef pthread_fpos_t fpos_t; /* Must match off_t */ diff --git a/lib/libpthread/machdep/openbsd-2.0/__stdlib.h b/lib/libpthread/machdep/openbsd-2.0/__stdlib.h deleted file mode 100755 index 6b0730e3ef3..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__stdlib.h +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * 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 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: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 - * $Id: __stdlib.h,v 1.1 1998/07/21 13:19:41 peter Exp $ - */ - -#ifndef _SYS___STDLIB_H_ -#define _SYS___STDLIB_H_ - -#include - -#ifdef _BSD_SIZE_T_ -typedef _BSD_SIZE_T_ size_t; -#undef _BSD_SIZE_T_ -#endif - -#ifdef _BSD_WCHAR_T_ -typedef _BSD_WCHAR_T_ wchar_t; -#ifdef _BSD_RUNE_T_ -typedef _BSD_RUNE_T_ rune_t; -#undef _BSD_RUNE_T_ -#else -typedef _BSD_WCHAR_T_ rune_t; -#endif -#undef _BSD_WCHAR_T_ -#endif - -#ifndef __NORETURN -#define __NORETURN -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#endif /* _STDLIB_H_ */ diff --git a/lib/libpthread/machdep/openbsd-2.0/__string.h b/lib/libpthread/machdep/openbsd-2.0/__string.h deleted file mode 100755 index 93d4fcf9dd2..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__string.h +++ /dev/null @@ -1,21 +0,0 @@ - -#include -#ifdef _BSD_SIZE_T_ -typedef _BSD_SIZE_T_ size_t; -#undef _BSD_SIZE_T_ -#endif - -/* Non-standard NetBSD string routines. */ -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -__BEGIN_DECLS -int bcmp __P_((const void *, const void *, size_t)); -void bcopy __P_((const void *, void *, size_t)); -void bzero __P_((void *, size_t)); -char *index __P_((const char *, int)); -char *rindex __P_((const char *, int)); -char *strdup __P_((const char *)); -void strmode __P_((int, char *)); -char *strsep __P_((char **, const char *)); -__END_DECLS -#endif - diff --git a/lib/libpthread/machdep/openbsd-2.0/__time.h b/lib/libpthread/machdep/openbsd-2.0/__time.h deleted file mode 100755 index 9423e10411b..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__time.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 1989 The Regents of the University of California. - * All rights reserved. - * - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * 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: @(#)time.h 5.12 (Berkeley) 3/9/91 - * $Id: __time.h,v 1.1 1998/07/21 13:19:41 peter Exp $ - */ - -#ifndef _SYS__TIME_H_ -#define _SYS__TIME_H_ - -#include -#include - -#ifdef _BSD_CLOCK_T_ -typedef _BSD_CLOCK_T_ clock_t; -#undef _BSD_CLOCK_T_ -#endif - -#ifdef _BSD_TIME_T_ -typedef _BSD_TIME_T_ time_t; -#undef _BSD_TIME_T_ -#endif - -#ifdef _BSD_SIZE_T_ -typedef _BSD_SIZE_T_ size_t; -#undef _BSD_SIZE_T_ -#endif - -#define CLOCKS_PER_SEC 100 - -#if !defined(CLK_TCK) -#define CLK_TCK 100 -#endif /* not CLK_TCK */ - -#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/openbsd-2.0/__unistd.h b/lib/libpthread/machdep/openbsd-2.0/__unistd.h deleted file mode 100755 index 2ad0f99c8c9..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/__unistd.h +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * 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 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: @(#)stdlib.h 5.13 (Berkeley) 6/4/91 - * $Id: __unistd.h,v 1.1 1998/07/21 13:19:41 peter Exp $ - */ - -#ifndef _SYS___UNISTD_H_ -#define _SYS___UNISTD_H_ - -#include - -#ifndef NULL -#define NULL 0 -#endif - -#define ioctl_request_type unsigned long /* For fd.c */ - -/* compile-time symbolic constants */ -#define _POSIX_JOB_CONTROL /* implementation supports job control */ - -#ifdef _NOT_AVAILABLE -#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ -#endif - -#define _POSIX_VERSION 198808L -#define _POSIX2_VERSION 199212L - -/* execution-time symbolic constants */ - /* chown requires appropriate privileges */ -#define _POSIX_CHOWN_RESTRICTED 1 - /* too-long path components generate errors */ -#define _POSIX_NO_TRUNC 1 - /* may disable terminal special characters */ -/* #define _POSIX_VDISABLE 0xff */ - -/* configurable pathname variables */ -#define _PC_LINK_MAX 1 -#define _PC_MAX_CANON 2 -#define _PC_MAX_INPUT 3 -#define _PC_NAME_MAX 4 -#define _PC_PATH_MAX 5 -#define _PC_PIPE_BUF 6 -#define _PC_CHOWN_RESTRICTED 7 -#define _PC_NO_TRUNC 8 -#define _PC_VDISABLE 9 - -/* configurable system variables */ -#define _SC_ARG_MAX 1 -#define _SC_CHILD_MAX 2 -#define _SC_CLK_TCK 3 -#define _SC_NGROUPS_MAX 4 -#define _SC_OPEN_MAX 5 -#define _SC_JOB_CONTROL 6 -#define _SC_SAVED_IDS 7 -#define _SC_VERSION 8 -#define _SC_BC_BASE_MAX 9 -#define _SC_BC_DIM_MAX 10 -#define _SC_BC_SCALE_MAX 11 -#define _SC_BC_STRING_MAX 12 -#define _SC_COLL_WEIGHTS_MAX 13 -#define _SC_EXPR_NEST_MAX 14 -#define _SC_LINE_MAX 15 -#define _SC_RE_DUP_MAX 16 -#define _SC_2_VERSION 17 -#define _SC_2_C_BIND 18 -#define _SC_2_C_DEV 19 -#define _SC_2_CHAR_TERM 20 -#define _SC_2_FORT_DEV 21 -#define _SC_2_FORT_RUN 22 -#define _SC_2_LOCALEDEF 23 -#define _SC_2_SW_DEV 24 -#define _SC_2_UPE 25 -#define _SC_STREAM_MAX 26 -#define _SC_TZNAME_MAX 27 - -/* configurable system strings */ -#define _CS_PATH 1 - -#endif diff --git a/lib/libpthread/machdep/openbsd-2.0/compat.h b/lib/libpthread/machdep/openbsd-2.0/compat.h deleted file mode 100755 index b85e46458a6..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/compat.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ==== compat.h ============================================================ - * Copyright (c) 1994 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: compat.h,v 1.1 1998/07/21 13:19:41 peter Exp $ - * - * Description : COmpat header to make socket code compile. - * - * 1.00 94/08/01 proven - * -Started coding this file. - */ - -#ifndef _SYS_COMPAT_H_ -#define _SYS_COMPAT_H_ - -#endif diff --git a/lib/libpthread/machdep/openbsd-2.0/dirent.h b/lib/libpthread/machdep/openbsd-2.0/dirent.h deleted file mode 100755 index 5226443f86b..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/dirent.h +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 1989 The Regents of the University of California. - * 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 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. - * - * @(#)dirent.h 5.18 (Berkeley) 2/23/91 - */ - -#ifndef _SYS_DIRENT_H_ -#define _SYS_DIRENT_H_ - -/* - * A directory entry has a struct dirent at the front of it, containing its - * inode number, the length of the entry, and the length of the name - * contained in the entry. These are followed by the name padded to a 4 - * byte boundary with null bytes. All names are guaranteed null terminated. - * The maximum length of a name in a directory is MAXNAMLEN. - */ - -struct dirent { - u_long d_fileno; /* file number of entry */ - u_short d_reclen; /* length of this record */ - u_short d_namlen; /* length of string in d_name */ -#ifdef _POSIX_SOURCE - char d_name[255 + 1]; /* name must be no longer than this */ -#else -#define MAXNAMLEN 255 - char d_name[MAXNAMLEN + 1]; /* name must be no longer than this */ -#endif -}; - -#define d_ino d_fileno /* backward compatibility */ - -/* definitions for library routines operating on directories. */ -#define DIRBLKSIZ 1024 - -#endif /* !_DIRENT_H_ */ diff --git a/lib/libpthread/machdep/openbsd-2.0/errno.h b/lib/libpthread/machdep/openbsd-2.0/errno.h deleted file mode 100755 index 3da61d692a3..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/errno.h +++ /dev/null @@ -1,160 +0,0 @@ -/* $NetBSD: errno.h,v 1.8 1994/06/29 06:44:02 cgd Exp $ */ - -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * 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. - * - * @(#)errno.h 8.5 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_ERRNO_H_ -#define _SYS_ERRNO_H_ - -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* Device not configured */ -#define E2BIG 7 /* Argument list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#define EDEADLK 11 /* Resource deadlock avoided */ - /* 11 was EAGAIN */ -#define ENOMEM 12 /* Cannot allocate memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#ifndef _POSIX_SOURCE -#define ENOTBLK 15 /* Block device required */ -#endif -#define EBUSY 16 /* Device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* Operation not supported by device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate ioctl for device */ -#ifndef _POSIX_SOURCE -#define ETXTBSY 26 /* Text file busy */ -#endif -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ - -/* math software */ -#define EDOM 33 /* Numerical argument out of domain */ -#define ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define EAGAIN 35 /* Resource temporarily unavailable */ -#ifndef _POSIX_SOURCE -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ - -/* ipc/network software -- argument errors */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Can't assign requested address */ - -/* ipc/network software -- operational errors */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection on reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Socket is already connected */ -#define ENOTCONN 57 /* Socket is not connected */ -#define ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 59 /* Too many references: can't splice */ -#define ETIMEDOUT 60 /* Operation timed out */ -#define ECONNREFUSED 61 /* Connection refused */ - -#define ELOOP 62 /* Too many levels of symbolic links */ -#endif /* _POSIX_SOURCE */ -#define ENAMETOOLONG 63 /* File name too long */ - -/* should be rearranged */ -#ifndef _POSIX_SOURCE -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#endif /* _POSIX_SOURCE */ -#define ENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#ifndef _POSIX_SOURCE -#define EPROCLIM 67 /* Too many processes */ -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define ESTALE 70 /* Stale NFS file handle */ -#define EREMOTE 71 /* Too many levels of remote in path */ -#define EBADRPC 72 /* RPC struct is bad */ -#define ERPCMISMATCH 73 /* RPC version wrong */ -#define EPROGUNAVAIL 74 /* RPC prog. not avail */ -#define EPROGMISMATCH 75 /* Program version wrong */ -#define EPROCUNAVAIL 76 /* Bad procedure for program */ -#endif /* _POSIX_SOURCE */ - -#define ENOLCK 77 /* No locks available */ -#define ENOSYS 78 /* Function not implemented */ - -#ifndef _POSIX_SOURCE -#define EFTYPE 79 /* Inappropriate file type or format */ -#define EAUTH 80 /* Authentication error */ -#define ENEEDAUTH 81 /* Need authenticator */ -#define ELAST 81 /* Must be equal largest errno */ -#endif /* _POSIX_SOURCE */ - -#endif diff --git a/lib/libpthread/machdep/openbsd-2.0/timers.h b/lib/libpthread/machdep/openbsd-2.0/timers.h deleted file mode 100755 index a4e39867166..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/timers.h +++ /dev/null @@ -1,45 +0,0 @@ -/* ==== timers.h ============================================================ - * Copyright (c) 1994 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: timers.h,v 1.1 1998/07/21 13:19:41 peter Exp $ - * - * Description : Basic timers header. - * - * 1.00 94/06/13 proven - * -Started coding this file. - */ - -#ifndef _SYS_TIMERS_H_ -#define _SYS_TIMERS_H_ - -#include - -#endif diff --git a/lib/libpthread/machdep/openbsd-2.0/wait.h b/lib/libpthread/machdep/openbsd-2.0/wait.h deleted file mode 100755 index b68a8a38c35..00000000000 --- a/lib/libpthread/machdep/openbsd-2.0/wait.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. 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 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. - * - * @(#)wait.h 8.1 (Berkeley) 6/2/93 - * $Id: wait.h,v 1.1 1998/07/21 13:19:42 peter Exp $ - */ - -#ifndef _SYS_WAIT_H_ -#define _SYS_WAIT_H_ - -/* - * This file holds definitions relevent to the wait4 system call - * and the alternate interfaces that use it (wait, wait3, waitpid). - */ - -/* - * Macros to test the exit status returned by wait - * and extract the relevant values. - */ -#ifdef _POSIX_SOURCE -#define _W_INT(i) (i) -#else -#define _W_INT(w) (*(int *)&(w)) /* convert union wait to int */ -#define WCOREFLAG 0200 -#endif - -#define _WSTATUS(x) (_W_INT(x) & 0177) -#define _WSTOPPED 0177 /* _WSTATUS if process is stopped */ -#define WIFSTOPPED(x) (_WSTATUS(x) == _WSTOPPED) -#define WSTOPSIG(x) (_W_INT(x) >> 8) -#define WIFSIGNALED(x) (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0) -#define WTERMSIG(x) (_WSTATUS(x)) -#define WIFEXITED(x) (_WSTATUS(x) == 0) -#define WEXITSTATUS(x) (_W_INT(x) >> 8) -#ifndef _POSIX_SOURCE -#define WCOREDUMP(x) (_W_INT(x) & WCOREFLAG) - -#define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) -#define W_STOPCODE(sig) ((sig) << 8 | _WSTOPPED) -#endif - -/* - * Option bits for the third argument of wait4. WNOHANG causes the - * wait to not hang if there are no stopped or terminated processes, rather - * returning an error indication in this case (pid==0). WUNTRACED - * indicates that the caller should receive status about untraced children - * which stop due to signals. If children are stopped and a wait without - * this option is done, it is as though they were still running... nothing - * about them is returned. - */ -#define WNOHANG 1 /* dont hang in wait */ -#define WUNTRACED 2 /* tell about stopped, untraced children */ - -#ifndef _POSIX_SOURCE -/* POSIX extensions and 4.2/4.3 compatability: */ - -/* - * Tokens for special values of the "pid" parameter to wait4. - */ -#define WAIT_ANY (-1) /* any process */ -#define WAIT_MYPGRP 0 /* any process in my process group */ - -#include - -/* - * Deprecated: - * Structure of the information in the status word returned by wait4. - * If w_stopval==WSTOPPED, then the second structure describes - * the information returned, else the first. - */ -union wait { - int w_status; /* used in syscall */ - /* - * Terminated process status. - */ - struct { -#if BYTE_ORDER == LITTLE_ENDIAN - unsigned int w_Termsig:7, /* termination signal */ - w_Coredump:1, /* core dump indicator */ - w_Retcode:8, /* exit code if w_termsig==0 */ - w_Filler:16; /* upper bits filler */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - unsigned int w_Filler:16, /* upper bits filler */ - w_Retcode:8, /* exit code if w_termsig==0 */ - w_Coredump:1, /* core dump indicator */ - w_Termsig:7; /* termination signal */ -#endif - } w_T; - /* - * Stopped process status. Returned - * only for traced children unless requested - * with the WUNTRACED option bit. - */ - struct { -#if BYTE_ORDER == LITTLE_ENDIAN - unsigned int w_Stopval:8, /* == W_STOPPED if stopped */ - w_Stopsig:8, /* signal that stopped us */ - w_Filler:16; /* upper bits filler */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - unsigned int w_Filler:16, /* upper bits filler */ - w_Stopsig:8, /* signal that stopped us */ - w_Stopval:8; /* == W_STOPPED if stopped */ -#endif - } w_S; -}; -#define w_termsig w_T.w_Termsig -#define w_coredump w_T.w_Coredump -#define w_retcode w_T.w_Retcode -#define w_stopval w_S.w_Stopval -#define w_stopsig w_S.w_Stopsig - -#define WSTOPPED _WSTOPPED -#endif /* _POSIX_SOURCE */ - -#ifndef KERNEL -#include -#include - -__BEGIN_DECLS -struct rusage; /* forward declaration */ - -pid_t wait __P_((int *)); -pid_t waitpid __P_((pid_t, int *, int)); -#ifndef _POSIX_SOURCE -pid_t wait3 __P_((int *, int, void *)); -pid_t wait4 __P_((pid_t, int *, int, void *)); -#endif -__END_DECLS -#endif - -#endif diff --git a/lib/libpthread/machdep/posix-openbsd-2.0.h b/lib/libpthread/machdep/posix-openbsd-2.0.h deleted file mode 100644 index 55c127e8136..00000000000 --- a/lib/libpthread/machdep/posix-openbsd-2.0.h +++ /dev/null @@ -1,31 +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-openbsd-2.0.h,v 1.1 1998/07/21 13:19:19 peter Exp $ - * - * 1.00 93/07/20 proven - * -Started coding this file. - */ - -#ifndef _PTHREAD_POSIX_H_ -#define _PTHREAD_POSIX_H_ - -#include - -/* More stuff for compiling */ -#if defined(__GNUC__) -#define __INLINE extern inline -#else -#define __INLINE static -#endif - -/* Make sure we have size_t defined */ -#include - -#ifndef __WAIT_STATUS -#define __WAIT_STATUS int * -#endif - -#endif diff --git a/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S b/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S deleted file mode 100644 index eda44311281..00000000000 --- a/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S +++ /dev/null @@ -1,224 +0,0 @@ -#include -#define CHMK() call_pal 0x83 -#define COMPAT_43 -#include -#ifndef __CONCAT -#include -#endif -#define CONCAT __CONCAT - -#undef SYSCALL - -/* Kernel syscall interface: - Input: - v0 - system call number - a* - arguments, as in C - Output: - a3 - zero iff successful - v0 - errno value on failure, else result - - This macro is similar to SYSCALL in asm.h, but not completely. - There's room for optimization, if we assume this will continue to - be assembled as one file. - - This macro expansions does not include the return instruction. - If there's no other work to be done, use something like: - SYSCALL(foo) ; ret - If there is other work to do (in fork, maybe?), do it after the - SYSCALL invocation. */ - -#define SYSCALL(x) \ - .align 4 ;\ - .globl CONCAT(machdep_sys_,x) ;\ - .ent CONCAT(machdep_sys_,x), 0 ;\ -CONCAT(machdep_sys_,x): ;\ - .frame sp,0,ra ;\ - ldiq v0, CONCAT(SYS_,x) ;\ - CHMK() ;\ - beq a3, CONCAT(Lsys_noerr_,x) ;\ - br gp, CONCAT(Lsys_err_,x) ;\ -CONCAT(Lsys_err_,x): ;\ - /* Load gp so we can find cerror to jump to. */;\ - ldgp gp, 0(gp) ;\ - jmp zero, machdep_cerror ;\ -CONCAT(Lsys_noerr_,x): - -#define XSYSCALL(x) SYSCALL(x) ; RET ; .end CONCAT(machdep_sys_,x) - - .globl machdep_cerror -machdep_cerror: - br t0, Lmachdep_cerror_setgp -Lmachdep_cerror_setgp: - ldgp gp, 0(t0) - stl v0, errno -#if 0 - ldiq v0, -1 -#else - subq zero, v0, v0 -#endif - RET - -/* The fork system call is special... */ -SYSCALL(fork) - cmovne a4, 0, v0 - RET - .end machdep_sys_fork - -/* The pipe system call is special... */ -SYSCALL(pipe) - stl v0, 0(a0) - stl a4, 4(a0) - mov zero, v0 - RET - .end machdep_sys_pipe - -/* The sigsuspend system call is special... */ - .align 4 - .globl machdep_sys_sigsuspend - .ent machdep_sys_sigsuspend, 0 -machdep_sys_sigsuspend: - ldl a0, 0(a0) /* pass *mask instead of mask */ - ldiq v0, SYS_sigsuspend - CHMK() - mov zero, v0 /* shouldn't need; just in case... */ - RET - .end machdep_sys_sigsuspend - -/* The sigprocmask system call is special... */ - .align 4 - .globl machdep_sys_sigprocmask - .ent machdep_sys_sigprocmask, 0 -machdep_sys_sigprocmask: - mov a2, a5 /* safe */ - cmoveq a1, 1, a0 /* if set == NULL, how = SIG_BLOCK */ - beq a1, Ldoit /* and set = 0, and do it. */ - ldl a1, 0(a1) /* load the set from *set */ -Ldoit: ldiq v0, SYS_sigprocmask - CHMK() - beq a5, Lret /* if they don't want old mask, done */ - stl v0, 0(a5) /* otherwise, give it to them. */ -Lret: mov zero, v0 - RET - .end machdep_sys_sigprocmask - -/* More stuff ... */ - .align 4 - .global __machdep_save_int_state - .ent __machdep_save_int_state, 0 -__machdep_save_int_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* save integer registers */ - stq ra, ( 0 * 8)(a0) /* return address */ - stq s0, ( 1 * 8)(a0) /* callee-saved registers */ - stq s1, ( 2 * 8)(a0) - stq s2, ( 3 * 8)(a0) - stq s3, ( 4 * 8)(a0) - stq s4, ( 5 * 8)(a0) - stq s5, ( 6 * 8)(a0) - stq s6, ( 7 * 8)(a0) - stq sp, ( 9 * 8)(a0) - stq ra, ( 8 * 8)(a0) /* RA on return */ - stq pv, (10 * 8)(a0) /* and PV; we restore it */ - - mov zero, v0 - lda sp, 16(sp) - RET - .end __machdep_save_int_state - - .align 4 - .global __machdep_restore_int_state - .ent __machdep_restore_int_state, 0 -__machdep_restore_int_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* restore integer registers */ - ldq t0, ( 0 * 8)(a0) /* return address */ - ldq s0, ( 1 * 8)(a0) /* callee-saved registers */ - ldq s1, ( 2 * 8)(a0) - ldq s2, ( 3 * 8)(a0) - ldq s3, ( 4 * 8)(a0) - ldq s4, ( 5 * 8)(a0) - ldq s5, ( 6 * 8)(a0) - ldq s6, ( 7 * 8)(a0) - ldq ra, ( 8 * 8)(a0) /* RA after return */ - ldq sp, ( 9 * 8)(a0) - ldq pv, (10 * 8)(a0) /* and PV; we restore it */ - - ldiq v0, 1 - ret zero,(t0),1 - .end __machdep_restore_int_state - - .align 4 - .global __machdep_save_fp_state - .ent __machdep_save_fp_state, 0 -__machdep_save_fp_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* save FP registers */ - stt fs0, (0 * 8)(a0) /* callee-saved registers */ - stt fs1, (1 * 8)(a0) - stt fs2, (2 * 8)(a0) - stt fs3, (3 * 8)(a0) - stt fs4, (4 * 8)(a0) - stt fs5, (5 * 8)(a0) - stt fs6, (6 * 8)(a0) - stt fs7, (7 * 8)(a0) - mf_fpcr ft0 /* and FP control reg */ - stt ft0, (8 * 8)(a0) - - lda sp, 16(sp) - RET - .end __machdep_save_fp_state - - .align 4 - .global __machdep_restore_fp_state - .ent __machdep_restore_fp_state, 0 -__machdep_restore_fp_state: - .frame sp, 16, ra - ldgp gp, 0(t12) - lda sp, -16(sp) - stq ra, 0(sp) - - /* restore FP registers */ - ldt fs0, (0 * 8)(a0) /* callee-saved registers */ - ldt fs1, (1 * 8)(a0) - ldt fs2, (2 * 8)(a0) - ldt fs3, (3 * 8)(a0) - ldt fs4, (4 * 8)(a0) - ldt fs5, (5 * 8)(a0) - ldt fs6, (6 * 8)(a0) - ldt fs7, (7 * 8)(a0) - ldt ft0, (8 * 8)(a0) - mt_fpcr ft0 /* and FP control reg */ - - lda sp, 16(sp) - RET - .end __machdep_restore_fp_state - -/* For fstat() we actually syscall fstat13. */ - .align 4 - .globl machdep_sys_fstat - .ent machdep_sys_fstat, 0 -machdep_sys_fstat: - .frame sp,0,ra - ldiq v0, SYS___fstat13 - CHMK() - beq a3, Lsys_noerr_fstat - br gp, Lsys_err_fstat -Lsys_err_fstat: - /* Load gp so we can find cerror to jump to. */ - ldgp gp, 0(gp) - jmp zero, machdep_cerror -Lsys_noerr_fstat: - RET - .end machdep_sys_fstat diff --git a/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S b/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S deleted file mode 100644 index cfdbbc77f73..00000000000 --- a/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S +++ /dev/null @@ -1,237 +0,0 @@ -/* ==== syscall.S ============================================================ - * Copyright (c) 1990 The Regents of the University of California. - * Copyright (c) 1995 Chris Provenzano, proven@mit.edu - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * 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. - * - * Description : Machine dependent syscalls for i386/i486/i586 - * - */ - -#ifndef lint - .text - .asciz "syscall-i386-freebsd-2.0.S,v 1.2 1995/05/26 07:44:29 proven Exp"; -#endif - -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" -#endif /* SYSLIBC_SCCS and not lint */ - -#include - -#ifdef __STDC__ - -#define SYSCALL(x) \ - .globl _machdep_sys_##x##; \ - \ -_machdep_sys_##x##:; \ - \ - movl $(SYS_##x##), %eax; \ - .byte 0x9a; .long 0; .word 7; \ - jb 1b; \ - ret; - -#else - -#define SYSCALL(x) \ - .globl _machdep_sys_/**/x; \ - \ -_machdep_sys_/**/x:; \ - \ - movl $(SYS_/**/x), %eax; \ - .byte 0x9a; .long 0; .word 7; \ - jb 1b; \ - ret; - -#endif - - -/* - * Initial asm stuff for all functions. - */ - .text - .align 2 - - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -1: - neg %eax - ret - -/* ========================================================================== - * machdep_sys_fork() - */ - .globl _machdep_sys_fork; - -_machdep_sys_fork:; - - movl $(SYS_fork), %eax; - .byte 0x9a; .long 0; .word 7; - cmpl $0, %edx - je 2f - movl $0, %eax -2: - ret; - -/* ========================================================================== - * machdep_sys___syscall() - */ - -_machdep_sys___syscall:; - - movl $(SYS___syscall), %eax; - .byte 0x9a; .long 0; .word 7; - jb 3f; - ret - -/* ========================================================================== - * machdep_sys_sigsuspend() - */ - .globl _machdep_sys_sigsuspend; - -_machdep_sys_sigsuspend:; - - movl 4(%esp),%eax # fetch mask arg - movl (%eax),%eax # indirect to mask arg - movl %eax,4(%esp) - movl $(SYS_sigsuspend), %eax; - .byte 0x9a; .long 0; .word 7; - jb 3f; - ret - -3: - - neg %eax - movl $0xffffffff,%edx - ret - -/* ========================================================================== - * machdep_sys_sigprocmask() - */ - .globl _machdep_sys_sigprocmask; - -_machdep_sys_sigprocmask:; - - movl 8(%esp),%ecx - movl (%ecx),%ecx - movl %ecx,8(%esp) - movl $ SYS_sigprocmask , %eax - .byte 0x9a; .long 0; .word 7; - jb 4f; - ret - -4: - neg %eax - movl $0xffffffff,%edx - ret - -/* ========================================================================== - * machdep_sys_lseek() - */ - .globl _machdep_sys_lseek; - -_machdep_sys_lseek:; - - pushl %ebp; - movl %esp,%ebp; - pushl 0x14(%ebp); - pushl 0x10(%ebp); - pushl 0xc(%ebp); - pushl $0x0; - pushl 0x8(%ebp); - pushl $0x0; - pushl $(SYS_lseek); - call _machdep_sys___syscall; - leave - ret - -/* ========================================================================== - * machdep_sys_ftruncate() ; Added by Monty - */ - .globl _machdep_sys_ftruncate; - -_machdep_sys_ftruncate:; - - pushl %ebp; - movl %esp,%ebp; - pushl 0x10(%ebp); - pushl 0xc(%ebp); - pushl $0x0; # Why this? - pushl 0x8(%ebp); - pushl $0x0; # And this? - pushl $(SYS_ftruncate); - call _machdep_sys___syscall; - leave - ret - -/* ========================================================================== - * machdep_sys_setjmp() - */ - .globl _machdep_sys_setjmp; - -_machdep_sys_setjmp:; - movl 4(%esp),%eax - movl 0(%esp),%edx - movl %edx, 0(%eax) /* rta */ - movl %ebx, 4(%eax) - movl %esp, 8(%eax) - movl %ebp,12(%eax) - movl %esi,16(%eax) - movl %edi,20(%eax) - xorl %eax,%eax - ret - -/* ========================================================================== - * machdep_sys_longjmp() - */ - .globl _machdep_sys_longjmp; - -_machdep_sys_longjmp:; - movl 4(%esp),%edx - movl 8(%esp),%eax - movl 0(%edx),%ecx - movl 4(%edx),%ebx - movl 8(%edx),%esp - movl 12(%edx),%ebp - movl 16(%edx),%esi - movl 20(%edx),%edi - testl %eax,%eax - jnz 1f - incl %eax -1: movl %ecx,0(%esp) - ret - diff --git a/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S b/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S deleted file mode 100644 index 78df3bd8c8a..00000000000 --- a/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S +++ /dev/null @@ -1,102 +0,0 @@ -/* ==== syscall.S ============================================================ - * Copyright (c) 1994 Chris Provenzano, proven@mit.edu - * All rights reserved. - * - */ - -#ifndef lint - .text - .asciz "$Id: syscall-sparc-netbsd-1.1.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; -#endif - -#include - -#define SYSCALL(x) \ - .globl _machdep_sys_##x; \ - \ -_machdep_sys_##x:; \ - \ - mov SYS_##x, %g1; \ - ta 0; \ - bcs,a 2b; \ - sub %r0,%o0,%o0; \ - retl - - -/* - * Initial asm stuff for all functions. - */ - .text - .align 4 - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -1: - sub %r0, %o0, %o0 -2: - retl - nop - -/* ========================================================================== - * machdep_sys_pipe() - */ - .globl _machdep_sys_pipe - -_machdep_sys_pipe: - mov %o0, %o2 - mov SYS_pipe, %g1 - ta 0 - bcs 1b - nop - st %o0, [ %o2 ] - st %o1, [ %o2 + 4 ] - retl - mov %g0, %o0 - -/* ========================================================================== - * machdep_sys_fork() - */ - .globl _machdep_sys_fork; - -_machdep_sys_fork:; - - mov SYS_fork, %g1; - ta 0; - bcs 1b; - nop; - dec %o1; - retl; - and %o0, %o1, %o0; ! return 0 in child, pid in parent - -/* ========================================================================== - * machdep_sys_sigprocmask() - */ - .globl _machdep_sys_sigprocmask; - -_machdep_sys_sigprocmask:; - - ld [%o1], %o1; - mov SYS_sigprocmask, %g1; - ta 0; - bcs 1b; - nop; - retl - nop - -/* ========================================================================== - * machdep_sys_sigsuspend() - */ - .globl _machdep_sys_sigsuspend; - -_machdep_sys_sigsuspend:; - - ld [%o0], %o0; - mov SYS_sigsuspend, %g1; - ta 0; - bcs 1b; - nop; - retl - nop diff --git a/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S b/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S deleted file mode 100644 index a2941ece7c9..00000000000 --- a/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S +++ /dev/null @@ -1,46 +0,0 @@ -#include -#define COMPAT_43 -#include -#define CHMK() call_pal 0x83 - -#undef SYSCALL - -/* Kernel syscall interface: - Input: - v0 - system call number - a* - arguments, as in C - Output: - a3 - zero iff successful - v0 - errno value on failure, else result - - This macro is similar to SYSCALL in asm.h, but not completely. - There's room for optimization, if we assume this will continue to - be assembled as one file. - - This macro expansions does not include the return instruction. - If there's no other work to be done, use something like: - SYSCALL(foo) ; ret - If there is other work to do (in fork, maybe?), do it after the - SYSCALL invocation. */ - -#define SYSCALL(x) \ - .align 4 ;\ - .globl machdep_sys_##x ;\ - .ent machdep_sys_##x, 0 ;\ -machdep_sys_##x: ;\ - .frame sp,0,ra ;\ - ldiq v0, SYS_##x ;\ - CHMK() ;\ - beq a3, Lsys_noerr_##x ;\ - br gp, Lsys_err_##x ;\ -Lsys_err_##x: ;\ - /* Load gp so we can find cerror to jump to. */;\ - ldgp gp, 0(gp) ;\ - jmp zero, machdep_cerror ;\ -Lsys_noerr_##x: - -#define SIMPLE_SYSCALL(x) SYSCALL(x) ; ret ; .end machdep_sys_##x - -#define XSYSCALL(x) SIMPLE_SYSCALL(x) - -XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S b/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S deleted file mode 100644 index 34fb5caaa43..00000000000 --- a/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#ifdef __STDC__ - -#define SYSCALL(x) \ - .globl _machdep_sys_##x##; \ - \ -_machdep_sys_##x:##; \ - \ - movl $(SYS_##x##), %eax; \ - .byte 0x9a; .long 0; .word 7; \ - jb 1b; \ - ret; - -#else - -#define SYSCALL(x) \ - .globl _machdep_sys_/**/x; \ - \ -_machdep_sys_/**/x:; \ - \ - movl $(SYS_/**/x), %eax; \ - .byte 0x9a; .long 0; .word 7; \ - jb 1b; \ - ret; - -#endif - - -/* - * Initial asm stuff for all functions. - */ - .text - .align 2 - - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -1: - neg %eax - ret - -#define XSYSCALL(NAME) SYSCALL(NAME) - -XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S b/lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S deleted file mode 100644 index 2d07892a315..00000000000 --- a/lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S +++ /dev/null @@ -1,40 +0,0 @@ -/* ==== syscall.S ============================================================ - * Copyright (c) 1994 Chris Provenzano, proven@mit.edu - * All rights reserved. - * - */ - -#include - -#define SYSCALL(x) \ - .globl _machdep_sys_##x; \ - \ -_machdep_sys_##x:; \ - \ - mov SYS_##x, %g1; \ - ta 0; \ - bcs,a 2b; \ - sub %r0,%o0,%o0; \ - retl; \ - nop - -/* - * Initial asm stuff for all functions. - */ - .text - .align 4 - -/* ========================================================================== - * error code for all syscalls. The error value is returned as the negative - * of the errno value. - */ - -1: - sub %r0, %o0, %o0 -2: - retl - nop - -#define XSYSCALL(NAME) SYSCALL(NAME) - -XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/net/Makefile.inc b/lib/libpthread/net/Makefile.inc index c89732ac048..76726e79e3a 100644 --- a/lib/libpthread/net/Makefile.inc +++ b/lib/libpthread/net/Makefile.inc @@ -1,8 +1,7 @@ # from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 -# $Id: Makefile.inc,v 1.1 1998/07/21 13:19:44 peter Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:42 peter Exp $ -# gen sources -.PATH: ${srcdir}/net +.PATH: ${.CURDIR}/net SRCS+= gethostbyaddr.c gethostbyname.c gethostent.c getnetbyaddr.c \ getnetbyname.c getnetent.c getproto.c getprotoent.c getprotoname.c \ diff --git a/lib/libpthread/pthreads/Makefile.inc b/lib/libpthread/pthreads/Makefile.inc index 86c63233c1a..98ac0b520cc 100644 --- a/lib/libpthread/pthreads/Makefile.inc +++ b/lib/libpthread/pthreads/Makefile.inc @@ -1,9 +1,65 @@ # from: @(#)Makefile.inc 5.6 (Berkeley) 6/4/91 -# pthread sources .PATH: ${.CURDIR}/pthreads -SRCS+= cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c mutex.c \ - pthread.c pthread_attr.c queue.c signal.c pthread_join.c \ - pthread_detach.c sleep.c +SRCS+= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c file.c globals.c malloc.c \ + mutex.c pthread.c pthread_attr.c queue.c signal.c machdep.c syscall.S \ + pthread_join.c pthread_detach.c pthread_once.c sleep.c specific.c \ + process.c wait.c errno.c schedparam.c _exit.c prio_queue.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 + +.if !defined(NOPIC) +SOBJS+= syscalls.so +SYSCALL_PIC_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -DPIC -c ${.CURDIR}/syscall-template.S -o ${.OBJDIR}/syscalls/S$$syscall.so +.else +SYSCALL_PIC_COMPILE= true +.endif + +.if !defined(NOPROFILE) +POBJS+= syscalls.po +SYSCALL_PROF_COMPILE= $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -pg -c ${.CURDIR}/syscall-template.S -o ${.OBJDIR}/syscalls/S$$syscall.po +.else +SYSCALL_PROF_COMPILE= true +.endif + +syscalls.o syscalls.so syscalls.po : syscall-template.S + -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 ${.CURDIR}/syscall-template.S -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 + +.if !defined(NOPROFILE) + x=`pwd` && cd ${.OBJDIR}/syscalls && ld -r -o ../syscalls.po *.po && cd $$x +.endif + rm -r ${.OBJDIR}/syscalls + +syscall.o: syscall.S + cpp ${CPPFLAGS} ${.CURDIR}/syscall.S > syscall.i + as syscall.i + rm syscall.i + mv a.out syscall.o + +syscall.po: syscall.S + cpp ${CPPFLAGS} ${.CURDIR}/syscall.S > syscall.i + as syscall.i + rm syscall.i + mv a.out syscall.po + +MAN2+= + +MAN3+= diff --git a/lib/libpthread/stdio/Makefile.inc b/lib/libpthread/stdio/Makefile.inc index ff13440c8d0..8f0e0a5d30a 100644 --- a/lib/libpthread/stdio/Makefile.inc +++ b/lib/libpthread/stdio/Makefile.inc @@ -1,18 +1,18 @@ # from: @(#)Makefile.inc 5.7 (Berkeley) 6/27/91 -# $Id: Makefile.inc,v 1.1 1995/10/18 08:43:05 deraadt Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:45 peter Exp $ -# Thread safe stdio sources .PATH: ${.CURDIR}/stdio +# SRCS+= tempnam.c tmpfile.c tmpnam.c + SRCS+= clrerr.c fclose.c fdopen.c feof.c ferror.c fflush.c fgetc.c \ fgetline.c fgetpos.c fgets.c fileno.c findfp.c flags.c fopen.c \ fprintf.c fpurge.c fputc.c fputs.c fread.c freopen.c fscanf.c \ fseek.c fsetpos.c ftell.c funopen.c fvwrite.c fwalk.c fwrite.c \ - getc.c getchar.c gets.c getw.c makebuf.c perror.c printf.c putc.c \ + getc.c getchar.c gets.c getw.c makebuf.c perror.c putc.c \ putchar.c puts.c putw.c refill.c remove.c rewind.c rget.c scanf.c \ - setbuf.c setbuffer.c setvbuf.c snprintf.c sprintf.c sscanf.c \ - stdio.c tempnam.c tmpfile.c tmpnam.c ungetc.c vfprintf.c \ - vfscanf.c vprintf.c vscanf.c vsnprintf.c vsprintf.c vsscanf.c \ + setbuf.c setbuffer.c setvbuf.c sscanf.c \ + stdio.c ungetc.c \ + vfscanf.c vscanf.c vsscanf.c \ wsetup.c putc_unlocked.c putchar_unlocked.c getc_unlocked.c \ - getchar_unlocked.c strerror.c wbuf.c - + getchar_unlocked.c strerror.c wbuf.c xprintf.c diff --git a/lib/libpthread/stdlib/Makefile.inc b/lib/libpthread/stdlib/Makefile.inc index cc323d1d0e1..07e7eceaec6 100644 --- a/lib/libpthread/stdlib/Makefile.inc +++ b/lib/libpthread/stdlib/Makefile.inc @@ -1,10 +1,5 @@ # @(#)Makefile.inc 5.6 (Berkeley) 6/4/91 -# stdlib sources -.PATH: ${srcdir}/${MACHINE}/stdlib ${srcdir}/stdlib +.PATH: ${.CURDIR}/stdlib SRCS+= exit.c strtod.c getopt.c rand.c random.c strtol.c strtoul.c - -# SRCS+=abort.c atexit.c atoi.c atof.c atol.c bsearch.c calloc.c div.c \ -# getenv.c heapsort.c labs.c ldiv.c malloc.c multibyte.c \ -# putenv.c qsort.c radixsort.c setenv.c system.c diff --git a/lib/libpthread/string/Makefile.inc b/lib/libpthread/string/Makefile.inc index 0a3804975e0..b76cb22565d 100644 --- a/lib/libpthread/string/Makefile.inc +++ b/lib/libpthread/string/Makefile.inc @@ -1,8 +1,8 @@ # from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 -# $Id: Makefile.inc,v 1.1 1998/07/21 13:22:19 peter Exp $ +# $Id: Makefile.inc,v 1.2 1998/07/21 16:28:48 peter Exp $ # string sources -.PATH: ${srcdir}/string +.PATH: ${.CURDIR}/string SRCS+= strtok.c -- cgit v1.2.3