diff --git a/lib/libpthread/Makefile b/lib/libpthread/Makefile index b6bd68064ece..77c8ccae2059 100644 --- a/lib/libpthread/Makefile +++ b/lib/libpthread/Makefile @@ -2,20 +2,21 @@ LIB=pthread INSTALL_PIC_ARCHIVE= no -CPPFLAGS+= -g -DPTHREAD_KERNEL -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE} +CPPFLAGS+= -g -DPTHREAD_KERNEL -I. -I${.CURDIR}/include -I${.CURDIR}/arch/${MACHINE} CFLAGS+= ${CPPFLAGS} .include "${.CURDIR}/arch/${MACHINE}/Makefile.inc" .include "${.CURDIR}/pthreads/Makefile.inc" -all: preall +all: includelinks -preall: - if [ ! -e include/pthread ]; then; \ - ln -s . include/pthread; \ - fi - if [ ! -e arch/${MACHINE}/pthread ]; then; \ - ln -s . arch/${MACHINE}/pthread; \ +beforedepend: includelinks + +CLEANFILES+=pthread + +includelinks: + if [ ! -e pthread ]; then; \ + ln -s ${.CURDIR}/include pthread; \ fi .include diff --git a/lib/libpthread/arch/i386/machdep.h b/lib/libpthread/arch/i386/machdep.h index acad2903592a..80b5df5b8108 100644 --- a/lib/libpthread/arch/i386/machdep.h +++ b/lib/libpthread/arch/i386/machdep.h @@ -4,9 +4,6 @@ */ #include -#include -#include -#include /* * The first machine dependent functions are the SEMAPHORES @@ -27,53 +24,8 @@ temp; \ #define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR -/* - * New types - */ -typedef long semaphore; - -#define SIGMAX 31 - -/* - * New Strutures - */ -struct machdep_pthread { - void *(*start_routine)(void *); - void *start_argument; - void *machdep_stack; - struct itimerval machdep_timer; - jmp_buf machdep_state; -}; - -/* - * Static machdep_pthread initialization values. - * For initial thread only. - */ -#define MACHDEP_PTHREAD_INIT \ -{ NULL, NULL, NULL, { { 0, 0 }, { 0, 0 } }, 0 } - /* * 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) - -int semaphore_text_and_set __P((semaphore *)); -int machdep_save_state __P((void)); - -#endif - -__END_DECLS diff --git a/lib/libpthread/include/Makefile.inc b/lib/libpthread/include/Makefile.inc index b7fe59d5f0df..3317d5651551 100644 --- a/lib/libpthread/include/Makefile.inc +++ b/lib/libpthread/include/Makefile.inc @@ -7,10 +7,7 @@ FILES= cond.h copyright.h fd.h fd_pipe.h kernel.h mutex.h posix.h \ - pthread.h pthread_attr.h queue.h util.h - -# Machine dependent header file -MFILE= ${.CURDIR}/arch/${MACHINE}/machdep.h + pthread.h pthread_attr.h queue.h util.h engine.h realinstall: if [ ! -d ${DESTDIR}/usr/include/pthread ]; then \ @@ -21,8 +18,6 @@ realinstall: cmp -s $$i ${DESTDIR}/usr/include/pthread/$$i || \ install -c -m 644 $$i ${DESTDIR}/usr/include/$$i; \ done - cmp -s ${MFILE} ${DESTDIR}/usr/include/pthread/machdep.h || \ - install -c -m 644 ${MFILE} ${DESTDIR}/usr/include/pthread/machdep.h rm -rf ${DESTDIR}/usr/include/pthread.h ln -s /usr/include/pthread/pthread.h ${DESTDIR}/usr/include/pthread.h @chown -R ${BINOWN}:${BINGRP} ${DESTDIR}/usr/include/pthread diff --git a/lib/libpthread/include/engine.h b/lib/libpthread/include/engine.h new file mode 100644 index 000000000000..a32a4a60e620 --- /dev/null +++ b/lib/libpthread/include/engine.h @@ -0,0 +1,59 @@ +/* ==== engine.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + */ + +#include +#include +#include +#include + +#if defined(PTHREAD_KERNEL) +#include "machdep.h" +#endif + +/* + * New types + */ +typedef long semaphore; + +#define SIGMAX 31 + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + jmp_buf machdep_state; +}; + +/* + * Static machdep_pthread initialization values. + * For initial thread only. + */ +#define MACHDEP_PTHREAD_INIT \ +{ NULL, NULL, NULL, { { 0, 0 }, { 0, 0 } }, 0 } + +/* + * Some fd flag defines that are necessary to distinguish between posix + * behavior and bsd4.3 behavior. + */ +#define __FD_NONBLOCK O_NONBLOCK + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(PTHREAD_KERNEL) + +int semaphore_text_and_set __P((semaphore *)); +int machdep_save_state __P((void)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/include/pthread.h b/lib/libpthread/include/pthread.h index 4a5fbd6d250a..a6b5e9107b9a 100644 --- a/lib/libpthread/include/pthread.h +++ b/lib/libpthread/include/pthread.h @@ -8,7 +8,7 @@ */ #include -#include +#include #include #include #include