diff options
author | Peter Galbavy <peter@cvs.openbsd.org> | 1998-07-21 13:20:29 +0000 |
---|---|---|
committer | Peter Galbavy <peter@cvs.openbsd.org> | 1998-07-21 13:20:29 +0000 |
commit | 43b686d61558c0957f1779c747214ddef20a2252 (patch) | |
tree | 99fb41dbccee40683a84fe98aa3c6a9784911bf2 /lib | |
parent | ea12e8eb2f8d4c89e854d9381f85ce8fb4688ad0 (diff) |
Complete initial import from mySQL 3.22.4 (mit-pthreads/).
Lots of dross to move and remove yet.
At minimum:
o remove GNU config and GNU Makefiles
o build arch directory and migrate away machdep/
o rebuild BSD Makefiles
o move notes etc. into doc/
Diffstat (limited to 'lib')
492 files changed, 56695 insertions, 0 deletions
diff --git a/lib/libpthread/Changes-mysql b/lib/libpthread/Changes-mysql new file mode 100644 index 00000000000..032a1fded87 --- /dev/null +++ b/lib/libpthread/Changes-mysql @@ -0,0 +1,169 @@ +Changes done to this distrubtion (pthreads-1_60_beta6) by Monty (monty@tcx.se) + +93.04.01 +- socket() didn't return NOTOK (-1) on error. +- bind() didn't set error code on failure + +93.03.27 +- Added patch by D. Richard Hipp <drh@vnet.net> to make strtod and + printf (of floats/doubles) thread safe. Patch provided by mevans@cti-ltd.com +- Added patch I got from lucid@secret.org to fix lock in fork(). + +93.03.26 +- Fixed some include files for BSD 2.0. +- Changed the prototype of ioctl() for BSD. +- Fixed new bug in fd_kernel.c; _fd_kern_read returned sometimes wrong errno. + +93.03.22 +- Change sys/cdefs.h to get it through Sun cc. +- Added patches by Mark Evans + 1. Crashes and hangs. + 2. Missing functionality (namely flock()) + 3. Use of POSIX reentrant safe routines. + +93.03.21 +- Add patches by Larry V. Streepy to fix pthread_cancel. + Fixed bug in Streepy's patch that checked return values of read,write.. + in fd.c (Already done in fd_sys.c) + +1. Added a declaration of "signal" to include/signal.h +2. Modified PANIC macro to operate like assert and call a new function + panic_kernel. Added new file pthreads/panic.c. +3. Added support for fstatfs syscall for linux (mod to + syscall-i386-linux-1.0.S). +4. Added missing function declarations to machdep/linux-1.0/socket.h: + getsockopt + setsockopt + getsockname + getpeername + send + recv + sendto + recvfrom + sendmsg + recvmsg + shutdown +5. Added ifdef to avoid type conflict in machdep/linux-1.0/timers.h +6. Fix bug in getprotoent (bogus semi-colon after if stmt). +7. Change function name in proto_internal.c from _proto_init to + _proto_buf. +8. Fix bug in res_internal.c where buffer pointer was improperly + maintained. +9. Fix return value handling for POSIX function implementations. +10. Fix bug in select handling where a thread could be incorrectly + resumed with no sockets ready. Also added proper handling of + selecting for exceptions (this was not implemented at all). +11. Added deadlock detection to pthread_join (it can now return an + EDEADLK error). +12. Added support for pthread_cancel, changes to lots of files for this. +13. Add new function __pthread_is_valid that searches the pthread list + for a specified pthread_t value. + +93.03.22 +- Fixed some if the tests according to the below changes. + +93.03.21 by "Mati Sauks" <mati@psti.com> +- Fixed bug if priority queue was empty or (*current)->next is empty. + +96.03.20 by Josip Gracin +- Fixed gethostbyname to handle alias + +97.02.07 +- Removed CVS directories. +- Commented make install in GNUmakefile.in. + +97.01.26 by David (david@detron.se) +- Fixed a dist target in the GNUmakefile +- Added #undef PTHREAD_STACK_MIN to avoid warning on solaris 2.5 + +97.01.21 by Monty (monty@tcx.se) + +- Added file mysql-TODO and the patches directory. +- Added patch p153 and p155 by Tim Hinderliter and Chris Colohan + check the patches directory for more info. +- Changed pthread_cond_timedwait to return ETIME instead of ETIMEDOUT + (Required by Posix) +- Changed the include file pthread.h to add prototypes for the following + functions: pthread_sigmask, sigwait and sigsetwait +- Added shutdown() and getpeername() prototypes to 'machdep/sunos-5.3/socket.h' +- Changed __FD_NONBLOCK to (O_NONBLOCK | O_NDELAY) in + ./machdep/engine-sparc-sunos-5.3.h +- Added rint() prototype to math.h +- Added new slot sighandled to 'struct pthread' for easy check if somebody + interrupts a system call. +- pthread_kill can now interrupt the following system calls: + select(), read(), write(), send(), sendto(), sendmsg(), recv_timedwait(), + recvfrom_timedwait(), readev(), writeev() and some socket functions. +- Fixed bug in pthread_kill() which count up 'sigcount' wrongly. + Two pthread_kill() in a row bugged the thread. +- Merged fd_kern_wait and fd_kern_poll to 1 function and removed a + a bug when polling select. +- Implemented getpeername(). +- Some small optimizations. +- Some re-indentation to make the code readable by me (Sorry about that). + +97.08.15 by Monty (monty@tcx.se) + +- Added patch by "Chris G. Demetriou" <cgd@pa.dec.com> for NetBSD/alpha. + +97.08.18 by Monty (monty@tcx.se) + +- Added new machdep definitions for HPUX-10.20, + by JOERG_HENNE@Non-HP-Germany-om88.om.hp.com + +97.09.25 by Monty (monty@tcx.se) + +- Added some definitions for i386-SCO from the site: + http://www.sco.com/skunkware/osr5/libraries/ + +97.10.12 by Monty (monty@tcx.se) + +- Changed prototype macro __P to __P_ to avoid warnings on Solaris. +- Fixed interruption of select() with pthread_kill() when signal handler + used read or write. + +97.10.16 by Monty (monty@tcx.se) + +- Fixed that blocked signals doesn't interrupt threads. + +97.10.20 by Monty (monty@tcx.se) + +- Fixed broken ftruncate system call for FreeBSD 2.0 + The old one destroyed the orignal file by truncation too much. +- Fixed prototypes for des_setkey,encrypt and setkey (according to Solaris 2.5) + +97.11.26 by Monty (monty@tcx.se) + +- Small patch to avoid compile errors on alpha-OSF1 3.2 + +97.12.18 by Monty (monty@tcx.se) + +- Added fix for Irix 5.3 in __unistd.h + +98.01.13 by Monty (monty@tcx.se) +- Added fd_check_entry to dup2 and table sizecheck to fd_check_entry() + patch by Martin Fuchs <Martin@igdv.fh-darmstadt.de> + +98.01.18 by Monty (monty@tcx.se) +- Added prototype for gettimeofday() for Solars 2.3 +- Added some small fixes for configure and Solaris 2.6 + +98.01.23 by Monty (monty@tcx.se) +- Ported to openbsd. +- Renamed nanosleep() to pthread_nanosleep() to avoid name conflict on + openbsd. +- Fixed link problem with variable __sglue for Irix 5.3 + by Vladislav Malyshkin <malyshki@cs.wmich.edu>. + +98.03.02 by Monty (monty@tcx.se) +- Applied patches from Curt Sampson <cjs@portal.ca>; NetBSD 1.3/i386 port. + +98.03.09 by Monty (monty@tcx.se) +- Applied patches from Curt Sampson <cjs@portal.ca>; NetBSD 1.3/Alpha port. + +98.05.12 +- Added unixware to config.guess + +98.06.07 +- Added patch by Scott Dybiec <sdybiec@humanfactor.com>: + Fixed select() returning incorrect number of active file descriptors. diff --git a/lib/libpthread/FAQ b/lib/libpthread/FAQ new file mode 100644 index 00000000000..e4fd3cfc6d8 --- /dev/null +++ b/lib/libpthread/FAQ @@ -0,0 +1,122 @@ + + Answers to frequently asked questions + for my implementation of POSIX threads + +------------------------------------------------------------------------------- +1. Pthreads + +(1.0) What is Pthreads? +(1.1) Where can I get info on Pthreads? + +2. Getting, Building, Installing and Using proven's Pthreads + +(2.0) Where can I get the latest version of proven's Pthreads? +(2.1) What platforms does proven's Pthreads run on? +(2.2) What do I need to build proven's Pthreads? +(2.3) How do I install proven's Pthreads? + +3. Known Problems + +(3.0) Tests +(3.1) Installation +(3.2) Missing functionality +(3.3) Signals + +------------------------------------------------------------------------------- +1. Pthreads + +(1.0) What is Pthreads? + +Pthreads stands for POSIX threads and is based on the POSIX 1003.1c 1995 +thread standard. This standard passed international Standards Organization +(ISO) Committee Document (CD) balloting in February 1995 and got the +IEEE Standards Board approval in June 1995. + + +(1.1) Where can I get info on Pthreads? + +You can call IEEE (908) 562-3800 which is the organization which POSIX +belongs, and ask for POSIX 1003.1c (not 1003.4a) draft 10 (the standard +won't be out until sometime in 1996). The draft costs $30.00 plus shipping +which for me was $4.00. The IEEE doesn't make any of the standards available +online. + +I have made documentation for some of the functions available online. +To reference these use http://www.mit.edu:8001/people/proven/pthreads.html + +------------------------------------------------------------------------------- +2. Getting, Building, Installing and Using proven's Pthreads + +(2.0) Where can I get the latest version of proven's Pthreads? + +The latest version is pthreads-1_60_beta6 was release on November 16, 1996 +and is available from sipb.mit.edu:/pub/pthreads. + + +(2.1) What platforms does proven's Pthreads run on? + +Lot's! It should run on the following platforms; the i386 processor +running NetBSD-1.x, FreeBSD-2.x, BSDOS-2.0, Linux-1.2 and Linux-1.3; +the r2000 (DECstation) running Ultrix-4.2; the Sparc running NetBSD-1.x, +SunOS-4.1.3, Solaris-2.3, and Solaris-2.4; the alpha running OSF-2.3 and +OSF-3.x; the SGI running IRIX-5.2; and the HPPA running HP/UX-9.x. + +Because it runs on so many platforms I don't get to compile and test every +platform for every release. If you have a problem send mail to +pthreads-bugs@mit.edu with the processor, OS, and version number along with +a description of the bug. + + +(2.2) What do I need to build proven's Pthreads? + +You will need gcc and gmake to build for all but NetBSD, FreeBSD and BSDOS. +For those you may use either gmake or pmake (the native make). + + +(2.3) How do I install proven's Pthreads? + +Installing pthreads is real easy. At the top level of pthreads do + +configure +make +make install + +It will be installed into the directory /usr/local/pthreads. If you don't +like the location add a --prefix=<dir> option to configure. That's it. + + +------------------------------------------------------------------------------- +3. Known problems. + +(3.0) Tests + +Under SunOS-4.1.x there is a bug in the kernel that prevents test_sock_1 +from passing. This bug has to do with a process tring to connect to itself. +In respose I wrote test_sock_2 to test the socket code for SunOS which +does work. You should have no problems using the socket code in SunOS +so long as you don't write a program that need to connect to itself. + + +(3.1) Installation + +The only know problem is on the SGI. You will need to use GNU tar instead +of the native supplied one or edit the config.flags file and remove the -h +option to tar. Aparently the -h option on IRIX 5.3 version of tar does the +exact opposite of all the other versions of tar I've used and instead of +following symbolic links and getting the file it archives the link. + + +(3.2) Missing functionality + +The current release is missing cancelation, priority mutexes and others. +I'm continuing to develope pthreads and I plan to put cancelation and +priority mutexes and as much other stuff as I can into the 1_70 release + + +(3.3) Signals + +Currently to intermix signals with pthreads you need to rename all calls +to signal() and sigaction() to pthread_signal() and pthread_sigaction(). +I plan to write real wrapper routines for signal() and sigaction() for +the 1_70 release. + diff --git a/lib/libpthread/GNUmakefile b/lib/libpthread/GNUmakefile new file mode 100644 index 00000000000..101d7761aee --- /dev/null +++ b/lib/libpthread/GNUmakefile @@ -0,0 +1,129 @@ +# === GNUmakefile ============================================================= +# Copyright (c) 1991, 1992, 1993 Chris Provenzano, proven@athena.mit.edu +# +# Description: This file is for creating libpthread.a +# +# 1.00 93/11/17 proven +# -Put all the .o files into one file libpthread.a +# -Initial cut for pthreads. +# + +INSTALL_PATH = $(exec_prefix) + + BINDIR = $(INSTALL_PATH)/bin + LIBDIR = $(INSTALL_PATH)/lib + MANDIR = $(INSTALL_PATH)/man + INCDIR = $(INSTALL_PATH)/include + SUBINCDIR = $(INCDIR)/pthread + + AR = ar + AS = gas + CFLAGS = -I. -Iinclude -I$(srcdir)/include -DPTHREAD_KERNEL \ + -g -O2 -Werror + CXXFLAGS = -I. -Iinclude -I$(srcdir)/include -DPTHREAD_KERNEL \ + -g -O2 + LD = gld + + CSRC = + + PTHREAD_DIR = pthreads stdlib stdio gen + DIRS = $(PTHREAD_DIR) + + HEADERS = + + LIBRARIES = libpthread.a + + .CURDIR = . + +# force correct default target +all: + +############################################################################### +# +# Read in any special flags that config knows about +include config.flags + +# What the heck. Convert srcdir to absolute form so it looks prettier. +srcdir := $(shell cd $(srcfoo) && pwd) + +################################################################################ +# +# Here starts the nitty grity part of the Makefile. + +all-lib : libpthread.a + +include ${srcdir}/pthreads/GNUmakefile.inc +include ${srcdir}/stdlib/GNUmakefile.inc +include ${srcdir}/stdio/GNUmakefile.inc +include ${srcdir}/string/GNUmakefile.inc +include ${srcdir}/gen/GNUmakefile.inc +include ${srcdir}/net/GNUmakefile.inc +include ${srcdir}/scripts/GNUmakefile.inc + +REGULAR_OBJS= $(subst .cc,.o,$(SRCS)) +REGULAR_OBJS:= $(subst .c,.o,$(REGULAR_OBJS)) +REGULAR_OBJS:= $(subst .S,.o,$(REGULAR_OBJS)) +OBJS= $(REGULAR_OBJS) $(EXTRA_OBJS) +REALOBJS = $(addprefix obj/, $(OBJS)) + +$(REALOBJS) : $(config) $(types) $(paths) + +# Since we do not have a list of the relevant files we do a make clean +# before copying everyting to the distribution directory. +distdir: + $(MAKE) clean + cp -a . $(distdir) + # Remove symlinks that the distribution should not have. + rm -f $(distdir)/config.cache \ + $(distdir)/include/pthread/machdep.h \ + $(distdir)/include/pthread/posix.h \ + $(distdir)/include/sys \ + $(distdir)/machdep.c \ + $(distdir)/syscall.S \ + $(distdir)/syscall-template.S + +clean: + rm -f a.out core maketmp makeout $(LIBRARIES) $(BINARIES) libpthread.* + rm -rf obj + cd tests && $(MAKE) clean && cd .. + +install-lib: $(LIBRARIES) install-dirs + for x in $(LIBRARIES); \ + do install $$x $(DESTDIR)$(LIBDIR); \ + done + +# Removed make install since mysql uses this in place. +# install-lib install-include install-bin +install: + +libpthread.a: obj/libpthread.a + rm -f libpthread.a + ln -s obj/libpthread.a . + +obj/libpthread.a: ${REALOBJS} + rm -f libpthread.a obj/new.a obj/libpthread.a + cd obj && \ + ar r new.a ${OBJS} && \ + $(RANLIB) new.a && \ + mv -f new.a libpthread.a && \ + cd .. + +# For examining a combined symbol table, sizes, &c. +libpthread.o: ${REALOBJS} + cd obj && ld -r -o ../libpthread.o ${OBJS} && cd .. + +obj/x: + if [ -d obj ]; then true; else mkdir obj; fi + cp /dev/null obj/x + +GNUmakefile: config.status ${srcdir}/config/GNUmakefile.in + $(SHELL) config.status + +obj/%.o: %.c obj/x + $(CC) $(CFLAGS) -c $< -o $@ + +obj/%.o: %.cc obj/x + $(CXX) $(CXXFLAGS) $(CFLAGS) -c $< -o $@ + +obj/%.o: %.S obj/x + $(CC) $(CFLAGS) -c $< -o $@ diff --git a/lib/libpthread/NOTES b/lib/libpthread/NOTES new file mode 100644 index 00000000000..cebdc6a396c --- /dev/null +++ b/lib/libpthread/NOTES @@ -0,0 +1,59 @@ + +Here are some notes on the internals of the implementation. + +LIBC routines. + + Unfortuanately many of the libc routine return a pointer to static data. +There are two methods to deal with this. One write a new routine where the +arguments are different, and have one argument be a pointer to some space +to store the data, or two use thread specific data and warn the user that +data isn't valid if the calling thread is terminated. + +INTERNAL LOCKING +To prevent deadlocks the following rules were used for locks. + +1. Local locks for mutex queues and other like things are only locked + by running threads, at NO time will a local lock be held by + a thread in a non running state. +2. Only threads that are in a run state can attempt to lock another thread, + this way, we can assume that the lock will be released shortly, and don't + have to unlock the local lock. +3. The only time a thread will have a pthread->lock and is not in a run + state is when it is in the reschedule routine. +4. The reschedule routine assumes all local locks have been released, + there is a lock on the currently running thread (pthread_run), + and that this thread is being rescheduled to a non running state. + It is safe to unlock the currently running threads lock after it + has been rescheduled. +5. The reschedule routine locks the kernel, sets the state of the currently + running thread, unlocks the currently running thread, calls the + context switch routines. +6 the kernel lock is used only ... + + +7. The order of locking is ... + +1 local locks +2 pthread->lock /* Assumes it will get it soon */ +3 pthread_run->lock /* Assumes it will get it soon, but must release 2 */ +4 kernel lock /* Currently assumes it will ALWAYS get it. */ + +8. The kernel lock will be changed to a spin lock for systems that +already support kernel threads, this way we can mutiplex threads onto +kernel threads. +9. There are points where the kernel is locked and it needs to get +either a local lock or a pthread lock, if at these points the code +fails to get the lock the kernel gives up and sets a flag which will +be checked at a later point. +10. Interrupts are dissabled while the kernel is locked, the interrupt +mask must be checked afterwards or cleared in some way, after interrputs +have been reenabled, this allows back to back interrupts, but should always +avoid missing one. + +------------------------------------------------------------------------------ +Copyright (c) 1994 Chris Provenzano. All rights reserved. +This product includes software developed by the Univeristy of California, +Berkeley and its contributors. + +For further licencing and distribution restrictions see the file COPYRIGHT +included in this directory. diff --git a/lib/libpthread/NOTES_OSR5_BUILD_SKUNKWARE97 b/lib/libpthread/NOTES_OSR5_BUILD_SKUNKWARE97 new file mode 100644 index 00000000000..fd2e00c9860 --- /dev/null +++ b/lib/libpthread/NOTES_OSR5_BUILD_SKUNKWARE97 @@ -0,0 +1,45 @@ +This port to Osr5 was donated by + ARTURO MONTES mitosys@colomsat.net.co +Its a snapshot of the 1.60 Beta 5 version + +It passes all the tests except test_fork (this seems to be a problem +with the MIT source) +and I suspect there may also to be problems with +the floating point initialisation and perhaps the netdb access as well + + +Regarding the networking API's mind the following (ARTURO): + +- Always we are searching host address in /etc/hosts by default, if you +want other behaviour let me to know. + +- If you haven't an entry in /etc/hosts, please create it and after test +with DNS service. + +regarding floating point initialisation (ARTURO) + +...mit-pthreads/pthreads/tests> ./test_preemption_float +test_preemption_float INDETERMINATE + +I inhibit the pthread float code, but they are a minor changes in machdep.c. + +> What did you do/needs to be done here ?? + +Look into machdep.c machdep_save_float_state() and +machdep_restore_float_state() routine. I think the initialization float +code can have problems with pthread initialization code. + +---------------- + + +If you wish to rebuild from source you'll need the gnus devsys +(gmake and gcc) and don't use configure to reconfigure the makefiles, etc + ( I don't know why this is but it doesn't work) + +If Arturo keeps me updated with buildable snapshots I'll endeavour to keep +the skunkware Website updated with them. + + +Best of luck + +hops 01-Aug-97 diff --git a/lib/libpthread/TODO-mysql b/lib/libpthread/TODO-mysql new file mode 100644 index 00000000000..a19b1bd51d6 --- /dev/null +++ b/lib/libpthread/TODO-mysql @@ -0,0 +1,4 @@ +This what should be done to get more functionally for mysqld. + +- open should be interruptable. +- fcntl lock should be interruptable. diff --git a/lib/libpthread/Whats_New b/lib/libpthread/Whats_New new file mode 100644 index 00000000000..556d9f63268 --- /dev/null +++ b/lib/libpthread/Whats_New @@ -0,0 +1,198 @@ +For patches made to this release, check the file Changes-mysql + +For the 96/11/11 release version 1_60_beta6 + + Ports + Alpha running NetBSD-1.1 by Chris G Demetriou <cgd+@cs.cmu.edu> + i386 running BSDi-2.1 by David J MacKenzie <djm@va.pubnix.com> + + Bug Fixes + Test for struct timespec under linux and DTRT. + include/unistd.h : #define SEEK_SET, SEEK_CUR, and SEEK_END. + Bug reported by Stephen Tether <tether@MITLNS.MIT.EDU> + stdlib/system.c : Uses the POSIX signal systemcalls. + Bug reported by Matthew Newhook <matthew@thor.udc.neweast.ca>. + net/gethostbyname.c: #include <string.h> and fix dereference problem. + Bug reported by Chris G Demetriou <cgd+@cs.cmu.edu> + pthreads/fd.c: Fix bug in close() reported by + Bug reported by "William S. Lear" <rael@dejanews.com> + tests/p_bench_pthread_create.c : Only try and create 10000 threads. + include/pthread/sleep.h : No need to prototype machdep_gettimeofday() + since it is declared here. + Bug reported by Stewart Gebbie <stewart@global.co.za> + stdio/fwrite.c: Fixed bug where if total bytes written = 0 then a divid + by 0 occurs. Thanks to CTLarsen@lbl.gov for finding is and to + Jin Guojun <jin@george.lbl.gov> for submitting a patch for it. + stdio/refill.c (__swalk_lflush()): Second pass of flush should call + flockfile() not ftrylockfile(). Just like in __swalk_sflush() + net/res_internal.c (_res_parse_answer()): It looks like if + iquery is true and type == T_PTR then the result->h_name + will be over written because the bp isn't incrementd + appropriately. Thanks to David Halls <David.Halls@cl.cam.ac.uk> + for finding it. + net/serv_internal.c (_serv_buf()) : Allocate more than four bytes + of buffer space. Reported by drh@@tobit.vnet.net. + pthreads/fd_kern.c: Make sure exception fds are included in + machdep_sys_select() for support of select(). Thanks to + Larry V. Streepy, Jr. <streepy@healthcare.com> for the patches. + pthreads/fd_kern.c: Fix more I/O routines to report NOTOK on error + instead of the old -error number. Hopefully this is the last of + them. Thanks to Larry V. Streepy, Jr. <streepy@healthcare.com> for + the patches. + machdep/engine-i386-linux-1.0.c: Remove unneeded machdep_sys_readv() + and machdep_sys_writev() routines. Reported by + pthreads/process.c : Fix execl() and execle() to work on sparc systems. + pthreads/fd_sysv.c : Fix accept() to work under Solaris 2.4 + + +For the 96/03/09 release version 1_60_beta5 + + Ports + Sparc running NetBSD-1.1 + + Additions + New reentrant netdb similar to Solaris API (ghudson) + + Bug Fixes + Make default signal handlers work. + Deadlock scheduling bug reported by Cathy Abbott <cabbot@cs.utk.edu> + See pthreads-bugs transaction 31 + pthread/queue.c (pthread_queue_remove()): Don't set thread->queue and + thread->next to NULL unless the thread is removed from the queue. + pthreads/fd.c (setsockopt(), getsockopt(), getsockname(), + getpeername()) : Call fd_lock() with appropriate paramaters. + pthreads/fd_kern.c (sendmsg_timedwait()): Call fd_unlock() with + FD_WRITE instead of FD_READ paramater. + machdep/*/timers.h net/res_send.c, pthreads/cond.c, pthreads/select.c + pthreads/sleep.c, tests/test_pthread_cond_timedwait.c: + Change timespec to be POSIX compliant. + include/unistd.h : Change u_int to unsigned [int] in prototypes. + pthreads/fd.c : Use FD_SETSIZE instead of 1024 for a limit on fds. + + +For the 95/09/xx release version 1_60_beta4 + + Ports + SGI running IRIX-5.3 + + Additions + Added pthread_sigprocmask(). + Added CV attributes + + strtok() and strtok_r() (Greg Hudson) + getsockname() (Sean Levy) + + Bug Fixes + stdio/fwalk.c, stdio/refill.c : Use flockfile() instead of + ftrylockfile()/pthread_yield(), for traversing FILE list. + pthreads/sig.c : Remove enum pthread_sig_flags and just use the vector. + Added pthread_sigprocmask(). + pthreads/signal.c : Protect calls to pthread_sig_process(). + configure : Create the obj directory. + tests/test_preemption_float.c : Rewritten to actually work. + machdep/engine-i386-linux-1.0.c : Added __strtol_internal() + tests/test_stdio_1.c : Don't use base_name or dir_name as variables. + gen/getcwd.c : fstat => machdep_sys_fstat, since kernel fd's are + used in the DIR data structure + gen/isatty.c : Fixed call to fd_lock() to pass the right # args. + pthreads/pthread_init.c : Fixed uninitialized members of + pthread_initial. + + + +For the 95/06/xx release version 1_60_beta3 + + Additions + Add exec variants execl, execlp, execv, execvp (Ken Raeburn) + pthreads/fd_sysv.c : Added routines setsockopt() and getsockname(). + Added include/endian.h : For machine dependent endian junk. (YUCK) + Added socketpair() + Added ttyname_r() + + Bug Fixes + config/Makefile.in : Need $$ to reference shell variables in make. + config/configure, config/configure.in : Redo freebsd2.* machine. + machdep/sunos-4.1.3/__stdlib.h : typedef pthread_size_t size_t + pthreads/fd.c : Fix bug with fd_free(), dup(), dup2(), and close() + where a fd gets lost after a dup() then close(). + pthreads/fd_kern.c : The fd_table[fd]->flags of the fd that accept() + returns should be the same as those of the fd passed to accept(). + stdio/fclose.c : Don't call funlockfile(fp) after fp->_file has been + closed. + pthreads/select.c : Move pthread_sched_prevent() inside the statement. + if (machdep_sys_select(...) == OK) + pthreads/machdep/linux-1.0/cdefs.h : moved the include_next outside + of the ifdef so that it would eventually find the system cdefs.h + pthreads/signal.c : Check sig_to_process before and after fd_kern_wait() + . It is possible for sig_handler_fake() to registered one. + pthreads/signal.c : Unset pthread_run temporarily around the call to + sig_handler(0). places where this causes core dumps should check + pthread_run. + include/stdlib.h : Fix prototype for bsearch(). + machdep/syscall-i386-freebsd-2.0.S syscall-template-i386-freebsd2.0.S: + Fix macro expansion problems for FreeBSD-2.0 + machdep/engine-sparc-sunos-5.3.c : Fix machdep_sys_select() to return + machdep_sys_poll() errors and not the number of entries found. + gen/getcwd.c : Use strlen(dp->d_name) not dp->d_namlen because there + may be extra data associated with dp->d_namelen. + machdep/freebsd-2.0/__unistd.h: Change #define _POSIX_VDISABLE to 0xff + include/pthread.h : Added prototypes pthread_kill(), pthread_signal() + machdep/linux-1.0/__signal.h : Added #define __sigmask() and + #define sigmask, and fixed other SIG macros to use __sigmask. + machdep/linux-1.0/dirent.h : #include <sys/types.h> + machdep/linux-1.0/wait.h : Fix #define WIFSTOPPED(x) to use __WSTATUS(x) + machdep/syscall-i386-linux-1.0.S : Added elf support. (NOT TESTED) + pthreads/stat.c : Added to separate linux stat calls. + (SGI will need this too) + pthreads/signal.c : Whereever #ifdef (SA_RESETHAND) is used then + #ifdef (SA_RESTART) also + gen/isatty.c : isatty_basic() is called with the KFD not UFD. + machdep/sunos-4.1.3/__stdlib.h : #include <sys/stdtypes.h> + config/sun4os4.mk : Added pipe to SYSCALL_EXCEPTIONS + machdep/syscall-sparc-sunos-4.1.3.S : Add machdep_sys_pipe(). + include/stdio.h : Remove __getc() and __putc(), because they really + shouldn't be inlined. + machdep/sunos-4.1.3/stat.h : Added __BEGIN_DECLS and __END_DECLS. + machdep/alpha-osf1/cdefs.h, machdep/hpux-9.03/cdefs.h + machdep/linux-1.0/cdefs.h, machdep/sunos-4.1.3/cdefs.h + machdep/sunos-5.3/cdefs.h, machdep/ultrix-4.2/cdefs.h : + #define __INLINE static inline and don't #define + __CAN_DO_EXTERN_INLINE if __cplusplus and __GCC__ is defined. + pthreads/fd_sysv.c : Fix so that only systems without socket systemcalls + compile this file. + machdep/engine-i386-linux-1.0.c : Fix linux machdep_sys_getdirentries() + pthreads/gen : Nuke the signal-blocking code in pclose(). It doesn't do + any good in a threaded program; some other thread would just get + the signal. + + +For the 94/11/xx release version 1_60 + + Additions + Added recvfrom_timedwait(), and similar calls + Added thread safe time routines: ctime(), localtime(), ... + Added thread safe rand routines: rand(), random(), ... + Added priorities and releated routines: pthread_attr_getschedparam(), + Added signals and releated routines:pthread_kill(), sigwait(), ... + Added mutex attribues and releated routines: pthread_mutexattr_init(), . + Added abort + + Added counting (recursive) mutexes. + Added debugging mutexes. + Added some more tests + + Redid entire thread kernel because of priorities, and signals. + Test and set instructions no longer necessary for versions + that don't support kernel threads. + + More debugging by Greg Hudson along with the network lookup routines + An Alpha port from Ken Raeburn and Sean Levy + A solaris port from me. + select() implementations from Sean Levy and Peter Hofmann + configure from Ken Raeburn + pthread_init() no longer necessary for systems with G++ from Ken Raeburn + net code from Greg Hudson including: gethostbyname(), ... + + Bug fixes: + honor _POSIX_THREAD_DESTRUCTOR_ITERATIONS + pthread_key_destroy() is really pthread_key_delete() diff --git a/lib/libpthread/config.flags b/lib/libpthread/config.flags new file mode 100644 index 00000000000..97e65818410 --- /dev/null +++ b/lib/libpthread/config.flags @@ -0,0 +1,80 @@ +# Since the real configure script runs from the config subdirectory, +# compensate here... +srctop= /dr1/my/masters/mysql/mit-pthreads +srcfoo= $(srctop) + +prefix= /usr/local/pthreads +exec_prefix= ${prefix} + +cpu = sparc +os = solaris2.5.1 + +MISSING_SYSCALLS = dup2 select getdtablesize ftruncate flock sigpause ksigaction readdir getdirentries wait4 wait3 waitpid socket bind connect accept listen getsockopt setsockopt socketpair socketcall send sendto sendmsg recv recvfrom recvmsg getpeername getsockname shutdown getpgrp +AVAILABLE_SYSCALLS = open write read creat close fcntl lseek dup pipe fchmod fchown execve fstat lstat link unlink chdir chown chmod stat rename ioctl fstatfs sigsuspend sigaction sigprocmask getdents waitsys poll putmsg getmsg pgrpsys exit readv writev fork +SYSCALL_EXCEPTIONS = fork sigaction +HAVE_SYSCALL_TEMPLATE = yes + +CC = gcc +CXX = c++ +CPP = gcc -E +SHELL = /bin/sh +RANLIB = ranlib +# Should use autoconf to find these. Currently our makefiles are inconsistent. +#AR = ar +#AS = gas +#LD = gld + +install-dirs: + for d in $(INSTALL_PATH) $(BINDIR) $(LIBDIR) $(INCDIR) ; do \ + test -d $(DESTDIR)$$d || mkdir $(DESTDIR)$$d || exit 1 ; \ + done + +config.status: ./config/configure + cd ${.CURDIR} && $(SHELL) config.status --recheck +config.flags: config.status ./config/config.flags.in + cd ${.CURDIR} && $(SHELL) config.status + +realclean: clean + cd tests && $(MAKE) realclean && cd .. + rm -f $(LINKS) config.status config.flags config.cache \ + Makefile GNUmakefile + +types=$(.CURDIR)/include/pthread/ac-types.h +$(types) : config.h + echo '#ifndef pthread_size_t' > $(types).new + egrep '^#define pthread_' $(.CURDIR)/config.h >> $(types).new + echo '#endif' >> $(types).new + mv -f $(types).new $(types) + +config=$(.CURDIR)/include/pthread/config.h +$(config) : config.h + echo '#ifndef _SYS___CONFIG_H_' > $(config).new + echo '#define _SYS___CONFIG_H_' >> $(config).new + -egrep '^#define _OS_HAS' $(.CURDIR)/config.h >> $(config).new + echo '#endif' >> $(config).new + mv -f $(config).new $(config) + +paths=$(.CURDIR)/include/pthread/paths.h +$(paths) : config.h + echo '#ifndef _SYS___PATHS_H_' > $(paths).new + echo '#define _SYS___PATHS_H_' >> $(paths).new + egrep '^#define _PATH' $(.CURDIR)/config.h >> $(paths).new + echo '#endif' >> $(paths).new + mv -f $(paths).new $(paths) + +all-tests: all-lib + cd ${.CURDIR}/tests && $(MAKE) all +check: all-lib + cd ${.CURDIR}/tests && $(MAKE) check +all : all-lib all-bin + +install-bin: all-bin install-dirs + for x in $(SCRIPTS) ; do \ + install $$x $(DESTDIR)$(BINDIR); \ + done + +install-include: install-dirs + (cd ${srcdir}/include && tar chf - .)|(cd $(DESTDIR)$(INCDIR) && tar xf -) + if [ -d config ]; then true; else \ + (cd ${.CURDIR}/include && tar chf - .)|(cd $(DESTDIR)$(INCDIR) && tar xf -); fi + (cd $(DESTDIR)$(INCDIR) && find . \( -name CVS -o -name \*~ \) -print | xargs rm -rf) diff --git a/lib/libpthread/config.h b/lib/libpthread/config.h new file mode 100644 index 00000000000..0cfd1f00e1d --- /dev/null +++ b/lib/libpthread/config.h @@ -0,0 +1,316 @@ +/* config.h. Generated automatically by configure. */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to `long' if <sys/types.h> doesn't define. */ +/* #undef off_t */ + +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +/* #undef size_t */ + +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 + +/* Does the OS already support struct timespec */ +#define _OS_HAS_TIMESPEC 1 + +/* For networking code: an integral type the size of an IP address (4 + octets). Determined by examining return values from certain + functions. */ +#define pthread_ipaddr_type unsigned long + +/* For networking code: an integral type the size of an IP port number + (2 octets). Determined by examining return values from certain + functions. */ +#define pthread_ipport_type unsigned short + +/* type of clock_t, from system header files */ +#define pthread_clock_t long + +/* Specially named so grep processing will find it and put it into the + generated ac-types.h. */ +/* #undef pthread_have_va_list_h */ + +/* type of size_t, from system header files */ +#define pthread_size_t unsigned int + +/* type of ssize_t, from system header files */ +#define pthread_ssize_t int + +/* type of time_t, from system header files */ +#define pthread_time_t long + +/* type of fpos_t, from system header files */ +#define pthread_fpos_t long + +/* type of off_t, from system header files */ +#define pthread_off_t long + +/* type of va_list, from system header files */ +#define pthread_va_list void * + +/* I don't know why the native compiler definitions aren't sufficient + for this. */ +/* #undef sunos4 */ + +/* define if the linker hauls in certain static data from libc even when + you don't want it to. yes, this description is bogus, but chris added + the need for this, without describing the problem. */ +#define LD_LINKS_STATIC_DATA 1 + +/* define if the system reissues the SIGCHLD if the handler reinstalls + * itself before calling wait() + */ +#define BROKEN_SIGNALS 1 + +/* where are terminal devices to be found? */ +#define _PATH_PTY "/devices/pseudo/" + +/* what directory holds the time zone info on this system? */ +#define _PATH_TZDIR "/usr/share/lib/zoneinfo" + +/* what file indicates the local time zone? */ +#define _PATH_TZFILE "/usr/share/lib/zoneinfo/localtime" + +/* Paths for various networking support files. */ +#define _PATH_RESCONF "/etc/resolv.conf" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" + +/* Path for Bourne shell. */ +#define _PATH_BSHELL "/bin/sh" + +/* Define if you have the syscall_accept function. */ +/* #undef HAVE_SYSCALL_ACCEPT */ + +/* Define if you have the syscall_bind function. */ +/* #undef HAVE_SYSCALL_BIND */ + +/* Define if you have the syscall_chdir function. */ +#define HAVE_SYSCALL_CHDIR 1 + +/* Define if you have the syscall_chmod function. */ +#define HAVE_SYSCALL_CHMOD 1 + +/* Define if you have the syscall_chown function. */ +#define HAVE_SYSCALL_CHOWN 1 + +/* Define if you have the syscall_close function. */ +#define HAVE_SYSCALL_CLOSE 1 + +/* Define if you have the syscall_connect function. */ +/* #undef HAVE_SYSCALL_CONNECT */ + +/* Define if you have the syscall_creat function. */ +#define HAVE_SYSCALL_CREAT 1 + +/* Define if you have the syscall_dup function. */ +#define HAVE_SYSCALL_DUP 1 + +/* Define if you have the syscall_dup2 function. */ +/* #undef HAVE_SYSCALL_DUP2 */ + +/* Define if you have the syscall_execve function. */ +#define HAVE_SYSCALL_EXECVE 1 + +/* Define if you have the syscall_exit function. */ +#define HAVE_SYSCALL_EXIT 1 + +/* Define if you have the syscall_fchmod function. */ +#define HAVE_SYSCALL_FCHMOD 1 + +/* Define if you have the syscall_fchown function. */ +#define HAVE_SYSCALL_FCHOWN 1 + +/* Define if you have the syscall_fcntl function. */ +#define HAVE_SYSCALL_FCNTL 1 + +/* Define if you have the syscall_flock function. */ +/* #undef HAVE_SYSCALL_FLOCK */ + +/* Define if you have the syscall_fork function. */ +#define HAVE_SYSCALL_FORK 1 + +/* Define if you have the syscall_fstat function. */ +#define HAVE_SYSCALL_FSTAT 1 + +/* Define if you have the syscall_fstatfs function. */ +#define HAVE_SYSCALL_FSTATFS 1 + +/* Define if you have the syscall_ftruncate function. */ +/* #undef HAVE_SYSCALL_FTRUNCATE */ + +/* Define if you have the syscall_getdents function. */ +#define HAVE_SYSCALL_GETDENTS 1 + +/* Define if you have the syscall_getdirentries function. */ +/* #undef HAVE_SYSCALL_GETDIRENTRIES */ + +/* Define if you have the syscall_getdtablesize function. */ +/* #undef HAVE_SYSCALL_GETDTABLESIZE */ + +/* Define if you have the syscall_getmsg function. */ +#define HAVE_SYSCALL_GETMSG 1 + +/* Define if you have the syscall_getpeername function. */ +/* #undef HAVE_SYSCALL_GETPEERNAME */ + +/* Define if you have the syscall_getpgrp function. */ +/* #undef HAVE_SYSCALL_GETPGRP */ + +/* Define if you have the syscall_getsockname function. */ +/* #undef HAVE_SYSCALL_GETSOCKNAME */ + +/* Define if you have the syscall_getsockopt function. */ +/* #undef HAVE_SYSCALL_GETSOCKOPT */ + +/* Define if you have the syscall_ioctl function. */ +#define HAVE_SYSCALL_IOCTL 1 + +/* Define if you have the syscall_ksigaction function. */ +/* #undef HAVE_SYSCALL_KSIGACTION */ + +/* Define if you have the syscall_link function. */ +#define HAVE_SYSCALL_LINK 1 + +/* Define if you have the syscall_listen function. */ +/* #undef HAVE_SYSCALL_LISTEN */ + +/* Define if you have the syscall_lseek function. */ +#define HAVE_SYSCALL_LSEEK 1 + +/* Define if you have the syscall_lstat function. */ +#define HAVE_SYSCALL_LSTAT 1 + +/* Define if you have the syscall_open function. */ +#define HAVE_SYSCALL_OPEN 1 + +/* Define if you have the syscall_pgrpsys function. */ +#define HAVE_SYSCALL_PGRPSYS 1 + +/* Define if you have the syscall_pipe function. */ +#define HAVE_SYSCALL_PIPE 1 + +/* Define if you have the syscall_poll function. */ +#define HAVE_SYSCALL_POLL 1 + +/* Define if you have the syscall_putmsg function. */ +#define HAVE_SYSCALL_PUTMSG 1 + +/* Define if you have the syscall_read function. */ +#define HAVE_SYSCALL_READ 1 + +/* Define if you have the syscall_readdir function. */ +/* #undef HAVE_SYSCALL_READDIR */ + +/* Define if you have the syscall_readv function. */ +#define HAVE_SYSCALL_READV 1 + +/* Define if you have the syscall_recv function. */ +/* #undef HAVE_SYSCALL_RECV */ + +/* Define if you have the syscall_recvfrom function. */ +/* #undef HAVE_SYSCALL_RECVFROM */ + +/* Define if you have the syscall_recvmsg function. */ +/* #undef HAVE_SYSCALL_RECVMSG */ + +/* Define if you have the syscall_rename function. */ +#define HAVE_SYSCALL_RENAME 1 + +/* Define if you have the syscall_select function. */ +/* #undef HAVE_SYSCALL_SELECT */ + +/* Define if you have the syscall_send function. */ +/* #undef HAVE_SYSCALL_SEND */ + +/* Define if you have the syscall_sendmsg function. */ +/* #undef HAVE_SYSCALL_SENDMSG */ + +/* Define if you have the syscall_sendto function. */ +/* #undef HAVE_SYSCALL_SENDTO */ + +/* Define if you have the syscall_setsockopt function. */ +/* #undef HAVE_SYSCALL_SETSOCKOPT */ + +/* Define if you have the syscall_shutdown function. */ +/* #undef HAVE_SYSCALL_SHUTDOWN */ + +/* Define if you have the syscall_sigaction function. */ +#define HAVE_SYSCALL_SIGACTION 1 + +/* Define if you have the syscall_sigpause function. */ +/* #undef HAVE_SYSCALL_SIGPAUSE */ + +/* Define if you have the syscall_sigprocmask function. */ +#define HAVE_SYSCALL_SIGPROCMASK 1 + +/* Define if you have the syscall_sigsuspend function. */ +#define HAVE_SYSCALL_SIGSUSPEND 1 + +/* Define if you have the syscall_socket function. */ +/* #undef HAVE_SYSCALL_SOCKET */ + +/* Define if you have the syscall_socketcall function. */ +/* #undef HAVE_SYSCALL_SOCKETCALL */ + +/* Define if you have the syscall_socketpair function. */ +/* #undef HAVE_SYSCALL_SOCKETPAIR */ + +/* Define if you have the syscall_stat function. */ +#define HAVE_SYSCALL_STAT 1 + +/* Define if you have the syscall_unlink function. */ +#define HAVE_SYSCALL_UNLINK 1 + +/* Define if you have the syscall_wait3 function. */ +/* #undef HAVE_SYSCALL_WAIT3 */ + +/* Define if you have the syscall_wait4 function. */ +/* #undef HAVE_SYSCALL_WAIT4 */ + +/* Define if you have the syscall_waitpid function. */ +/* #undef HAVE_SYSCALL_WAITPID */ + +/* Define if you have the syscall_waitsys function. */ +#define HAVE_SYSCALL_WAITSYS 1 + +/* Define if you have the syscall_write function. */ +#define HAVE_SYSCALL_WRITE 1 + +/* Define if you have the syscall_writev function. */ +#define HAVE_SYSCALL_WRITEV 1 + +/* Define if you have the vfork function. */ +#define HAVE_VFORK 1 + +/* Define if you have the <alloc.h> header file. */ +/* #undef HAVE_ALLOC_H */ + +/* Define if you have the <sys/filio.h> header file. */ +#define HAVE_SYS_FILIO_H 1 + +/* Define if you have the <sys/syscall.h> header file. */ +#define HAVE_SYS_SYSCALL_H 1 + +/* Define if you have the <sys/termio.h> header file. */ +#define HAVE_SYS_TERMIO_H 1 + +/* Define if you have the <sys/time.h> header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define if you have the <syscall.h> header file. */ +/* #undef HAVE_SYSCALL_H */ + +/* Define if you have the <termio.h> header file. */ +#define HAVE_TERMIO_H 1 + +/* Define if you have the <termios.h> header file. */ +#define HAVE_TERMIOS_H 1 diff --git a/lib/libpthread/config.log b/lib/libpthread/config.log new file mode 100644 index 00000000000..2cd6cf09fca --- /dev/null +++ b/lib/libpthread/config.log @@ -0,0 +1,149 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +configure:539: checking for gcc +configure:616: checking whether the C compiler (gcc ) works +configure:630: gcc -o conftest conftest.c 1>&5 +configure:650: checking whether the C compiler (gcc ) is a cross-compiler +configure:655: checking whether we are using GNU C +configure:679: checking whether gcc accepts -g +configure:711: checking for c++ +configure:742: checking whether the C++ compiler (c++ ) works +configure:756: c++ -o conftest conftest.C 1>&5 +configure:782: checking whether the C++ compiler (c++ ) is a cross-compiler +configure:787: checking whether we are using GNU C++ +configure:811: checking whether c++ accepts -g +configure:839: checking compiler availability and simple error detection +configure:848: gcc -c -g -O2 conftest.c 1>&5 +configure:859: gcc -c -g -O2 conftest.c 1>&5 +configure: In function `main': +configure:855: `syntax' undeclared (first use this function) +configure:855: (Each undeclared identifier is reported only once +configure:855: for each function it appears in.) +configure:855: parse error before `errors' +configure: failed program was: +#line 852 "configure" +#include "confdefs.h" + +int main() { + syntax errors galore! +; return 0; } +configure:889: gcc -c -g -O2 conftest.c 1>&5 +configure:910: gcc -c -g -O2 conftest.c 1>&5 +configure: In function `main': +configure:905: conflicting types for `i' +configure:904: previous declaration of `i' +configure: failed program was: +#line 899 "configure" +#include "confdefs.h" + +int main() { + + typedef long Long; + extern int i; + extern Long i; + +; return 0; } +configure:925: checking how to run the C preprocessor +configure:989: checking for ranlib +configure:1065: checking host system type +configure:1086: checking target system type +configure:1104: checking build system type +configure:1326: checking for sys/termio.h +configure:1326: checking for termios.h +configure:1326: checking for termio.h +configure:1326: checking for alloc.h +configure:1365: checking for va_list.h +configure:1404: checking for syscall.h +configure:1404: checking for sys/syscall.h +configure:1404: checking for sys/filio.h +configure:1460: checking for syscall open +configure:1460: checking for syscall write +configure:1460: checking for syscall read +configure:1460: checking for syscall creat +configure:1460: checking for syscall close +configure:1460: checking for syscall fcntl +configure:1460: checking for syscall lseek +configure:1460: checking for syscall dup2 +configure:1460: checking for syscall dup +configure:1460: checking for syscall pipe +configure:1460: checking for syscall fchmod +configure:1460: checking for syscall fchown +configure:1460: checking for syscall execve +configure:1460: checking for syscall fstat +configure:1460: checking for syscall lstat +configure:1460: checking for syscall link +configure:1460: checking for syscall unlink +configure:1460: checking for syscall chdir +configure:1460: checking for syscall chown +configure:1460: checking for syscall chmod +configure:1460: checking for syscall stat +configure:1460: checking for syscall rename +configure:1460: checking for syscall select +configure:1460: checking for syscall getdtablesize +configure:1460: checking for syscall ioctl +configure:1460: checking for syscall ftruncate +configure:1460: checking for syscall flock +configure:1460: checking for syscall fstatfs +configure:1460: checking for syscall sigsuspend +configure:1460: checking for syscall sigaction +configure:1460: checking for syscall sigpause +configure:1460: checking for syscall sigprocmask +configure:1460: checking for syscall ksigaction +configure:1460: checking for syscall getdents +configure:1460: checking for syscall readdir +configure:1460: checking for syscall getdirentries +configure:1460: checking for syscall wait4 +configure:1460: checking for syscall wait3 +configure:1460: checking for syscall waitpid +configure:1460: checking for syscall waitsys +configure:1460: checking for syscall socket +configure:1460: checking for syscall bind +configure:1460: checking for syscall connect +configure:1460: checking for syscall accept +configure:1460: checking for syscall listen +configure:1460: checking for syscall getsockopt +configure:1460: checking for syscall setsockopt +configure:1460: checking for syscall socketpair +configure:1460: checking for syscall poll +configure:1460: checking for syscall putmsg +configure:1460: checking for syscall getmsg +configure:1460: checking for syscall socketcall +configure:1460: checking for syscall pgrpsys +configure:1460: checking for syscall exit +configure:1460: checking for syscall readv +configure:1460: checking for syscall writev +configure:1460: checking for syscall send +configure:1460: checking for syscall sendto +configure:1460: checking for syscall sendmsg +configure:1460: checking for syscall recv +configure:1460: checking for syscall recvfrom +configure:1460: checking for syscall recvmsg +configure:1460: checking for syscall getpeername +configure:1460: checking for syscall getsockname +configure:1460: checking for syscall shutdown +configure:1460: checking for syscall getpgrp +configure:1460: checking for syscall fork +configure:1521: checking for ANSI C header files +configure:1625: checking for off_t +configure:1658: checking for size_t +configure:1691: checking return type of signal handlers +configure:1732: checking for ssize_t +configure:1765: checking for time_t +configure:1801: checking for sys/time.h +configure:1838: checking whether time.h and sys/time.h may both be included +configure:1874: checking for struct timespec in sys/time.h +configure:1909: checking type of size_t +configure:1972: checking type of ssize_t +configure:2031: checking type of clock_t +configure:2106: checking type of time_t +configure:2180: checking for fpos_t in stdio.h +configure:2208: checking type of fpos_t +configure:2281: checking type of off_t +configure:2343: checking type of va_list +configure:2397: checking IP address type +configure:2456: checking IP port type +configure:2515: checking pathname for terminal devices directory +configure:2535: checking directory name for time zone info +configure:2558: checking filename for local time zone +configure:2614: checking for vfork diff --git a/lib/libpthread/config.status b/lib/libpthread/config.status new file mode 100644 index 00000000000..c0b99cc92fe --- /dev/null +++ b/lib/libpthread/config.status @@ -0,0 +1,571 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host analytik: +# +# ./config/configure +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: ./config.status [--recheck] [--version] [--help]" +for ac_option +do + case "$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running ${CONFIG_SHELL-/bin/sh} ./config/configure --no-create --no-recursion" + exec ${CONFIG_SHELL-/bin/sh} ./config/configure --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "./config.status generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "$ac_cs_usage"; exit 0 ;; + *) echo "$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=./config + +trap 'rm -fr config.flags GNUmakefile Makefile lib/Makefile lib/libpthreadutil/Makefile bin/Makefile bin/finger/Makefile tests/Makefile config.h conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\&%]/\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF + + +s%@CFLAGS@%-g -O2 -Werror%g +s%@CPPFLAGS@%%g +s%@CXXFLAGS@%-g -O2%g +s%@DEFS@%-DHAVE_CONFIG_H%g +s%@LDFLAGS@%%g +s%@LIBS@%%g +s%@exec_prefix@%${prefix}%g +s%@prefix@%/usr/local/pthreads%g +s%@program_transform_name@%s,x,x,%g +s%@bindir@%${exec_prefix}/bin%g +s%@sbindir@%${exec_prefix}/sbin%g +s%@libexecdir@%${exec_prefix}/libexec%g +s%@datadir@%${prefix}/share%g +s%@sysconfdir@%${prefix}/etc%g +s%@sharedstatedir@%${prefix}/com%g +s%@localstatedir@%${prefix}/var%g +s%@libdir@%${exec_prefix}/lib%g +s%@includedir@%${prefix}/include%g +s%@oldincludedir@%/usr/include%g +s%@infodir@%${prefix}/info%g +s%@mandir@%${prefix}/man%g +s%@CC@%gcc%g +s%@CXX@%c++%g +s%@CPP@%gcc -E%g +s%@RANLIB@%ranlib%g +s%@host@%sparc-sun-solaris2.5.1%g +s%@host_alias@%sparc-sun-solaris2.5.1%g +s%@host_cpu@%sparc%g +s%@host_vendor@%sun%g +s%@host_os@%solaris2.5.1%g +s%@target@%sparc-sun-solaris2.5.1%g +s%@target_alias@%sparc-sun-solaris2.5.1%g +s%@target_cpu@%sparc%g +s%@target_vendor@%sun%g +s%@target_os@%solaris2.5.1%g +s%@build@%sparc-sun-solaris2.5.1%g +s%@build_alias@%sparc-sun-solaris2.5.1%g +s%@build_cpu@%sparc%g +s%@build_vendor@%sun%g +s%@build_os@%solaris2.5.1%g +s%@SYSCALL_EXCEPTIONS@%fork sigaction%g +s%@available_syscalls@% open write read creat close fcntl lseek dup pipe fchmod fchown execve fstat lstat link unlink chdir chown chmod stat rename ioctl fstatfs sigsuspend sigaction sigprocmask getdents waitsys poll putmsg getmsg pgrpsys exit readv writev fork%g +s%@missing_syscalls@% dup2 select getdtablesize ftruncate flock sigpause ksigaction readdir getdirentries wait4 wait3 waitpid socket bind connect accept listen getsockopt setsockopt socketpair socketcall send sendto sendmsg recv recvfrom recvmsg getpeername getsockname shutdown getpgrp%g +s%@srctop@%/dr1/my/masters/mysql/mit-pthreads%g +s%@HAVE_SYSCALL_TEMPLATE@%yes%g +/@makefile_frag@/r /dev/null +s%@makefile_frag@%%g + +CEOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi + +CONFIG_FILES=${CONFIG_FILES-"config.flags GNUmakefile Makefile lib/Makefile:../lib/Makefile.in lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in bin/Makefile:../bin/Makefile.in bin/finger/Makefile:../bin/finger/Makefile.in tests/Makefile:../tests/Makefile.in"} +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then + CONFIG_HEADERS="config.h" +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}LD_LINKS_STATIC_DATA${ac_dB}LD_LINKS_STATIC_DATA${ac_dC}1${ac_dD} +${ac_uA}LD_LINKS_STATIC_DATA${ac_uB}LD_LINKS_STATIC_DATA${ac_uC}1${ac_uD} +${ac_eA}LD_LINKS_STATIC_DATA${ac_eB}LD_LINKS_STATIC_DATA${ac_eC}1${ac_eD} +${ac_dA}BROKEN_SIGNALS${ac_dB}BROKEN_SIGNALS${ac_dC}1${ac_dD} +${ac_uA}BROKEN_SIGNALS${ac_uB}BROKEN_SIGNALS${ac_uC}1${ac_uD} +${ac_eA}BROKEN_SIGNALS${ac_eB}BROKEN_SIGNALS${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_TERMIO_H${ac_dB}HAVE_SYS_TERMIO_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TERMIO_H${ac_uB}HAVE_SYS_TERMIO_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TERMIO_H${ac_eB}HAVE_SYS_TERMIO_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_TERMIOS_H${ac_dB}HAVE_TERMIOS_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_TERMIOS_H${ac_uB}HAVE_TERMIOS_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_TERMIOS_H${ac_eB}HAVE_TERMIOS_H${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_TERMIO_H${ac_dB}HAVE_TERMIO_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_TERMIO_H${ac_uB}HAVE_TERMIO_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_TERMIO_H${ac_eB}HAVE_TERMIO_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_SYSCALL_H${ac_dB}HAVE_SYS_SYSCALL_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_SYSCALL_H${ac_uB}HAVE_SYS_SYSCALL_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_SYSCALL_H${ac_eB}HAVE_SYS_SYSCALL_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYS_FILIO_H${ac_dB}HAVE_SYS_FILIO_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_FILIO_H${ac_uB}HAVE_SYS_FILIO_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_FILIO_H${ac_eB}HAVE_SYS_FILIO_H${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_OPEN${ac_dB}HAVE_SYSCALL_OPEN${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_OPEN${ac_uB}HAVE_SYSCALL_OPEN${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_OPEN${ac_eB}HAVE_SYSCALL_OPEN${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_WRITE${ac_dB}HAVE_SYSCALL_WRITE${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_WRITE${ac_uB}HAVE_SYSCALL_WRITE${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_WRITE${ac_eB}HAVE_SYSCALL_WRITE${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_READ${ac_dB}HAVE_SYSCALL_READ${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_READ${ac_uB}HAVE_SYSCALL_READ${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_READ${ac_eB}HAVE_SYSCALL_READ${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_CREAT${ac_dB}HAVE_SYSCALL_CREAT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_CREAT${ac_uB}HAVE_SYSCALL_CREAT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_CREAT${ac_eB}HAVE_SYSCALL_CREAT${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_CLOSE${ac_dB}HAVE_SYSCALL_CLOSE${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_CLOSE${ac_uB}HAVE_SYSCALL_CLOSE${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_CLOSE${ac_eB}HAVE_SYSCALL_CLOSE${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_FCNTL${ac_dB}HAVE_SYSCALL_FCNTL${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_FCNTL${ac_uB}HAVE_SYSCALL_FCNTL${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_FCNTL${ac_eB}HAVE_SYSCALL_FCNTL${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_LSEEK${ac_dB}HAVE_SYSCALL_LSEEK${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_LSEEK${ac_uB}HAVE_SYSCALL_LSEEK${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_LSEEK${ac_eB}HAVE_SYSCALL_LSEEK${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_DUP${ac_dB}HAVE_SYSCALL_DUP${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_DUP${ac_uB}HAVE_SYSCALL_DUP${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_DUP${ac_eB}HAVE_SYSCALL_DUP${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_PIPE${ac_dB}HAVE_SYSCALL_PIPE${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_PIPE${ac_uB}HAVE_SYSCALL_PIPE${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_PIPE${ac_eB}HAVE_SYSCALL_PIPE${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_FCHMOD${ac_dB}HAVE_SYSCALL_FCHMOD${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_FCHMOD${ac_uB}HAVE_SYSCALL_FCHMOD${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_FCHMOD${ac_eB}HAVE_SYSCALL_FCHMOD${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_FCHOWN${ac_dB}HAVE_SYSCALL_FCHOWN${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_FCHOWN${ac_uB}HAVE_SYSCALL_FCHOWN${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_FCHOWN${ac_eB}HAVE_SYSCALL_FCHOWN${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_EXECVE${ac_dB}HAVE_SYSCALL_EXECVE${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_EXECVE${ac_uB}HAVE_SYSCALL_EXECVE${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_EXECVE${ac_eB}HAVE_SYSCALL_EXECVE${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_FSTAT${ac_dB}HAVE_SYSCALL_FSTAT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_FSTAT${ac_uB}HAVE_SYSCALL_FSTAT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_FSTAT${ac_eB}HAVE_SYSCALL_FSTAT${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_LSTAT${ac_dB}HAVE_SYSCALL_LSTAT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_LSTAT${ac_uB}HAVE_SYSCALL_LSTAT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_LSTAT${ac_eB}HAVE_SYSCALL_LSTAT${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_LINK${ac_dB}HAVE_SYSCALL_LINK${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_LINK${ac_uB}HAVE_SYSCALL_LINK${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_LINK${ac_eB}HAVE_SYSCALL_LINK${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_UNLINK${ac_dB}HAVE_SYSCALL_UNLINK${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_UNLINK${ac_uB}HAVE_SYSCALL_UNLINK${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_UNLINK${ac_eB}HAVE_SYSCALL_UNLINK${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_CHDIR${ac_dB}HAVE_SYSCALL_CHDIR${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_CHDIR${ac_uB}HAVE_SYSCALL_CHDIR${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_CHDIR${ac_eB}HAVE_SYSCALL_CHDIR${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_CHOWN${ac_dB}HAVE_SYSCALL_CHOWN${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_CHOWN${ac_uB}HAVE_SYSCALL_CHOWN${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_CHOWN${ac_eB}HAVE_SYSCALL_CHOWN${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_CHMOD${ac_dB}HAVE_SYSCALL_CHMOD${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_CHMOD${ac_uB}HAVE_SYSCALL_CHMOD${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_CHMOD${ac_eB}HAVE_SYSCALL_CHMOD${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_STAT${ac_dB}HAVE_SYSCALL_STAT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_STAT${ac_uB}HAVE_SYSCALL_STAT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_STAT${ac_eB}HAVE_SYSCALL_STAT${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_RENAME${ac_dB}HAVE_SYSCALL_RENAME${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_RENAME${ac_uB}HAVE_SYSCALL_RENAME${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_RENAME${ac_eB}HAVE_SYSCALL_RENAME${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_IOCTL${ac_dB}HAVE_SYSCALL_IOCTL${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_IOCTL${ac_uB}HAVE_SYSCALL_IOCTL${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_IOCTL${ac_eB}HAVE_SYSCALL_IOCTL${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_FSTATFS${ac_dB}HAVE_SYSCALL_FSTATFS${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_FSTATFS${ac_uB}HAVE_SYSCALL_FSTATFS${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_FSTATFS${ac_eB}HAVE_SYSCALL_FSTATFS${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_SIGSUSPEND${ac_dB}HAVE_SYSCALL_SIGSUSPEND${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_SIGSUSPEND${ac_uB}HAVE_SYSCALL_SIGSUSPEND${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_SIGSUSPEND${ac_eB}HAVE_SYSCALL_SIGSUSPEND${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_SIGACTION${ac_dB}HAVE_SYSCALL_SIGACTION${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_SIGACTION${ac_uB}HAVE_SYSCALL_SIGACTION${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_SIGACTION${ac_eB}HAVE_SYSCALL_SIGACTION${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_SIGPROCMASK${ac_dB}HAVE_SYSCALL_SIGPROCMASK${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_SIGPROCMASK${ac_uB}HAVE_SYSCALL_SIGPROCMASK${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_SIGPROCMASK${ac_eB}HAVE_SYSCALL_SIGPROCMASK${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_GETDENTS${ac_dB}HAVE_SYSCALL_GETDENTS${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_GETDENTS${ac_uB}HAVE_SYSCALL_GETDENTS${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_GETDENTS${ac_eB}HAVE_SYSCALL_GETDENTS${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_WAITSYS${ac_dB}HAVE_SYSCALL_WAITSYS${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_WAITSYS${ac_uB}HAVE_SYSCALL_WAITSYS${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_WAITSYS${ac_eB}HAVE_SYSCALL_WAITSYS${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_POLL${ac_dB}HAVE_SYSCALL_POLL${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_POLL${ac_uB}HAVE_SYSCALL_POLL${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_POLL${ac_eB}HAVE_SYSCALL_POLL${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_PUTMSG${ac_dB}HAVE_SYSCALL_PUTMSG${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_PUTMSG${ac_uB}HAVE_SYSCALL_PUTMSG${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_PUTMSG${ac_eB}HAVE_SYSCALL_PUTMSG${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_GETMSG${ac_dB}HAVE_SYSCALL_GETMSG${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_GETMSG${ac_uB}HAVE_SYSCALL_GETMSG${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_GETMSG${ac_eB}HAVE_SYSCALL_GETMSG${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_PGRPSYS${ac_dB}HAVE_SYSCALL_PGRPSYS${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_PGRPSYS${ac_uB}HAVE_SYSCALL_PGRPSYS${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_PGRPSYS${ac_eB}HAVE_SYSCALL_PGRPSYS${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_EXIT${ac_dB}HAVE_SYSCALL_EXIT${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_EXIT${ac_uB}HAVE_SYSCALL_EXIT${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_EXIT${ac_eB}HAVE_SYSCALL_EXIT${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}HAVE_SYSCALL_READV${ac_dB}HAVE_SYSCALL_READV${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_READV${ac_uB}HAVE_SYSCALL_READV${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_READV${ac_eB}HAVE_SYSCALL_READV${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_WRITEV${ac_dB}HAVE_SYSCALL_WRITEV${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_WRITEV${ac_uB}HAVE_SYSCALL_WRITEV${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_WRITEV${ac_eB}HAVE_SYSCALL_WRITEV${ac_eC}1${ac_eD} +${ac_dA}HAVE_SYSCALL_FORK${ac_dB}HAVE_SYSCALL_FORK${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYSCALL_FORK${ac_uB}HAVE_SYSCALL_FORK${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYSCALL_FORK${ac_eB}HAVE_SYSCALL_FORK${ac_eC}1${ac_eD} +${ac_dA}STDC_HEADERS${ac_dB}STDC_HEADERS${ac_dC}1${ac_dD} +${ac_uA}STDC_HEADERS${ac_uB}STDC_HEADERS${ac_uC}1${ac_uD} +${ac_eA}STDC_HEADERS${ac_eB}STDC_HEADERS${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}RETSIGTYPE${ac_dB}RETSIGTYPE${ac_dC}void${ac_dD} +${ac_uA}RETSIGTYPE${ac_uB}RETSIGTYPE${ac_uC}void${ac_uD} +${ac_eA}RETSIGTYPE${ac_eB}RETSIGTYPE${ac_eC}void${ac_eD} +${ac_dA}HAVE_SYS_TIME_H${ac_dB}HAVE_SYS_TIME_H${ac_dC}1${ac_dD} +${ac_uA}HAVE_SYS_TIME_H${ac_uB}HAVE_SYS_TIME_H${ac_uC}1${ac_uD} +${ac_eA}HAVE_SYS_TIME_H${ac_eB}HAVE_SYS_TIME_H${ac_eC}1${ac_eD} +${ac_dA}TIME_WITH_SYS_TIME${ac_dB}TIME_WITH_SYS_TIME${ac_dC}1${ac_dD} +${ac_uA}TIME_WITH_SYS_TIME${ac_uB}TIME_WITH_SYS_TIME${ac_uC}1${ac_uD} +${ac_eA}TIME_WITH_SYS_TIME${ac_eB}TIME_WITH_SYS_TIME${ac_eC}1${ac_eD} +${ac_dA}_OS_HAS_TIMESPEC${ac_dB}_OS_HAS_TIMESPEC${ac_dC}1${ac_dD} +${ac_uA}_OS_HAS_TIMESPEC${ac_uB}_OS_HAS_TIMESPEC${ac_uC}1${ac_uD} +${ac_eA}_OS_HAS_TIMESPEC${ac_eB}_OS_HAS_TIMESPEC${ac_eC}1${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}pthread_size_t${ac_dB}pthread_size_t${ac_dC}unsigned int${ac_dD} +${ac_uA}pthread_size_t${ac_uB}pthread_size_t${ac_uC}unsigned int${ac_uD} +${ac_eA}pthread_size_t${ac_eB}pthread_size_t${ac_eC}unsigned int${ac_eD} +${ac_dA}pthread_ssize_t${ac_dB}pthread_ssize_t${ac_dC}int${ac_dD} +${ac_uA}pthread_ssize_t${ac_uB}pthread_ssize_t${ac_uC}int${ac_uD} +${ac_eA}pthread_ssize_t${ac_eB}pthread_ssize_t${ac_eC}int${ac_eD} +${ac_dA}pthread_clock_t${ac_dB}pthread_clock_t${ac_dC}long${ac_dD} +${ac_uA}pthread_clock_t${ac_uB}pthread_clock_t${ac_uC}long${ac_uD} +${ac_eA}pthread_clock_t${ac_eB}pthread_clock_t${ac_eC}long${ac_eD} +${ac_dA}pthread_time_t${ac_dB}pthread_time_t${ac_dC}long${ac_dD} +${ac_uA}pthread_time_t${ac_uB}pthread_time_t${ac_uC}long${ac_uD} +${ac_eA}pthread_time_t${ac_eB}pthread_time_t${ac_eC}long${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}pthread_fpos_t${ac_dB}pthread_fpos_t${ac_dC}long${ac_dD} +${ac_uA}pthread_fpos_t${ac_uB}pthread_fpos_t${ac_uC}long${ac_uD} +${ac_eA}pthread_fpos_t${ac_eB}pthread_fpos_t${ac_eC}long${ac_eD} +${ac_dA}pthread_off_t${ac_dB}pthread_off_t${ac_dC}long${ac_dD} +${ac_uA}pthread_off_t${ac_uB}pthread_off_t${ac_uC}long${ac_uD} +${ac_eA}pthread_off_t${ac_eB}pthread_off_t${ac_eC}long${ac_eD} +${ac_dA}pthread_va_list${ac_dB}pthread_va_list${ac_dC}void *${ac_dD} +${ac_uA}pthread_va_list${ac_uB}pthread_va_list${ac_uC}void *${ac_uD} +${ac_eA}pthread_va_list${ac_eB}pthread_va_list${ac_eC}void *${ac_eD} +${ac_dA}pthread_ipaddr_type${ac_dB}pthread_ipaddr_type${ac_dC}unsigned long${ac_dD} +${ac_uA}pthread_ipaddr_type${ac_uB}pthread_ipaddr_type${ac_uC}unsigned long${ac_uD} +${ac_eA}pthread_ipaddr_type${ac_eB}pthread_ipaddr_type${ac_eC}unsigned long${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}pthread_ipport_type${ac_dB}pthread_ipport_type${ac_dC}unsigned short${ac_dD} +${ac_uA}pthread_ipport_type${ac_uB}pthread_ipport_type${ac_uC}unsigned short${ac_uD} +${ac_eA}pthread_ipport_type${ac_eB}pthread_ipport_type${ac_eC}unsigned short${ac_eD} +${ac_dA}_PATH_PTY${ac_dB}_PATH_PTY${ac_dC}"/devices/pseudo/"${ac_dD} +${ac_uA}_PATH_PTY${ac_uB}_PATH_PTY${ac_uC}"/devices/pseudo/"${ac_uD} +${ac_eA}_PATH_PTY${ac_eB}_PATH_PTY${ac_eC}"/devices/pseudo/"${ac_eD} +${ac_dA}_PATH_TZDIR${ac_dB}_PATH_TZDIR${ac_dC}"/usr/share/lib/zoneinfo"${ac_dD} +${ac_uA}_PATH_TZDIR${ac_uB}_PATH_TZDIR${ac_uC}"/usr/share/lib/zoneinfo"${ac_uD} +${ac_eA}_PATH_TZDIR${ac_eB}_PATH_TZDIR${ac_eC}"/usr/share/lib/zoneinfo"${ac_eD} +${ac_dA}_PATH_TZFILE${ac_dB}_PATH_TZFILE${ac_dC}"/usr/share/lib/zoneinfo/localtime"${ac_dD} +${ac_uA}_PATH_TZFILE${ac_uB}_PATH_TZFILE${ac_uC}"/usr/share/lib/zoneinfo/localtime"${ac_uD} +${ac_eA}_PATH_TZFILE${ac_eB}_PATH_TZFILE${ac_eC}"/usr/share/lib/zoneinfo/localtime"${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}_PATH_RESCONF${ac_dB}_PATH_RESCONF${ac_dC}"/etc/resolv.conf"${ac_dD} +${ac_uA}_PATH_RESCONF${ac_uB}_PATH_RESCONF${ac_uC}"/etc/resolv.conf"${ac_uD} +${ac_eA}_PATH_RESCONF${ac_eB}_PATH_RESCONF${ac_eC}"/etc/resolv.conf"${ac_eD} +${ac_dA}_PATH_HOSTS${ac_dB}_PATH_HOSTS${ac_dC}"/etc/hosts"${ac_dD} +${ac_uA}_PATH_HOSTS${ac_uB}_PATH_HOSTS${ac_uC}"/etc/hosts"${ac_uD} +${ac_eA}_PATH_HOSTS${ac_eB}_PATH_HOSTS${ac_eC}"/etc/hosts"${ac_eD} +${ac_dA}_PATH_NETWORKS${ac_dB}_PATH_NETWORKS${ac_dC}"/etc/networks"${ac_dD} +${ac_uA}_PATH_NETWORKS${ac_uB}_PATH_NETWORKS${ac_uC}"/etc/networks"${ac_uD} +${ac_eA}_PATH_NETWORKS${ac_eB}_PATH_NETWORKS${ac_eC}"/etc/networks"${ac_eD} +${ac_dA}_PATH_PROTOCOLS${ac_dB}_PATH_PROTOCOLS${ac_dC}"/etc/protocols"${ac_dD} +${ac_uA}_PATH_PROTOCOLS${ac_uB}_PATH_PROTOCOLS${ac_uC}"/etc/protocols"${ac_uD} +${ac_eA}_PATH_PROTOCOLS${ac_eB}_PATH_PROTOCOLS${ac_eC}"/etc/protocols"${ac_eD} +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + cat > conftest.frag <<CEOF +${ac_dA}_PATH_SERVICES${ac_dB}_PATH_SERVICES${ac_dC}"/etc/services"${ac_dD} +${ac_uA}_PATH_SERVICES${ac_uB}_PATH_SERVICES${ac_uC}"/etc/services"${ac_uD} +${ac_eA}_PATH_SERVICES${ac_eB}_PATH_SERVICES${ac_eC}"/etc/services"${ac_eD} +${ac_dA}_PATH_BSHELL${ac_dB}_PATH_BSHELL${ac_dC}"/bin/sh"${ac_dD} +${ac_uA}_PATH_BSHELL${ac_uB}_PATH_BSHELL${ac_uC}"/bin/sh"${ac_uD} +${ac_eA}_PATH_BSHELL${ac_eB}_PATH_BSHELL${ac_eC}"/bin/sh"${ac_eD} +${ac_dA}HAVE_VFORK${ac_dB}HAVE_VFORK${ac_dC}1${ac_dD} +${ac_uA}HAVE_VFORK${ac_uB}HAVE_VFORK${ac_uC}1${ac_uD} +${ac_eA}HAVE_VFORK${ac_eB}HAVE_VFORK${ac_eC}1${ac_eD} +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +ac_sources="../machdep/engine-sparc-sunos-5.3.h ../machdep/posix-sunos-5.5.h ../machdep/engine-sparc-sunos-5.3.c ../machdep/syscall-sparc-sunos-5.3.S ../machdep/sunos-5.5 ../machdep/syscall-template-sparc-sunos-5.3.S" +ac_dests="include/pthread/machdep.h include/pthread/posix.h machdep.c syscall.S include/sys syscall-template.S" +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done + + +exit 0 diff --git a/lib/libpthread/config/COPYING.GNU b/lib/libpthread/config/COPYING.GNU new file mode 100755 index 00000000000..a43ea2126fb --- /dev/null +++ b/lib/libpthread/config/COPYING.GNU @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/lib/libpthread/config/COPYRIGHT b/lib/libpthread/config/COPYRIGHT new file mode 100755 index 00000000000..ba3ac43c589 --- /dev/null +++ b/lib/libpthread/config/COPYRIGHT @@ -0,0 +1,4 @@ +The files config.guess and config.sub in this directory come from the GNU +autoconf distribution, and are covered by the GNU Public License, which may +be found in the file COPYING.GNU. They are the only files covered by the +GPL. diff --git a/lib/libpthread/config/GNUmakefile.in b/lib/libpthread/config/GNUmakefile.in new file mode 100755 index 00000000000..7c06ee367e6 --- /dev/null +++ b/lib/libpthread/config/GNUmakefile.in @@ -0,0 +1,129 @@ +# === GNUmakefile ============================================================= +# Copyright (c) 1991, 1992, 1993 Chris Provenzano, proven@athena.mit.edu +# +# Description: This file is for creating libpthread.a +# +# 1.00 93/11/17 proven +# -Put all the .o files into one file libpthread.a +# -Initial cut for pthreads. +# + +INSTALL_PATH = $(exec_prefix) + + BINDIR = $(INSTALL_PATH)/bin + LIBDIR = $(INSTALL_PATH)/lib + MANDIR = $(INSTALL_PATH)/man + INCDIR = $(INSTALL_PATH)/include + SUBINCDIR = $(INCDIR)/pthread + + AR = ar + AS = gas + CFLAGS = -I. -Iinclude -I$(srcdir)/include -DPTHREAD_KERNEL \ + @CFLAGS@ + CXXFLAGS = -I. -Iinclude -I$(srcdir)/include -DPTHREAD_KERNEL \ + @CXXFLAGS@ + LD = gld + + CSRC = + + PTHREAD_DIR = pthreads stdlib stdio gen + DIRS = $(PTHREAD_DIR) + + HEADERS = + + LIBRARIES = libpthread.a + + .CURDIR = . + +# force correct default target +all: + +############################################################################### +# +# Read in any special flags that config knows about +include config.flags + +# What the heck. Convert srcdir to absolute form so it looks prettier. +srcdir := $(shell cd $(srcfoo) && pwd) + +################################################################################ +# +# Here starts the nitty grity part of the Makefile. + +all-lib : libpthread.a + +include ${srcdir}/pthreads/GNUmakefile.inc +include ${srcdir}/stdlib/GNUmakefile.inc +include ${srcdir}/stdio/GNUmakefile.inc +include ${srcdir}/string/GNUmakefile.inc +include ${srcdir}/gen/GNUmakefile.inc +include ${srcdir}/net/GNUmakefile.inc +include ${srcdir}/scripts/GNUmakefile.inc + +REGULAR_OBJS= $(subst .cc,.o,$(SRCS)) +REGULAR_OBJS:= $(subst .c,.o,$(REGULAR_OBJS)) +REGULAR_OBJS:= $(subst .S,.o,$(REGULAR_OBJS)) +OBJS= $(REGULAR_OBJS) $(EXTRA_OBJS) +REALOBJS = $(addprefix obj/, $(OBJS)) + +$(REALOBJS) : $(config) $(types) $(paths) + +# Since we do not have a list of the relevant files we do a make clean +# before copying everyting to the distribution directory. +distdir: + $(MAKE) clean + cp -a . $(distdir) + # Remove symlinks that the distribution should not have. + rm -f $(distdir)/config.cache \ + $(distdir)/include/pthread/machdep.h \ + $(distdir)/include/pthread/posix.h \ + $(distdir)/include/sys \ + $(distdir)/machdep.c \ + $(distdir)/syscall.S \ + $(distdir)/syscall-template.S + +clean: + rm -f a.out core maketmp makeout $(LIBRARIES) $(BINARIES) libpthread.* + rm -rf obj + cd tests && $(MAKE) clean && cd .. + +install-lib: $(LIBRARIES) install-dirs + for x in $(LIBRARIES); \ + do install $$x $(DESTDIR)$(LIBDIR); \ + done + +# Removed make install since mysql uses this in place. +# install-lib install-include install-bin +install: + +libpthread.a: obj/libpthread.a + rm -f libpthread.a + ln -s obj/libpthread.a . + +obj/libpthread.a: ${REALOBJS} + rm -f libpthread.a obj/new.a obj/libpthread.a + cd obj && \ + ar r new.a ${OBJS} && \ + $(RANLIB) new.a && \ + mv -f new.a libpthread.a && \ + cd .. + +# For examining a combined symbol table, sizes, &c. +libpthread.o: ${REALOBJS} + cd obj && ld -r -o ../libpthread.o ${OBJS} && cd .. + +obj/x: + if [ -d obj ]; then true; else mkdir obj; fi + cp /dev/null obj/x + +GNUmakefile: config.status ${srcdir}/config/GNUmakefile.in + $(SHELL) config.status + +obj/%.o: %.c obj/x + $(CC) $(CFLAGS) -c $< -o $@ + +obj/%.o: %.cc obj/x + $(CXX) $(CXXFLAGS) $(CFLAGS) -c $< -o $@ + +obj/%.o: %.S obj/x + $(CC) $(CFLAGS) -c $< -o $@ diff --git a/lib/libpthread/config/Makefile.in b/lib/libpthread/config/Makefile.in new file mode 100644 index 00000000000..f5f5ba5247b --- /dev/null +++ b/lib/libpthread/config/Makefile.in @@ -0,0 +1,52 @@ +# @(#)Makefile 5.2 (Berkeley) 3/5/91 +# + +LIB=pthread +#NOPIC= +#NOPROFILE=1 +CPPFLAGS+= -I${.CURDIR} -I${.CURDIR}/include -I${srcdir}/include -DPTHREAD_KERNEL +CDEBUGFLAGS= @CFLAGS@ +CFLAGS+= ${CDEBUGFLAGS} +# CFLAGS+= ${CPPFLAGS} <- done by bsd.lib.mk +CFLAGS+= ${CPPFLAGS} +LIBDIR= $(exec_prefix)/lib +BINDIR= $(exec_prefix)/bin +INCDIR= $(exec_prefix)/include +MANDIR= $(exec_prefix)/man + +.OBJDIR != if test -d ${.CURDIR}/obj ; then true ; else mkdir ${.CURDIR}/obj || exit 1 ; fi ; echo ${.CURDIR}/obj + +# Standard bsd install rules look for the "install" program, rather than +# using some variable. So, hack things so that that install rule works. +BINGRP != echo " " `groups` " " | sed 's/ [0-9][0-9]* / /g' | awk '{print $$1}' +BINOWN != echo $${USER} +LIBMODE = 644 # so ranlib can run! + +.include "config.flags" + +# %!$@ pmake seems to automagically cd into the obj directory, so relative +# srcdir references are completely botched. Try to figure out an absolute +# pathname for srcdir here, and live with it. +srcdir = $(srctop) + +beforeinstall: install-dirs + +.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" + +$(OBJS) : $(config) $(types) $(paths) + +Makefile: ${srcdir}/config/Makefile.in + cd ${.CURDIR} && sh config.status + +all-lib : libpthread.a +# Removed make install since mysql uses this in place. +#install : install-bin install-include +install: + +.include <bsd.lib.mk> diff --git a/lib/libpthread/config/acconfig.h b/lib/libpthread/config/acconfig.h new file mode 100644 index 00000000000..14552b0d851 --- /dev/null +++ b/lib/libpthread/config/acconfig.h @@ -0,0 +1,73 @@ +/* Does the OS already support struct timespec */ +#undef _OS_HAS_TIMESPEC + +/* For networking code: an integral type the size of an IP address (4 + octets). Determined by examining return values from certain + functions. */ +#undef pthread_ipaddr_type + +/* For networking code: an integral type the size of an IP port number + (2 octets). Determined by examining return values from certain + functions. */ +#undef pthread_ipport_type + +/* type of clock_t, from system header files */ +#undef pthread_clock_t + +/* Specially named so grep processing will find it and put it into the + generated ac-types.h. */ +#undef pthread_have_va_list_h + +/* type of size_t, from system header files */ +#undef pthread_size_t + +/* type of ssize_t, from system header files */ +#undef pthread_ssize_t + +/* type of time_t, from system header files */ +#undef pthread_time_t + +/* type of fpos_t, from system header files */ +#undef pthread_fpos_t + +/* type of off_t, from system header files */ +#undef pthread_off_t + +/* type of va_list, from system header files */ +#undef pthread_va_list + +/* type of sigset_t, from system header files */ +#undef pthread_sigset_t + +/* I don't know why the native compiler definitions aren't sufficient + for this. */ +#undef sunos4 + +/* define if the linker hauls in certain static data from libc even when + you don't want it to. yes, this description is bogus, but chris added + the need for this, without describing the problem. */ +#undef LD_LINKS_STATIC_DATA + +/* define if the system reissues the SIGCHLD if the handler reinstalls + * itself before calling wait() + */ +#undef BROKEN_SIGNALS + +/* where are terminal devices to be found? */ +#undef _PATH_PTY + +/* what directory holds the time zone info on this system? */ +#undef _PATH_TZDIR + +/* what file indicates the local time zone? */ +#undef _PATH_TZFILE + +/* Paths for various networking support files. */ +#undef _PATH_RESCONF +#undef _PATH_HOSTS +#undef _PATH_NETWORKS +#undef _PATH_PROTOCOLS +#undef _PATH_SERVICES + +/* Path for Bourne shell. */ +#undef _PATH_BSHELL diff --git a/lib/libpthread/config/aclocal.m4 b/lib/libpthread/config/aclocal.m4 new file mode 100755 index 00000000000..2a5cd3e9cbf --- /dev/null +++ b/lib/libpthread/config/aclocal.m4 @@ -0,0 +1,94 @@ +dnl Autoconf extensions for pthreads package. +dnl +ifelse(regexp(AC_DEFINE(xxxxx),.*@@@.*),-1,,[define(IS_AUTOHEADER)])])dnl +dnl +dnl Now, the real stuff needed by the pthreads package. +dnl +AC_DEFUN([PTHREADS_CHECK_ONE_SYSCALL], +[AC_MSG_CHECKING(for syscall $1) +AC_CACHE_VAL(pthreads_cv_syscall_$1, +AC_TRY_LINK([ +/* FIXME: This list should be generated from info in configure.in. */ +#ifdef HAVE_SYSCALL_H +#include <syscall.h> +#else +#ifdef HAVE_SYS_SYSCALL_H +#include <sys/syscall.h> +#else +where is your syscall header file?? +#endif +#endif +],[ +int x; +x = SYS_$1 ; +], +eval pthreads_cv_syscall_$1=yes, +eval pthreads_cv_syscall_$1=no)) +if eval test \$pthreads_cv_syscall_$1 = yes ; then + pthreads_syscall_present=yes + available_syscalls="$available_syscalls $1" +dnl Can't just do the obvious substitution here or autoheader gets +dnl sorta confused. (Sigh.) Getting the requoting of the brackets right +dnl would be a pain too. + macroname=HAVE_SYSCALL_`echo $1 | tr '[[[a-z]]]' '[[[A-Z]]]'` + AC_DEFINE_UNQUOTED($macroname) +else + pthreads_syscall_present=no + missing_syscalls="$missing_syscalls $1" +fi +AC_MSG_RESULT($pthreads_syscall_present) +])dnl +dnl +AC_DEFUN(PTHREADS_CHECK_SYSCALLS,dnl +ifdef([IS_AUTOHEADER],[# +dnl Need to fake out autoheader, since there's no way to add a new class +dnl of features to generate config.h.in entries for. +@@@syscalls="$1"@@@ +@@@funcs="$funcs syscall_`echo $syscalls | sed 's/ / syscall_/g'`"@@@ +], +[pthreads_syscall_list="$1" +for pthreads_syscallname in $pthreads_syscall_list ; do + PTHREADS_CHECK_ONE_SYSCALL([$]pthreads_syscallname) +done +]))dnl +dnl +dnl Requote each argument. +define([requote], [ifelse($#, 0, , $#, 1, "$1", + "$1" [requote(builtin(shift,$@))])])dnl +dnl +dnl Determine proper typedef value for a typedef name, and define a +dnl C macro to expand to that type. (A shell variable with that value +dnl is also created.) If none of the specified types to try match, the +dnl macro is left undefined, and the shell variable empty. If the +dnl typedef name cannot be found in the specified header files, this +dnl test errors out; perhaps it should be changed to simply leave the +dnl macro undefined... +dnl +dnl PTHREADS_FIND_TYPE(typedefname,varname,includes,possible values...) +dnl +AC_DEFUN(PTHREADS_FIND_TYPE, +ifdef([IS_AUTOHEADER],[# +@@@syms="$syms $2"@@@ +],[dnl +AC_MSG_CHECKING(type of $1) +AC_CACHE_VAL(pthreads_cv_type_$1, +[AC_TRY_COMPILE([$3],[ extern $1 foo; ], +[ for try_type in [requote(builtin(shift,builtin(shift,builtin(shift,$@))))] ; do + AC_TRY_COMPILE([$3],[ extern $1 foo; extern $try_type foo; ], + [ pthreads_cv_type_$1="$try_type" ; break ]) + done], + AC_MSG_ERROR(Can't find system typedef for $1.))]) +if test -n "$pthreads_cv_type_$1" ; then + AC_DEFINE_UNQUOTED($2,$pthreads_cv_type_$1) +fi +$2=$pthreads_cv_type_$1 +AC_MSG_RESULT($pthreads_cv_type_$1)]))dnl +dnl +dnl +dnl Like above, but the list of types to try is pre-specified. +dnl +AC_DEFUN(PTHREADS_FIND_INTEGRAL_TYPE,[ +PTHREADS_FIND_TYPE([$1], [$2], [$3], + int, unsigned int, long, unsigned long, + short, unsigned short, char, unsigned char, + long long, unsigned long long)])dnl diff --git a/lib/libpthread/config/config.flags.in b/lib/libpthread/config/config.flags.in new file mode 100755 index 00000000000..3d16423a045 --- /dev/null +++ b/lib/libpthread/config/config.flags.in @@ -0,0 +1,80 @@ +# Since the real configure script runs from the config subdirectory, +# compensate here... +srctop= @srctop@ +srcfoo= $(srctop) + +prefix= @prefix@ +exec_prefix= @exec_prefix@ + +cpu = @target_cpu@ +os = @target_os@ + +MISSING_SYSCALLS = @missing_syscalls@ +AVAILABLE_SYSCALLS = @available_syscalls@ +SYSCALL_EXCEPTIONS = @SYSCALL_EXCEPTIONS@ +HAVE_SYSCALL_TEMPLATE = @HAVE_SYSCALL_TEMPLATE@ + +CC = @CC@ +CXX = @CXX@ +CPP = @CPP@ +SHELL = /bin/sh +RANLIB = @RANLIB@ +# Should use autoconf to find these. Currently our makefiles are inconsistent. +#AR = ar +#AS = gas +#LD = gld + +install-dirs: + for d in $(INSTALL_PATH) $(BINDIR) $(LIBDIR) $(INCDIR) ; do \ + test -d $(DESTDIR)$$d || mkdir $(DESTDIR)$$d || exit 1 ; \ + done + +config.status: @srcdir@/configure + cd ${.CURDIR} && $(SHELL) config.status --recheck +config.flags: config.status @srcdir@/config.flags.in + cd ${.CURDIR} && $(SHELL) config.status + +realclean: clean + cd tests && $(MAKE) realclean && cd .. + rm -f $(LINKS) config.status config.flags config.cache \ + Makefile GNUmakefile + +types=$(.CURDIR)/include/pthread/ac-types.h +$(types) : config.h + echo '#ifndef pthread_size_t' > $(types).new + egrep '^#define pthread_' $(.CURDIR)/config.h >> $(types).new + echo '#endif' >> $(types).new + mv -f $(types).new $(types) + +config=$(.CURDIR)/include/pthread/config.h +$(config) : config.h + echo '#ifndef _SYS___CONFIG_H_' > $(config).new + echo '#define _SYS___CONFIG_H_' >> $(config).new + -egrep '^#define _OS_HAS' $(.CURDIR)/config.h >> $(config).new + echo '#endif' >> $(config).new + mv -f $(config).new $(config) + +paths=$(.CURDIR)/include/pthread/paths.h +$(paths) : config.h + echo '#ifndef _SYS___PATHS_H_' > $(paths).new + echo '#define _SYS___PATHS_H_' >> $(paths).new + egrep '^#define _PATH' $(.CURDIR)/config.h >> $(paths).new + echo '#endif' >> $(paths).new + mv -f $(paths).new $(paths) + +all-tests: all-lib + cd ${.CURDIR}/tests && $(MAKE) all +check: all-lib + cd ${.CURDIR}/tests && $(MAKE) check +all : all-lib all-bin + +install-bin: all-bin install-dirs + for x in $(SCRIPTS) ; do \ + install $$x $(DESTDIR)$(BINDIR); \ + done + +install-include: install-dirs + (cd ${srcdir}/include && tar chf - .)|(cd $(DESTDIR)$(INCDIR) && tar xf -) + if [ -d config ]; then true; else \ + (cd ${.CURDIR}/include && tar chf - .)|(cd $(DESTDIR)$(INCDIR) && tar xf -); fi + (cd $(DESTDIR)$(INCDIR) && find . \( -name CVS -o -name \*~ \) -print | xargs rm -rf) diff --git a/lib/libpthread/config/config.guess b/lib/libpthread/config/config.guess new file mode 100644 index 00000000000..7fb2d744e03 --- /dev/null +++ b/lib/libpthread/config/config.guess @@ -0,0 +1,480 @@ +#!/bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner <bothner@cygnus.com>. +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:V*:*) + # After 1.2, OSF1 uses "V1.3" for uname -r. + echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'` + exit 0 ;; + alpha:OSF1:*:*) + # 1.2 uses "1.2" for uname -r. + echo alpha-dec-osf${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + Pyramid*:OSx*:*:*) + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + sun4*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + mips:*:5*:RISCos) + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX:*:*) + echo mips-sgi-irix${UNAME_RELEASE} + exit 0 ;; + i[34]86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if grep bos410 /usr/include/stdio.h >/dev/null 2>&1; then + IBM_REV=4.1 + elif grep bos411 /usr/include/stdio.h >/dev/null 2>&1; then + IBM_REV=4.1.1 + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[3478]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/7?? | 9000/8?7 ) HP_ARCH=hppa1.1 ;; + 9000/8?? ) HP_ARCH=hppa1.0 ;; + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?7:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?7:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:UNICOS:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:UNICOS:*:*) + echo ymp-cray-unicos + exit 0 ;; + CRAY-2:UNICOS:*:*) + echo cray2-cray-unicos + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + i[34]86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i[34]86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i[34]86:*:3.2:*) + if /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL + elif test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL + else + echo ${UNAME_MACHINE}-unknown-sysv32 + fi + exit 0 ;; + i?86:*:5:7) + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} + exit 0 ;; + Intel:Mach:3*:*) + echo i386-unknown-mach3 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M680[234]0:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0) + uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3 && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m680[234]0:LynxOS:2.2*:*) + echo m68k-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i[34]86:LynxOS:2.2*:*) + echo i386-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.2*:*) + echo sparc-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.2*:*) + echo rs6000-lynx-lynxos${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c <<EOF +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else + printf ("m68k-sony-newsos\n"); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3"); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-unknown-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/lib/libpthread/config/config.h.in b/lib/libpthread/config/config.h.in new file mode 100755 index 00000000000..6efdcf68d44 --- /dev/null +++ b/lib/libpthread/config/config.h.in @@ -0,0 +1,315 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* Define to `long' if <sys/types.h> doesn't define. */ +#undef off_t + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +#undef size_t + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Does the OS already support struct timespec */ +#undef _OS_HAS_TIMESPEC + +/* For networking code: an integral type the size of an IP address (4 + octets). Determined by examining return values from certain + functions. */ +#undef pthread_ipaddr_type + +/* For networking code: an integral type the size of an IP port number + (2 octets). Determined by examining return values from certain + functions. */ +#undef pthread_ipport_type + +/* type of clock_t, from system header files */ +#undef pthread_clock_t + +/* Specially named so grep processing will find it and put it into the + generated ac-types.h. */ +#undef pthread_have_va_list_h + +/* type of size_t, from system header files */ +#undef pthread_size_t + +/* type of ssize_t, from system header files */ +#undef pthread_ssize_t + +/* type of time_t, from system header files */ +#undef pthread_time_t + +/* type of fpos_t, from system header files */ +#undef pthread_fpos_t + +/* type of off_t, from system header files */ +#undef pthread_off_t + +/* type of va_list, from system header files */ +#undef pthread_va_list + +/* I don't know why the native compiler definitions aren't sufficient + for this. */ +#undef sunos4 + +/* define if the linker hauls in certain static data from libc even when + you don't want it to. yes, this description is bogus, but chris added + the need for this, without describing the problem. */ +#undef LD_LINKS_STATIC_DATA + +/* define if the system reissues the SIGCHLD if the handler reinstalls + * itself before calling wait() + */ +#undef BROKEN_SIGNALS + +/* where are terminal devices to be found? */ +#undef _PATH_PTY + +/* what directory holds the time zone info on this system? */ +#undef _PATH_TZDIR + +/* what file indicates the local time zone? */ +#undef _PATH_TZFILE + +/* Paths for various networking support files. */ +#undef _PATH_RESCONF +#undef _PATH_HOSTS +#undef _PATH_NETWORKS +#undef _PATH_PROTOCOLS +#undef _PATH_SERVICES + +/* Path for Bourne shell. */ +#undef _PATH_BSHELL + +/* Define if you have the syscall_accept function. */ +#undef HAVE_SYSCALL_ACCEPT + +/* Define if you have the syscall_bind function. */ +#undef HAVE_SYSCALL_BIND + +/* Define if you have the syscall_chdir function. */ +#undef HAVE_SYSCALL_CHDIR + +/* Define if you have the syscall_chmod function. */ +#undef HAVE_SYSCALL_CHMOD + +/* Define if you have the syscall_chown function. */ +#undef HAVE_SYSCALL_CHOWN + +/* Define if you have the syscall_close function. */ +#undef HAVE_SYSCALL_CLOSE + +/* Define if you have the syscall_connect function. */ +#undef HAVE_SYSCALL_CONNECT + +/* Define if you have the syscall_creat function. */ +#undef HAVE_SYSCALL_CREAT + +/* Define if you have the syscall_dup function. */ +#undef HAVE_SYSCALL_DUP + +/* Define if you have the syscall_dup2 function. */ +#undef HAVE_SYSCALL_DUP2 + +/* Define if you have the syscall_execve function. */ +#undef HAVE_SYSCALL_EXECVE + +/* Define if you have the syscall_exit function. */ +#undef HAVE_SYSCALL_EXIT + +/* Define if you have the syscall_fchmod function. */ +#undef HAVE_SYSCALL_FCHMOD + +/* Define if you have the syscall_fchown function. */ +#undef HAVE_SYSCALL_FCHOWN + +/* Define if you have the syscall_fcntl function. */ +#undef HAVE_SYSCALL_FCNTL + +/* Define if you have the syscall_flock function. */ +#undef HAVE_SYSCALL_FLOCK + +/* Define if you have the syscall_fork function. */ +#undef HAVE_SYSCALL_FORK + +/* Define if you have the syscall_fstat function. */ +#undef HAVE_SYSCALL_FSTAT + +/* Define if you have the syscall_fstatfs function. */ +#undef HAVE_SYSCALL_FSTATFS + +/* Define if you have the syscall_ftruncate function. */ +#undef HAVE_SYSCALL_FTRUNCATE + +/* Define if you have the syscall_getdents function. */ +#undef HAVE_SYSCALL_GETDENTS + +/* Define if you have the syscall_getdirentries function. */ +#undef HAVE_SYSCALL_GETDIRENTRIES + +/* Define if you have the syscall_getdtablesize function. */ +#undef HAVE_SYSCALL_GETDTABLESIZE + +/* Define if you have the syscall_getmsg function. */ +#undef HAVE_SYSCALL_GETMSG + +/* Define if you have the syscall_getpeername function. */ +#undef HAVE_SYSCALL_GETPEERNAME + +/* Define if you have the syscall_getpgrp function. */ +#undef HAVE_SYSCALL_GETPGRP + +/* Define if you have the syscall_getsockname function. */ +#undef HAVE_SYSCALL_GETSOCKNAME + +/* Define if you have the syscall_getsockopt function. */ +#undef HAVE_SYSCALL_GETSOCKOPT + +/* Define if you have the syscall_ioctl function. */ +#undef HAVE_SYSCALL_IOCTL + +/* Define if you have the syscall_ksigaction function. */ +#undef HAVE_SYSCALL_KSIGACTION + +/* Define if you have the syscall_link function. */ +#undef HAVE_SYSCALL_LINK + +/* Define if you have the syscall_listen function. */ +#undef HAVE_SYSCALL_LISTEN + +/* Define if you have the syscall_lseek function. */ +#undef HAVE_SYSCALL_LSEEK + +/* Define if you have the syscall_lstat function. */ +#undef HAVE_SYSCALL_LSTAT + +/* Define if you have the syscall_open function. */ +#undef HAVE_SYSCALL_OPEN + +/* Define if you have the syscall_pgrpsys function. */ +#undef HAVE_SYSCALL_PGRPSYS + +/* Define if you have the syscall_pipe function. */ +#undef HAVE_SYSCALL_PIPE + +/* Define if you have the syscall_poll function. */ +#undef HAVE_SYSCALL_POLL + +/* Define if you have the syscall_putmsg function. */ +#undef HAVE_SYSCALL_PUTMSG + +/* Define if you have the syscall_read function. */ +#undef HAVE_SYSCALL_READ + +/* Define if you have the syscall_readdir function. */ +#undef HAVE_SYSCALL_READDIR + +/* Define if you have the syscall_readv function. */ +#undef HAVE_SYSCALL_READV + +/* Define if you have the syscall_recv function. */ +#undef HAVE_SYSCALL_RECV + +/* Define if you have the syscall_recvfrom function. */ +#undef HAVE_SYSCALL_RECVFROM + +/* Define if you have the syscall_recvmsg function. */ +#undef HAVE_SYSCALL_RECVMSG + +/* Define if you have the syscall_rename function. */ +#undef HAVE_SYSCALL_RENAME + +/* Define if you have the syscall_select function. */ +#undef HAVE_SYSCALL_SELECT + +/* Define if you have the syscall_send function. */ +#undef HAVE_SYSCALL_SEND + +/* Define if you have the syscall_sendmsg function. */ +#undef HAVE_SYSCALL_SENDMSG + +/* Define if you have the syscall_sendto function. */ +#undef HAVE_SYSCALL_SENDTO + +/* Define if you have the syscall_setsockopt function. */ +#undef HAVE_SYSCALL_SETSOCKOPT + +/* Define if you have the syscall_shutdown function. */ +#undef HAVE_SYSCALL_SHUTDOWN + +/* Define if you have the syscall_sigaction function. */ +#undef HAVE_SYSCALL_SIGACTION + +/* Define if you have the syscall_sigpause function. */ +#undef HAVE_SYSCALL_SIGPAUSE + +/* Define if you have the syscall_sigprocmask function. */ +#undef HAVE_SYSCALL_SIGPROCMASK + +/* Define if you have the syscall_sigsuspend function. */ +#undef HAVE_SYSCALL_SIGSUSPEND + +/* Define if you have the syscall_socket function. */ +#undef HAVE_SYSCALL_SOCKET + +/* Define if you have the syscall_socketcall function. */ +#undef HAVE_SYSCALL_SOCKETCALL + +/* Define if you have the syscall_socketpair function. */ +#undef HAVE_SYSCALL_SOCKETPAIR + +/* Define if you have the syscall_stat function. */ +#undef HAVE_SYSCALL_STAT + +/* Define if you have the syscall_unlink function. */ +#undef HAVE_SYSCALL_UNLINK + +/* Define if you have the syscall_wait3 function. */ +#undef HAVE_SYSCALL_WAIT3 + +/* Define if you have the syscall_wait4 function. */ +#undef HAVE_SYSCALL_WAIT4 + +/* Define if you have the syscall_waitpid function. */ +#undef HAVE_SYSCALL_WAITPID + +/* Define if you have the syscall_waitsys function. */ +#undef HAVE_SYSCALL_WAITSYS + +/* Define if you have the syscall_write function. */ +#undef HAVE_SYSCALL_WRITE + +/* Define if you have the syscall_writev function. */ +#undef HAVE_SYSCALL_WRITEV + +/* Define if you have the vfork function. */ +#undef HAVE_VFORK + +/* Define if you have the <alloc.h> header file. */ +#undef HAVE_ALLOC_H + +/* Define if you have the <sys/filio.h> header file. */ +#undef HAVE_SYS_FILIO_H + +/* Define if you have the <sys/syscall.h> header file. */ +#undef HAVE_SYS_SYSCALL_H + +/* Define if you have the <sys/termio.h> header file. */ +#undef HAVE_SYS_TERMIO_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the <syscall.h> header file. */ +#undef HAVE_SYSCALL_H + +/* Define if you have the <termio.h> header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the <termios.h> header file. */ +#undef HAVE_TERMIOS_H diff --git a/lib/libpthread/config/config.sub b/lib/libpthread/config/config.sub new file mode 100644 index 00000000000..26bba506ef7 --- /dev/null +++ b/lib/libpthread/config/config.sub @@ -0,0 +1,794 @@ +#!/bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS (if any). +basic_machine=`echo $1 | sed 's/-[^-]*$//'` +if [ $basic_machine != $1 ] +then os=`echo $1 | sed 's/.*-/-/'` +else os=; fi + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp ) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-unknown/'` + ;; + -lynx) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i[3456]86 | i860 | m68k | m68000 | m88k | ns32k | arm | pyramid \ + | tron | a29k | 580 | i960 | h8300 | hppa1.0 | hppa1.1 \ + | alpha | we32k | ns16k | clipper | sparclite | i370 | sh \ + | powerpc | sparc64 | 1750a | dsp16xx | mips64 | mipsel \ + | pdp11 | mips64el | mips64orion | mips64orionel ) + basic_machine=$basic_machine-unknown + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[3456]86-* | i860-* | m68k-* | m68000-* | m88k-* \ + | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \ + | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \ + | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \ + | pdp11-* | sh-* | powerpc-* | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* ) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigados) + basic_machine=m68k-cbm + os=-amigados + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[3456]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-sysv32 + ;; + i[3456]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-sysv4 + ;; + i[3456]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-sysv + ;; + i[3456]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-unknown/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium-*) + # We will change tis to say i586 once there has been + # time for various packages to start to recognize that. + basic_machine=i486-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + ps2) + basic_machine=i386-ibm + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + basic_machine=mips-mips + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative must end in a *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[3456]* \ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigados* | -msdos* | -newsos* | -unicos* | -aos* \ + | -nindy* | -vxworks* | -ebmon* | -hms* | -mvs* | -clix* \ + | -riscos* | -linux* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -freebsd* | -openbsd* \ + |-riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -winnt*) + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigados + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-masscomp) + os=-rtu + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -lynxos*) + vendor=lynx + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/lib/libpthread/config/configure b/lib/libpthread/config/configure new file mode 100644 index 00000000000..b103492f524 --- /dev/null +++ b/lib/libpthread/config/configure @@ -0,0 +1,3161 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.12 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help +--enable-dce-compat DCE compatibility" +ac_default_prefix=/usr/local/pthreads + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.12" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=config.flags.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +# Check whether --enable-dce-compat or --disable-dce-compat was given. +if test "${enable_dce_compat+set}" = set; then + enableval="$enable_dce_compat" + { echo "configure: error: Actually, DCE compatibility doesn't work yet..." 1>&2; exit 1; } + +else + true + +fi + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:539: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:568: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:616: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext <<EOF +#line 626 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +if { (eval echo configure:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:650: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:655: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:679: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-O2" + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:711: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:742: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext <<EOF +#line 752 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +if { (eval echo configure:756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:782: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:787: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes + ac_test_CXXFLAGS="${CXXFLAGS+set}" + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS= + echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:811: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 + if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" + elif test $ac_cv_prog_cxx_g = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-O2" + fi +else + GXX= + test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" +fi + +echo $ac_n "checking compiler availability and simple error detection""... $ac_c" 1>&6 +echo "configure:839: checking compiler availability and simple error detection" >&5 +cat > conftest.$ac_ext <<EOF +#line 841 "configure" +#include "confdefs.h" + +int main() { + exit(0); +; return 0; } +EOF +if { (eval echo configure:848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + cat > conftest.$ac_ext <<EOF +#line 852 "configure" +#include "confdefs.h" + +int main() { + syntax errors galore! +; return 0; } +EOF +if { (eval echo configure:859: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + { echo "configure: error: Can't detect syntax errors! Is CC set right?" 1>&2; exit 1; } +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + true +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't compile test program! Is CC set right?" 1>&2; exit 1; } +fi +rm -f conftest* + +cat > conftest.$ac_ext <<EOF +#line 878 "configure" +#include "confdefs.h" + +int main() { + + typedef int Integer; + extern int i; + extern Integer i; + +; return 0; } +EOF +if { (eval echo configure:889: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't redeclare variables with this compiler??" 1>&2; exit 1; } +fi +rm -f conftest* +cat > conftest.$ac_ext <<EOF +#line 899 "configure" +#include "confdefs.h" + +int main() { + + typedef long Long; + extern int i; + extern Long i; + +; return 0; } +EOF +if { (eval echo configure:910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + { echo "configure: error: Compiler doesn't detect conflicting declarations." 1>&2; exit 1; } +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +echo "$ac_t""ok" 1>&6 + +if test $ac_cv_prog_gcc = yes ; then + CFLAGS="$CFLAGS -Werror" +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:925: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 940 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 957 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:963: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:989: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:1065: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 +echo "configure:1086: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 +echo "configure:1104: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +syscall=NONE +sysincludes=NONE + +# Treat all x86 machines the same. +# (Yet below, we pretend we can distinguish between the MIPS r2000 and r4000?) +# (What about 680x0 machines?) +case $host in + i[456]86-*) + host=`echo $host | sed 's/^i[456]86/i386/'` + host_cpu=i386 + ;; +esac + +# Here, you should set the following variables: +# name +# The "name" of this configuration. Used for "engine-*.c" file name, +# default for syscall file names. Chris seems to have a thing for +# putting "-" between OS and version number, but the configure script +# will already have $host_cpu and $host_os available for you to use +# in constructing a name. +# sysincludes +# Name of machdep directory with "sys" include file +# replacements, if any. This directory is optional; +# if you don't provide it, don't set this variable. +# except +# Names of any syscalls that shouldn't be generated +# from the template, if any. +# syscall +# Base name of the syscall template files, if not the +# same as <name>. If they're the same, omit this. +# +# Also, you may define random symbols and update CFLAGS if +# necessary. However, for ease of porting to new machines, +# it's best if you can create portable autoconf tests for +# whatever you're trying to do, rather than hard-coding it +# here based on the OS name. So please, try to keep this +# section as minimal as possible. + +except="" +name=$host_cpu-$host_os + +case $host in + alpha-*-netbsd1.3*) + name=alpha-netbsd-1.3 + sysincludes=netbsd-1.1 + except="fork lseek pipe sigsuspend sigprocmask fstat" + ;; + alpha-*-netbsd1.1* | alpha-*-netbsd1.2*) + name=alpha-netbsd-1.1 + sysincludes=netbsd-1.1 + except="fork lseek pipe sigsuspend sigprocmask" + ;; + alpha-*-osf*) + name=alpha-osf1 + sysincludes=alpha-osf1 + except="fork sigsuspend" + if test $ac_cv_prog_gcc = no ; then + CFLAGS="$CFLAGS -std" + fi + ;; + hppa1.0-*-hpux10.20 | hppa1.1-*-hpux10.20) + name=hppa-hpux-10.20 + sysincludes=hpux-10.20 + except="fork" + ;; + hppa1.1-*-hpux*9.*) + name=hppa-hpux-9.03 + sysincludes=hpux-9.03 + # hpux-9.03.mk seems to be missing; what should this be? + except="fork" + ;; + sparc-*-sunos4.1.3* | sparc-*-sunos4.1.4*) + name=sparc-sunos-4.1.3 + sysincludes=sunos-4.1.3 + syscall=sparc-sunos4 + except="fork pipe getpgrp getdirentries" + cat >> confdefs.h <<\EOF +#define sunos4 1 +EOF + # is this really needed?? + ;; + sparc-*-solaris2.3* | sparc-*-solaris2.4*) + name=sparc-sunos-5.3 + sysincludes=sunos-5.3 + except="fork sigaction" + # Should really come up with a test for this... + cat >> confdefs.h <<\EOF +#define LD_LINKS_STATIC_DATA 1 +EOF + + cat >> confdefs.h <<\EOF +#define BROKEN_SIGNALS 1 +EOF + + ;; + sparc-*-solaris2*) + name=sparc-sunos-5.3 + sysincludes=sunos-5.5 + except="fork sigaction" + # Should really come up with a test for this... + cat >> confdefs.h <<\EOF +#define LD_LINKS_STATIC_DATA 1 +EOF + + cat >> confdefs.h <<\EOF +#define BROKEN_SIGNALS 1 +EOF + + ;; + sparc-*-netbsd1.0A | sparc-*-netbsd1.1* | sparc-*-netbsd1.2*) + name=sparc-sunos-4.1.3 + sysincludes=netbsd-1.0 + syscall=sparc-netbsd-1.1 + except="pipe fork sigprocmask sigsuspend" + ;; + i386-*-openbsd2.*) + name=i386-openbsd-2.0 + sysincludes=openbsd-2.0 + except="fork lseek ftruncate sigsuspend sigprocmask" + ;; + i386-*-linux*) + name=i386-linux-1.0 + sysincludes=linux-1.0 + ;; + i386-*-bsdi1.1) + name=i386-bsdi-1.1 + sysincludes=bsdi-1.1 + ;; + i386-*-bsdi2.0* | i386-*-bsdi2.1*) + name=i386-bsdi-2.0 + sysincludes=bsdi-2.0 + syscall=i386-bsdi-2.0 + except="fork lseek ftruncate sigsuspend" + ;; + i386-*-netbsd1.3*) + name=i386-netbsd-1.3 + sysincludes=netbsd-1.1 + except="fork lseek ftruncate pipe sigsuspend sigprocmask fstat" + ;; + i386-*-netbsd1.1* | i386-*-netbsd1.2*) + name=i386-netbsd-1.0 + sysincludes=netbsd-1.1 + syscall=i386-netbsd-1.1 + except="fork lseek ftruncate pipe sigsuspend sigprocmask" + ;; + i386-*-netbsd1.0*) + name=i386-netbsd-1.0 + sysincludes=netbsd-1.0 + except="fork lseek ftruncate sigsuspend" + ;; + i386-*-netbsd0.9*) + name=i386-netbsd-0.9 + sysincludes=netbsd-0.9 + ;; + m68*-*-netbsd*) + name=m68000-netbsd + ;; + i386-*-freebsd2.*) + name=i386-freebsd-2.0 + sysincludes=freebsd-2.0 + except="fork lseek ftruncate sigsuspend sigprocmask" + ;; + romp-*-bsd*) + name=romp-bsd + ;; + mips-dec-ultrix*) + name=r2000-ultrix-4.2 + sysincludes=ultrix-4.2 + except="fork pipe" + ;; + mips-sgi-irix*) + name=ip22-irix-5.2 + sysincludes=irix-5.2 + except="fstat stat" + cat >> confdefs.h <<\EOF +#define BROKEN_SIGNALS 1 +EOF + + ;; + i386-*-sco3.2v5*) + name=i386-sco3.2.5 + sysincludes=i386-sco3.2.5 + syscall=i386-sco3.2.5 + except="select socketcall accept bind connect getpeername getsockname getsockopt setsockopt listen recv recvfrom recvmsg send sendmsg sendto shutdown socket socketpair fork fcntl dup2 fstat fchmod fchown ftruncate pipe getdirentries sigaction sigpause wait3 waitpid getdtablesize" + ;; + *) + { echo "configure: error: System type $host not recognized or not supported. +See $srcdir/configure.in for supported systems." 1>&2; exit 1; } + exit 1 + ;; +esac + +SYSCALL_EXCEPTIONS=$except + + +for ac_hdr in sys/termio.h termios.h termio.h alloc.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1326: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1331 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1336: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +ac_safe=`echo "va_list.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for va_list.h""... $ac_c" 1>&6 +echo "configure:1365: checking for va_list.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1370 "configure" +#include "confdefs.h" +#include <va_list.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1375: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define pthread_have_va_list_h 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + +for ac_hdr in syscall.h sys/syscall.h sys/filio.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1404: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1409 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1414: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +pthreads_syscall_list="open write read creat close fcntl lseek dup2 dup pipe + fchmod fchown execve fstat lstat link unlink chdir chown chmod stat + rename select getdtablesize ioctl ftruncate flock fstatfs + sigsuspend sigaction sigpause sigprocmask ksigaction + getdents readdir getdirentries + wait4 wait3 waitpid waitsys + socket bind connect accept listen getsockopt setsockopt socketpair + poll putmsg getmsg + socketcall + + pgrpsys + + exit + readv writev send sendto sendmsg recv recvfrom recvmsg + getpeername getsockname + shutdown + getpgrp fork" +for pthreads_syscallname in $pthreads_syscall_list ; do + echo $ac_n "checking for syscall $pthreads_syscallname""... $ac_c" 1>&6 +echo "configure:1460: checking for syscall $pthreads_syscallname" >&5 +if eval "test \"`echo '$''{'pthreads_cv_syscall_$pthreads_syscallname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1465 "configure" +#include "confdefs.h" + +/* FIXME: This list should be generated from info in configure.in. */ +#ifdef HAVE_SYSCALL_H +#include <syscall.h> +#else +#ifdef HAVE_SYS_SYSCALL_H +#include <sys/syscall.h> +#else +where is your syscall header file?? +#endif +#endif + +int main() { + +int x; +x = SYS_$pthreads_syscallname ; + +; return 0; } +EOF +if { (eval echo configure:1486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval pthreads_cv_syscall_$pthreads_syscallname=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval pthreads_cv_syscall_$pthreads_syscallname=no +fi +rm -f conftest* +fi + +if eval test \$pthreads_cv_syscall_$pthreads_syscallname = yes ; then + pthreads_syscall_present=yes + available_syscalls="$available_syscalls $pthreads_syscallname" + macroname=HAVE_SYSCALL_`echo $pthreads_syscallname | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <<EOF +#define $macroname 1 +EOF + +else + pthreads_syscall_present=no + missing_syscalls="$missing_syscalls $pthreads_syscallname" +fi +echo "$ac_t""$pthreads_syscall_present" 1>&6 + +done + + + + + + +## Determine some typedef values from the system header files. +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1521: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1526 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1551 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1569 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 1590 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:1625: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1630 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1658: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1663 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:1691: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1696 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:1713: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:1732: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1737 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t int +EOF + +fi + +echo $ac_n "checking for time_t""... $ac_c" 1>&6 +echo "configure:1765: checking for time_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1770 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "time_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_time_t=yes +else + rm -rf conftest* + ac_cv_type_time_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_time_t" 1>&6 +if test $ac_cv_type_time_t = no; then + cat >> confdefs.h <<\EOF +#define time_t long +EOF + +fi + +for ac_hdr in sys/time.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1801: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1806 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1838: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1843 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1852: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + + +echo $ac_n "checking for struct timespec in sys/time.h""... $ac_c" 1>&6 +echo "configure:1874: checking for struct timespec in sys/time.h" >&5 +if eval "test \"`echo '$''{'pthreads_cv_timespec_in_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1879 "configure" +#include "confdefs.h" +#include <sys/time.h> +int main() { +struct timespec foo; +; return 0; } +EOF +if { (eval echo configure:1886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_timespec_in_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + pthreads_cv_timespec_in_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$pthreads_cv_timespec_in_time" 1>&6 +if test $pthreads_cv_timespec_in_time = yes ; then + cat >> confdefs.h <<\EOF +#define _OS_HAS_TIMESPEC 1 +EOF + +fi + + + +echo $ac_n "checking type of size_t""... $ac_c" 1>&6 +echo "configure:1909: checking type of size_t" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1914 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { + extern size_t foo; +; return 0; } +EOF +if { (eval echo configure:1927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 1931 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { + extern size_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:1944: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_size_t="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for size_t." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_size_t" ; then + cat >> confdefs.h <<EOF +#define pthread_size_t $pthreads_cv_type_size_t +EOF + +fi +pthread_size_t=$pthreads_cv_type_size_t +echo "$ac_t""$pthreads_cv_type_size_t" 1>&6 + +echo $ac_n "checking type of ssize_t""... $ac_c" 1>&6 +echo "configure:1972: checking type of ssize_t" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1977 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> + +int main() { + extern ssize_t foo; +; return 0; } +EOF +if { (eval echo configure:1988: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 1992 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> + +int main() { + extern ssize_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_ssize_t="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for ssize_t." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_ssize_t" ; then + cat >> confdefs.h <<EOF +#define pthread_ssize_t $pthreads_cv_type_ssize_t +EOF + +fi +pthread_ssize_t=$pthreads_cv_type_ssize_t +echo "$ac_t""$pthreads_cv_type_ssize_t" 1>&6 + +echo $ac_n "checking type of clock_t""... $ac_c" 1>&6 +echo "configure:2031: checking type of clock_t" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_clock_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2036 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { + extern clock_t foo; +; return 0; } +EOF +if { (eval echo configure:2055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 2059 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { + extern clock_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2078: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_clock_t="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for clock_t." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_clock_t" ; then + cat >> confdefs.h <<EOF +#define pthread_clock_t $pthreads_cv_type_clock_t +EOF + +fi +pthread_clock_t=$pthreads_cv_type_clock_t +echo "$ac_t""$pthreads_cv_type_clock_t" 1>&6 + +echo $ac_n "checking type of time_t""... $ac_c" 1>&6 +echo "configure:2106: checking type of time_t" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_time_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2111 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { + extern time_t foo; +; return 0; } +EOF +if { (eval echo configure:2130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 2134 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { + extern time_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_time_t="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for time_t." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_time_t" ; then + cat >> confdefs.h <<EOF +#define pthread_time_t $pthreads_cv_type_time_t +EOF + +fi +pthread_time_t=$pthreads_cv_type_time_t +echo "$ac_t""$pthreads_cv_type_time_t" 1>&6 +echo $ac_n "checking for fpos_t in stdio.h""... $ac_c" 1>&6 +echo "configure:2180: checking for fpos_t in stdio.h" >&5 +if eval "test \"`echo '$''{'pthreads_cv_fpos_t_in_stdio'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2185 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +fpos_t position; +; return 0; } +EOF +if { (eval echo configure:2192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_fpos_t_in_stdio=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + pthreads_cv_fpos_t_in_stdio=no +fi +rm -f conftest* +fi + +echo "$ac_t""$pthreads_cv_fpos_t_in_stdio" 1>&6 +if test $pthreads_cv_fpos_t_in_stdio = yes ; then + +echo $ac_n "checking type of fpos_t""... $ac_c" 1>&6 +echo "configure:2208: checking type of fpos_t" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_fpos_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2213 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { + extern fpos_t foo; +; return 0; } +EOF +if { (eval echo configure:2226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 2230 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { + extern fpos_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_fpos_t="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for fpos_t." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_fpos_t" ; then + cat >> confdefs.h <<EOF +#define pthread_fpos_t $pthreads_cv_type_fpos_t +EOF + +fi +pthread_fpos_t=$pthreads_cv_type_fpos_t +echo "$ac_t""$pthreads_cv_type_fpos_t" 1>&6 +else + cat >> confdefs.h <<\EOF +#define fpos_t off_t +EOF + + cat >> confdefs.h <<\EOF +#define pthread_fpos_t pthread_off_t +EOF + +fi + +echo $ac_n "checking type of off_t""... $ac_c" 1>&6 +echo "configure:2281: checking type of off_t" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2286 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { + extern off_t foo; +; return 0; } +EOF +if { (eval echo configure:2299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 2303 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { + extern off_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_off_t="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for off_t." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_off_t" ; then + cat >> confdefs.h <<EOF +#define pthread_off_t $pthreads_cv_type_off_t +EOF + +fi +pthread_off_t=$pthreads_cv_type_off_t +echo "$ac_t""$pthreads_cv_type_off_t" 1>&6 +echo $ac_n "checking type of va_list""... $ac_c" 1>&6 +echo "configure:2343: checking type of va_list" >&5 +if eval "test \"`echo '$''{'pthreads_cv_type_va_list'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2348 "configure" +#include "confdefs.h" +#include <stdarg.h> +int main() { + extern va_list foo; +; return 0; } +EOF +if { (eval echo configure:2355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "char *" "char **" "void *" "void **" "int *" "long *" ; do + cat > conftest.$ac_ext <<EOF +#line 2359 "configure" +#include "confdefs.h" +#include <stdarg.h> +int main() { + extern va_list foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_va_list="$try_type" ; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + { echo "configure: error: Can't find system typedef for va_list." 1>&2; exit 1; } +fi +rm -f conftest* +fi + +if test -n "$pthreads_cv_type_va_list" ; then + cat >> confdefs.h <<EOF +#define pthread_va_list $pthreads_cv_type_va_list +EOF + +fi +pthread_va_list=$pthreads_cv_type_va_list +echo "$ac_t""$pthreads_cv_type_va_list" 1>&6 + +arpa_headers="#include <sys/types.h> +#include <arpa/nameser.h>" + +echo $ac_n "checking IP address type""... $ac_c" 1>&6 +echo "configure:2397: checking IP address type" >&5 +if eval "test \"`echo '$''{'pthread_cv_type_ipaddr'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2402 "configure" +#include "confdefs.h" +$arpa_headers +int main() { + &_getlong; +; return 0; } +EOF +if { (eval echo configure:2409: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + for type in "unsigned long" "unsigned int" ; do + cat > conftest.$ac_ext <<EOF +#line 2414 "configure" +#include "confdefs.h" +$arpa_headers +int main() { +extern $type _getlong (); +; return 0; } +EOF +if { (eval echo configure:2421: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + pthread_cv_type_ipaddr="$type" + break + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "configure: warning: Can't compile _getlong reference." 1>&2 +fi +rm -f conftest* + if test "$pthread_cv_type_ipaddr" = "" ; then + echo "configure: warning: Can't determine _getlong return type." 1>&2 + echo "configure: warning: Defaulting to unsigned long." 1>&2 + pthread_cv_type_ipaddr="unsigned long" + fi + +fi + +echo "$ac_t""$pthread_cv_type_ipaddr" 1>&6 +cat >> confdefs.h <<EOF +#define pthread_ipaddr_type $pthread_cv_type_ipaddr +EOF + + +echo $ac_n "checking IP port type""... $ac_c" 1>&6 +echo "configure:2456: checking IP port type" >&5 +if eval "test \"`echo '$''{'pthread_cv_type_ipport'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2461 "configure" +#include "confdefs.h" +$arpa_headers +int main() { + &_getshort; +; return 0; } +EOF +if { (eval echo configure:2468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + for type in "unsigned short" "unsigned int" ; do + cat > conftest.$ac_ext <<EOF +#line 2473 "configure" +#include "confdefs.h" +$arpa_headers +int main() { +extern $type _getshort (); +; return 0; } +EOF +if { (eval echo configure:2480: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + pthread_cv_type_ipport="$type" + break + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + done + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + echo "configure: warning: Can't compile _getshort reference." 1>&2 +fi +rm -f conftest* + if test "$pthread_cv_type_ipport" = "" ; then + echo "configure: warning: Can't determine _getshort return type." 1>&2 + echo "configure: warning: Defaulting to unsigned short." 1>&2 + pthread_cv_type_ipport="unsigned short" + fi + +fi + +echo "$ac_t""$pthread_cv_type_ipport" 1>&6 +cat >> confdefs.h <<EOF +#define pthread_ipport_type $pthread_cv_type_ipport +EOF + + +echo $ac_n "checking pathname for terminal devices directory""... $ac_c" 1>&6 +echo "configure:2515: checking pathname for terminal devices directory" >&5 +if eval "test \"`echo '$''{'pthread_cv_pty_path'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -d /devices/pseudo ; then + pty_path=/devices/pseudo/ + else + pty_path=/dev/ + fi + pthread_cv_pty_path=$pty_path + +fi + +cat >> confdefs.h <<EOF +#define _PATH_PTY "$pthread_cv_pty_path" +EOF + +echo "$ac_t""$pthread_cv_pty_path" 1>&6 + +echo $ac_n "checking directory name for time zone info""... $ac_c" 1>&6 +echo "configure:2535: checking directory name for time zone info" >&5 +tzdir=NONE +for f in /usr/lib/zoneinfo /usr/share/zoneinfo /usr/share/lib/zoneinfo /etc/zoneinfo /usr/local/lib/zoneinfo +do + if test -d $f ; then + tzdir=$f + break + fi +done +case $tzdir in +NONE) + echo "configure: warning: Can't find zoneinfo directory." 1>&2 + echo "configure: warning: Defaulting zoneinfo directory to NULL." 1>&2 + tzdir=NULL + ;; +esac +cat >> confdefs.h <<EOF +#define _PATH_TZDIR "$tzdir" +EOF + +echo "$ac_t""$tzdir" 1>&6 + +echo $ac_n "checking filename for local time zone""... $ac_c" 1>&6 +echo "configure:2558: checking filename for local time zone" >&5 +tzfile=NONE +for f in $tzdir/localtime /etc/localtime +do + if test -f $f ; then + tzfile=$f + break + fi +done +case $tzfile in +NONE) # Should this default to tzdir/localtime? + echo "configure: warning: Can't find local time zone file." 1>&2 + if test tzdir = NULL ; then + echo "configure: warning: Defaulting local time zone file to NULL" 1>&2 + tzfile=NULL + else + echo "configure: warning: Defaulting local time zone file to $tzdir/localtime." 1>&2 + tzfile=$tzdir/localtime + fi + ;; +esac +cat >> confdefs.h <<EOF +#define _PATH_TZFILE "$tzfile" +EOF + +echo "$ac_t""$tzfile" 1>&6 + +cat >> confdefs.h <<\EOF +#define _PATH_RESCONF "/etc/resolv.conf" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_HOSTS "/etc/hosts" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_NETWORKS "/etc/networks" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_PROTOCOLS "/etc/protocols" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_SERVICES "/etc/services" +EOF + + +cat >> confdefs.h <<\EOF +#define _PATH_BSHELL "/bin/sh" +EOF + + +for ac_func in vfork +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2614: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2619 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +srctop=`cd ${srcdir}/..;pwd` + + +# Now we deal with symlinks &c. + +test -d include || mkdir include || \ + { echo "configure: error: Can't create include directory." 1>&2; exit 1; } + +test -d include/pthread || mkdir include/pthread || \ + { echo "configure: error: Can't create include/pthread directory." 1>&2; exit 1; } + +test -d lib || mkdir lib || \ + { echo "configure: error: Can't create lib directory." 1>&2; exit 1; } + +test -d lib/libpthreadutil || mkdir lib/libpthreadutil || \ + { echo "configure: error: Can't create lib/libpthreadutil directory." 1>&2; exit 1; } + +test -d bin || mkdir bin || \ + { echo "configure: error: Can't create bin directory." 1>&2; exit 1; } + +test -d bin/finger || mkdir bin/finger || \ + { echo "configure: error: Can't create bin directory." 1>&2; exit 1; } + +test -d tests || mkdir tests || \ + { echo "configure: error: Can't create tests directory." 1>&2; exit 1; } + +if test x$syscall = xNONE ; then + syscall=$name +fi + +links="include/pthread/machdep.h include/pthread/posix.h \ + machdep.c syscall.S" +targets="../machdep/engine-$name.h ../machdep/posix-$sysincludes.h \ + ../machdep/engine-$name.c ../machdep/syscall-$syscall.S" + +# Both these targets are optional. (Autoconf-generated configure scripts +# will require the existence of link targets, so check before adding them +# to the list.) +if test x$sysincludes != xNONE ; then + links="$links include/sys" + targets="$targets ../machdep/$sysincludes" +fi + +syscall_file=../machdep/syscall-template-$syscall.S +if test -r $srcdir/$syscall_file ; then + links="$links syscall-template.S" + targets="$targets $syscall_file" + HAVE_SYSCALL_TEMPLATE=yes +else + # This really isn't a fatal problem. In fact, it's expected, initially, + # for some targets. This is just to persuade people to fix the targets + # they deal with to provide some sort of template. + # + # Eventually this file probably will be required... + echo "configure: warning: No syscall template file syscall-template-$syscall.S found." 1>&2 + HAVE_SYSCALL_TEMPLATE=no +fi + + + + +if test x$makefile_frag != x ; then + makefile_frag=${srcdir}/$makefile_frag +else + makefile_frag=/dev/null +fi + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.12" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "config.flags GNUmakefile Makefile \ + lib/Makefile:../lib/Makefile.in \ + lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in \ + bin/Makefile:../bin/Makefile.in \ + bin/finger/Makefile:../bin/finger/Makefile.in \ + tests/Makefile:../tests/Makefile.in config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@CXX@%$CXX%g +s%@CPP@%$CPP%g +s%@RANLIB@%$RANLIB%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@SYSCALL_EXCEPTIONS@%$SYSCALL_EXCEPTIONS%g +s%@available_syscalls@%$available_syscalls%g +s%@missing_syscalls@%$missing_syscalls%g +s%@srctop@%$srctop%g +s%@HAVE_SYSCALL_TEMPLATE@%$HAVE_SYSCALL_TEMPLATE%g +/@makefile_frag@/r $makefile_frag +s%@makefile_frag@%%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"config.flags GNUmakefile Makefile \ + lib/Makefile:../lib/Makefile.in \ + lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in \ + bin/Makefile:../bin/Makefile.in \ + bin/finger/Makefile:../bin/finger/Makefile.in \ + tests/Makefile:../tests/Makefile.in"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="config.h" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF + +cat >> $CONFIG_STATUS <<EOF +ac_sources="$targets" +ac_dests="$links" +EOF + +cat >> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/lib/libpthread/config/configure.in b/lib/libpthread/config/configure.in new file mode 100755 index 00000000000..0673c52f123 --- /dev/null +++ b/lib/libpthread/config/configure.in @@ -0,0 +1,672 @@ +dnl Some reminders: +dnl "dnl" is a "delete to newline" command for m4 - the remainder of the +dnl line it's on, including the newline, will be discarded +dnl "#" comments will usually be copied through +dnl "[]" are quoting characters; use changequote around code that really +dnl needs to use them, but try not to invoke autoconf macros +dnl within such code +dnl +dnl When you change this file, re-run "autoreconf" -- that'll automatically +dnl re-run both autoconf and autoheader. +dnl +dnl +dnl To do: +dnl CLOCKS_PER_SEC (default 100, Ultrix differs) +dnl CLK_TCK (default 100, Ultrix differs) +dnl clockid_t (not on all systems) +dnl timer_t (not on all systems) +dnl +dnl +dnl Now, the real stuff. +dnl +dnl This must be first. +AC_INIT(config.flags.in) +dnl +dnl This file does require autoconf 2.0 or better... +dnl +AC_PREREQ(2.0)dnl +dnl +dnl Hook for the "--enable-dce-compat" option, when Chris actually +dnl implements it. +dnl +AC_ARG_ENABLE(dce-compat, + --enable-dce-compat DCE compatibility, +[dnl "true" action + AC_MSG_ERROR([Actually, DCE compatibility doesn't work yet...]) +], +[dnl "false" action + true +]) + +dnl What C compiler? +AC_PROG_CC +AC_PROG_CXX +dnl Apparently autoconf doesn't test to see if the C compiler it locates +dnl actually works... oops! +AC_MSG_CHECKING(compiler availability and simple error detection) +AC_TRY_COMPILE(,[ exit(0); ],[ + dnl true + AC_TRY_COMPILE(,[ syntax errors galore! ], + dnl true + AC_MSG_ERROR(Can't detect syntax errors! Is CC set right?), + dnl false + true)], + dnl false + AC_MSG_ERROR(Can't compile test program! Is CC set right?)) + +AC_TRY_COMPILE(,[ + typedef int Integer; + extern int i; + extern Integer i; +], , AC_MSG_ERROR(Can't redeclare variables with this compiler??)) +AC_TRY_COMPILE(,[ + typedef long Long; + extern int i; + extern Long i; +], AC_MSG_ERROR(Compiler doesn't detect conflicting declarations.)) +AC_MSG_RESULT(ok) + +if test $ac_cv_prog_gcc = yes ; then + CFLAGS="$CFLAGS -Werror" +fi + +AC_PROG_CPP + +AC_PROG_RANLIB + +dnl Default value of prefix should be /usr/local/pthreads, not /usr/local. +AC_PREFIX_DEFAULT(/usr/local/pthreads) + +dnl Determine $host, by guessing if necessary. +AC_CANONICAL_SYSTEM + +syscall=NONE +sysincludes=NONE + +# Treat all x86 machines the same. +# (Yet below, we pretend we can distinguish between the MIPS r2000 and r4000?) +# (What about 680x0 machines?) +changequote(,)dnl +case $host in + i[456]86-*) + host=`echo $host | sed 's/^i[456]86/i386/'` + host_cpu=i386 + ;; +esac +changequote([,])dnl + +# Here, you should set the following variables: +# name +# The "name" of this configuration. Used for "engine-*.c" file name, +# default for syscall file names. Chris seems to have a thing for +# putting "-" between OS and version number, but the configure script +# will already have $host_cpu and $host_os available for you to use +# in constructing a name. +# sysincludes +# Name of machdep directory with "sys" include file +# replacements, if any. This directory is optional; +# if you don't provide it, don't set this variable. +# except +# Names of any syscalls that shouldn't be generated +# from the template, if any. +# syscall +# Base name of the syscall template files, if not the +# same as <name>. If they're the same, omit this. +# +# Also, you may define random symbols and update CFLAGS if +# necessary. However, for ease of porting to new machines, +# it's best if you can create portable autoconf tests for +# whatever you're trying to do, rather than hard-coding it +# here based on the OS name. So please, try to keep this +# section as minimal as possible. + +except="" +name=$host_cpu-$host_os + +case $host in + alpha-*-netbsd1.3*) + name=alpha-netbsd-1.3 + sysincludes=netbsd-1.1 + except="fork lseek pipe sigsuspend sigprocmask fstat" + ;; + alpha-*-netbsd1.1* | alpha-*-netbsd1.2*) + name=alpha-netbsd-1.1 + sysincludes=netbsd-1.1 + except="fork lseek pipe sigsuspend sigprocmask" + ;; + alpha-*-osf*) + name=alpha-osf1 + sysincludes=alpha-osf1 + except="fork sigsuspend" + if test $ac_cv_prog_gcc = no ; then + CFLAGS="$CFLAGS -std" + fi + ;; + hppa1.0-*-hpux10.20 | hppa1.1-*-hpux10.20) + name=hppa-hpux-10.20 + sysincludes=hpux-10.20 + except="fork" + ;; + hppa1.1-*-hpux*9.*) + name=hppa-hpux-9.03 + sysincludes=hpux-9.03 + # hpux-9.03.mk seems to be missing; what should this be? + except="fork" + ;; + sparc-*-sunos4.1.3* | sparc-*-sunos4.1.4*) + name=sparc-sunos-4.1.3 + sysincludes=sunos-4.1.3 + syscall=sparc-sunos4 + except="fork pipe getpgrp getdirentries" + AC_DEFINE(sunos4) # is this really needed?? + ;; + sparc-*-solaris2.3* | sparc-*-solaris2.4*) + name=sparc-sunos-5.3 + sysincludes=sunos-5.3 + except="fork sigaction" + # Should really come up with a test for this... + AC_DEFINE(LD_LINKS_STATIC_DATA) + AC_DEFINE(BROKEN_SIGNALS) + ;; + sparc-*-solaris2*) + name=sparc-sunos-5.3 + sysincludes=sunos-5.5 + except="fork sigaction" + # Should really come up with a test for this... + AC_DEFINE(LD_LINKS_STATIC_DATA) + AC_DEFINE(BROKEN_SIGNALS) + ;; + sparc-*-netbsd1.0A | sparc-*-netbsd1.1* | sparc-*-netbsd1.2*) + name=sparc-sunos-4.1.3 + sysincludes=netbsd-1.0 + syscall=sparc-netbsd-1.1 + except="pipe fork sigprocmask sigsuspend" + ;; + i386-*-openbsd2.*) + name=i386-openbsd-2.0 + sysincludes=openbsd-2.0 + except="fork lseek ftruncate sigsuspend sigprocmask" + ;; + i386-*-linux*) + name=i386-linux-1.0 + sysincludes=linux-1.0 + ;; + i386-*-bsdi1.1) + name=i386-bsdi-1.1 + sysincludes=bsdi-1.1 + ;; + i386-*-bsdi2.0* | i386-*-bsdi2.1*) + name=i386-bsdi-2.0 + sysincludes=bsdi-2.0 + syscall=i386-bsdi-2.0 + except="fork lseek ftruncate sigsuspend" + ;; + i386-*-netbsd1.3*) + name=i386-netbsd-1.3 + sysincludes=netbsd-1.1 + except="fork lseek ftruncate pipe sigsuspend sigprocmask fstat" + ;; + i386-*-netbsd1.1* | i386-*-netbsd1.2*) + name=i386-netbsd-1.0 + sysincludes=netbsd-1.1 + syscall=i386-netbsd-1.1 + except="fork lseek ftruncate pipe sigsuspend sigprocmask" + ;; + i386-*-netbsd1.0*) + name=i386-netbsd-1.0 + sysincludes=netbsd-1.0 + except="fork lseek ftruncate sigsuspend" + ;; + i386-*-netbsd0.9*) + name=i386-netbsd-0.9 + sysincludes=netbsd-0.9 + ;; + m68*-*-netbsd*) + name=m68000-netbsd + ;; + i386-*-freebsd2.*) + name=i386-freebsd-2.0 + sysincludes=freebsd-2.0 + except="fork lseek ftruncate sigsuspend sigprocmask" + ;; + romp-*-bsd*) + name=romp-bsd + ;; + mips-dec-ultrix*) + name=r2000-ultrix-4.2 + sysincludes=ultrix-4.2 + except="fork pipe" + ;; + mips-sgi-irix*) + name=ip22-irix-5.2 + sysincludes=irix-5.2 + except="fstat stat" + AC_DEFINE(BROKEN_SIGNALS) + ;; + i386-*-sco3.2v5*) + name=i386-sco3.2.5 + sysincludes=i386-sco3.2.5 + syscall=i386-sco3.2.5 + except="select socketcall accept bind connect getpeername getsockname getsockopt setsockopt listen recv recvfrom recvmsg send sendmsg sendto shutdown socket socketpair fork fcntl dup2 fstat fchmod fchown ftruncate pipe getdirentries sigaction sigpause wait3 waitpid getdtablesize" + ;; + *) + AC_MSG_ERROR(System type $host not recognized or not supported. +See $srcdir/configure.in for supported systems.) + exit 1 + ;; +esac + +SYSCALL_EXCEPTIONS=$except +AC_SUBST(SYSCALL_EXCEPTIONS) + +AC_CHECK_HEADERS(sys/termio.h termios.h termio.h alloc.h) + +dnl Don't use AC_CHECK_HEADERS for this one, we want to define a special +dnl symbol name starting with pthread_ if it's found. +AC_CHECK_HEADER(va_list.h, AC_DEFINE(pthread_have_va_list_h)) + +dnl Generate a list of system calls that we could generate. We later use +dnl a syscall template .S file to produce a .o file for each syscall. This +dnl is a bit better for porting and development purposes than having every +dnl syscall listed for every target system; this way we only need the +dnl template, and special hanlding for only those syscalls that can't be +dnl handled by the templates. +AC_CHECK_HEADERS(syscall.h sys/syscall.h sys/filio.h) + +PTHREADS_CHECK_SYSCALLS(open write read creat close fcntl lseek dup2 dup pipe + fchmod fchown execve fstat lstat link unlink chdir chown chmod stat + rename select getdtablesize ioctl ftruncate flock fstatfs + dnl - signals + sigsuspend sigaction sigpause sigprocmask ksigaction + dnl - directory reading + getdents readdir getdirentries + dnl - variants of `wait' syscalls + wait4 wait3 waitpid waitsys + dnl - BSD socket calls + socket bind connect accept listen getsockopt setsockopt socketpair + dnl - SYSV stream calls + poll putmsg getmsg + dnl - Linux version uses one syscall + socketcall + + dnl - Process info + pgrpsys + + exit + readv writev send sendto sendmsg recv recvfrom recvmsg + getpeername getsockname + shutdown + getpgrp fork) + +AC_SUBST(available_syscalls) +AC_SUBST(missing_syscalls) + +dnl Disabled for now -- generates warnings from autoconf. +dnl ## Check some type sizes. +dnl AC_CHECK_SIZEOF(int) +dnl AC_CHECK_SIZEOF(long) +dnl AC_CHECK_SIZEOF(char *) + +## Determine some typedef values from the system header files. +dnl +dnl Autoconf provides these automatically. They provide reasonable +dnl fallbacks if the standard header files don't define the typedef names. +dnl +dnl AC_TYPE_MODE_T +AC_TYPE_OFF_T +dnl AC_TYPE_PID_T +AC_TYPE_SIZE_T +dnl AC_TYPE_UID_T +AC_TYPE_SIGNAL +dnl +dnl Default these types if their definitions can't be found. +dnl +AC_CHECK_TYPE(ssize_t,int) +AC_CHECK_TYPE(time_t,long) +dnl +AC_CHECK_HEADERS(sys/time.h) +AC_HEADER_TIME + +dnl +dnl Check for the existence of these types +dnl +dnl struct timespec +dnl +AC_MSG_CHECKING(for struct timespec in sys/time.h) +AC_CACHE_VAL(pthreads_cv_timespec_in_time, + AC_TRY_COMPILE([#include <sys/time.h>], [struct timespec foo;], + pthreads_cv_timespec_in_time=yes, pthreads_cv_timespec_in_time=no)) +AC_MSG_RESULT($pthreads_cv_timespec_in_time) +if test $pthreads_cv_timespec_in_time = yes ; then + AC_DEFINE(_OS_HAS_TIMESPEC) +fi + + +dnl +dnl Usage: PTHREADS_FIND_TYPE(system-typedef-name, new-macro-name, +dnl list-of-includes-in-square-brackets, +dnl comma-separated-list-of-types-to-try) +dnl +dnl PTHREADS_FIND_INTEGRAL_TYPE automatically provides a set of integral +dnl types, and does not permit specification of additional types. +dnl +dnl The specified types must all be able to work as prefixes -- i.e., no +dnl direct specification of array or function types. If you need such +dnl types, add typedefs for them to include/pthread/xtypes.h, and include +dnl that in the set of header files. For simple struct types, you can +dnl try including the definition directly here, but it had better not +dnl contain any commas or square brackets. +dnl +dnl If necessary, you can include other preprocessing commands and such +dnl in the `includes' portion. +dnl +dnl Note: For now, each of these needs a corresponding entry +dnl in acconfig.h. +dnl +dnl size_t +dnl +PTHREADS_FIND_INTEGRAL_TYPE(size_t, pthread_size_t, [ +#include <stddef.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif +]) +dnl +dnl ssize_t +dnl +PTHREADS_FIND_INTEGRAL_TYPE(ssize_t, pthread_ssize_t, [ +#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> +]) +dnl +dnl clock_t ---FIXME I don't know if this is the right set of header files. KR +dnl +PTHREADS_FIND_INTEGRAL_TYPE(clock_t, pthread_clock_t, [ +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +]) +dnl +dnl time_t +dnl +PTHREADS_FIND_INTEGRAL_TYPE(time_t, pthread_time_t, [ +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +]) +dnl +dnl fpos_t +dnl +dnl If fpos_t isn't defined in stdio.h, define it to be off_t. It +dnl looks like AC_CHECK_TYPE won't work for this, because it doesn't +dnl include stdio.h. +dnl +AC_MSG_CHECKING(for fpos_t in stdio.h) +AC_CACHE_VAL(pthreads_cv_fpos_t_in_stdio, + AC_TRY_COMPILE([#include <stdio.h>], [fpos_t position;], + pthreads_cv_fpos_t_in_stdio=yes, pthreads_cv_fpos_t_in_stdio=no)) +AC_MSG_RESULT($pthreads_cv_fpos_t_in_stdio) +if test $pthreads_cv_fpos_t_in_stdio = yes ; then + PTHREADS_FIND_INTEGRAL_TYPE(fpos_t, pthread_fpos_t, [ +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif +]) +else + AC_DEFINE(fpos_t,off_t) + AC_DEFINE(pthread_fpos_t,pthread_off_t) +fi +dnl +dnl off_t +dnl +PTHREADS_FIND_INTEGRAL_TYPE(off_t, pthread_off_t, [ +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif +]) +dnl +dnl va_list -- This one could be tricky. Fortunately, on some systems, +dnl we can just include the gcc stdarg.h header file if we can't determine +dnl the type here. Won't work for non-gcc configurations though. +dnl +PTHREADS_FIND_TYPE(va_list, pthread_va_list, [#include <stdarg.h>], + char *, char **, void *, void **, int *, long *) +dnl +dnl + +arpa_headers="#include <sys/types.h> +#include <arpa/nameser.h>" + +dnl +dnl Type for network (IP) addresses, 32 bits. +dnl For now, I'm assuming that the return type from _getlong is it. +dnl +AC_MSG_CHECKING(IP address type) +AC_CACHE_VAL(pthread_cv_type_ipaddr, + AC_TRY_COMPILE($arpa_headers,[ &_getlong; ],[ + for type in "unsigned long" "unsigned int" ; do + AC_TRY_COMPILE($arpa_headers, extern $type _getlong ();,[ + pthread_cv_type_ipaddr="$type" + break + ]) + done + ],[ AC_MSG_WARN(Can't compile _getlong reference.) ]) + if test "$pthread_cv_type_ipaddr" = "" ; then + AC_MSG_WARN(Can't determine _getlong return type.) + AC_MSG_WARN(Defaulting to unsigned long.) + pthread_cv_type_ipaddr="unsigned long" + fi +) +AC_MSG_RESULT($pthread_cv_type_ipaddr) +AC_DEFINE_UNQUOTED(pthread_ipaddr_type,$pthread_cv_type_ipaddr) + +dnl +dnl Type for network (IP) ports, 16 bits. +dnl For now, I'm assuming that the return type from _getshort is it. +dnl +AC_MSG_CHECKING(IP port type) +AC_CACHE_VAL(pthread_cv_type_ipport, + AC_TRY_COMPILE($arpa_headers,[ &_getshort; ],[ + for type in "unsigned short" "unsigned int" ; do + AC_TRY_COMPILE($arpa_headers, extern $type _getshort ();,[ + pthread_cv_type_ipport="$type" + break + ]) + done + ],[ AC_MSG_WARN(Can't compile _getshort reference.) ]) + if test "$pthread_cv_type_ipport" = "" ; then + AC_MSG_WARN(Can't determine _getshort return type.) + AC_MSG_WARN(Defaulting to unsigned short.) + pthread_cv_type_ipport="unsigned short" + fi +) +AC_MSG_RESULT($pthread_cv_type_ipport) +AC_DEFINE_UNQUOTED(pthread_ipport_type,$pthread_cv_type_ipport) + +dnl +dnl Guess where terminal devices are stored. This is for use in the +dnl ttyname() implementation provided here. +dnl +AC_MSG_CHECKING(pathname for terminal devices directory) +AC_CACHE_VAL(pthread_cv_pty_path, + if test -d /devices/pseudo ; then + pty_path=/devices/pseudo/ + else + pty_path=/dev/ + fi + pthread_cv_pty_path=$pty_path +) +AC_DEFINE_UNQUOTED(_PATH_PTY,"$pthread_cv_pty_path") +AC_MSG_RESULT($pthread_cv_pty_path) + +dnl +dnl Look for timezone info, for use in ctime. +dnl +AC_MSG_CHECKING(directory name for time zone info) +tzdir=NONE +for f in /usr/lib/zoneinfo /usr/share/zoneinfo /usr/share/lib/zoneinfo /etc/zoneinfo /usr/local/lib/zoneinfo +do + if test -d $f ; then + tzdir=$f + break + fi +done +case $tzdir in +NONE) + AC_MSG_WARN(Can't find zoneinfo directory.) + AC_MSG_WARN(Defaulting zoneinfo directory to NULL.) + tzdir=NULL + ;; +esac +AC_DEFINE_UNQUOTED(_PATH_TZDIR,"$tzdir") +AC_MSG_RESULT($tzdir) + +AC_MSG_CHECKING(filename for local time zone) +tzfile=NONE +for f in $tzdir/localtime /etc/localtime +do + if test -f $f ; then + tzfile=$f + break + fi +done +case $tzfile in +NONE) # Should this default to tzdir/localtime? + AC_MSG_WARN(Can't find local time zone file.) + if test tzdir = NULL ; then + AC_MSG_WARN(Defaulting local time zone file to NULL) + tzfile=NULL + else + AC_MSG_WARN(Defaulting local time zone file to $tzdir/localtime.) + tzfile=$tzdir/localtime + fi + ;; +esac +AC_DEFINE_UNQUOTED(_PATH_TZFILE,"$tzfile") +AC_MSG_RESULT($tzfile) + +dnl +dnl Network stuff. At the moment, I don't think there are any other +dnl values we should expect. If we find a system that does store these +dnl files elsewhere -- or doesn't have them all -- then run some tests. +dnl +AC_DEFINE(_PATH_RESCONF, "/etc/resolv.conf") +AC_DEFINE(_PATH_HOSTS, "/etc/hosts") +AC_DEFINE(_PATH_NETWORKS, "/etc/networks") +AC_DEFINE(_PATH_PROTOCOLS, "/etc/protocols") +AC_DEFINE(_PATH_SERVICES, "/etc/services") + +dnl +dnl Other stuff +dnl +AC_DEFINE(_PATH_BSHELL, "/bin/sh") + +dnl If the system provides vfork, autoconf scripts will detect it. +dnl So we should hide it. +AC_CHECK_FUNCS(vfork) + +srctop=`cd ${srcdir}/..;pwd` +AC_SUBST(srctop) + +# Now we deal with symlinks &c. + +test -d include || mkdir include || \ + AC_MSG_ERROR(Can't create include directory.) + +test -d include/pthread || mkdir include/pthread || \ + AC_MSG_ERROR(Can't create include/pthread directory.) + +test -d lib || mkdir lib || \ + AC_MSG_ERROR(Can't create lib directory.) + +test -d lib/libpthreadutil || mkdir lib/libpthreadutil || \ + AC_MSG_ERROR(Can't create lib/libpthreadutil directory.) + +test -d bin || mkdir bin || \ + AC_MSG_ERROR(Can't create bin directory.) + +test -d bin/finger || mkdir bin/finger || \ + AC_MSG_ERROR(Can't create bin directory.) + +test -d tests || mkdir tests || \ + AC_MSG_ERROR(Can't create tests directory.) + +if test x$syscall = xNONE ; then + syscall=$name +fi + +links="include/pthread/machdep.h include/pthread/posix.h \ + machdep.c syscall.S" +targets="../machdep/engine-$name.h ../machdep/posix-$sysincludes.h \ + ../machdep/engine-$name.c ../machdep/syscall-$syscall.S" + +# Both these targets are optional. (Autoconf-generated configure scripts +# will require the existence of link targets, so check before adding them +# to the list.) +if test x$sysincludes != xNONE ; then + links="$links include/sys" + targets="$targets ../machdep/$sysincludes" +fi + +syscall_file=../machdep/syscall-template-$syscall.S +if test -r $srcdir/$syscall_file ; then + links="$links syscall-template.S" + targets="$targets $syscall_file" + HAVE_SYSCALL_TEMPLATE=yes +else + # This really isn't a fatal problem. In fact, it's expected, initially, + # for some targets. This is just to persuade people to fix the targets + # they deal with to provide some sort of template. + # + # Eventually this file probably will be required... + AC_MSG_WARN(No syscall template file syscall-template-$syscall.S found.) + HAVE_SYSCALL_TEMPLATE=no +fi +AC_SUBST(HAVE_SYSCALL_TEMPLATE) + +dnl Now tell it to make the links. +dnl (The links are actually made by config.status.) +AC_LINK_FILES($targets, $links) + +if test x$makefile_frag != x ; then + makefile_frag=${srcdir}/$makefile_frag +else + makefile_frag=/dev/null +fi +dnl Drop in file indicated by $makefile_frag on *the line after* the +dnl magic @makefile_frag@ sequence. +AC_SUBST_FILE(makefile_frag) + + +dnl Generate output files... +AC_CONFIG_HEADER(config.h) + +dnl This must be last. +AC_OUTPUT(config.flags GNUmakefile Makefile \ + lib/Makefile:../lib/Makefile.in \ + lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in \ + bin/Makefile:../bin/Makefile.in \ + bin/finger/Makefile:../bin/finger/Makefile.in \ + tests/Makefile:../tests/Makefile.in) diff --git a/lib/libpthread/config/configure.org b/lib/libpthread/config/configure.org new file mode 100644 index 00000000000..f8526844a24 --- /dev/null +++ b/lib/libpthread/config/configure.org @@ -0,0 +1,2874 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.10 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help +--enable-dce-compat DCE compatibility" +ac_default_prefix=/usr/local/pthreads + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.10" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=config.flags.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + +# Check whether --enable-dce-compat or --disable-dce-compat was given. +if test "${enable_dce_compat+set}" = set; then + enableval="$enable_dce_compat" + { echo "configure: error: Actually, DCE compatibility doesn't work yet..." 1>&2; exit 1; } + +else + true + +fi + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + ac_prog_rejected=no + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:616: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +for ac_prog in $CCC c++ g++ gcc CC cxx +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 +if test $ac_cv_prog_gxx = yes; then + GXX=yes + if test "${CXXFLAGS+set}" != set; then + echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_gxx_g=yes +else + ac_cv_prog_gxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_gxx_g" 1>&6 + if test $ac_cv_prog_gxx_g = yes; then + CXXFLAGS="-g -O" + else + CXXFLAGS="-O" + fi + fi +else + GXX= + test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" +fi + +echo $ac_n "checking compiler availability and simple error detection""... $ac_c" 1>&6 +cat > conftest.$ac_ext <<EOF +#line 735 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { + exit(0); +; return 0; } +EOF +if { (eval echo configure:743: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + cat > conftest.$ac_ext <<EOF +#line 747 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { + syntax errors galore! +; return 0; } +EOF +if { (eval echo configure:755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + { echo "configure: error: Can't detect syntax errors! Is CC set right?" 1>&2; exit 1; } +else + rm -rf conftest* + true +fi +rm -f conftest* + +else + rm -rf conftest* + { echo "configure: error: Can't compile test program! Is CC set right?" 1>&2; exit 1; } +fi +rm -f conftest* + + +cat > conftest.$ac_ext <<EOF +#line 772 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { + + typedef int Integer; + extern int i; + extern Integer i; + +; return 0; } +EOF +if { (eval echo configure:784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + rm -rf conftest* + { echo "configure: error: Can't redeclare variables with this compiler??" 1>&2; exit 1; } +fi +rm -f conftest* + +cat > conftest.$ac_ext <<EOF +#line 793 "configure" +#include "confdefs.h" + +int main() { return 0; } +int t() { + + typedef long Long; + extern int i; + extern Long i; + +; return 0; } +EOF +if { (eval echo configure:805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + { echo "configure: error: Compiler doesn't detect conflicting declarations." 1>&2; exit 1; } +fi +rm -f conftest* + +echo "$ac_t""ok" 1>&6 + +if test $ac_cv_prog_gcc = yes ; then + CFLAGS="$CFLAGS -Werror" +fi + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 832 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 847 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`$ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`$ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + +echo $ac_n "checking target system type""... $ac_c" 1>&6 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`$ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$target" 1>&6 + +echo $ac_n "checking build system type""... $ac_c" 1>&6 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`$ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + + +syscall=NONE +sysincludes=NONE + +# Treat all x86 machines the same. +# (Yet below, we pretend we can distinguish between the MIPS r2000 and r4000?) +# (What about 680x0 machines?) +case $host in + i[456]86-*) + host=`echo $host | sed 's/^i[456]86/i386/'` + host_cpu=i386 + ;; +esac + +# Here, you should set the following variables: +# name +# The "name" of this configuration. Used for "engine-*.c" file name, +# default for syscall file names. Chris seems to have a thing for +# putting "-" between OS and version number, but the configure script +# will already have $host_cpu and $host_os available for you to use +# in constructing a name. +# sysincludes +# Name of machdep directory with "sys" include file +# replacements, if any. This directory is optional; +# if you don't provide it, don't set this variable. +# except +# Names of any syscalls that shouldn't be generated +# from the template, if any. +# syscall +# Base name of the syscall template files, if not the +# same as <name>. If they're the same, omit this. +# +# Also, you may define random symbols and update CFLAGS if +# necessary. However, for ease of porting to new machines, +# it's best if you can create portable autoconf tests for +# whatever you're trying to do, rather than hard-coding it +# here based on the OS name. So please, try to keep this +# section as minimal as possible. + +except="" +name=$host_cpu-$host_os + +case $host in + alpha-*-netbsd1.1* | alpha-*-netbsd1.2*) + name=alpha-netbsd-1.1 + sysincludes=netbsd-1.1 + except="fork lseek pipe sigsuspend sigprocmask" + ;; + alpha-*-osf*) + name=alpha-osf1 + sysincludes=alpha-osf1 + except="fork sigsuspend" + if test $ac_cv_prog_gcc = no ; then + CFLAGS="$CFLAGS -std" + fi + ;; + hppa1.1-*-hpux*) + name=hppa-hpux-9.03 + sysincludes=hpux-9.03 + # hpux-9.03.mk seems to be missing; what should this be? + except="fork" + ;; + sparc-*-sunos4.1.3* | sparc-*-sunos4.1.4*) + name=sparc-sunos-4.1.3 + sysincludes=sunos-4.1.3 + syscall=sparc-sunos4 + except="fork pipe getpgrp getdirentries" + cat >> confdefs.h <<\EOF +#define sunos4 1 +EOF + # is this really needed?? + ;; + sparc-*-solaris2*) + name=sparc-sunos-5.3 + sysincludes=sunos-5.3 + except="fork sigaction" + # Should really come up with a test for this... + cat >> confdefs.h <<\EOF +#define LD_LINKS_STATIC_DATA 1 +EOF + + cat >> confdefs.h <<\EOF +#define BROKEN_SIGNALS 1 +EOF + + ;; + sparc-*-netbsd1.0A | sparc-*-netbsd1.1* | sparc-*-netbsd1.2*) + name=sparc-sunos-4.1.3 + sysincludes=netbsd-1.0 + syscall=sparc-netbsd-1.1 + except="pipe fork sigprocmask sigsuspend" + ;; + i386-*-linux*) + name=i386-linux-1.0 + sysincludes=linux-1.0 + ;; + i386-*-bsdi1.1) + name=i386-bsdi-1.1 + sysincludes=bsdi-1.1 + ;; + i386-*-bsdi2.0* | i386-*-bsdi2.1*) + name=i386-bsdi-2.0 + sysincludes=bsdi-2.0 + syscall=i386-bsdi-2.0 + except="fork lseek sigsuspend" + ;; + i386-*-netbsd1.1* | i386-*-netbsd1.2*) + name=i386-netbsd-1.0 + sysincludes=netbsd-1.1 + syscall=i386-netbsd-1.1 + except="fork lseek pipe sigsuspend sigprocmask" + ;; + i386-*-netbsd1.0*) + name=i386-netbsd-1.0 + sysincludes=netbsd-1.0 + except="fork lseek sigsuspend" + ;; + i386-*-netbsd0.9*) + name=i386-netbsd-0.9 + sysincludes=netbsd-0.9 + ;; + m68*-*-netbsd*) + name=m68000-netbsd + ;; + i386-*-freebsd2.*) + name=i386-freebsd-2.0 + sysincludes=freebsd-2.0 + except="fork lseek sigsuspend sigprocmask" + ;; + romp-*-bsd*) + name=romp-bsd + ;; + mips-dec-ultrix*) + name=r2000-ultrix-4.2 + sysincludes=ultrix-4.2 + except="fork pipe" + ;; + mips-sgi-irix*) + name=ip22-irix-5.2 + sysincludes=irix-5.2 + except="fstat stat" + cat >> confdefs.h <<\EOF +#define BROKEN_SIGNALS 1 +EOF + + ;; + *) + { echo "configure: error: System type $host not recognized or not supported. +See $srcdir/configure.in for supported systems." 1>&2; exit 1; } + exit 1 + ;; +esac + +SYSCALL_EXCEPTIONS=$except + + +for ac_hdr in sys/termio.h termios.h termio.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1174 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1179: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +ac_safe=`echo "va_list.h" | tr './\055' '___'` +echo $ac_n "checking for va_list.h""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1210 "configure" +#include "confdefs.h" +#include <va_list.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define pthread_have_va_list_h 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + +for ac_hdr in syscall.h sys/syscall.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1246 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1251: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +pthreads_syscall_list="open write read creat close fcntl lseek dup2 dup pipe + fchmod fchown execve fstat lstat link unlink chdir chown chmod stat + rename select getdtablesize ioctl ftruncate + sigsuspend sigaction sigpause sigprocmask ksigaction + getdents readdir getdirentries + wait4 wait3 waitpid waitsys + socket bind connect accept listen getsockopt setsockopt socketpair + poll putmsg getmsg + socketcall + + pgrpsys + + exit + readv writev send sendto sendmsg recv recvfrom recvmsg + getpeername getsockname + shutdown + getpgrp fork" +for pthreads_syscallname in $pthreads_syscall_list ; do + echo $ac_n "checking for syscall $pthreads_syscallname""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_syscall_$pthreads_syscallname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1299 "configure" +#include "confdefs.h" + +/* FIXME: This list should be generated from info in configure.in. */ +#ifdef HAVE_SYSCALL_H +#include <syscall.h> +#else +#ifdef HAVE_SYS_SYSCALL_H +#include <sys/syscall.h> +#else +where is your syscall header file?? +#endif +#endif + +int main() { return 0; } +int t() { + +int x; +x = SYS_$pthreads_syscallname ; + +; return 0; } +EOF +if { (eval echo configure:1321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + eval pthreads_cv_syscall_$pthreads_syscallname=yes +else + rm -rf conftest* + eval pthreads_cv_syscall_$pthreads_syscallname=no +fi +rm -f conftest* + +fi + +if eval test \$pthreads_cv_syscall_$pthreads_syscallname = yes ; then + pthreads_syscall_present=yes + available_syscalls="$available_syscalls $pthreads_syscallname" + macroname=HAVE_SYSCALL_`echo $pthreads_syscallname | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <<EOF +#define $macroname 1 +EOF + +else + pthreads_syscall_present=no + missing_syscalls="$missing_syscalls $pthreads_syscallname" +fi +echo "$ac_t""$pthreads_syscall_present" 1>&6 + +done + + + + + + +## Determine some typedef values from the system header files. +# If we cannot run a trivial program, we must be cross compiling. +echo $ac_n "checking whether cross-compiling""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_c_cross'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_cross=yes +else +cat > conftest.$ac_ext <<EOF +#line 1363 "configure" +#include "confdefs.h" +main(){return(0);} +EOF +{ (eval echo configure:1367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +if test -s conftest && (./conftest; exit) 2>/dev/null; then + ac_cv_c_cross=no +else + ac_cv_c_cross=yes +fi +fi +rm -fr conftest* +fi + +echo "$ac_t""$ac_cv_c_cross" 1>&6 +cross_compiling=$ac_cv_c_cross + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1385 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1408 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1426 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else +cat > conftest.$ac_ext <<EOF +#line 1447 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +{ (eval echo configure:1458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +if test -s conftest && (./conftest; exit) 2>/dev/null; then + : +else + ac_cv_header_stdc=no +fi +fi +rm -fr conftest* +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1482 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "off_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1513 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1544 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "ssize_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t int +EOF + +fi + +echo $ac_n "checking for time_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1575 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "time_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_time_t=yes +else + rm -rf conftest* + ac_cv_type_time_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_time_t" 1>&6 +if test $ac_cv_type_time_t = no; then + cat >> confdefs.h <<\EOF +#define time_t long +EOF + +fi + +for ac_hdr in sys/time.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1609 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1614: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdefghijklmnopqrstuvwxyz./\055' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ___'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1643 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +int main() { return 0; } +int t() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1653: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + + +echo $ac_n "checking for struct timespec in sys/time.h""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_timespec_in_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1678 "configure" +#include "confdefs.h" +#include <sys/time.h> +int main() { return 0; } +int t() { +struct timespec foo; +; return 0; } +EOF +if { (eval echo configure:1686: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_timespec_in_time=yes +else + rm -rf conftest* + pthreads_cv_timespec_in_time=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$pthreads_cv_timespec_in_time" 1>&6 +if test $pthreads_cv_timespec_in_time = yes ; then + cat >> confdefs.h <<\EOF +#define _OS_HAS_TIMESPEC 1 +EOF + +fi + + + +echo $ac_n "checking type of size_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1712 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { return 0; } +int t() { + extern size_t foo; +; return 0; } +EOF +if { (eval echo configure:1726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 1730 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { return 0; } +int t() { + extern size_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:1744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_size_t="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for size_t." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_size_t" ; then + cat >> confdefs.h <<EOF +#define pthread_size_t $pthreads_cv_type_size_t +EOF + +fi +pthread_size_t=$pthreads_cv_type_size_t +echo "$ac_t""$pthreads_cv_type_size_t" 1>&6 + +echo $ac_n "checking type of ssize_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1773 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> + +int main() { return 0; } +int t() { + extern ssize_t foo; +; return 0; } +EOF +if { (eval echo configure:1785: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 1789 "configure" +#include "confdefs.h" + +#include <stddef.h> +#include <stdlib.h> +#include <unistd.h> + +int main() { return 0; } +int t() { + extern ssize_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:1801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_ssize_t="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for ssize_t." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_ssize_t" ; then + cat >> confdefs.h <<EOF +#define pthread_ssize_t $pthreads_cv_type_ssize_t +EOF + +fi +pthread_ssize_t=$pthreads_cv_type_ssize_t +echo "$ac_t""$pthreads_cv_type_ssize_t" 1>&6 + +echo $ac_n "checking type of clock_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_clock_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1830 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { return 0; } +int t() { + extern clock_t foo; +; return 0; } +EOF +if { (eval echo configure:1850: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 1854 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { return 0; } +int t() { + extern clock_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:1874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_clock_t="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for clock_t." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_clock_t" ; then + cat >> confdefs.h <<EOF +#define pthread_clock_t $pthreads_cv_type_clock_t +EOF + +fi +pthread_clock_t=$pthreads_cv_type_clock_t +echo "$ac_t""$pthreads_cv_type_clock_t" 1>&6 + +echo $ac_n "checking type of time_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_time_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1903 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { return 0; } +int t() { + extern time_t foo; +; return 0; } +EOF +if { (eval echo configure:1923: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 1927 "configure" +#include "confdefs.h" + +#include <stddef.h> +#if TIME_WITH_SYS_TIME +# include <time.h> +# include <sys/time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +int main() { return 0; } +int t() { + extern time_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_time_t="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for time_t." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_time_t" ; then + cat >> confdefs.h <<EOF +#define pthread_time_t $pthreads_cv_type_time_t +EOF + +fi +pthread_time_t=$pthreads_cv_type_time_t +echo "$ac_t""$pthreads_cv_type_time_t" 1>&6 +echo $ac_n "checking for fpos_t in stdio.h""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_fpos_t_in_stdio'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1975 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { return 0; } +int t() { +fpos_t position; +; return 0; } +EOF +if { (eval echo configure:1983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_fpos_t_in_stdio=yes +else + rm -rf conftest* + pthreads_cv_fpos_t_in_stdio=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$pthreads_cv_fpos_t_in_stdio" 1>&6 +if test $pthreads_cv_fpos_t_in_stdio = yes ; then + +echo $ac_n "checking type of fpos_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_fpos_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2002 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { return 0; } +int t() { + extern fpos_t foo; +; return 0; } +EOF +if { (eval echo configure:2016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 2020 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { return 0; } +int t() { + extern fpos_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_fpos_t="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for fpos_t." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_fpos_t" ; then + cat >> confdefs.h <<EOF +#define pthread_fpos_t $pthreads_cv_type_fpos_t +EOF + +fi +pthread_fpos_t=$pthreads_cv_type_fpos_t +echo "$ac_t""$pthreads_cv_type_fpos_t" 1>&6 +else + cat >> confdefs.h <<\EOF +#define fpos_t off_t +EOF + + cat >> confdefs.h <<\EOF +#define pthread_fpos_t pthread_off_t +EOF + +fi + +echo $ac_n "checking type of off_t""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2073 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { return 0; } +int t() { + extern off_t foo; +; return 0; } +EOF +if { (eval echo configure:2087: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "int" "unsigned int" "long" "unsigned long" "short" "unsigned short" "char" "unsigned char" "long long" "unsigned long long" ; do + cat > conftest.$ac_ext <<EOF +#line 2091 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <sys/types.h> +#ifdef STDC_HEADERS +#include <stdlib.h> +#endif + +int main() { return 0; } +int t() { + extern off_t foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_off_t="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for off_t." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_off_t" ; then + cat >> confdefs.h <<EOF +#define pthread_off_t $pthreads_cv_type_off_t +EOF + +fi +pthread_off_t=$pthreads_cv_type_off_t +echo "$ac_t""$pthreads_cv_type_off_t" 1>&6 +echo $ac_n "checking type of va_list""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthreads_cv_type_va_list'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2133 "configure" +#include "confdefs.h" +#include <stdarg.h> +int main() { return 0; } +int t() { + extern va_list foo; +; return 0; } +EOF +if { (eval echo configure:2141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + for try_type in "char *" "char **" "void *" "void **" "int *" "long *" ; do + cat > conftest.$ac_ext <<EOF +#line 2145 "configure" +#include "confdefs.h" +#include <stdarg.h> +int main() { return 0; } +int t() { + extern va_list foo; extern $try_type foo; +; return 0; } +EOF +if { (eval echo configure:2153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + pthreads_cv_type_va_list="$try_type" ; break +fi +rm -f conftest* + + done +else + rm -rf conftest* + { echo "configure: error: Can't find system typedef for va_list." 1>&2; exit 1; } +fi +rm -f conftest* + +fi + +if test -n "$pthreads_cv_type_va_list" ; then + cat >> confdefs.h <<EOF +#define pthread_va_list $pthreads_cv_type_va_list +EOF + +fi +pthread_va_list=$pthreads_cv_type_va_list +echo "$ac_t""$pthreads_cv_type_va_list" 1>&6 + +arpa_headers="#include <sys/types.h> +#include <arpa/nameser.h>" + +echo $ac_n "checking IP address type""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthread_cv_type_ipaddr'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2185 "configure" +#include "confdefs.h" +$arpa_headers +int main() { return 0; } +int t() { + &_getlong; +; return 0; } +EOF +if { (eval echo configure:2193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + for type in "unsigned long" "unsigned int" ; do + cat > conftest.$ac_ext <<EOF +#line 2198 "configure" +#include "confdefs.h" +$arpa_headers +int main() { return 0; } +int t() { +extern $type _getlong (); +; return 0; } +EOF +if { (eval echo configure:2206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + pthread_cv_type_ipaddr="$type" + break + +fi +rm -f conftest* + + done + +else + rm -rf conftest* + echo "configure: warning: Can't compile _getlong reference." 1>&2 +fi +rm -f conftest* + + if test "$pthread_cv_type_ipaddr" = "" ; then + echo "configure: warning: Can't determine _getlong return type." 1>&2 + echo "configure: warning: Defaulting to unsigned long." 1>&2 + pthread_cv_type_ipaddr="unsigned long" + fi + +fi + +echo "$ac_t""$pthread_cv_type_ipaddr" 1>&6 +cat >> confdefs.h <<EOF +#define pthread_ipaddr_type $pthread_cv_type_ipaddr +EOF + + +echo $ac_n "checking IP port type""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthread_cv_type_ipport'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2242 "configure" +#include "confdefs.h" +$arpa_headers +int main() { return 0; } +int t() { + &_getshort; +; return 0; } +EOF +if { (eval echo configure:2250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + for type in "unsigned short" "unsigned int" ; do + cat > conftest.$ac_ext <<EOF +#line 2255 "configure" +#include "confdefs.h" +$arpa_headers +int main() { return 0; } +int t() { +extern $type _getshort (); +; return 0; } +EOF +if { (eval echo configure:2263: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + + pthread_cv_type_ipport="$type" + break + +fi +rm -f conftest* + + done + +else + rm -rf conftest* + echo "configure: warning: Can't compile _getshort reference." 1>&2 +fi +rm -f conftest* + + if test "$pthread_cv_type_ipport" = "" ; then + echo "configure: warning: Can't determine _getshort return type." 1>&2 + echo "configure: warning: Defaulting to unsigned short." 1>&2 + pthread_cv_type_ipport="unsigned short" + fi + +fi + +echo "$ac_t""$pthread_cv_type_ipport" 1>&6 +cat >> confdefs.h <<EOF +#define pthread_ipport_type $pthread_cv_type_ipport +EOF + + +echo $ac_n "checking pathname for terminal devices directory""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'pthread_cv_pty_path'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -d /devices/pseudo ; then + pty_path=/devices/pseudo/ + else + pty_path=/dev/ + fi + pthread_cv_pty_path=$pty_path + +fi + +cat >> confdefs.h <<EOF +#define _PATH_PTY "$pthread_cv_pty_path" +EOF + +echo "$ac_t""$pthread_cv_pty_path" 1>&6 + +echo $ac_n "checking directory name for time zone info""... $ac_c" 1>&6 +tzdir=NONE +for f in /usr/lib/zoneinfo /usr/share/zoneinfo /usr/share/lib/zoneinfo /etc/zoneinfo /usr/local/lib/zoneinfo +do + if test -d $f ; then + tzdir=$f + break + fi +done +case $tzdir in +NONE) + echo "configure: warning: Can't find zoneinfo directory." 1>&2 + echo "configure: warning: Defaulting zoneinfo directory to NULL." 1>&2 + tzdir=NULL + ;; +esac +cat >> confdefs.h <<EOF +#define _PATH_TZDIR "$tzdir" +EOF + +echo "$ac_t""$tzdir" 1>&6 + +echo $ac_n "checking filename for local time zone""... $ac_c" 1>&6 +tzfile=NONE +for f in $tzdir/localtime /etc/localtime +do + if test -f $f ; then + tzfile=$f + break + fi +done +case $tzfile in +NONE) # Should this default to tzdir/localtime? + echo "configure: warning: Can't find local time zone file." 1>&2 + if test tzdir = NULL ; then + echo "configure: warning: Defaulting local time zone file to NULL" 1>&2 + tzfile=NULL + else + echo "configure: warning: Defaulting local time zone file to $tzdir/localtime." 1>&2 + tzfile=$tzdir/localtime + fi + ;; +esac +cat >> confdefs.h <<EOF +#define _PATH_TZFILE "$tzfile" +EOF + +echo "$ac_t""$tzfile" 1>&6 + +cat >> confdefs.h <<\EOF +#define _PATH_RESCONF "/etc/resolv.conf" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_HOSTS "/etc/hosts" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_NETWORKS "/etc/networks" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_PROTOCOLS "/etc/protocols" +EOF + +cat >> confdefs.h <<\EOF +#define _PATH_SERVICES "/etc/services" +EOF + + +cat >> confdefs.h <<\EOF +#define _PATH_BSHELL "/bin/sh" +EOF + + +for ac_func in vfork +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2395 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +srctop=`cd ${srcdir}/..;pwd` + + +# Now we deal with symlinks &c. + +test -d include || mkdir include || \ + { echo "configure: error: Can't create include directory." 1>&2; exit 1; } + +test -d include/pthread || mkdir include/pthread || \ + { echo "configure: error: Can't create include/pthread directory." 1>&2; exit 1; } + +test -d lib || mkdir lib || \ + { echo "configure: error: Can't create lib directory." 1>&2; exit 1; } + +test -d lib/libpthreadutil || mkdir lib/libpthreadutil || \ + { echo "configure: error: Can't create lib/libpthreadutil directory." 1>&2; exit 1; } + +test -d bin || mkdir bin || \ + { echo "configure: error: Can't create bin directory." 1>&2; exit 1; } + +test -d bin/finger || mkdir bin/finger || \ + { echo "configure: error: Can't create bin directory." 1>&2; exit 1; } + +test -d tests || mkdir tests || \ + { echo "configure: error: Can't create tests directory." 1>&2; exit 1; } + +if test x$syscall = xNONE ; then + syscall=$name +fi + +links="include/pthread/machdep.h include/pthread/posix.h \ + machdep.c syscall.S" +targets="../machdep/engine-$name.h ../machdep/posix-$sysincludes.h \ + ../machdep/engine-$name.c ../machdep/syscall-$syscall.S" + +# Both these targets are optional. (Autoconf-generated configure scripts +# will require the existence of link targets, so check before adding them +# to the list.) +if test x$sysincludes != xNONE ; then + links="$links include/sys" + targets="$targets ../machdep/$sysincludes" +fi + +syscall_file=../machdep/syscall-template-$syscall.S +if test -r $srcdir/$syscall_file ; then + links="$links syscall-template.S" + targets="$targets $syscall_file" + HAVE_SYSCALL_TEMPLATE=yes +else + # This really isn't a fatal problem. In fact, it's expected, initially, + # for some targets. This is just to persuade people to fix the targets + # they deal with to provide some sort of template. + # + # Eventually this file probably will be required... + echo "configure: warning: No syscall template file syscall-template-$syscall.S found." 1>&2 + HAVE_SYSCALL_TEMPLATE=no +fi + + + + +if test x$makefile_frag != x ; then + makefile_frag=${srcdir}/$makefile_frag +else + makefile_frag=/dev/null +fi + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.10" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "config.flags GNUmakefile Makefile \ + lib/Makefile:../lib/Makefile.in \ + lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in \ + bin/Makefile:../bin/Makefile.in \ + bin/finger/Makefile:../bin/finger/Makefile.in \ + tests/Makefile:../tests/Makefile.in config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@CXX@%$CXX%g +s%@CPP@%$CPP%g +s%@RANLIB@%$RANLIB%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@SYSCALL_EXCEPTIONS@%$SYSCALL_EXCEPTIONS%g +s%@available_syscalls@%$available_syscalls%g +s%@missing_syscalls@%$missing_syscalls%g +s%@srctop@%$srctop%g +s%@HAVE_SYSCALL_TEMPLATE@%$HAVE_SYSCALL_TEMPLATE%g +/@makefile_frag@/r $makefile_frag +s%@makefile_frag@%%g + +CEOF +EOF +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"config.flags GNUmakefile Makefile \ + lib/Makefile:../lib/Makefile.in \ + lib/libpthreadutil/Makefile:../lib/libpthreadutil/Makefile.in \ + bin/Makefile:../bin/Makefile.in \ + bin/finger/Makefile:../bin/finger/Makefile.in \ + tests/Makefile:../tests/Makefile.in"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"} +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + cp $ac_given_srcdir/$ac_file_in conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. +# Maximum number of lines to put in a single here document. +ac_max_here_lines=12 + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF + +cat >> $CONFIG_STATUS <<EOF +ac_sources="$targets" +ac_dests="$links" +EOF + +cat >> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/lib/libpthread/config/install-sh b/lib/libpthread/config/install-sh new file mode 100644 index 00000000000..ab74c882e92 --- /dev/null +++ b/lib/libpthread/config/install-sh @@ -0,0 +1,238 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +tranformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/lib/libpthread/configure b/lib/libpthread/configure new file mode 100644 index 00000000000..9411483a31d --- /dev/null +++ b/lib/libpthread/configure @@ -0,0 +1,19 @@ +#!/bin/sh + +# This silliness is because Chris wants the autoconf-related files +# and makefiles not to appear in the top-level directory. Fine by +# me, I don't much care. This script just needs to invoke the real +# configure script... + +config=`echo $0 | sed -e 's,configure$,config/configure,'` + +if test ! -d obj ; then + mkdir obj +fi + +if test -n "$1" ; then + exec $config "$@" +else + exec $config +fi + diff --git a/lib/libpthread/gen/GNUmakefile.inc b/lib/libpthread/gen/GNUmakefile.inc new file mode 100755 index 00000000000..93f48ad6208 --- /dev/null +++ b/lib/libpthread/gen/GNUmakefile.inc @@ -0,0 +1,9 @@ +# from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 +# $Id: GNUmakefile.inc,v 1.1 1998/07/21 13:19:02 peter Exp $ + +# gen sources +VPATH:= ${VPATH}:${srcdir}/gen + +SRCS:= ttyname.c directory.c popen.c time.c ctime.c difftime.c syslog.c \ + eprintf.c getpwent.c getpwnamuid.c pwd_internal.c \ + getcwd.c getwd.c isatty.c $(SRCS) diff --git a/lib/libpthread/gen/Makefile.inc b/lib/libpthread/gen/Makefile.inc new file mode 100644 index 00000000000..275955e9c86 --- /dev/null +++ b/lib/libpthread/gen/Makefile.inc @@ -0,0 +1,24 @@ +# from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 +# $Id: Makefile.inc,v 1.1 1998/07/21 13:19:02 peter Exp $ + +# gen sources +.PATH: ${srcdir}/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 + diff --git a/lib/libpthread/gen/ctime.c b/lib/libpthread/gen/ctime.c new file mode 100644 index 00000000000..e7980296e50 --- /dev/null +++ b/lib/libpthread/gen/ctime.c @@ -0,0 +1,1315 @@ +/* + * Copyright (c) 1987, 1989 Regents of the University of California. + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Arthur David Olson of the National Cancer Institute. + * + * 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ctime.c 5.26 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +/* +** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu). +** POSIX-style TZ environment variable handling from Guy Harris +** (guy@auspex.com). +*/ + +/*LINTLIBRARY*/ +#include "config.h" +#include <pthread.h> +#include <sys/param.h> +#include <fcntl.h> +#include <time.h> +#include <tzfile.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> + +#ifndef WILDABBR +/* +** Someone might make incorrect use of a time zone abbreviation: +** 1. They might reference tzname[0] before calling tzset (explicitly +** or implicitly). +** 2. They might reference tzname[1] before calling tzset (explicitly +** or implicitly). +** 3. They might reference tzname[1] after setting to a time zone +** in which Daylight Saving Time is never observed. +** 4. They might reference tzname[0] after setting to a time zone +** in which Standard Time is never observed. +** 5. They might reference tm.TM_ZONE after calling offtime. +** What's best to do in the above cases is open to debate; +** for now, we just set things up so that in any of the five cases +** WILDABBR is used. Another possibility: initialize tzname[0] to the +** string "tzname[0] used before set", and similarly for the other cases. +** And another: initialize tzname[0] to "ERA", with an explanation in the +** manual page of what this "time zone abbreviation" means (doing this so +** that tzname[0] has the "normal" length of three characters). +*/ +#define WILDABBR " " +#endif /* !defined WILDABBR */ + +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif /* !defined TRUE */ + +static const char GMT[] = "GMT"; + +struct ttinfo { /* time type information */ + long tt_gmtoff; /* GMT offset in seconds */ + int tt_isdst; /* used to set tm_isdst */ + int tt_abbrind; /* abbreviation list index */ + int tt_ttisstd; /* TRUE if transition is std time */ +}; + +struct lsinfo { /* leap second information */ + time_t ls_trans; /* transition time */ + long ls_corr; /* correction to apply */ +}; + +struct state { + int leapcnt; + int timecnt; + int typecnt; + int charcnt; + time_t ats[TZ_MAX_TIMES]; + unsigned char types[TZ_MAX_TIMES]; + struct ttinfo ttis[TZ_MAX_TYPES]; + char chars[(TZ_MAX_CHARS + 1 > sizeof GMT) ? + TZ_MAX_CHARS + 1 : sizeof GMT]; + struct lsinfo lsis[TZ_MAX_LEAPS]; +}; + +struct rule { + int r_type; /* type of rule--see below */ + int r_day; /* day number of rule */ + int r_week; /* week number of rule */ + int r_mon; /* month number of rule */ + long r_time; /* transition time of rule */ +}; + +#define JULIAN_DAY 0 /* Jn - Julian day */ +#define DAY_OF_YEAR 1 /* n - day of year */ +#define MONTH_NTH_DAY_OF_WEEK 2 /* Mm.n.d - month, week, day of week */ + +/* +** Prototypes for static functions. +*/ + +static long detzcode __P_((const char *)); +static const char * getnum __P_((const char *, int *, int, int)); +static const char * getsecs __P_((const char *, long *)); +static const char * getoffset __P_((const char *, long *)); +static const char * getrule __P_((const char *, struct rule *)); +static const char * getzname __P_((const char *)); +static void gmtload __P_((struct state *)); +static void gmtsub __P_((const time_t *, long, struct tm *)); +static void localsub __P_((const time_t *, long, struct tm *)); +static void normalize __P_((int *, int *, int)); +static void settzname __P_((struct state *)); +static time_t time1 __P_((struct tm *, long)); +static time_t time2 __P_((struct tm *, long, int *)); +static void timesub __P_((const time_t *, long, const struct state *, + struct tm *)); +static int tmcomp __P_((const struct tm *, const struct tm *)); +static time_t transtime __P_((time_t, int, const struct rule *, long)); +static int tzload __P_((const char *, struct state *)); +static int tzparse __P_((const char *, struct state *, int)); +static void tzset_basic __P_((void)); +static void tzsetwall_basic __P_((void)); + +static pthread_mutex_t lcl_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t gmt_mutex = PTHREAD_MUTEX_INITIALIZER; +static int lcl_is_set = FALSE; +static int gmt_is_set = FALSE; +static struct state lclmem; +static struct state gmtmem; + +#define lclptr (&lclmem) +#define gmtptr (&gmtmem) + +char * tzname[2] = { + WILDABBR, + WILDABBR +}; + +#ifdef USG_COMPAT +time_t timezone = 0; +int daylight = 0; +#endif /* defined USG_COMPAT */ + +#ifdef ALTZONE +time_t altzone = 0; +#endif /* defined ALTZONE */ + +static long detzcode(const char * codep) +{ + long result; + int i; + + result = 0; + for (i = 0; i < 4; ++i) + result = (result << 8) | (codep[i] & 0xff); + return result; +} + +static void settzname(struct state * sp) +{ + register int i; + + tzname[0] = WILDABBR; + tzname[1] = WILDABBR; +#ifdef USG_COMPAT + daylight = 0; + timezone = 0; +#endif /* defined USG_COMPAT */ +#ifdef ALTZONE + altzone = 0; +#endif /* defined ALTZONE */ + for (i = 0; i < sp->typecnt; ++i) { + register const struct ttinfo * const ttisp = &sp->ttis[i]; + + tzname[ttisp->tt_isdst] = + (char *) &sp->chars[ttisp->tt_abbrind]; +#ifdef USG_COMPAT + if (ttisp->tt_isdst) + daylight = 1; + if (i == 0 || !ttisp->tt_isdst) + timezone = -(ttisp->tt_gmtoff); +#endif /* defined USG_COMPAT */ +#ifdef ALTZONE + if (i == 0 || ttisp->tt_isdst) + altzone = -(ttisp->tt_gmtoff); +#endif /* defined ALTZONE */ + } + /* + ** And to get the latest zone names into tzname. . . + */ + for (i = 0; i < sp->timecnt; ++i) { + register const struct ttinfo * const ttisp = + &sp->ttis[sp->types[i]]; + + tzname[ttisp->tt_isdst] = + (char *) &sp->chars[ttisp->tt_abbrind]; + } +} + +static int tzload(const char * name, struct state * sp) +{ + register const char * p; + register int i; + register int fid; + + if (name == NULL && (name = TZDEFAULT) == NULL) + return -1; + { + char fullname[FILENAME_MAX + 1]; + + if (name[0] == ':') + ++name; + if (name[0] != '/') { + if ((p = TZDIR) == NULL) + return -1; + if ((strlen(p) + strlen(name) + 1) >= sizeof fullname) + return -1; + (void) strcpy(fullname, p); + (void) strcat(fullname, "/"); + (void) strcat(fullname, name); + name = fullname; + } + if ((fid = open(name, O_RDONLY)) == -1) + return -1; + } + { + register const struct tzhead * tzhp; + char buf[sizeof *sp + sizeof *tzhp]; + int ttisstdcnt; + + i = read(fid, buf, sizeof buf); + if (close(fid) != 0 || i < sizeof *tzhp) + return -1; + tzhp = (struct tzhead *) buf; + ttisstdcnt = (int) detzcode(tzhp->tzh_ttisstdcnt); + sp->leapcnt = (int) detzcode(tzhp->tzh_leapcnt); + sp->timecnt = (int) detzcode(tzhp->tzh_timecnt); + sp->typecnt = (int) detzcode(tzhp->tzh_typecnt); + sp->charcnt = (int) detzcode(tzhp->tzh_charcnt); + if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS || + sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES || + sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES || + sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS || + (ttisstdcnt != sp->typecnt && ttisstdcnt != 0)) + return -1; + if (i < sizeof *tzhp + + sp->timecnt * (4 + sizeof (char)) + + sp->typecnt * (4 + 2 * sizeof (char)) + + sp->charcnt * sizeof (char) + + sp->leapcnt * 2 * 4 + + ttisstdcnt * sizeof (char)) + return -1; + p = buf + sizeof *tzhp; + for (i = 0; i < sp->timecnt; ++i) { + sp->ats[i] = detzcode(p); + p += 4; + } + for (i = 0; i < sp->timecnt; ++i) { + sp->types[i] = (unsigned char) *p++; + if (sp->types[i] >= sp->typecnt) + return -1; + } + for (i = 0; i < sp->typecnt; ++i) { + register struct ttinfo * ttisp; + + ttisp = &sp->ttis[i]; + ttisp->tt_gmtoff = detzcode(p); + p += 4; + ttisp->tt_isdst = (unsigned char) *p++; + if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1) + return -1; + ttisp->tt_abbrind = (unsigned char) *p++; + if (ttisp->tt_abbrind < 0 || + ttisp->tt_abbrind > sp->charcnt) + return -1; + } + for (i = 0; i < sp->charcnt; ++i) + sp->chars[i] = *p++; + sp->chars[i] = '\0'; /* ensure '\0' at end */ + for (i = 0; i < sp->leapcnt; ++i) { + register struct lsinfo * lsisp; + + lsisp = &sp->lsis[i]; + lsisp->ls_trans = detzcode(p); + p += 4; + lsisp->ls_corr = detzcode(p); + p += 4; + } + for (i = 0; i < sp->typecnt; ++i) { + register struct ttinfo * ttisp; + + ttisp = &sp->ttis[i]; + if (ttisstdcnt == 0) + ttisp->tt_ttisstd = FALSE; + else { + ttisp->tt_ttisstd = *p++; + if (ttisp->tt_ttisstd != TRUE && + ttisp->tt_ttisstd != FALSE) + return -1; + } + } + } + return 0; +} + +static const int mon_lengths[2][MONSPERYEAR] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, + 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +static const int year_lengths[2] = { + DAYSPERNYEAR, DAYSPERLYEAR +}; + +/* +** Given a pointer into a time zone string, scan until a character that is not +** a valid character in a zone name is found. Return a pointer to that +** character. +*/ +static const char * getzname(const char * strp) +{ + register char c; + + while ((c = *strp) != '\0' && !isdigit(c) && c != ',' && c != '-' && + c != '+') + ++strp; + return strp; +} + +/* +** Given a pointer into a time zone string, extract a number from that string. +** Check that the number is within a specified range; if it is not, return +** NULL. +** Otherwise, return a pointer to the first character not part of the number. +*/ + +static const char *getnum(const char * strp, int * nump, int min, int max) +{ + char c; + int num; + + if (strp == NULL || !isdigit(*strp)) + return NULL; + num = 0; + while ((c = *strp) != '\0' && isdigit(c)) { + num = num * 10 + (c - '0'); + if (num > max) + return NULL; /* illegal value */ + ++strp; + } + if (num < min) + return NULL; /* illegal value */ + *nump = num; + return strp; +} + +/* +** Given a pointer into a time zone string, extract a number of seconds, +** in hh[:mm[:ss]] form, from the string. +** If any error occurs, return NULL. +** Otherwise, return a pointer to the first character not part of the number +** of seconds. +*/ +static const char * getsecs(const char * strp, long * secsp) +{ + int num; + + strp = getnum(strp, &num, 0, HOURSPERDAY); + if (strp == NULL) + return NULL; + *secsp = num * SECSPERHOUR; + if (*strp == ':') { + ++strp; + strp = getnum(strp, &num, 0, MINSPERHOUR - 1); + if (strp == NULL) + return NULL; + *secsp += num * SECSPERMIN; + if (*strp == ':') { + ++strp; + strp = getnum(strp, &num, 0, SECSPERMIN - 1); + if (strp == NULL) + return NULL; + *secsp += num; + } + } + return strp; +} + +/* +** Given a pointer into a time zone string, extract an offset, in +** [+-]hh[:mm[:ss]] form, from the string. +** If any error occurs, return NULL. +** Otherwise, return a pointer to the first character not part of the time. +*/ +static const char * getoffset(const char * strp, long * offsetp) +{ + int neg; + + if (*strp == '-') { + neg = 1; + ++strp; + } else if (isdigit(*strp) || *strp++ == '+') + neg = 0; + else return NULL; /* illegal offset */ + strp = getsecs(strp, offsetp); + if (strp == NULL) + return NULL; /* illegal time */ + if (neg) + *offsetp = -*offsetp; + return strp; +} + +/* +** Given a pointer into a time zone string, extract a rule in the form +** date[/time]. See POSIX section 8 for the format of "date" and "time". +** If a valid rule is not found, return NULL. +** Otherwise, return a pointer to the first character not part of the rule. +*/ +static const char * getrule(const char * strp, struct rule * rulep) +{ + if (*strp == 'J') { + /* + ** Julian day. + */ + rulep->r_type = JULIAN_DAY; + ++strp; + strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR); + } else if (*strp == 'M') { + /* + ** Month, week, day. + */ + rulep->r_type = MONTH_NTH_DAY_OF_WEEK; + ++strp; + strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR); + if (strp == NULL) + return NULL; + if (*strp++ != '.') + return NULL; + strp = getnum(strp, &rulep->r_week, 1, 5); + if (strp == NULL) + return NULL; + if (*strp++ != '.') + return NULL; + strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1); + } else if (isdigit(*strp)) { + /* + ** Day of year. + */ + rulep->r_type = DAY_OF_YEAR; + strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1); + } else return NULL; /* invalid format */ + if (strp == NULL) + return NULL; + if (*strp == '/') { + /* + ** Time specified. + */ + ++strp; + strp = getsecs(strp, &rulep->r_time); + } else rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */ + return strp; +} + +/* +** Given the Epoch-relative time of January 1, 00:00:00 GMT, in a year, the +** year, a rule, and the offset from GMT at the time that rule takes effect, +** calculate the Epoch-relative time that rule takes effect. +*/ +static time_t transtime(time_t janfirst, int year, + const struct rule * rulep, long offset) +{ + register int leapyear; + register time_t value; + register int i; + int d, m1, yy0, yy1, yy2, dow; + + leapyear = isleap(year); + switch (rulep->r_type) { + + case JULIAN_DAY: + /* + ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap + ** years. + ** In non-leap years, or if the day number is 59 or less, just + ** add SECSPERDAY times the day number-1 to the time of + ** January 1, midnight, to get the day. + */ + value = janfirst + (rulep->r_day - 1) * SECSPERDAY; + if (leapyear && rulep->r_day >= 60) + value += SECSPERDAY; + break; + + case DAY_OF_YEAR: + /* + ** n - day of year. + ** Just add SECSPERDAY times the day number to the time of + ** January 1, midnight, to get the day. + */ + value = janfirst + rulep->r_day * SECSPERDAY; + break; + + case MONTH_NTH_DAY_OF_WEEK: + /* + ** Mm.n.d - nth "dth day" of month m. + */ + value = janfirst; + for (i = 0; i < rulep->r_mon - 1; ++i) + value += mon_lengths[leapyear][i] * SECSPERDAY; + + /* + ** Use Zeller's Congruence to get day-of-week of first day of + ** month. + */ + m1 = (rulep->r_mon + 9) % 12 + 1; + yy0 = (rulep->r_mon <= 2) ? (year - 1) : year; + yy1 = yy0 / 100; + yy2 = yy0 % 100; + dow = ((26 * m1 - 2) / 10 + + 1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7; + if (dow < 0) + dow += DAYSPERWEEK; + + /* + ** "dow" is the day-of-week of the first day of the month. Get + ** the day-of-month (zero-origin) of the first "dow" day of the + ** month. + */ + d = rulep->r_day - dow; + if (d < 0) + d += DAYSPERWEEK; + for (i = 1; i < rulep->r_week; ++i) { + if (d + DAYSPERWEEK >= + mon_lengths[leapyear][rulep->r_mon - 1]) + break; + d += DAYSPERWEEK; + } + + /* + ** "d" is the day-of-month (zero-origin) of the day we want. + */ + value += d * SECSPERDAY; + break; + } + + /* + ** "value" is the Epoch-relative time of 00:00:00 GMT on the day in + ** question. To get the Epoch-relative time of the specified local + ** time on that day, add the transition time and the current offset + ** from GMT. + */ + return value + rulep->r_time + offset; +} + +/* +** Given a POSIX section 8-style TZ string, fill in the rule tables as +** appropriate. +*/ +static int tzparse(const char * name, struct state * sp, int lastditch) +{ + const char * stdname; + const char * dstname; + int stdlen; + int dstlen; + long stdoffset; + long dstoffset; + register time_t * atp; + register unsigned char * typep; + register char * cp; + register int load_result; + + stdname = name; + if (lastditch) { + stdlen = strlen(name); /* length of standard zone name */ + name += stdlen; + if (stdlen >= sizeof sp->chars) + stdlen = (sizeof sp->chars) - 1; + } else { + name = getzname(name); + stdlen = name - stdname; + if (stdlen < 3) + return -1; + } + if (*name == '\0') + return -1; + else { + name = getoffset(name, &stdoffset); + if (name == NULL) + return -1; + } + load_result = tzload(TZDEFRULES, sp); + if (load_result != 0) + sp->leapcnt = 0; /* so, we're off a little */ + if (*name != '\0') { + dstname = name; + name = getzname(name); + dstlen = name - dstname; /* length of DST zone name */ + if (dstlen < 3) + return -1; + if (*name != '\0' && *name != ',' && *name != ';') { + name = getoffset(name, &dstoffset); + if (name == NULL) + return -1; + } else dstoffset = stdoffset - SECSPERHOUR; + if (*name == ',' || *name == ';') { + struct rule start; + struct rule end; + register int year; + register time_t janfirst; + time_t starttime; + time_t endtime; + + ++name; + if ((name = getrule(name, &start)) == NULL) + return -1; + if (*name++ != ',') + return -1; + if ((name = getrule(name, &end)) == NULL) + return -1; + if (*name != '\0') + return -1; + sp->typecnt = 2; /* standard time and DST */ + /* + ** Two transitions per year, from EPOCH_YEAR to 2037. + */ + sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1); + if (sp->timecnt > TZ_MAX_TIMES) + return -1; + sp->ttis[0].tt_gmtoff = -dstoffset; + sp->ttis[0].tt_isdst = 1; + sp->ttis[0].tt_abbrind = stdlen + 1; + sp->ttis[1].tt_gmtoff = -stdoffset; + sp->ttis[1].tt_isdst = 0; + sp->ttis[1].tt_abbrind = 0; + atp = sp->ats; + typep = sp->types; + janfirst = 0; + for (year = EPOCH_YEAR; year <= 2037; ++year) { + starttime = transtime(janfirst, year, &start, + stdoffset); + endtime = transtime(janfirst, year, &end, + dstoffset); + if (starttime > endtime) { + *atp++ = endtime; + *typep++ = 1; /* DST ends */ + *atp++ = starttime; + *typep++ = 0; /* DST begins */ + } else { + *atp++ = starttime; + *typep++ = 0; /* DST begins */ + *atp++ = endtime; + *typep++ = 1; /* DST ends */ + } + janfirst += + year_lengths[isleap(year)] * SECSPERDAY; + } + } else { + int sawstd; + int sawdst; + long stdfix; + long dstfix; + long oldfix; + int isdst; + register int i; + + if (*name != '\0') + return -1; + if (load_result != 0) + return -1; + /* + ** Compute the difference between the real and + ** prototype standard and summer time offsets + ** from GMT, and put the real standard and summer + ** time offsets into the rules in place of the + ** prototype offsets. + */ + sawstd = FALSE; + sawdst = FALSE; + stdfix = 0; + dstfix = 0; + for (i = 0; i < sp->typecnt; ++i) { + if (sp->ttis[i].tt_isdst) { + oldfix = dstfix; + dstfix = + sp->ttis[i].tt_gmtoff + dstoffset; + if (sawdst && (oldfix != dstfix)) + return -1; + sp->ttis[i].tt_gmtoff = -dstoffset; + sp->ttis[i].tt_abbrind = stdlen + 1; + sawdst = TRUE; + } else { + oldfix = stdfix; + stdfix = + sp->ttis[i].tt_gmtoff + stdoffset; + if (sawstd && (oldfix != stdfix)) + return -1; + sp->ttis[i].tt_gmtoff = -stdoffset; + sp->ttis[i].tt_abbrind = 0; + sawstd = TRUE; + } + } + /* + ** Make sure we have both standard and summer time. + */ + if (!sawdst || !sawstd) + return -1; + /* + ** Now correct the transition times by shifting + ** them by the difference between the real and + ** prototype offsets. Note that this difference + ** can be different in standard and summer time; + ** the prototype probably has a 1-hour difference + ** between standard and summer time, but a different + ** difference can be specified in TZ. + */ + isdst = FALSE; /* we start in standard time */ + for (i = 0; i < sp->timecnt; ++i) { + register const struct ttinfo * ttisp; + + /* + ** If summer time is in effect, and the + ** transition time was not specified as + ** standard time, add the summer time + ** offset to the transition time; + ** otherwise, add the standard time offset + ** to the transition time. + */ + ttisp = &sp->ttis[sp->types[i]]; + sp->ats[i] += + (isdst && !ttisp->tt_ttisstd) ? + dstfix : stdfix; + isdst = ttisp->tt_isdst; + } + } + } else { + dstlen = 0; + sp->typecnt = 1; /* only standard time */ + sp->timecnt = 0; + sp->ttis[0].tt_gmtoff = -stdoffset; + sp->ttis[0].tt_isdst = 0; + sp->ttis[0].tt_abbrind = 0; + } + sp->charcnt = stdlen + 1; + if (dstlen != 0) + sp->charcnt += dstlen + 1; + if (sp->charcnt > sizeof sp->chars) + return -1; + cp = sp->chars; + (void) strncpy(cp, stdname, stdlen); + cp += stdlen; + *cp++ = '\0'; + if (dstlen != 0) { + (void) strncpy(cp, dstname, dstlen); + *(cp + dstlen) = '\0'; + } + return 0; +} + +static void gmtload(struct state * sp) +{ + if (tzload(GMT, sp) != 0) + (void) tzparse(GMT, sp, TRUE); +} + +static void tzset_basic() +{ + const char * name; + if ((name = getenv("TZ")) == NULL) { + tzsetwall_basic(); + return; + } + + if (*name == '\0') { + /* + ** User wants it fast rather than right. + */ + lclptr->leapcnt = 0; /* so, we're off a little */ + lclptr->timecnt = 0; + lclptr->ttis[0].tt_gmtoff = 0; + lclptr->ttis[0].tt_abbrind = 0; + (void) strcpy(lclptr->chars, GMT); + } else { + if (tzload(name, lclptr) != 0) + if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0) + (void) gmtload(lclptr); + } + lcl_is_set = TRUE; + settzname(lclptr); +} + +void tzset() +{ + pthread_mutex_lock(&lcl_mutex); + tzset_basic(); + pthread_mutex_unlock(&lcl_mutex); +} + +static void tzsetwall_basic() +{ + if (tzload((char *) NULL, lclptr) != 0) + gmtload(lclptr); + settzname(lclptr); + lcl_is_set = TRUE; +} + +void tzsetwall() +{ + pthread_mutex_lock(&lcl_mutex); + tzsetwall_basic(); + pthread_mutex_unlock(&lcl_mutex); +} + +/* +** The easy way to behave "as if no library function calls" localtime +** is to not call it--so we drop its guts into "localsub", which can be +** freely called. (And no, the PANS doesn't require the above behavior-- +** but it *is* desirable.) +** +** The unused offset argument is for the benefit of mktime variants. +*/ + +static void localsub(const time_t * timep, long offset, struct tm * tmp) +{ + const struct ttinfo * ttisp; + const time_t t = *timep; + struct state * sp; + int i; + + if (!lcl_is_set) + tzset_basic(); + sp = lclptr; + if (sp->timecnt == 0 || t < sp->ats[0]) { + i = 0; + while (sp->ttis[i].tt_isdst) + if (++i >= sp->typecnt) { + i = 0; + break; + } + } else { + for (i = 1; i < sp->timecnt; ++i) + if (t < sp->ats[i]) + break; + i = sp->types[i - 1]; + } + ttisp = &sp->ttis[i]; + /* + ** To get (wrong) behavior that's compatible with System V Release 2.0 + ** you'd replace the statement below with + ** t += ttisp->tt_gmtoff; + ** timesub(&t, 0L, sp, tmp); + */ + timesub(&t, ttisp->tt_gmtoff, sp, tmp); + tzname[tmp->tm_isdst] = (char *) &sp->chars[ttisp->tt_abbrind]; +#ifdef BSD_TM + tmp->tm_zone = &sp->chars[ttisp->tt_abbrind]; +#endif + tmp->tm_isdst = ttisp->tt_isdst; + + pthread_mutex_unlock(&lcl_mutex); +} + +struct tm * localtime_r(const time_t * timep, struct tm * tm) +{ + pthread_mutex_lock(&lcl_mutex); + localsub(timep, 0L, tm); + pthread_mutex_unlock(&lcl_mutex); + return(tm); +} + +struct tm * localtime(const time_t * timep) +{ + static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER; + static pthread_key_t localtime_key = -1; + struct tm * tm; + + pthread_mutex_lock(&localtime_mutex); + if (localtime_key < 0) { + if (pthread_key_create(&localtime_key, free) < 0) { + pthread_mutex_unlock(&localtime_mutex); + return(NULL); + } + } + pthread_mutex_unlock(&localtime_mutex); + if ((tm = pthread_getspecific(localtime_key)) == NULL) { + if ((tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) { + return(NULL); + } + pthread_setspecific(localtime_key, tm); + } + + pthread_mutex_lock(&lcl_mutex); + localsub(timep, 0L, tm); + pthread_mutex_unlock(&lcl_mutex); + return tm; +} + + +/* + * gmtsub is to gmtime as localsub is to localtime. + * + * Once set there is no need to lock the gmt_mutex to view gmtptr + */ +static void gmtsub(const time_t * timep, long offset, struct tm * tmp) +{ + pthread_mutex_lock(&gmt_mutex); + if (gmt_is_set == FALSE) { + gmt_is_set = TRUE; + gmtload(gmtptr); + } + pthread_mutex_unlock(&gmt_mutex); + + timesub(timep, offset, gmtptr, tmp); + /* + ** Could get fancy here and deliver something such as + ** "GMT+xxxx" or "GMT-xxxx" if offset is non-zero, + ** but this is no time for a treasure hunt. + */ +#ifdef BSD_TM + if (offset != 0) { + tmp->tm_zone = WILDABBR; + } else { + tmp->tm_zone = gmtptr->chars; + } +#endif +} + +struct tm * gmtime_r(const time_t * timep, struct tm * tm) +{ + gmtsub(timep, 0L, tm); + return(tm); +} + +struct tm * gmtime(const time_t * timep) +{ + static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER; + static pthread_key_t gmtime_key = -1; + struct tm * tm; + + pthread_mutex_lock(&gmtime_mutex); + if (gmtime_key < 0) { + if (pthread_key_create(&gmtime_key, free) < 0) { + pthread_mutex_unlock(&gmtime_mutex); + return(NULL); + } + } + pthread_mutex_unlock(&gmtime_mutex); + if ((tm = pthread_getspecific(gmtime_key)) == NULL) { + if ((tm = (struct tm *)malloc(sizeof(struct tm))) == NULL) { + return(NULL); + } + pthread_setspecific(gmtime_key, tm); + } + + gmtsub(timep, 0L, tm); + return(tm); +} + +static void timesub(const time_t * timep, long offset, + const struct state * sp, struct tm * tmp) +{ + register const struct lsinfo * lp; + register long days; + register long rem; + register int y; + register int yleap; + register const int * ip; + register long corr; + register int hit; + register int i; + + corr = 0; + hit = FALSE; + i = sp->leapcnt; + while (--i >= 0) { + lp = &sp->lsis[i]; + if (*timep >= lp->ls_trans) { + if (*timep == lp->ls_trans) + hit = ((i == 0 && lp->ls_corr > 0) || + lp->ls_corr > sp->lsis[i - 1].ls_corr); + corr = lp->ls_corr; + break; + } + } + days = *timep / SECSPERDAY; + rem = *timep % SECSPERDAY; +#ifdef mc68k + if (*timep == 0x80000000) { + /* + ** A 3B1 muffs the division on the most negative number. + */ + days = -24855; + rem = -11648; + } +#endif /* mc68k */ + rem += (offset - corr); + while (rem < 0) { + rem += SECSPERDAY; + --days; + } + while (rem >= SECSPERDAY) { + rem -= SECSPERDAY; + ++days; + } + tmp->tm_hour = (int) (rem / SECSPERHOUR); + rem = rem % SECSPERHOUR; + tmp->tm_min = (int) (rem / SECSPERMIN); + tmp->tm_sec = (int) (rem % SECSPERMIN); + if (hit) + /* + ** A positive leap second requires a special + ** representation. This uses "... ??:59:60". + */ + ++(tmp->tm_sec); + tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK); + if (tmp->tm_wday < 0) + tmp->tm_wday += DAYSPERWEEK; + y = EPOCH_YEAR; + if (days >= 0) + for ( ; ; ) { + yleap = isleap(y); + if (days < (long) year_lengths[yleap]) + break; + ++y; + days = days - (long) year_lengths[yleap]; + } + else do { + --y; + yleap = isleap(y); + days = days + (long) year_lengths[yleap]; + } while (days < 0); + tmp->tm_year = y - TM_YEAR_BASE; + tmp->tm_yday = (int) days; + ip = mon_lengths[yleap]; + for (tmp->tm_mon = 0; days >= (long) ip[tmp->tm_mon]; ++(tmp->tm_mon)) + days = days - (long) ip[tmp->tm_mon]; + tmp->tm_mday = (int) (days + 1); + tmp->tm_isdst = 0; +#ifdef BSD_TM + tmp->tm_gmtoff = offset; +#endif +} + +/* + * A la X3J11 + * + * Made thread safe by using thread specific data + */ +char * asctime_r(const struct tm * timeptr, char * result) +{ + static const char wday_name[DAYSPERWEEK][3] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + }; + static const char mon_name[MONSPERYEAR][3] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + (void) sprintf(result, "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n", + wday_name[timeptr->tm_wday], + mon_name[timeptr->tm_mon], + timeptr->tm_mday, timeptr->tm_hour, + timeptr->tm_min, timeptr->tm_sec, + TM_YEAR_BASE + timeptr->tm_year); + return(result); +} + +char * asctime(const struct tm * timeptr) +{ + static pthread_mutex_t asctime_mutex = PTHREAD_MUTEX_INITIALIZER; + static pthread_key_t asctime_key = -1; + char * result; + + pthread_mutex_lock(&asctime_mutex); + if (asctime_key < 0) { + if (pthread_key_create(&asctime_key, free) < 0) { + pthread_mutex_unlock(&asctime_mutex); + return(NULL); + } + } + pthread_mutex_unlock(&asctime_mutex); + if ((result = pthread_getspecific(asctime_key)) == NULL) { + if ((result = malloc(26)) == NULL) { + return(NULL); + } + pthread_setspecific(asctime_key, result); + } + + return(asctime_r(timeptr, result)); +} + +char * ctime_r(const time_t * timep, char * buf) +{ + struct tm tm; + return asctime_r(localtime_r(timep, &tm), buf); +} + +char * ctime(const time_t * timep) +{ + struct tm tm; + return asctime(localtime_r(timep, &tm)); +} + +/* +** Adapted from code provided by Robert Elz, who writes: +** The "best" way to do mktime I think is based on an idea of Bob +** Kridle's (so its said...) from a long time ago. (mtxinu!kridle now). +** It does a binary search of the time_t space. Since time_t's are +** just 32 bits, its a max of 32 iterations (even at 64 bits it +** would still be very reasonable). +*/ +static void normalize(int * tensptr,int * unitsptr, int base) +{ + if (*unitsptr >= base) { + *tensptr += *unitsptr / base; + *unitsptr %= base; + } else if (*unitsptr < 0) { + --*tensptr; + *unitsptr += base; + if (*unitsptr < 0) { + *tensptr -= 1 + (-*unitsptr) / base; + *unitsptr = base - (-*unitsptr) % base; + } + } +} + +static int tmcomp(const struct tm * atmp, const struct tm * btmp) +{ + register int result; + + if ((result = (atmp->tm_year - btmp->tm_year)) == 0 && + (result = (atmp->tm_mon - btmp->tm_mon)) == 0 && + (result = (atmp->tm_mday - btmp->tm_mday)) == 0 && + (result = (atmp->tm_hour - btmp->tm_hour)) == 0 && + (result = (atmp->tm_min - btmp->tm_min)) == 0) + result = atmp->tm_sec - btmp->tm_sec; + return result; +} + +static time_t time2(struct tm * tmp, long offset, int * okayp) +{ + register const struct state * sp; + register int dir; + register int bits; + register int i, j ; + register int saved_seconds; + time_t newt; + time_t t; + struct tm yourtm, mytm; + + *okayp = FALSE; + yourtm = *tmp; + if (yourtm.tm_sec >= SECSPERMIN + 2 || yourtm.tm_sec < 0) + normalize(&yourtm.tm_min, &yourtm.tm_sec, SECSPERMIN); + normalize(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR); + normalize(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY); + normalize(&yourtm.tm_year, &yourtm.tm_mon, MONSPERYEAR); + while (yourtm.tm_mday <= 0) { + --yourtm.tm_year; + yourtm.tm_mday += + year_lengths[isleap(yourtm.tm_year + TM_YEAR_BASE)]; + } + for ( ; ; ) { + i = mon_lengths[isleap(yourtm.tm_year + + TM_YEAR_BASE)][yourtm.tm_mon]; + if (yourtm.tm_mday <= i) + break; + yourtm.tm_mday -= i; + if (++yourtm.tm_mon >= MONSPERYEAR) { + yourtm.tm_mon = 0; + ++yourtm.tm_year; + } + } + saved_seconds = yourtm.tm_sec; + yourtm.tm_sec = 0; + /* + ** Calculate the number of magnitude bits in a time_t + ** (this works regardless of whether time_t is + ** signed or unsigned, though lint complains if unsigned). + */ + for (bits = 0, t = 1; t > 0; ++bits, t <<= 1) + ; + /* + ** If time_t is signed, then 0 is the median value, + ** if time_t is unsigned, then 1 << bits is median. + */ + t = (t < 0) ? 0 : ((time_t) 1 << bits); + for ( ; ; ) { + localsub(&t, offset, &mytm); + dir = tmcomp(&mytm, &yourtm); + if (dir != 0) { + if (bits-- < 0) + return NOTOK; + if (bits < 0) + --t; + else if (dir > 0) + t -= (time_t) 1 << bits; + else t += (time_t) 1 << bits; + continue; + } + if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst) + break; + /* + ** Right time, wrong type. + ** Hunt for right time, right type. + ** It's okay to guess wrong since the guess + ** gets checked. + */ + sp = lclptr; + for (i = 0; i < sp->typecnt; ++i) { + if (sp->ttis[i].tt_isdst != yourtm.tm_isdst) + continue; + for (j = 0; j < sp->typecnt; ++j) { + if (sp->ttis[j].tt_isdst == yourtm.tm_isdst) + continue; + newt = t + sp->ttis[j].tt_gmtoff - + sp->ttis[i].tt_gmtoff; + localsub(&newt, offset, &mytm); + if (tmcomp(&mytm, &yourtm) != 0) + continue; + if (mytm.tm_isdst != yourtm.tm_isdst) + continue; + /* + ** We have a match. + */ + t = newt; + goto label; + } + } + return NOTOK; + } +label: + t += saved_seconds; + localsub(&t, offset, tmp); + *okayp = TRUE; + return t; +} + +static time_t time1(struct tm * tmp, long offset) +{ + const struct state * sp; + int samei, otheri, okay; + time_t t; + + if (tmp->tm_isdst > 1) + tmp->tm_isdst = 1; + t = time2(tmp, offset, &okay); + if (okay || tmp->tm_isdst < 0) + return t; + /* + ** We're supposed to assume that somebody took a time of one type + ** and did some math on it that yielded a "struct tm" that's bad. + ** We try to divine the type they started from and adjust to the + ** type they need. + */ + sp = lclptr; + for (samei = 0; samei < sp->typecnt; ++samei) { + if (sp->ttis[samei].tt_isdst != tmp->tm_isdst) + continue; + for (otheri = 0; otheri < sp->typecnt; ++otheri) { + if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst) + continue; + tmp->tm_sec += sp->ttis[otheri].tt_gmtoff - + sp->ttis[samei].tt_gmtoff; + tmp->tm_isdst = !tmp->tm_isdst; + t = time2(tmp, offset, &okay); + if (okay) + return t; + tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff - + sp->ttis[samei].tt_gmtoff; + tmp->tm_isdst = !tmp->tm_isdst; + } + } + return NOTOK; +} + +time_t mktime(struct tm * tmp) +{ + time_t mktime_return_value; + + pthread_mutex_lock(&lcl_mutex); + if (lcl_is_set == FALSE) { + tzset_basic(); + } + mktime_return_value = time1(tmp, 0L); + pthread_mutex_unlock(&lcl_mutex); + return(mktime_return_value); +} diff --git a/lib/libpthread/gen/difftime.c b/lib/libpthread/gen/difftime.c new file mode 100644 index 00000000000..cddd896e04a --- /dev/null +++ b/lib/libpthread/gen/difftime.c @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)difftime.c 5.2 (Berkeley) 6/1/90"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> + +double +difftime(time1, time0) + time_t time1, time0; +{ + return(time1 - time0); +} diff --git a/lib/libpthread/gen/directory.c b/lib/libpthread/gen/directory.c new file mode 100644 index 00000000000..d189280fc1f --- /dev/null +++ b/lib/libpthread/gen/directory.c @@ -0,0 +1,322 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)closedir.c 5.9 (Berkeley) 2/23/91"; +#endif /* LIBC_SCCS and not lint */ + +/* + * One of these structures is malloced to describe the current directory + * position each time telldir is called. It records the current magic + * cookie returned by getdirentries and the offset within the buffer + * associated with that return value. + */ +struct ddloc { + struct ddloc *loc_next;/* next structure in list */ + long loc_index; /* key associated with structure */ + long loc_seek; /* magic cookie returned by getdirentries */ + long loc_loc; /* offset of entry in buffer */ +}; + +static long dd_loccnt = 0; /* Index of entry for sequential telldir's */ + +#include <errno.h> +#include <pthread.h> +#include <sys/types.h> +#include <sys/param.h> +#include <dirent.h> +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <string.h> + + +/* + * close a directory. + */ +int closedir(DIR * dirp) +{ + void *ptr, *nextptr; + int fd; + + pthread_mutex_lock (dirp->dd_lock); + fd = dirp->dd_fd; + dirp->dd_fd = -1; + dirp->dd_loc = 0; + for (ptr = (void *)dirp->dd_ddloc; ptr; ptr = nextptr) { + nextptr = (void *)(((struct ddloc *)ptr)->loc_next); + free(ptr); + } + for (ptr = (void *)dirp->dd_dp; ptr; ptr = nextptr) { + nextptr = (void *)(((struct __dirent *)ptr)->next); + free(ptr); + } + free((void *)dirp->dd_buf); + free (dirp->dd_lock); + free((void *)dirp); + return(machdep_sys_close(fd)); +} + +/* + * open a directory. + */ +DIR * opendir(const char * name) +{ + DIR *dirp; + int fd; + + if ((fd = machdep_sys_open(name, 0)) < 0) + return NULL; + if (machdep_sys_fcntl(fd, F_SETFD, 1) < 0 || + (dirp = (DIR *)malloc(sizeof(DIR))) == NULL) { + machdep_sys_close (fd); + return NULL; + } + dirp->dd_lock = (pthread_mutex_t*) malloc (sizeof (pthread_mutex_t)); + pthread_mutex_init (dirp->dd_lock, 0); + /* + * If CLSIZE is an exact multiple of DIRBLKSIZ, use a CLSIZE + * buffer that it cluster boundary aligned. + * Hopefully this can be a big win someday by allowing page trades + * to user space to be done by getdirentries() + */ +#ifndef CLSIZE +#define CLSIZE 1 +#endif + if ((CLSIZE % DIRBLKSIZ) == 0) { + dirp->dd_buf = malloc(CLSIZE); + dirp->dd_len = CLSIZE; + } else { + dirp->dd_buf = malloc(DIRBLKSIZ); + dirp->dd_len = DIRBLKSIZ; + } + if (dirp->dd_buf == NULL) { + machdep_sys_close (fd); + free((void *)dirp); + return NULL; + } + + dirp->dd_ddloc = NULL; + dirp->dd_dp = NULL; + dirp->dd_seek = 0; + dirp->dd_loc = 0; + dirp->dd_fd = fd; + return(dirp); +} + +/* + * The real work in gettint the next entry in a directory. + * Return + * NULL on End of directory + * &ERR on Error + * dp on valid directory; + */ +static struct dirent ERR; +static struct dirent * readdir_basic(DIR * dirp) +{ + register struct dirent *dp; + + for (;;) { + if (dirp->dd_loc == 0) { + dirp->dd_size = machdep_sys_getdirentries(dirp->dd_fd, + dirp->dd_buf, dirp->dd_len, &dirp->dd_seek); + if (dirp->dd_size < 0) + return(&ERR); + if (dirp->dd_size == 0) + return(NULL); + } + if (dirp->dd_loc >= dirp->dd_size) { + dirp->dd_loc = 0; + continue; + } + dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc); + if ((long)dp & 03) /* bogus pointer check */ + return(&ERR); + if (dp->d_reclen <= 0 || + dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc) + return(&ERR); + dirp->dd_loc += dp->d_reclen; + if (dp->d_ino == 0) + continue; + return(dp); + } +} + +/* + * POSIX.1 version of getting the next entry in a directory. + */ +struct dirent * readdir(DIR * dirp) +{ + register struct dirent * rp; + struct __dirent * my__dp; + pthread_t self; + + pthread_mutex_lock (dirp->dd_lock); + + self = pthread_self(); + /* Allocate space and return */ + for (my__dp = dirp->dd_dp; my__dp; my__dp = my__dp->next) { + if (pthread_equal(my__dp->owner, self)) { + break; + } + } + if (my__dp == NULL) { + if (my__dp = (struct __dirent *)(malloc(sizeof(struct __dirent)))) { + my__dp->next = dirp->dd_dp; + dirp->dd_dp = my__dp; + my__dp->owner = self; + } else { + pthread_mutex_unlock (dirp->dd_lock); + return(NULL); + } + } + if (rp = readdir_basic(dirp)) { + if (rp != &ERR) { + memcpy(& (my__dp->data), rp, sizeof(struct dirent)); + rp = & (my__dp->data); + } else { + rp = NULL; + } + } + pthread_mutex_unlock (dirp->dd_lock); + return(rp); +} + +/* + * POSIX.4a version of getting the next entry in a directory. + */ +int readdir_r(DIR * dirp, struct dirent * entry, struct dirent ** result) +{ + register struct dirent * rp; + int ret; + + pthread_mutex_lock (dirp->dd_lock); + rp = readdir_basic(dirp); + if (rp != &ERR) { + if (rp) { + memcpy(entry, rp, sizeof(struct dirent)); + *result = entry; + ret = 0; + } else { + *result = NULL; + ret = 0; + } + } else { + /* Should get it from errno */ + ret = EBADF; + } + pthread_mutex_unlock (dirp->dd_lock); + return(ret); +} + +void rewinddir(DIR * dirp) +{ + pthread_mutex_lock (dirp->dd_lock); + (void)machdep_sys_lseek(dirp->dd_fd, 0, 0); + dirp->dd_seek = 0; + dirp->dd_loc = 0; + pthread_mutex_unlock (dirp->dd_lock); +} + +/* + * Seek to an entry in a directory. + * _seekdir is in telldir.c so that it can share opaque data structures. + * + * Use the POSIX reentrant safe readdir_r to simplify varifying POSIX + * thread-safe compliance. + */ +void seekdir(DIR * dirp, long loc) +{ + register struct ddloc ** prevlp; + register struct ddloc * lp; + struct dirent * dp; + struct dirent de; + + pthread_mutex_lock (dirp->dd_lock); + prevlp = (struct ddloc **)&(dirp->dd_ddloc); + lp = *prevlp; + while (lp != NULL) { + if (lp->loc_index == loc) + break; + prevlp = &lp->loc_next; + lp = lp->loc_next; + } + if (lp) { + if (lp->loc_seek != dirp->dd_seek) { + if (machdep_sys_lseek(dirp->dd_fd, lp->loc_seek, 0) < 0) { + *prevlp = lp->loc_next; + pthread_mutex_unlock (dirp->dd_lock); + return; + } + dirp->dd_seek = lp->loc_seek; + dirp->dd_loc = 0; + while (dirp->dd_loc < lp->loc_loc) { + if (readdir_r(dirp, &de, &dp)) { + *prevlp = lp->loc_next; + break; + } + } + } + } + pthread_mutex_unlock (dirp->dd_lock); +} + +/* + * return a pointer into a directory + */ +long telldir(DIR *dirp) +{ + struct ddloc *lp, **fakeout; + int ret; + + pthread_mutex_lock (dirp->dd_lock); + if (lp = (struct ddloc *)malloc(sizeof(struct ddloc))) { + lp->loc_index = dd_loccnt++; + lp->loc_seek = dirp->dd_seek; + lp->loc_loc = dirp->dd_loc; + lp->loc_next = dirp->dd_ddloc; + + /* Compiler won't let us change anything pointed to by db directly */ + /* So we fake to the left and do it anyway */ + /* Wonder if the compile optomizes it to the correct solution */ + fakeout = (struct ddloc **)&(dirp->dd_ddloc); + *fakeout = lp; + + ret = lp->loc_index; + } else { + ret = -1; + } + pthread_mutex_unlock (dirp->dd_lock); + return(ret); +} + diff --git a/lib/libpthread/gen/eprintf.c b/lib/libpthread/gen/eprintf.c new file mode 100644 index 00000000000..bcc65757bd4 --- /dev/null +++ b/lib/libpthread/gen/eprintf.c @@ -0,0 +1,18 @@ +/* This function is a replacement for the version in libgcc.a. This + is needed because typically libgcc.a won't have been compiled + against the threads library, so its references to "stderr" will + come out wrong. */ + +#include <stdio.h> + +void __eprintf (const char *fmt, const char *expr, int line, const char *file) +{ + /* Considering the very special circumstances where this function + would be called, perhaps we might want to disable the thread + scheduler and break any existing locks on stderr? Well, maybe if + we could be sure that stderr was in a useable state... */ + fprintf (stderr, fmt, expr, line, file); + fflush (stderr); + + abort (); +} diff --git a/lib/libpthread/gen/getcwd.c b/lib/libpthread/gen/getcwd.c new file mode 100644 index 00000000000..333ad902263 --- /dev/null +++ b/lib/libpthread/gen/getcwd.c @@ -0,0 +1,248 @@ +/* + * Copyright (c) 1989, 1991 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getcwd.c 5.11 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getcwd.c,v 1.1 1998/07/21 13:19:02 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <sys/stat.h> +#include <errno.h> +#include <dirent.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#define ISDOT(dp) \ + (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \ + dp->d_name[1] == '.' && dp->d_name[2] == '\0')) + + +/* Only use reentrant safe routines to simplify varifying POSIX thread-safe + * compliance. (mevans). + */ + +char * +getcwd(pt, size) + char *pt; + size_t size; +{ + register DIR *dir; + register dev_t dev; + register ino_t ino; + register int first; + register char *bpt, *bup; + struct stat s; + struct dirent *dp; + struct dirent de; + dev_t root_dev; + ino_t root_ino; + size_t ptsize, upsize; + int save_errno; + char *ept, *eup, *up; + int namelen; + + /* + * If no buffer specified by the user, allocate one as necessary. + * If a buffer is specified, the size has to be non-zero. The path + * is built from the end of the buffer backwards. + */ + if (pt) { + ptsize = 0; + if (!size) { + errno = EINVAL; + return((char *)NULL); + } + ept = pt + size; + } else { + if (!(pt = (char *)malloc(ptsize = 1024 - 4))) + return((char *)NULL); + ept = pt + ptsize; + } + bpt = ept - 1; + *bpt = '\0'; + + /* + * Allocate bytes (1024 - malloc space) for the string of "../"'s. + * Should always be enough (it's 340 levels). If it's not, allocate + * as necessary. Special * case the first stat, it's ".", not "..". + */ + if (!(up = (char *)malloc(upsize = 1024 - 4))) + goto err; + eup = up + MAXPATHLEN; + bup = up; + up[0] = '.'; + up[1] = '\0'; + + /* Save root values, so know when to stop. */ + if (stat("/", &s)) + goto err; + root_dev = s.st_dev; + root_ino = s.st_ino; + + SET_ERRNO(0); + + for (first = 1;; first = 0) { + /* Stat the current level. */ + if (lstat(up, &s)) + goto err; + + /* Save current node values. */ + ino = s.st_ino; + dev = s.st_dev; + + /* Check for reaching root. */ + if (root_dev == dev && root_ino == ino) { + *--bpt = '/'; + /* + * It's unclear that it's a requirement to copy the + * path to the beginning of the buffer, but it's always + * been that way and stuff would probably break. + */ + /* XXX was bcopy */ + (void)memcpy(pt, bpt, ept - bpt); + free(up); + return(pt); + } + + /* + * Build pointer to the parent directory, allocating memory + * as necessary. Max length is 3 for "../", the largest + * possible component name, plus a trailing NULL. + */ + if (bup + 3 + MAXNAMLEN + 1 >= eup) { + if (!(up = (char *)realloc(up, upsize *= 2))) + goto err; + eup = up + upsize; + } + *bup++ = '.'; + *bup++ = '.'; + *bup = '\0'; + + /* Open and stat parent directory. */ + /* XXX opendir() returns kernel fd's instead of + pthread fd's for some odd reason, so we must + break the abstraction boundry here as well or + fix everything in opendir et al. SNL */ + if (!(dir = opendir(up)) || + machdep_sys_fstat(dirfd(dir), &s)) + goto err; + + /* Add trailing slash for next directory. */ + *bup++ = '/'; + + /* + * If it's a mount point, have to stat each element because + * the inode number in the directory is for the entry in the + * parent directory, not the inode number of the mounted file. + */ + save_errno = 0; + if (s.st_dev == dev) { + for (;;) { + if (readdir_r(dir, &de, &dp)) + goto notfound; + if (dp->d_fileno == ino) + break; + } + } else + for (;;) { + if (readdir_r(dir, &de, &dp)) + goto notfound; + if (ISDOT(dp)) + continue; + memcpy(bup, dp->d_name, strlen(dp->d_name) + 1); + + /* Save the first error for later. */ + if (lstat(up, &s)) { + if (!save_errno) + save_errno = errno; + SET_ERRNO(0); + continue; + } + if (s.st_dev == dev && s.st_ino == ino) + break; + } + + /* + * Check for length of the current name, preceding slash, + * leading slash. + */ + namelen = strlen(dp->d_name); + if (bpt - pt <= namelen + (first ? 1 : 2)) { + size_t len, off; + + if (!ptsize) { + SET_ERRNO(ERANGE); + goto err; + } + off = bpt - pt; + len = ept - bpt; + if (!(pt = (char *)realloc(pt, ptsize *= 2))) + goto err; + bpt = pt + off; + ept = pt + ptsize; + /* XXX was bcopy */ + (void)memcpy(ept - len, bpt, len); + bpt = ept - len; + } + if (!first) + *--bpt = '/'; + bpt -= namelen; + memcpy(bpt, dp->d_name, namelen); + (void)closedir(dir); + + /* Truncate any file name. */ + *bup = '\0'; + } + +notfound: + /* + * If readdir set errno, use it, not any saved error; otherwise, + * didn't find the current directory in its parent directory, set + * errno to ENOENT. + */ + if (!errno) { + if (!save_errno) + save_errno = ENOENT; + SET_ERRNO(save_errno); + } + /* FALLTHROUGH */ +err: + if (ptsize) + free(pt); + free(up); + return((char *)NULL); +} diff --git a/lib/libpthread/gen/getpwent.c b/lib/libpthread/gen/getpwent.c new file mode 100644 index 00000000000..7bcb2cbd610 --- /dev/null +++ b/lib/libpthread/gen/getpwent.c @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1984 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getpwent.c 5.2 (Berkeley) 3/9/86"; +#endif + +#include <pthread.h> +#include <stdio.h> +#include <pwd.h> +#include "pwd_internal.h" + +void +setpwent() +{ + pwf_context_t *_data; + + _data = _pw_get_data(); + + if (_data) { + if (_data->pwf == NULL) + _data->pwf = fopen(_data->pw_file, "r"); + else + rewind(_data->pwf); + } +} + +void +endpwent() +{ + pwf_context_t *_data; + + _data = _pw_get_data(); + + if (_data) { + if (_data->pwf != NULL) { + fclose(_data->pwf); + _data->pwf = NULL; + } +#ifdef DBM_PWD_SUPPORT + if (_data->pw_db != (DBM *)0) { + dbm_close(_data->pw_db); + _data->pw_db = (DBM *)0; + _data->pw_stayopen = 0; + } +#endif /* DBM_PWD_SUPPORT */ + } +} + +static char * +pwskip(p) + char *p; +{ + while (*p && *p != ':' && *p != '\n') + ++p; + if (*p) + *p++ = 0; + return(p); +} + +struct passwd * +getpwent() +{ + pwf_context_t *_data; + char *p; + + _data = _pw_get_data(); + if (!_data) + return 0; + + if (_data->pwf == NULL) { + if ((_data->pwf = fopen(_data->pw_file, "r" )) == NULL) + return(0); + } + p = fgets(_data->line, BUFSIZ, _data->pwf); + if (p == NULL) + return(0); + _data->passwd.pw_name = p; + p = pwskip(p); + _data->passwd.pw_passwd = p; + p = pwskip(p); + _data->passwd.pw_uid = atoi(p); + p = pwskip(p); + _data->passwd.pw_gid = atoi(p); + p = pwskip(p); + _data->passwd.pw_gecos = p; + p = pwskip(p); + _data->passwd.pw_dir = p; + p = pwskip(p); + _data->passwd.pw_shell = p; + while (*p && *p != '\n') + p++; + *p = '\0'; + return(&_data->passwd); +} + +void +setpwfile(file) + char *file; +{ + pwf_context_t *_data; + + _data = _pw_get_data(); + if (_data) + _data->pw_file = file; +} diff --git a/lib/libpthread/gen/getpwnamuid.c b/lib/libpthread/gen/getpwnamuid.c new file mode 100644 index 00000000000..0e87081b7a9 --- /dev/null +++ b/lib/libpthread/gen/getpwnamuid.c @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getpwnamuid.c 5.3 (Berkeley) 12/21/87"; +#endif + +#include <stdio.h> +#include <pwd.h> +#include <sys/file.h> +#include "pwd_internal.h" + +/* + * The following are shared with getpwent.c + */ + +#ifdef DBM_PWD_SUPPORT +static struct passwd * +fetchpw(key) + datum key; +{ + char *cp, *tp; + pwf_context_t *_data; + + _data = _pw_get_data(); + if (!_data) + return 0; + if (key.dptr == 0) + return ((struct passwd *)NULL); + key = dbm_fetch(_data->pw_db, key); + if (key.dptr == 0) + return ((struct passwd *)NULL); + cp = key.dptr; + tp = _data->line; + +#define EXPAND(e) _data->passwd.e = tp; while (*tp++ = *cp++); + EXPAND(pw_name); + EXPAND(pw_passwd); + memcpy((char *)&_data->passwd.pw_uid, cp, sizeof (int)); + cp += sizeof (int); + memcpy((char *)&_data->passwd.pw_gid, cp, sizeof (int)); + cp += sizeof (int); + EXPAND(pw_gecos); + EXPAND(pw_dir); + EXPAND(pw_shell); + return (&_data->passwd); +} +#endif /* DBM_PWD_SUPPORT */ + +struct passwd * +getpwnam(nam) + const char *nam; +{ +#ifdef DBM_PWD_SUPPORT + datum key; +#endif + struct passwd *pw, *getpwent(); + pwf_context_t *_data; + + _data = _pw_get_data(); + if (!_data) + return 0; + +#ifdef DBM_PWD_SUPPORT + if (_data->pw_db == (DBM *)0 && + (_data->pw_db = dbm_open(_data->pw_file, O_RDONLY)) == (DBM *)0) { + oldcode: +#endif + setpwent(); + while ((pw = getpwent()) && strcmp(nam, pw->pw_name)) + ; + if (!_data->pw_stayopen) + endpwent(); + return (pw); +#ifdef DBM_PWD_SUPPORT + } + if (flock(dbm_dirfno(_data->pw_db), LOCK_SH) < 0) { + dbm_close(_data->pw_db); + _data->pw_db = (DBM *)0; + goto oldcode; + } + key.dptr = nam; + key.dsize = strlen(nam); + pw = fetchpw(key); + (void) flock(dbm_dirfno(_data->pw_db), LOCK_UN); + if (!_data->pw_stayopen) { + dbm_close(_data->pw_db); + _data->pw_db = (DBM *)0; + } + return (pw); +#endif +} + +struct passwd * +getpwuid(uid) + uid_t uid; +{ +#ifdef DBM_PWD_SUPPORT + datum key; +#endif + struct passwd *pw, *getpwent(); + pwf_context_t *_data; + + _data = _pw_get_data(); + if (!_data) + return 0; +#ifdef DBM_PWD_SUPPORT + if (_data->pw_db == (DBM *)0 && + (_data->pw_db = dbm_open(_data->pw_file, O_RDONLY)) == (DBM *)0) { + oldcode: +#endif + setpwent(); + while ((pw = getpwent()) && pw->pw_uid != uid) + ; + if (!_data->pw_stayopen) + endpwent(); + return (pw); +#ifdef DBM_PWD_SUPPORT + } + if (flock(dbm_dirfno(_data->pw_db), LOCK_SH) < 0) { + dbm_close(_data->pw_db); + _data->pw_db = (DBM *)0; + goto oldcode; + } + key.dptr = (char *) &uid; + key.dsize = sizeof uid; + pw = fetchpw(key); + (void) flock(dbm_dirfno(_data->pw_db), LOCK_UN); + if (!_data->pw_stayopen) { + dbm_close(_data->pw_db); + _data->pw_db = (DBM *)0; + } + return (pw); +#endif +} diff --git a/lib/libpthread/gen/getwd.c b/lib/libpthread/gen/getwd.c new file mode 100644 index 00000000000..6e32561bfc3 --- /dev/null +++ b/lib/libpthread/gen/getwd.c @@ -0,0 +1,57 @@ +/*- + * 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getwd.c 5.1 (Berkeley) 2/20/91";*/ +static char *rcsid = "$Id: getwd.c,v 1.1 1998/07/21 13:19:02 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <unistd.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> + +char * +getwd(buf) + char *buf; +{ + char *p; + char *strerror(); + + if (p = getcwd(buf, MAXPATHLEN)) + return(p); + (void)strcpy(buf, strerror(errno)); + return((char *)NULL); +} diff --git a/lib/libpthread/gen/isatty.c b/lib/libpthread/gen/isatty.c new file mode 100644 index 00000000000..a3a01aad19e --- /dev/null +++ b/lib/libpthread/gen/isatty.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1988 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)isatty.c 5.6 (Berkeley) 2/23/91";*/ +static char *rcsid = "$Id: isatty.c,v 1.1 1998/07/21 13:19:02 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#ifdef sunos4 +#include <sys/termio.h> +#else +#include <termios.h> +#endif +#include <unistd.h> + +/* + * If TIOCGETA is not defined try TCGETATTR + * If TCGETATTR is not defined try TCGETA + * If that doesn't work try getting it from termio.h + */ +#ifndef TIOCGETA +#ifdef TCGETATTR +#define TIOCGETA TCGETATTR +#else +#ifndef TCGETA +#include <termio.h> +#endif +#ifndef TIOCGETA +#define TIOCGETA TCGETA +#endif +#endif +#endif + +/* fd is the real fd to pass to the kernel */ +int isatty_basic(int fd) +{ +#ifdef sunos4 + struct termio t; +#else /* !sunos4 */ + struct termios t; +#endif /* sunos4 */ + return (machdep_sys_ioctl(fd, +#ifdef sunos4 + TCGETA, +#else /* !sunos4 */ + TIOCGETA, +#endif /* sunos4 */ + &t) ? 0 : 1); +} + +int isatty(int fd) +{ + int ret; + + if ((ret = fd_lock(fd, FD_READ, NULL)) == OK) { + ret = isatty_basic(fd_table[fd]->fd.i); + fd_unlock(fd, FD_READ); + } else { + /* Return 0 or 1 */ + ret = 0; + } + return(ret); +} + diff --git a/lib/libpthread/gen/popen.c b/lib/libpthread/gen/popen.c new file mode 100644 index 00000000000..c15fbdce1fe --- /dev/null +++ b/lib/libpthread/gen/popen.c @@ -0,0 +1,117 @@ +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/wait.h> + +static pid_t *pids = NULL; +static int pids_size = 0; +static int pids_top = 0; +static pthread_mutex_t pids_lock = PTHREAD_MUTEX_INITIALIZER; + +FILE *popen(const char *cmd, const char *mode) +{ + int fds[2], parent_fd, child_fd, child_target, new_size, i; + pid_t pid, *new_pids; + + /* Verify the mode. */ + if ((*mode != 'r' && *mode != 'w') || mode[1] != 0) + return NULL; + + /* Generate fds, and choose the parent and child fds. */ + if (pipe(fds) < 0) + return NULL; + parent_fd = (*mode == 'r') ? fds[0] : fds[1]; + child_fd = (*mode == 'r') ? fds[1] : fds[0]; + + /* Ensure that there is space in the pid table. */ + pthread_mutex_lock(&pids_lock); + if (pids_size <= parent_fd) { + new_size = parent_fd + 1; + if ((new_pids = malloc(new_size * sizeof(pid_t))) == NULL) { + pthread_mutex_unlock(&pids_lock); + close(parent_fd); + close(child_fd); + return NULL; + } + if (pids) { + memcpy(new_pids, pids, pids_size * sizeof(pid_t)); + free(pids); + } + while (pids_size < new_size) + new_pids[pids_size++] = -1; + pids = new_pids; + } + pthread_mutex_unlock(&pids_lock); + + /* Fork off a child process. */ + switch (pid = fork()) { + case -1: /* Failed to fork. */ + close(parent_fd); + close(child_fd); + return NULL; + break; + case 0: /* Child */ + /* + * Set the child fd to stdout or stdin as appropriate, + * and close the parent fd. + */ + child_target = (*mode == 'r') ? STDOUT_FILENO : STDIN_FILENO; + if (child_fd != child_target) { + dup2(child_fd, child_target); + close(child_fd); + } + close(parent_fd); + + /* Close all parent fds from previous popens(). */ + for (i = 0; i < pids_top; i++) { + if (pids[i] != -1) + close(i); + } + + execl("/bin/sh", "sh", "-c", cmd, NULL); + exit(1); + default: + break; + } + + /* Record the parent fd in the pids table. */ + pthread_mutex_lock(&pids_lock); + pids[parent_fd] = pid; + if (pids_top < parent_fd + 1) + pids_top = parent_fd + 1; + pthread_mutex_unlock(&pids_lock); + + /* Close the child fd and return a stdio buffer for the parent fd. */ + close(child_fd); + return fdopen(parent_fd, mode); +} + +int pclose(fp) + FILE *fp; +{ + pid_t pid, result; + int fd, pstat; + + fd = fileno(fp); + pthread_mutex_lock(&pids_lock); + /* Make sure this is a popened file. */ + if ((pids_top <= fd) || ((pid = pids[fd]) == -1)) { + pthread_mutex_unlock(&pids_lock); + return -1; + } + pids[fd] = -1; + while (pids_top > 0 && pids[pids_top - 1] == -1) + pids_top--; + pthread_mutex_unlock(&pids_lock); + + fclose(fp); + + /* Wait for the subprocess to quit. */ + return (((result = waitpid(pid, &pstat, 0)) == -1) ? -1 : pstat); +} + diff --git a/lib/libpthread/gen/pwd_internal.c b/lib/libpthread/gen/pwd_internal.c new file mode 100644 index 00000000000..b0ebc27b5c6 --- /dev/null +++ b/lib/libpthread/gen/pwd_internal.c @@ -0,0 +1,97 @@ +/* ==== pwd_internal.c ============================================================ + * Copyright (c) 1993, 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. + * + * Description : Thread-safe password hacking functions. + * + * 1.00 95/02/08 snl + * -Started coding this file. + */ + +#include <pthread.h> +#include <stdlib.h> +#include <stdio.h> +#include <pwd.h> +#include <unistd.h> +#include "pwd_internal.h" + +static pthread_once_t __pw_init = PTHREAD_ONCE_INIT; +static pthread_key_t __pw_key; + +void +_pw_null_cleanup(void *junkola) +{ + pwf_context_t *x = (pwf_context_t *)junkola; + + if (x) { + if (x->pwf) { + fclose(x->pwf); + x->pwf = 0; + } +#ifdef DBM_PWD_SUPPORT + if (x->pw_db) { + dbm_close(x->pw_db); + x->pw_db = 0; + } +#endif /* DBM_PWD_SUPPORT */ + free((void *)x); + } +} + +void +_pw_create_key() +{ + if (pthread_key_create(&__pw_key, _pw_null_cleanup)) { + PANIC(); + } +} + +pwf_context_t * +_pw_get_data() +{ + pwf_context_t *_data; + + pthread_once(&__pw_init, _pw_create_key); + _data = (pwf_context_t *)pthread_getspecific(__pw_key); + if (!_data) { + _data = (pwf_context_t *)malloc(sizeof(pwf_context_t)); + if (_data) { + _data->pwf = 0; + _data->line[0] = '\0'; + _data->pw_stayopen = 0; + _data->pw_file = "/etc/passwd"; +#ifdef DBM_PWD_SUPPORT + _data->pw_db = 0; +#endif /* DBM_PWD_SUPPORT */ + pthread_setspecific(__pw_key, (void *)_data); + } + } + return _data; +} diff --git a/lib/libpthread/gen/pwd_internal.h b/lib/libpthread/gen/pwd_internal.h new file mode 100644 index 00000000000..10fdab6cc4e --- /dev/null +++ b/lib/libpthread/gen/pwd_internal.h @@ -0,0 +1,29 @@ +#ifndef _PWD_INTERNAL_H_ +#define _PWD_INTERNAL_H_ + +#if 0 /* Turn this off for now until we suck in ndbm or use gdbm -- SNL */ +#ifndef DBM_PWD_SUPPORT +#if !defined(__alpha) && !defined(linux) && !defined(hpux) +#define DBM_PWD_SUPPORT 1 +#endif /* !alpha && !linux && !hpux */ +#endif /* !DBM_PWD_SUPPORT */ +#endif + +#ifdef DBM_PWD_SUPPORT +#include <ndbm.h> +#endif /* DBM_PWD_SUPPORT */ + +typedef struct pwf_context { + FILE *pwf; + char line[BUFSIZ+1]; + struct passwd passwd; + int pw_stayopen; + char *pw_file; +#ifdef DBM_PWD_SUPPORT + DBM *pw_db; +#endif /* DBM_PWD_SUPPORT */ +} pwf_context_t; + +pwf_context_t *_pw_get_data __P_((void)); + +#endif /* _PWD_INTERNAL_H_ */ diff --git a/lib/libpthread/gen/syslog.c b/lib/libpthread/gen/syslog.c new file mode 100644 index 00000000000..e49795ecb69 --- /dev/null +++ b/lib/libpthread/gen/syslog.c @@ -0,0 +1,216 @@ +/* + * Copyright (c) 1983, 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)syslog.c 5.14 (Berkeley) 5/20/88"; +#endif /* LIBC_SCCS and not lint */ + + +/* + * SYSLOG -- print message on log file + * + * This routine looks a lot like printf, except that it + * outputs to the log file instead of the standard output. + * Also: + * adds a timestamp, + * prints the module name in front of the message, + * has some other formatting types (or will sometime), + * adds a newline on the end of the message. + * + * The output of this routine is intended to be read by /etc/syslogd. + * + * Author: Eric Allman + * Modified to use UNIX domain IPC by Ralph Campbell + * Modified for pthreads and made more POSIX-compliant by Greg Hudson + */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <signal.h> +#include <stdio.h> +#include <stdarg.h> +#include <string.h> +#include <fcntl.h> +#include <netdb.h> +#include <unistd.h> +#include <errno.h> +#include <syslog.h> + +int socket(); +char *strerror(int); /* For systems that don't prototype it */ + +#define MAXLINE 1024 /* max message size */ + +#define PRIFAC(p) (((p) & LOG_FACMASK) >> 3) + /* XXX should be in <syslog.h> */ +#define IMPORTANT LOG_ERR + +static void basic_init(void); + +static char _log_name[] = "/dev/log"; +static char ctty[] = "/dev/console"; + +static int LogFile = -1; /* fd for log */ +static int LogStat = 0; /* status bits, set by openlog() */ +static char *LogTag = "syslog"; /* string to tag the entry with */ +static int LogMask = 0xff; /* mask of priorities to be logged */ +static int LogFacility = LOG_USER; /* default facility code */ + +static pthread_mutex_t basic_init_lock = PTHREAD_MUTEX_INITIALIZER; + +static struct sockaddr SyslogAddr; /* AF_UNIX address of local logger */ + +static void basic_init() +{ + pthread_mutex_lock(&basic_init_lock); + if (LogFile < 0) + openlog(LogTag, LogStat | LOG_NDELAY, 0); + pthread_mutex_unlock(&basic_init_lock); +} + +void syslog(int pri, char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vsyslog(pri, fmt, args); + va_end(args); +} + +void vsyslog(int pri, char *fmt, va_list args) +{ + char buf[MAXLINE + 1], outline[MAXLINE + 1]; + register char *b, *f, *o; + register int c; + time_t now; + int olderrno = errno, fd; + + /* Do a basic initialization if user didn't call openlog(). */ + if (LogFile < 0) + basic_init(); + + /* see if we should just throw out this message */ + if ((unsigned) PRIFAC(pri) >= LOG_NFACILITIES || + (LOG_MASK(pri & LOG_PRIMASK) & LogMask) == 0 || + (pri &~ (LOG_PRIMASK|LOG_FACMASK)) != 0) + return; + + /* set default facility if none specified */ + if ((pri & LOG_FACMASK) == 0) + pri |= LogFacility; + + /* build the message */ + o = outline; + (void)sprintf(o, "<%d>", pri); + o += strlen(o); + time(&now); + (void)sprintf(o, "%.15s ", ctime(&now) + 4); + o += strlen(o); + if (LogTag) { + strcpy(o, LogTag); + o += strlen(o); + } + if (LogStat & LOG_PID) { + (void)sprintf(o, "[%d]", getpid()); + o += strlen(o); + } + if (LogTag) { + strcpy(o, ": "); + o += 2; + } + + b = buf; + f = fmt; + while ((c = *f++) != '\0' && c != '\n' && b < &buf[MAXLINE]) { + char *strerror(); + + if (c != '%') { + *b++ = c; + continue; + } + if ((c = *f++) != 'm') { + *b++ = '%'; + *b++ = c; + continue; + } + strcpy(b, strerror(olderrno)); + b += strlen(b); + } + *b++ = '\n'; + *b = '\0'; + vsprintf(o, buf, args); + c = strlen(outline); + if (c > MAXLINE) + c = MAXLINE; + + /* output the message to the local logger */ + if (sendto(LogFile, outline, c, 0, &SyslogAddr, sizeof SyslogAddr) >= 0) + return; + if (!(LogStat & LOG_CONS)) + return; + + /* output the message to the console */ + fd = open(ctty, O_WRONLY); + alarm(0); + strcat(o, "\r"); + o = strchr(outline, '>') + 1; + write(fd, o, c + 1 - (o - outline)); + close(fd); +} + +/* + * OPENLOG -- open system log + */ + +void openlog(char *ident, int logstat, int logfac) +{ + int flags; + + if (ident != NULL) + LogTag = ident; + LogStat = logstat; + if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) + LogFacility = logfac; + if (LogFile >= 0) + return; + SyslogAddr.sa_family = AF_UNIX; + strncpy(SyslogAddr.sa_data, _log_name, sizeof SyslogAddr.sa_data); + if (LogStat & LOG_NDELAY) { + LogFile = socket(AF_UNIX, SOCK_DGRAM, 0); + flags = fcntl(LogFile, F_GETFD); + fcntl(LogFile, F_SETFD, flags & O_NONBLOCK); + } +} + +/* + * CLOSELOG -- close the system log + */ + +void closelog() +{ + (void) close(LogFile); + LogFile = -1; +} + +/* + * SETLOGMASK -- set the log mask level + */ +int setlogmask(int pmask) +{ + int omask; + + omask = LogMask; + if (pmask != 0) + LogMask = pmask; + return (omask); +} diff --git a/lib/libpthread/gen/time.c b/lib/libpthread/gen/time.c new file mode 100644 index 00000000000..82eec7edc1e --- /dev/null +++ b/lib/libpthread/gen/time.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)time.c 5.6 (Berkeley) 6/1/90"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/time.h> + +time_t time(time_t * t) +{ + struct timeval tt; + + if (gettimeofday(&tt, (struct timezone *)0) < 0) + return(-1); + if (t) + *t = tt.tv_sec; + return(tt.tv_sec); +} diff --git a/lib/libpthread/gen/ttyname.c b/lib/libpthread/gen/ttyname.c new file mode 100644 index 00000000000..0998cad1f78 --- /dev/null +++ b/lib/libpthread/gen/ttyname.c @@ -0,0 +1,147 @@ +/* + * Copyright (c) 1988 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)ttyname.c 5.10 (Berkeley) 5/6/91"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <dirent.h> +#include <unistd.h> +#include <string.h> +#include <stdlib.h> +#include "config.h" + +static pthread_mutex_t ttyname_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_key_t ttyname_key; +static int ttyname_init = 0; +extern void free(); + +char * __ttyname_r_basic(int fd, char * buf, size_t len) +{ + register struct dirent *dirp; + register DIR *dp; + struct stat dsb; + struct stat sb; + char * rval; + int minlen; + + rval = NULL; + + /* Must be a terminal. */ + if (! isatty_basic(fd)) + return(rval); + /* Must be a character device. */ + if (machdep_sys_fstat(fd, &sb) || !S_ISCHR(sb.st_mode)) + return(rval); + /* Must have enough room */ + if (len <= sizeof(_PATH_PTY)) + return(rval); + + if ((dp = opendir(_PATH_PTY)) != NULL) { + memcpy(buf, _PATH_PTY, sizeof(_PATH_PTY)); + for (rval = NULL; dirp = readdir(dp);) { + if (dirp->d_fileno != sb.st_ino) + continue; + minlen = (len - (sizeof(_PATH_PTY) - 1)) < (dirp->d_namlen + 1) ? + (len - (sizeof(_PATH_PTY) - 1)) : (dirp->d_namlen + 1); + memcpy (buf + sizeof(_PATH_PTY) - 1, dirp->d_name, minlen); + if (stat(buf, &dsb) || sb.st_dev != dsb.st_dev || + sb.st_ino != dsb.st_ino) + continue; + rval = buf; + break; + } + (void)closedir(dp); + } + return(rval); +} + +char * __ttyname_basic(int fd) +{ + char *buf; + + pthread_mutex_lock (&ttyname_lock); + if (ttyname_init == 0) { + if (pthread_key_create(&ttyname_key, free)) { + pthread_mutex_unlock (&ttyname_lock); + return(NULL); + } + ttyname_init = 1; + } + pthread_mutex_unlock (&ttyname_lock); + + /* Must have thread specific data field to put data */ + if ((buf = pthread_getspecific(ttyname_key)) == NULL) { + if (buf = malloc(sizeof(_PATH_PTY) + MAXNAMLEN)) { + if (pthread_setspecific(ttyname_key, buf) != OK) { + free(buf); + return(NULL); + } + } else { + return(NULL); + } + } + return(__ttyname_r_basic(fd, buf, sizeof(_PATH_PTY) + MAXNAMLEN)); +} + +char * ttyname_r(int fd, char * buf, size_t len) +{ + char * ret; + + if (fd_lock(fd, FD_READ) == OK) { + ret = __ttyname_r_basic(fd_table[fd]->fd.i, buf, len); + fd_unlock(fd, FD_READ); + } else { + ret = NULL; + } + return(ret); +} + +char * ttyname(int fd) +{ + char * ret; + + if (fd_lock(fd, FD_READ) == OK) { + ret = __ttyname_basic(fd_table[fd]->fd.i); + fd_unlock(fd, FD_READ); + } else { + ret = NULL; + } + return(ret); +} + + diff --git a/lib/libpthread/include/arpa/inet.h b/lib/libpthread/include/arpa/inet.h new file mode 100755 index 00000000000..27e045fa615 --- /dev/null +++ b/lib/libpthread/include/arpa/inet.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1983, 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. + * + * from: @(#)inet.h 5.7 (Berkeley) 4/3/91 + * $Id: inet.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + */ + +#ifndef _INET_H_ +#define _INET_H_ + +/* External definitions for functions in inet(3) */ + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <pthread/types.h> + +__BEGIN_DECLS + +pthread_ipaddr_type inet_addr __P_((const char *)); +int inet_aton __P_((const char *, struct in_addr *)); +pthread_ipaddr_type inet_lnaof __P_((struct in_addr)); +struct in_addr inet_makeaddr __P_((pthread_ipaddr_type, + pthread_ipaddr_type)); +pthread_ipaddr_type inet_netof __P_((struct in_addr)); +pthread_ipaddr_type inet_network __P_((const char *)); +char * inet_ntoa __P_((struct in_addr)); +char * inet_ntoa_r __P_((struct in_addr in, char *buf, + int bufsize)); + +__END_DECLS + +#endif /* !_INET_H_ */ diff --git a/lib/libpthread/include/arpa/nameser.h b/lib/libpthread/include/arpa/nameser.h new file mode 100755 index 00000000000..350d67538bd --- /dev/null +++ b/lib/libpthread/include/arpa/nameser.h @@ -0,0 +1,279 @@ +/* + * Copyright (c) 1983, 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. + * + * @(#)nameser.h 8.2 (Berkeley) 2/16/94 + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _NAMESER_H_ +#define _NAMESER_H_ + +#include <endian.h> +#include <sys/types.h> +#include <pthread/types.h> + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3*/ /* 0x3 reserved */ + /* non standard - supports ALLOW_UPDATES stuff from Mike Schwartz */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all named resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse lookup for NSAP */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net (MIT) */ +#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +#if !defined(BYTE_ORDER) || (BYTE_ORDER != BIG_ENDIAN \ + && BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + #error "Undefined or invalid BYTE_ORDER"; +#endif + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + pthread_ipport_type id; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + u_int qr:1; /* response flag */ + u_int opcode:4; /* purpose of message */ + u_int aa:1; /* authoritive answer */ + u_int tc:1; /* truncated message */ + u_int rd:1; /* recursion desired */ + /* fields in fourth byte */ + u_int ra:1; /* recursion available */ + u_int pr:1; /* primary server required (non standard) */ + u_int unused:2; /* unused bits */ + u_int rcode:4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + u_int rd:1; /* recursion desired */ + u_int tc:1; /* truncated message */ + u_int aa:1; /* authoritive answer */ + u_int opcode:4; /* purpose of message */ + u_int qr:1; /* response flag */ + /* fields in fourth byte */ + u_int rcode:4; /* response code */ + u_int unused:2; /* unused bits */ + u_int pr:1; /* primary server required (non standard) */ + u_int ra:1; /* recursion available */ +#endif + /* remaining bytes */ + pthread_ipport_type qdcount; /* number of question entries */ + pthread_ipport_type ancount; /* number of answer entries */ + pthread_ipport_type nscount; /* number of authority entries */ + pthread_ipport_type arcount; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + pthread_ipport_type r_zone; /* zone number */ + pthread_ipport_type r_class; /* class number */ + pthread_ipport_type r_type; /* type number */ + pthread_ipaddr_type r_ttl; /* time to live */ + int r_size; /* size of data area */ + char * r_data; /* pointer to data */ +}; + +extern pthread_ipport_type _getshort(); +extern pthread_ipaddr_type _getlong(); + +/* + * Inline versions of get/put short/long. Pointer is advanced. + * We also assume that a "pthread_ipport_type" holds 2 "chars" + * and that a "pthread_ipaddr_type" holds 4 "chars". + * + * These macros demonstrate the property of C whereby it can be + * portable or it can be elegant but never both. + */ +#define GETSHORT(s, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (s) = ((pthread_ipport_type)t_cp[0] << 8) | (pthread_ipport_type)t_cp[1]; \ + (cp) += 2; \ +} + +#define GETLONG(l, cp) { \ + register u_char *t_cp = (u_char *)(cp); \ + (l) = (((pthread_ipaddr_type)t_cp[0]) << 24) \ + | (((pthread_ipaddr_type)t_cp[1]) << 16) \ + | (((pthread_ipaddr_type)t_cp[2]) << 8) \ + | (((pthread_ipaddr_type)t_cp[3])); \ + (cp) += 4; \ +} + +#define PUTSHORT(s, cp) { \ + register pthread_ipport_type t_s = (pthread_ipport_type)(s); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_s >> 8; \ + *t_cp = t_s; \ + (cp) += 2; \ +} + +/* + * Warning: PUTLONG --no-longer-- destroys its first argument. if you + * were depending on this "feature", you will lose. + */ +#define PUTLONG(l, cp) { \ + register pthread_ipaddr_type t_l = (pthread_ipaddr_type)(l); \ + register u_char *t_cp = (u_char *)(cp); \ + *t_cp++ = t_l >> 24; \ + *t_cp++ = t_l >> 16; \ + *t_cp++ = t_l >> 8; \ + *t_cp = t_l; \ + (cp) += 4; \ +} + +#endif /* !_NAMESER_H_ */ diff --git a/lib/libpthread/include/dirent.h b/lib/libpthread/include/dirent.h new file mode 100644 index 00000000000..c3e86cb9da1 --- /dev/null +++ b/lib/libpthread/include/dirent.h @@ -0,0 +1,97 @@ +/*- + * 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 _DIRENT_H_ +#define _DIRENT_H_ + +#include <sys/dirent.h> +#include <pthread.h> + +struct __dirent { + struct __dirent * next; + struct dirent data; + pthread_t owner; +}; + +/* definitions for library routines operating on directories. */ +#define DIRBLKSIZ 1024 + +/* structure describing an open directory. */ +typedef struct _dirdesc { + struct __dirent * dd_dp; /* Linked list of struct __dirent pointer */ + int dd_fd; /* file descriptor associated with directory */ + long dd_loc; /* offset in current buffer */ + long dd_size; /* amount of data returned by getdirentries */ + char * dd_buf; /* data buffer */ + int dd_len; /* size of data buffer */ + long dd_seek; /* magic cookie returned by getdirentries */ + void * dd_ddloc; /* Linked list of ddloc structs for telldir/seekdir */ + pthread_mutex_t *dd_lock; /* Lock for open directory structure */ +} DIR; + +#define dirfd(dirp) ((dirp)->dd_fd) + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef KERNEL + +#include <sys/cdefs.h> + +__BEGIN_DECLS +DIR * opendir __P_((const char *)); +struct dirent * readdir __P_((DIR *)); +int readdir_r __P_((DIR *, struct dirent *, struct dirent **)); +void rewinddir __P_((DIR *)); +int closedir __P_((DIR *)); +#ifndef _POSIX_SOURCE +long telldir __P_((DIR *)); +void seekdir __P_((DIR *, long)); + +/* +int scandir __P_((const char *, struct dirent ***, + int (*)(struct dirent *), + int (*)(const void *, const void *))); +int alphasort __P_((const void *, const void *)); +int getdirentries __P_((int, char *, int, long *)); +*/ +#endif /* not POSIX */ + +__END_DECLS + +#endif /* !KERNEL */ + +#endif /* !_DIRENT_H_ */ diff --git a/lib/libpthread/include/endian.h b/lib/libpthread/include/endian.h new file mode 100644 index 00000000000..8fb947dbd33 --- /dev/null +++ b/lib/libpthread/include/endian.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1983, 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. + * + * @(#)nameser.h 8.2 (Berkeley) 2/16/94 + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * --Copyright-- + */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +#ifndef BYTE_ORDER +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ +#define __LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define __BIG_ENDIAN 4321 +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ +#define __PDP_ENDIAN 3412 + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ + defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ + defined(__alpha__) || defined(__alpha) +#define BYTE_ORDER LITTLE_ENDIAN +#define __BYTE_ORDER LITTLE_ENDIAN +#endif + +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || \ + defined(apollo) || defined(hp9000) || defined(hp9000s300) || \ + defined(hp9000s800) || \ + defined (BIT_ZERO_ON_LEFT) +#define BYTE_ORDER BIG_ENDIAN +#define __BYTE_ORDER BIG_ENDIAN +#endif +#endif /* BYTE_ORDER */ + +#if !defined(BYTE_ORDER) || (BYTE_ORDER != BIG_ENDIAN \ + && BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + #error "Undefined or invalid BYTE_ORDER"; +#endif + +#endif /* !_ENDIAN_H */ diff --git a/lib/libpthread/include/errno.h b/lib/libpthread/include/errno.h new file mode 100644 index 00000000000..24b005e9369 --- /dev/null +++ b/lib/libpthread/include/errno.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1982, 1986, 1989 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: @(#)errno.h 7.13 (Berkeley) 2/19/91 + * errno.h,v 1.3 1993/05/20 16:22:09 cgd Exp + */ + +#ifndef _ERRNO_H_ +#define _ERRNO_H_ + +#include <sys/cdefs.h> +#include <sys/errno.h> + +__BEGIN_DECLS + +extern int * __error(); + +__END_DECLS + +#define errno (* __error()) +#define pthread_errno(x) pthread_run->error_p = x + +#endif /* _ERRNO_H_ */ diff --git a/lib/libpthread/include/math.h b/lib/libpthread/include/math.h new file mode 100644 index 00000000000..d5963ce6023 --- /dev/null +++ b/lib/libpthread/include/math.h @@ -0,0 +1,85 @@ +#ifndef _MATH_H_ +#define _MATH_H_ + +/* Needed for HUGE_VAL */ +#include <sys/__math.h> + +/* XOPEN/SVID */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +#define M_E 2.7182818284590452354 /* e */ +#define M_LOG2E 1.4426950408889634074 /* log 2e */ +#define M_LOG10E 0.43429448190325182765 /* log 10e */ +#define M_LN2 0.69314718055994530942 /* log e2 */ +#define M_LN10 2.30258509299404568402 /* log e10 */ +#define M_PI 3.14159265358979323846 /* pi */ +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + +#define MAXFLOAT ((float)3.40282346638528860e+38) + +#if !defined(_XOPEN_SOURCE) + +struct exception { + int type; + char *name; + double arg1; + double arg2; + double retval; +}; + +#define HUGE MAXFLOAT + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +#endif /* !_XOPEN_SOURCE */ +#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ + +#include <sys/cdefs.h> + +/* ANSI/POSIX */ + +__BEGIN_DECLS + +double hypot __P_((double, double)); +double acos __P_((double)); +double asin __P_((double)); +double atan __P_((double)); +double atan2 __P_((double, double)); +double cos __P_((double)); +double sin __P_((double)); +double tan __P_((double)); + +double cosh __P_((double)); +double sinh __P_((double)); +double tanh __P_((double)); + +double exp __P_((double)); +double frexp __P_((double, int *)); +double ldexp __P_((double, int)); +double log __P_((double)); +double log10 __P_((double)); +double modf __P_((double, double *)); + +double pow __P_((double, double)); +double sqrt __P_((double)); + +double ceil __P_((double)); +double fabs __P_((double)); +double floor __P_((double)); +double fmod __P_((double, double)); +double rint __P_((double)); /* XOPEN; Added by Monty */ +int finite __P_((double dsrc)); /* math.h; added by Monty */ +__END_DECLS + +#endif /* _MATH_H_ */ diff --git a/lib/libpthread/include/netdb.h b/lib/libpthread/include/netdb.h new file mode 100644 index 00000000000..12ecef51a8e --- /dev/null +++ b/lib/libpthread/include/netdb.h @@ -0,0 +1,146 @@ +/*- + * Copyright (c) 1980, 1983, 1988 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: @(#)netdb.h 5.15 (Berkeley) 4/3/91 + * $Id: netdb.h,v 1.1 1998/07/21 13:19:05 peter Exp $ + */ + +#ifndef _NETDB_H_ +#define _NETDB_H_ + +#include <stdio.h> +#include <sys/types.h> +#include <netinet/in.h> + +#define _PATH_HEQUIV "/etc/hosts.equiv" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" +#define __NETDB_MAXALIASES 35 +#define __NETDB_MAXADDRS 35 + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + unsigned long n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +void endhostent __P_((void)); +void endnetent __P_((void)); +void endprotoent __P_((void)); +void endservent __P_((void)); +struct hostent *gethostbyaddr __P_((const char *, int, int)); +struct hostent *gethostbyname __P_((const char *)); +struct hostent *gethostent __P_((void)); +struct netent *getnetbyaddr __P_((long, int)); /* u_long? */ +struct netent *getnetbyname __P_((const char *)); +struct netent *getnetent __P_((void)); +struct protoent *getprotobyname __P_((const char *)); +struct protoent *getprotobynumber __P_((int)); +struct protoent *getprotoent __P_((void)); +struct servent *getservbyname __P_((const char *, const char *)); +struct servent *getservbyport __P_((int, const char *)); +struct servent *getservent __P_((void)); +void herror __P_((const char *)); +char *hstrerror __P_((int)); +void sethostent __P_((int)); +void setnetent __P_((int)); +void setprotoent __P_((int)); +void setservent __P_((int)); +struct hostent *gethostbyaddr_r __P_((const char *, int, int, + struct hostent *, char *, int, int *)); +struct hostent *gethostbyname_r __P_((const char *, struct hostent *, char *, + int, int *)); +struct hostent *gethostent_r __P_((struct hostent *, char *, int, int *)); +struct netent *getnetbyaddr_r __P_((long, int, struct netent *, char *, int)); +struct netent *getnetbyname_r __P_((const char *, struct netent *, char *, + int)); +struct netent *getnetent_r __P_((struct netent *, char *, int)); +struct protoent *getprotobyname_r __P_((const char *, struct protoent *, char *, + int)); +struct protoent *getprotobynumber_r __P_((int, struct protoent *, char *, int)); +struct protoent *getprotoent_r __P_((struct protoent *, char *, int)); +struct servent *getservbyname_r __P_((const char *, const char *, + struct servent *, char *, int)); +struct servent *getservbyport_r __P_((int, const char *, struct servent *, + char *, int)); +struct servent *getservent_r __P_((struct servent *, char *, int)); +__END_DECLS + +#endif /* !_NETDB_H_ */ diff --git a/lib/libpthread/include/pthread/ac-types.h b/lib/libpthread/include/pthread/ac-types.h new file mode 100755 index 00000000000..f21fc6806e4 --- /dev/null +++ b/lib/libpthread/include/pthread/ac-types.h @@ -0,0 +1,11 @@ +#ifndef pthread_size_t +#define pthread_ipaddr_type unsigned long +#define pthread_ipport_type unsigned short +#define pthread_clock_t long +#define pthread_size_t unsigned int +#define pthread_ssize_t int +#define pthread_time_t long +#define pthread_fpos_t long +#define pthread_off_t long +#define pthread_va_list void * +#endif diff --git a/lib/libpthread/include/pthread/cleanup.h b/lib/libpthread/include/pthread/cleanup.h new file mode 100755 index 00000000000..720f2d55445 --- /dev/null +++ b/lib/libpthread/include/pthread/cleanup.h @@ -0,0 +1,59 @@ +/* ==== cleanup.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: cleanup.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : cleanup header. + * + * 1.20 94/02/13 proven + * -Started coding this file. + */ + +/* + * New cleanup structures + */ +struct pthread_cleanup { + struct pthread_cleanup *next; + void (*routine)(); + void *routine_arg; +}; + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_cleanup_push __P_((void (*routine)(void *), void *routine_arg)); +void pthread_cleanup_pop __P_((int execute)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/cond.h b/lib/libpthread/include/pthread/cond.h new file mode 100755 index 00000000000..28c283b75f4 --- /dev/null +++ b/lib/libpthread/include/pthread/cond.h @@ -0,0 +1,100 @@ +/* ==== cond.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: cond.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : Condition variable header. + * + * 1.00 93/10/30 proven + * -Started coding this file. + */ + +#include <timers.h> + +/* + * New cond structures + */ +enum pthread_condtype { + COND_TYPE_FAST, + COND_TYPE_STATIC_FAST, + COND_TYPE_COUNTING_FAST, /* Used with MUTEX_TYPE_COUNTING_FAST */ + COND_TYPE_METERED, + COND_TYPE_DEBUG, /* Debug conds will have lots of options */ + COND_TYPE_MAX +}; + +#define PTHREAD_CONDTYPE_FAST 1 +#define PTHREAD_CONDTYPE_DEBUG 4 +#define PTHREAD_CONDTYPE_RECURSIVE 2 + +typedef struct pthread_cond { + enum pthread_condtype c_type; + struct pthread_queue c_queue; + semaphore c_lock; + void * c_data; + long c_flags; +} pthread_cond_t; + +typedef struct pthread_condattr { + enum pthread_condtype c_type; + long c_flags; +} pthread_condattr_t; + +/* + * Flags for conds. + */ +#define COND_FLAGS_PRIVATE 0x01 +#define COND_FLAGS_INITED 0x02 +#define COND_FLAGS_BUSY 0x04 + +/* + * Static cond initialization values. + */ +#define PTHREAD_COND_INITIALIZER \ +{ COND_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ + SEMAPHORE_CLEAR, NULL, COND_FLAGS_INITED } + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_cond_init __P_((pthread_cond_t *, const pthread_condattr_t *)); +int pthread_cond_timedwait __P_((pthread_cond_t *, pthread_mutex_t *, + const struct timespec * abstime)); +int pthread_cond_wait __P_((pthread_cond_t *, pthread_mutex_t *)); +int pthread_cond_signal __P_((pthread_cond_t *)); +int pthread_cond_broadcast __P_((pthread_cond_t *)); +int pthread_cond_destroy __P_((pthread_cond_t *)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/config.h b/lib/libpthread/include/pthread/config.h new file mode 100755 index 00000000000..d944b14a8c6 --- /dev/null +++ b/lib/libpthread/include/pthread/config.h @@ -0,0 +1,4 @@ +#ifndef _SYS___CONFIG_H_ +#define _SYS___CONFIG_H_ +#define _OS_HAS_TIMESPEC 1 +#endif diff --git a/lib/libpthread/include/pthread/debug_out.h b/lib/libpthread/include/pthread/debug_out.h new file mode 100755 index 00000000000..6968c5ea90e --- /dev/null +++ b/lib/libpthread/include/pthread/debug_out.h @@ -0,0 +1,44 @@ +/* debug_out.h - macros to use for debugging prints in places where calls + to printf() and gang are ill-advised. */ + +#ifdef PTHREAD_DEBUGGING +#define PTHREAD_DEBUG_WriteStr(S) (void)machdep_sys_write(2,S,strlen(S)) +#define PTHREAD_DEBUG_WriteInt32Hex(X) \ + { char _xbuf[8]; int _temp = (int)(X), _temp2; \ + _temp2 = ((_temp>>28)&0xf); \ + _xbuf[0] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>24)&0xf); \ + _xbuf[1] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>20)&0xf); \ + _xbuf[2] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>16)&0xf); \ + _xbuf[3] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>12)&0xf); \ + _xbuf[4] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>8)&0xf); \ + _xbuf[5] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = ((_temp>>4)&0xf); \ + _xbuf[6] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + _temp2 = (_temp&0xf); \ + _xbuf[7] = (_temp2<10)? (_temp2+'0'): ((_temp2-10)+'a'); \ + (void)machdep_sys_write(2,_xbuf,8); \ + } +#ifdef __alpha +#define PTHREAD_DEBUG_WriteInt64Hex(X) \ + { long _tempX = (long)(X),_tempY; \ + _tempY=((_tempX>>32)&0xffffffff); \ + PTHREAD_DEBUG_WriteInt32Hex(_tempY); \ + _tempY=(_tempX&0xffffffff); \ + PTHREAD_DEBUG_WriteInt32Hex(_tempY); \ + } +#define PTHREAD_DEBUG_WritePointer(X) PTHREAD_DEBUG_WriteInt64Hex(X) +#else +#define PTHREAD_DEBUG_WriteInt64Hex(X) PTHREAD_DEBUG_WriteInt32Hex(X) +#define PTHREAD_DEBUG_WritePointer(X) PTHREAD_DEBUG_WriteInt32Hex(X) +#endif /* __alpha */ +#else /* ! PTHREAD_DEBUGGING */ +#define PTHREAD_DEBUG_WriteStr(S) +#define PTHREAD_DEBUG_WriteInt32Hex(X) +#define PTHREAD_DEBUG_WriteInt64HeX(X) +#define PTHREAD_DEBUG_WritePointer(X) +#endif /* PTHREAD_DEBUGGING */ diff --git a/lib/libpthread/include/pthread/fd.h b/lib/libpthread/include/pthread/fd.h new file mode 100755 index 00000000000..28e55935812 --- /dev/null +++ b/lib/libpthread/include/pthread/fd.h @@ -0,0 +1,122 @@ +/* ==== fd.h ============================================================ + * Copyright (c) 1993, 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: fd.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : Basic fd header. + * + * 1.00 93/08/14 proven + * -Started coding this file. + * + * 1.01 93/11/13 proven + * -The functions readv() and writev() added + */ + +/* + * New pthread types. + */ +enum fd_type { + FD_NT, /* Not tested */ + FD_NIU, /* Known to be not in use */ + FD_HALF_DUPLEX, /* Files, and seeking devices */ + FD_FULL_DUPLEX, /* pipes, sockets, drivers, ... */ + FD_TEST_HALF_DUPLEX, /* Redo machdep_sys_fcntl */ + FD_TEST_FULL_DUPLEX /* Redo machdep_sys_fcntl */ +}; + + +#define FD_READ 0x1 +#define FD_WRITE 0x2 +#define FD_RDWR (FD_READ | FD_WRITE) + +union fd_data { + void *ptr; + int i; +}; + +struct timespec; +struct iovec; +struct fd_ops { + pthread_ssize_t (*write) __P_((union fd_data, int, const void *, + size_t, struct timespec *)); + pthread_ssize_t (*read) __P_((union fd_data, int, void *, size_t, + struct timespec *)); + int (*close)(); + int (*fcntl)(); + int (*writev) __P_((union fd_data, int, + const struct iovec *, + int, struct timespec *)); + int (*readv) __P_((union fd_data, int, + const struct iovec *, + int, struct timespec *)); + off_t (*seek)(); + int use_kfds; +}; + +struct fd_table_entry { + struct pthread_queue r_queue; + struct pthread_queue w_queue; + struct pthread *r_owner; + struct pthread *w_owner; + pthread_mutex_t mutex; + struct fd_table_entry *next; + struct fd_ops *ops; + enum fd_type type; + int r_lockcount; /* Count for FILE read locks */ + int w_lockcount; /* Count for FILE write locks */ + int count; + + /* data that needs to be passed to the type dependent fd */ + int flags; + union fd_data fd; +}; + +/* + * Globals + */ +#if defined(PTHREAD_KERNEL) + +extern struct fd_table_entry **fd_table; +extern int dtablesize; + +#endif + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(PTHREAD_KERNEL) + +#endif + +__END_DECLS diff --git a/lib/libpthread/include/pthread/fd_pipe.h b/lib/libpthread/include/pthread/fd_pipe.h new file mode 100755 index 00000000000..1561eeb6a7e --- /dev/null +++ b/lib/libpthread/include/pthread/fd_pipe.h @@ -0,0 +1,54 @@ +/* ==== fd_pipe.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: fd_pipe.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : The new fast ITC pipe header. + * + * 1.00 93/08/14 proven + * -Started coding this file. + */ + +struct __pipe { + semaphore lock; + char * buf; + int size; + int flags; + int count; + int offset; + struct pthread * wait; + char * wait_buf; + size_t wait_size; +}; + +#define RD_CLOSED 0x01 +#define WR_CLOSED 0x02 + diff --git a/lib/libpthread/include/pthread/kernel.h b/lib/libpthread/include/pthread/kernel.h new file mode 100755 index 00000000000..71518becced --- /dev/null +++ b/lib/libpthread/include/pthread/kernel.h @@ -0,0 +1,71 @@ +/* ==== kernel.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: kernel.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/07/22 proven + * -Started coding this file. + */ + +/* + * Defines only for the pthread user kernel. + */ +#if defined(PTHREAD_KERNEL) + +#ifdef __GNUC__ +#include <assert.h> +#endif +#ifdef __ASSERT_FUNCTION +#define PANIC() panic_kernel( __FILE__, __LINE__, __ASSERT_FUNCTION ) +#else +#define PANIC() panic_kernel( __FILE__, __LINE__, (const char *)0 ) +#endif + + +/* Time each rr thread gets */ +#define PTHREAD_RR_TIMEOUT 100000000 + +/* Set the errno value */ +#define SET_ERRNO(x) \ +{ \ + if (!pthread_run->error_p) { \ + pthread_run->error_p = &pthread_run->error; \ + } \ + (*(pthread_run->error_p)) = x; \ +} + +/* Globals only the internals should see */ +extern struct pthread_prio_queue * pthread_current_prio_queue; +extern volatile int pthread_kernel_lock; + +#endif diff --git a/lib/libpthread/include/pthread/kthread.h b/lib/libpthread/include/pthread/kthread.h new file mode 100755 index 00000000000..e9eed520ae9 --- /dev/null +++ b/lib/libpthread/include/pthread/kthread.h @@ -0,0 +1,67 @@ +/* ==== kthread.h ============================================================ + * Copyright (c) 1993, 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: kthread.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : Basic pthread header. + * + * 1.00 93/07/20 proven + * -Started coding this file. + * + * 1.32 94/05/25 proven + * -Started adding kernel thread support + */ + +#ifndef _KTHREAD_H_ +#define _KTHREAD_H_ + +enum kthread_state { + KS_RUNNING, + KS_DEAD, +}; + +struct kthread { + enum kthread_state state; + + struct pthread_queue pthread_current_queue; + struct pthread * pthread_link_list; + struct pthread * pthread_run; + + semaphore lock; + +}; + +/* + * Globals + */ +extern struct kthread * kthread_link_list; + +#endif diff --git a/lib/libpthread/include/pthread/mutex.h b/lib/libpthread/include/pthread/mutex.h new file mode 100755 index 00000000000..273ae461e69 --- /dev/null +++ b/lib/libpthread/include/pthread/mutex.h @@ -0,0 +1,102 @@ +/* ==== mutex.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: mutex.h,v 1.1 1998/07/21 13:19:11 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +/* + * New mutex structures + */ +enum pthread_mutextype { + MUTEX_TYPE_STATIC_FAST = 0, + MUTEX_TYPE_FAST = 1, + MUTEX_TYPE_COUNTING_FAST = 2, /* Recursive */ + MUTEX_TYPE_METERED = 3, + MUTEX_TYPE_DEBUG = 4, /* This will have lots of options */ + MUTEX_TYPE_MAX +}; + +#define PTHREAD_MUTEXTYPE_FAST 1 +#define PTHREAD_MUTEXTYPE_DEBUG 4 +#define PTHREAD_MUTEXTYPE_RECURSIVE 2 + +union pthread_mutex_data { + void * m_ptr; + int m_count; +}; + +typedef struct pthread_mutex { + enum pthread_mutextype m_type; + struct pthread_queue m_queue; + struct pthread * m_owner; + semaphore m_lock; + union pthread_mutex_data m_data; + long m_flags; +} pthread_mutex_t; + +typedef struct pthread_mutexattr { + enum pthread_mutextype m_type; + long m_flags; +} pthread_mutexattr_t; + +/* + * Flags for mutexes. + */ +#define MUTEX_FLAGS_PRIVATE 0x01 +#define MUTEX_FLAGS_INITED 0x02 +#define MUTEX_FLAGS_BUSY 0x04 + +/* + * Static mutex initialization values. + */ +#define PTHREAD_MUTEX_INITIALIZER \ +{ MUTEX_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ + NULL, SEMAPHORE_CLEAR, { NULL }, MUTEX_FLAGS_INITED } + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_mutex_init __P_((pthread_mutex_t *, const pthread_mutexattr_t *)); +int pthread_mutex_lock __P_((pthread_mutex_t *)); +int pthread_mutex_unlock __P_((pthread_mutex_t *)); +int pthread_mutex_trylock __P_((pthread_mutex_t *)); +int pthread_mutex_destroy __P_((pthread_mutex_t *)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/paths.h b/lib/libpthread/include/pthread/paths.h new file mode 100755 index 00000000000..3d695546bc3 --- /dev/null +++ b/lib/libpthread/include/pthread/paths.h @@ -0,0 +1,12 @@ +#ifndef _SYS___PATHS_H_ +#define _SYS___PATHS_H_ +#define _PATH_PTY "/devices/pseudo/" +#define _PATH_TZDIR "/usr/share/lib/zoneinfo" +#define _PATH_TZFILE "/usr/share/lib/zoneinfo/localtime" +#define _PATH_RESCONF "/etc/resolv.conf" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" +#define _PATH_BSHELL "/bin/sh" +#endif diff --git a/lib/libpthread/include/pthread/prio_queue.h b/lib/libpthread/include/pthread/prio_queue.h new file mode 100755 index 00000000000..d9c84ad25ed --- /dev/null +++ b/lib/libpthread/include/pthread/prio_queue.h @@ -0,0 +1,78 @@ +/* ==== priority.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: prio_queue.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Priority functions. + * + * 1.00 94/09/19 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_PRIO_QUEUE_H_ +#define _PTHREAD_PRIO_QUEUE_H_ + +/* + * Static queue initialization values. + */ +#define PTHREAD_DEFAULT_PRIORITY 64 +#define PTHREAD_MAX_PRIORITY 126 +#define PTHREAD_MIN_PRIORITY 0 + +/* + * New prio_queue structures + */ +struct pthread_prio_level { + struct pthread * first; + struct pthread * last; +}; + +struct pthread_prio_queue { + void * data; + struct pthread * next; + struct pthread_prio_level level[PTHREAD_MAX_PRIORITY + 1]; +}; + +/* + * New functions + */ + +__BEGIN_DECLS + +void pthread_prio_queue_init __P_((struct pthread_prio_queue *)); +void pthread_prio_queue_enq __P_((struct pthread_prio_queue *, + struct pthread *)); +struct pthread *pthread_prio_queue_deq + __P_((struct pthread_prio_queue *)); + +__END_DECLS + +#endif diff --git a/lib/libpthread/include/pthread/pthread_attr.h b/lib/libpthread/include/pthread/pthread_attr.h new file mode 100755 index 00000000000..2602c1fa9c2 --- /dev/null +++ b/lib/libpthread/include/pthread/pthread_attr.h @@ -0,0 +1,122 @@ +/* ==== pthread_attr.h ======================================================== + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: pthread_attr.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Basic pthread attributes header. + * + * 1.00 93/11/03 proven + * -Started coding this file. + */ + +#define _POSIX_THREAD_ATTR_STACKSIZE + +#define PTHREAD_STACK_DEFAULT 65536 + +/* flags */ +#define PTHREAD_DETACHED 0x1 +#define PTHREAD_SCOPE_SYSTEM 0x2 +#define PTHREAD_INHERIT_SCHED 0x4 +#define PTHREAD_NOFLOAT 0x8 + +#define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED +#define PTHREAD_CREATE_JOINABLE 0 +#define PTHREAD_SCOPE_PROCESS 0 +#define PTHREAD_EXPLICIT_SCHED 0 + +/* + * New pthread attribute types. + */ +enum schedparam_policy { + SCHED_RR, + SCHED_IO, + SCHED_FIFO, + SCHED_OTHER +}; + +struct pthread_attr { + enum schedparam_policy schedparam_policy; + int sched_priority; + + int flags; + void * arg_attr; + void (*cleanup_attr)(); + void * stackaddr_attr; + size_t stacksize_attr; +}; + +struct sched_param { + int sched_priority; + void * no_data; +}; + +/* + * New functions + */ + +__BEGIN_DECLS + +#if defined(DCE_COMPAT) + +typedef struct pthread_attr * pthread_attr_t; + +int pthread_attr_create __P_((pthread_attr_t *)); +int pthread_attr_delete __P_((pthread_attr_t *)); + +#else + +typedef struct pthread_attr pthread_attr_t; + +int pthread_attr_init __P_((pthread_attr_t *)); +int pthread_attr_destroy __P_((pthread_attr_t *)); +int pthread_attr_setstacksize __P_((pthread_attr_t *, size_t)); +int pthread_attr_getstacksize __P_((pthread_attr_t *, size_t *)); +int pthread_attr_setstackaddr __P_((pthread_attr_t *, void *)); +int pthread_attr_getstackaddr __P_((pthread_attr_t *, void **)); +int pthread_attr_setdetachstate __P_((pthread_attr_t *, int )); +int pthread_attr_getdetachstate __P_((pthread_attr_t *, int *)); +int pthread_attr_setscope __P_((pthread_attr_t *, int )); +int pthread_attr_getscope __P_((pthread_attr_t *, int *)); +int pthread_attr_setinheritsched __P_((pthread_attr_t *, int )); +int pthread_attr_getinheritsched __P_((pthread_attr_t *, int *)); +int pthread_attr_setschedpolicy __P_((pthread_attr_t *, int )); +int pthread_attr_getschedpolicy __P_((pthread_attr_t *, int *)); +int pthread_attr_setschedparam __P_((pthread_attr_t *, struct sched_param *)); +int pthread_attr_getschedparam __P_((pthread_attr_t *, struct sched_param *)); + +int pthread_attr_setfloatstate __P_((pthread_attr_t *, int )); +int pthread_attr_getfloatstate __P_((pthread_attr_t *, int *)); +int pthread_attr_setcleanup __P_((pthread_attr_t *, void (*routine)(void *), + void *)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/include/pthread/pthread_once.h b/lib/libpthread/include/pthread/pthread_once.h new file mode 100755 index 00000000000..a9395c0f7fe --- /dev/null +++ b/lib/libpthread/include/pthread/pthread_once.h @@ -0,0 +1,58 @@ +/* ==== pthread_once.h ======================================================== + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: pthread_once.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/12/12 proven + * -Started coding this file. + */ + +/* New pthread_once structures */ +typedef struct pthread_once { + int state; + pthread_mutex_t mutex; +} pthread_once_t; + +/* Static pthread_once_t initialization value. */ +#define PTHREAD_NEEDS_INIT 0 +#define PTHREAD_DONE_INIT 1 +#define PTHREAD_ONCE_INIT { PTHREAD_NEEDS_INIT, PTHREAD_MUTEX_INITIALIZER } + +/* New functions */ + +__BEGIN_DECLS + +int pthread_once __P_((pthread_once_t *, void (*init_routine)(void))); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/queue.h b/lib/libpthread/include/pthread/queue.h new file mode 100755 index 00000000000..0d7d2d219e3 --- /dev/null +++ b/lib/libpthread/include/pthread/queue.h @@ -0,0 +1,67 @@ +/* ==== queue.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: queue.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : mutex header. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +/* + * New queue structures + */ +struct pthread_queue { + struct pthread *q_next; + struct pthread *q_last; + void *q_data; +}; + +/* + * Static queue initialization values. + */ +#define PTHREAD_QUEUE_INITIALIZER { NULL, NULL, NULL } + +/* + * New functions + * Should make pthread_queue_get a macro + */ + +__BEGIN_DECLS + +void pthread_queue_init __P_((struct pthread_queue *)); +void pthread_queue_enq __P_((struct pthread_queue *, struct pthread *)); +int pthread_queue_remove __P_((struct pthread_queue *, struct pthread *)); +struct pthread *pthread_queue_get __P_((struct pthread_queue *)); +struct pthread *pthread_queue_deq __P_((struct pthread_queue *)); + +__END_DECLS diff --git a/lib/libpthread/include/pthread/sleep.h b/lib/libpthread/include/pthread/sleep.h new file mode 100755 index 00000000000..9f8f2dccd95 --- /dev/null +++ b/lib/libpthread/include/pthread/sleep.h @@ -0,0 +1,63 @@ +/* ==== sleep.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: sleep.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : sleep header. + * + * 1.00 94/06/04 proven + * -Started coding this file. + */ + +#if defined(PTHREAD_KERNEL) + +#include <timers.h> + +/* + * New functions + */ +static inline int machdep_gettimeofday(struct timespec * current_time) +{ + struct timeval current_real_time; + int ret; + + ret = gettimeofday(¤t_real_time, NULL); + TIMEVAL_TO_TIMESPEC((¤t_real_time), current_time); + return(ret); +} + +__BEGIN_DECLS + +void sleep_schedule __P_((struct timespec *, struct timespec *)); + +__END_DECLS + +#endif diff --git a/lib/libpthread/include/pthread/specific.h b/lib/libpthread/include/pthread/specific.h new file mode 100755 index 00000000000..6757ceeb08e --- /dev/null +++ b/lib/libpthread/include/pthread/specific.h @@ -0,0 +1,66 @@ +/* ==== specific.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: specific.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Thread specific data management header. + * + * 1.20 94/03/30 proven + * -Started coding this file. + */ + +#define PTHREAD_DATAKEYS_MAX 256 +#define _POSIX_THREAD_DESTRUTOR_ITERATIONS 4 + +/* + * New thread specific key type. + */ +struct pthread_key { + pthread_mutex_t mutex; + long count; + void (*destructor)(); +}; + +typedef int pthread_key_t; + +/* + * New functions + */ + +__BEGIN_DECLS + +int pthread_key_create __P_((pthread_key_t *, void (*routine)(void *))); +int pthread_setspecific __P_((pthread_key_t, const void *)); +void *pthread_getspecific __P_((pthread_key_t)); +int pthread_key_delete __P_((pthread_key_t)); + +__END_DECLS + diff --git a/lib/libpthread/include/pthread/state.def b/lib/libpthread/include/pthread/state.def new file mode 100755 index 00000000000..c62d102a9f0 --- /dev/null +++ b/lib/libpthread/include/pthread/state.def @@ -0,0 +1,64 @@ +/* This file defines the states that a given thread can be in. + + The funky macro use here is so that this one header file can also + define the corresponding state names, so that the two lists can't + get inconsistent within a given source tree. */ + +/* The thread is runnable. */ +__pthread_defstate (PS_RUNNING, "running") + +/* + * The rest of the states are where the thread is waiting on some event. + * Someday maybe the "data" field will point to the object being waited for. + */ + +/* Waiting for a mutex (pthread_mutex_lock()). */ +__pthread_defstate (PS_MUTEX_WAIT, "mutex") + +/* Waiting on a condition variable + (pthread_cond_wait(), or pthread_cond_timedwait()). */ +__pthread_defstate (PS_COND_WAIT, "cond") + +/* + * File descriptor stuff. + * + * File descriptors have a special lock. If it is a FULL_DUPLEX fd such as + * a socket or fifo then it has two mutexes, one for reads and one for writes. + * Some routines will even try to get both. It will always try to get the + * read lock first before tring to get the write. All other fds only have + * one mutex which all calls will get. It is displayed as if it is a read lock. + */ +/* Waiting on a fd read lock (fd_lock()) */ +__pthread_defstate (PS_FDLR_WAIT, "fdlr") + +/* Waiting on a fd write lock (fd_lock()) */ +__pthread_defstate (PS_FDLW_WAIT, "fdlw") + +/* Waiting for the kernel fd to have data to read, + (read(), readv(), recv(), recvfrom(), and recvmsg()). */ +__pthread_defstate (PS_FDR_WAIT, "fdr") /* Waiting on a kernel read */ + +/* Waiting for the kernel fd to allow a write + (write(), writev(), send(), sendto(), sendmsg()) */ +__pthread_defstate (PS_FDW_WAIT, "fdw") + +/* Waiting for several fds in a select() */ +__pthread_defstate (PS_SELECT_WAIT, "select") + +/* Waiting on a sleep (sleep(), usleep() or nanosleep()). */ +__pthread_defstate (PS_SLEEP_WAIT, "sleep") + +/* Waiting for a child to die (wait(), waitpid(), wait3(), or wait4()). */ +__pthread_defstate (PS_WAIT_WAIT, "wait") + +/* Waiting on some set of signals (sigwait()) */ +__pthread_defstate (PS_SIGWAIT, "sig") + +/* Waiting for a thread to die (pthread_join()) */ +__pthread_defstate (PS_JOIN, "join") + +/* Waiting for some thread to join with me or detach me */ +__pthread_defstate (PS_DEAD, "dead") + +/* Waiting for some thread to create me */ +__pthread_defstate (PS_UNALLOCED, "unallocated") diff --git a/lib/libpthread/include/pthread/types.h b/lib/libpthread/include/pthread/types.h new file mode 100755 index 00000000000..7fdf001a0bc --- /dev/null +++ b/lib/libpthread/include/pthread/types.h @@ -0,0 +1,46 @@ +#ifndef pthread_types_h +#define pthread_types_h + +#include <pthread/xtypes.h> +#include <pthread/ac-types.h> + +#if !defined (pthread_va_list) && defined (__NetBSD__) +#include <stdarg.h> +#define pthread_va_list _BSD_VA_LIST_ +#endif + +#if !defined (pthread_va_list) && defined (__GNUC__) +#define __need_va_list +#include <stdarg.h> +#define pthread_va_list __gnuc_va_list +#endif /* pthread_va_list, __GNUC__ */ + +/* OSF/1 does it this way. */ +#if !defined (pthread_va_list) && defined (pthread_have_va_list_h) +#ifndef _VA_LIST +#define _HIDDEN_VA_LIST +#include <va_list.h> +#define pthread_va_list __va_list +#else +/* va_list has already been defined */ +#define pthread_va_list va_list +#endif +#endif + +/* If all else fails... */ +#ifndef pthread_va_list +#include <stdarg.h> +#define pthread_va_list va_list +#endif + +#if defined(__STDC__) || defined(__GNUC__) +#ifndef __P_ +#define __P_(protos) protos +#endif +#else +#ifndef __P_ +#define __P_(protos) +#endif +#endif + +#endif /* pthread_types_h */ diff --git a/lib/libpthread/include/pthread/unistd.h b/lib/libpthread/include/pthread/unistd.h new file mode 100755 index 00000000000..3cb07533114 --- /dev/null +++ b/lib/libpthread/include/pthread/unistd.h @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 1991 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. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +void _exit __P_((int)); +int access __P_((const char *, int)); +int chdir __P_((const char *)); +int chown __P_((const char *, uid_t, gid_t)); +int close __P_((int)); +int dup __P_((int)); +int dup2 __P_((int, int)); +int execve __P_((const char *, char * const *, char * const *)); +pid_t fork __P_((void)); +int isatty __P_((int)); +int link __P_((const char *, const char *)); +off_t lseek __P_((int, off_t, int)); +int pipe __P_((int *)); +ssize_t read __P_((int, void *, size_t)); +u_int sleep __P_((u_int)); +char *ttyname __P_((int)); +int unlink __P_((const char *)); +ssize_t write __P_((int, const void *, size_t)); + +/* Not implemented for threads yet */ +u_int alarm __P_((u_int)); +char *cuserid __P_((char *)); +int execl __P_((const char *, const char *, ...)); +int execle __P_((const char *, const char *, ...)); +int execlp __P_((const char *, const char *, ...)); +int execv __P_((const char *, char * const *)); +int execvp __P_((const char *, char * const *)); +long fpathconf __P_((int, int)); /* not yet */ +char *getcwd __P_((char *, size_t)); +gid_t getegid __P_((void)); +uid_t geteuid __P_((void)); +gid_t getgid __P_((void)); +int getgroups __P_((int, int *)); /* XXX (gid_t *) */ +char *getlogin __P_((void)); +pid_t getpgrp __P_((void)); +pid_t getpid __P_((void)); +pid_t getppid __P_((void)); +uid_t getuid __P_((void)); +long pathconf __P_((const char *, int)); /* not yet */ +int pause __P_((void)); +int rmdir __P_((const char *)); +int setgid __P_((gid_t)); +int setpgid __P_((pid_t, pid_t)); +pid_t setsid __P_((void)); +int setuid __P_((uid_t)); +long sysconf __P_((int)); /* not yet */ +pid_t tcgetpgrp __P_((int)); +int tcsetpgrp __P_((int, pid_t)); + +#ifndef _POSIX_SOURCE + +int acct __P_((const char *)); +int async_daemon __P_((void)); +char *brk __P_((const char *)); +int chflags __P_((const char *, long)); +int chroot __P_((const char *)); +char *crypt __P_((const char *, const char *)); +int des_cipher __P_((const char *, char *, long, int)); +int des_setkey __P_((const char *key)); +int encrypt __P_((char *, int)); +void endusershell __P_((void)); +int exect __P_((const char *, char * const *, char * const *)); +int fchdir __P_((int)); +int fchflags __P_((int, long)); +int fchown __P_((int, uid_t, gid_t)); +int fsync __P_((int)); +int ftruncate __P_((int, off_t)); +int getdtablesize __P_((void)); +long gethostid __P_((void)); +int gethostname __P_((char *, int)); +mode_t getmode __P_((const void *, mode_t)); +int getpagesize __P_((void)); +char *getpass __P_((const char *)); +char *getusershell __P_((void)); +char *getwd __P_((char *)); /* obsoleted by getcwd() */ +int initgroups __P_((const char *, int)); +int mknod __P_((const char *, mode_t, dev_t)); +int mkstemp __P_((char *)); +char *mktemp __P_((char *)); +int nfssvc __P_((int)); +int nice __P_((int)); +void psignal __P_((u_int, const char *)); +extern char *sys_siglist[]; +int profil __P_((char *, int, int, int)); +int rcmd __P_((char **, int, const char *, + const char *, const char *, int *)); +char *re_comp __P_((const char *)); +int re_exec __P_((const char *)); +int readlink __P_((const char *, char *, int)); +int reboot __P_((int)); +int revoke __P_((const char *)); +int rresvport __P_((int *)); +int ruserok __P_((const char *, int, const char *, const char *)); +char *sbrk __P_((int)); +int setegid __P_((gid_t)); +int seteuid __P_((uid_t)); +int setgroups __P_((int, const int *)); +void sethostid __P_((long)); +int sethostname __P_((const char *, int)); +int setkey __P_((const char *)); +int setlogin __P_((const char *)); +void *setmode __P_((const char *)); +int setpgrp __P_((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */ +int setregid __P_((int, int)); +int setreuid __P_((int, int)); +int setrgid __P_((gid_t)); +int setruid __P_((uid_t)); +void setusershell __P_((void)); +int swapon __P_((const char *)); +int symlink __P_((const char *, const char *)); +void sync __P_((void)); +int syscall __P_((int, ...)); +int truncate __P_((const char *, off_t)); +int ttyslot __P_((void)); +u_int ualarm __P_((u_int, u_int)); +void usleep __P_((u_int)); +int vfork __P_((void)); + +#endif /* !_POSIX_SOURCE */ +__END_DECLS + diff --git a/lib/libpthread/include/pthread/util.h b/lib/libpthread/include/pthread/util.h new file mode 100755 index 00000000000..c9ff1dbcabd --- /dev/null +++ b/lib/libpthread/include/pthread/util.h @@ -0,0 +1,89 @@ +/* ==== util.h ============================================================ + * Copyright (c) 1991, 1992, 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: util.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Header file for generic utility functions. + * + * 91/08/31 proven - Added exchange. + * Exchange any two objects of any size in any table. + * + * 91/10/06 proven - Cleaned out all the old junk. + * + * 91/03/06 proven - Added getint. + */ + +#ifndef _PTHREAD_UTIL_H +#define _PTHREAD_UTIL_H + +#ifndef NULL +#define NULL 0 +#endif + +/* Stuff only pthread internals really uses */ +#if defined(PTHREAD_KERNEL) + +#undef FALSE +#undef TRUE + +typedef enum Boolean { + FALSE, + TRUE +} Boolean; + +#define OK 0 +#define NUL '\0' +#define NOTOK -1 + +#if ! defined(min) +#define min(a,b) (((a)<(b))?(a):(b)) +#define max(a,b) (((a)>(b))?(a):(b)) +#endif + +/* Alingn the size to the next multiple of 4 bytes */ +#define ALIGN4(size) ((size + 3) & ~3) +#define ALIGN8(size) ((size + 7) & ~7) + +#ifdef DEBUG +#define DEBUG0(s) printf(s) +#define DEBUG1(s,a) printf(s,a) +#define DEBUG2(s,a,b) printf(s,a,b) +#define DEBUG3(s,a,b,c) printf(s,a,b,c) +#else +#define DEBUG0(s) +#define DEBUG1(s) +#define DEBUG2(s) +#define DEBUG3(s) +#endif + +#endif + +#endif diff --git a/lib/libpthread/include/pthread/version.h b/lib/libpthread/include/pthread/version.h new file mode 100755 index 00000000000..ae0cbc6f4cb --- /dev/null +++ b/lib/libpthread/include/pthread/version.h @@ -0,0 +1,43 @@ +/* ==== version.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: version.h,v 1.1 1998/07/21 13:19:12 peter Exp $ + * + * Description : Header file for programs that what to KNOW the version. + * + * 94/08/24 proven - Added this file for pthreads. + */ + +#ifndef _PTHREAD_VERSION_H +#define _PTHREAD_VERSION_H 1 +#define _PTHREAD_VERSION_M 60 +#define _PTHREAD_VERSION_P 0 +#endif diff --git a/lib/libpthread/include/pthread/xtypes.h b/lib/libpthread/include/pthread/xtypes.h new file mode 100755 index 00000000000..4dcc4f04f8c --- /dev/null +++ b/lib/libpthread/include/pthread/xtypes.h @@ -0,0 +1,13 @@ +/* If you need any special typedefs for function pointers &c to try + testing for in configure.in, define them here. */ + +/* According to ANSI, two struct types in the same module are not + compatible types. So there's no way to define a type for + pthread_sigset_t that's compatible with sigset_t when they're + structure types, if we assume we can't pull in a __sigset_t or + something by itself from system header files. + + Since that was my main reason for creating this file, there isn't + anything here now. If after working on this code a bit longer we + don't find anything else to put here, this file should just go + away. */ diff --git a/lib/libpthread/include/pwd.h b/lib/libpthread/include/pwd.h new file mode 100644 index 00000000000..4607080607a --- /dev/null +++ b/lib/libpthread/include/pwd.h @@ -0,0 +1,93 @@ +/*- + * Copyright (c) 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. + * + * from: @(#)pwd.h 8.2 (Berkeley) 1/21/94 + * $Id: pwd.h,v 1.1 1998/07/21 13:19:08 peter Exp $ + */ + +#ifndef _PWD_H_ +#define _PWD_H_ + +#include <sys/types.h> + +#ifndef _POSIX_SOURCE +#define _PATH_PASSWD "/etc/passwd" +#define _PATH_MASTERPASSWD "/etc/master.passwd" + +#define _PATH_MP_DB "/etc/pwd.db" +#define _PATH_SMP_DB "/etc/spwd.db" + +#define _PATH_PWD_MKDB "/usr/sbin/pwd_mkdb" + +#define _PW_KEYBYNAME '1' /* stored by name */ +#define _PW_KEYBYNUM '2' /* stored by entry in the "file" */ +#define _PW_KEYBYUID '3' /* stored by uid */ + +#define _PASSWORD_EFMT1 '_' /* extended encryption format */ + +#define _PASSWORD_LEN 128 /* max length, not counting NULL */ +#endif + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* encrypted password */ + int pw_uid; /* user uid */ + int pw_gid; /* user gid */ + time_t pw_change; /* password change time */ + char *pw_class; /* user access class */ + char *pw_gecos; /* Honeywell login info */ + char *pw_dir; /* home directory */ + char *pw_shell; /* default shell */ + time_t pw_expire; /* account expiration */ +}; + +#include <sys/cdefs.h> + +__BEGIN_DECLS +struct passwd *getpwuid __P_((uid_t)); +struct passwd *getpwnam __P_((const char *)); +#ifndef _POSIX_SOURCE +struct passwd *getpwent __P_((void)); +#ifndef _XOPEN_SOURCE +int setpassent __P_((int)); +#endif +void setpwent __P_((void)); +void endpwent __P_((void)); +#endif +__END_DECLS + +#endif /* !_PWD_H_ */ diff --git a/lib/libpthread/include/resolv.h b/lib/libpthread/include/resolv.h new file mode 100644 index 00000000000..7e2fcc7a5da --- /dev/null +++ b/lib/libpthread/include/resolv.h @@ -0,0 +1,179 @@ +/* + * Copyright (c) 1983, 1987, 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. + * + * from: @(#)resolv.h 5.15 (Berkeley) 4/3/91 + * $Id: resolv.h,v 1.1 1998/07/21 13:19:08 peter Exp $ + */ + +#ifndef _RESOLV_H_ +#define _RESOLV_H_ + +#include <netinet/in.h> +/* + * This is specificly for Solaris which defines NOERROR in the streams + * header files and defines it differently than in arpa/nameser.h + */ +#ifdef NOERROR +#undef NOERROR +#endif +#include <arpa/nameser.h> + +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__RES > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __RES 19940703 + +/* + * Resolver configuration file. + * Normally not present, but may contain the address of the + * inital name server(s) to query and the domain search list. + */ + +#ifndef _PATH_RESCONF +#define _PATH_RESCONF "/etc/resolv.conf" +#endif + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 3 /* max # name servers we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ +#define MAXDNSLUS 4 /* max # of host lookup types */ + +#define RES_TIMEOUT 5 /* min. seconds between retries */ +#define MAXRESOLVSORT 10 /* number of net to sort on */ +#define RES_MAXNDOTS 15 /* should reflect bit field size */ + +struct __res_state { + int retrans; /* retransmition time interval */ + int retry; /* number of times to retransmit */ + long options; /* option flags - see below. */ + int nscount; /* number of name servers */ + struct sockaddr_in nsaddr_list[MAXNS]; /* address of name server */ +#define nsaddr nsaddr_list[0] /* for backward compatibility */ + u_short id; /* current packet id */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ + char defdname[MAXDNAME]; /* default domain */ + long pfcode; /* RES_PRF_ flags - see below. */ + u_char ndots:4; /* threshold for initial abs. query */ + u_char nsort:4; /* number of elements in sort_list[] */ + char unused[3]; + struct { + struct in_addr addr; + u_long mask; + } sort_list[MAXRESOLVSORT]; + char lookups[MAXDNSLUS]; +}; + +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + +/* + * Resolver "pfcode" values. Used by dig. + */ +#define RES_PRF_STATS 0x0001 +/* 0x0002 */ +#define RES_PRF_CLASS 0x0004 +#define RES_PRF_CMD 0x0008 +#define RES_PRF_QUES 0x0010 +#define RES_PRF_ANS 0x0020 +#define RES_PRF_AUTH 0x0040 +#define RES_PRF_ADD 0x0080 +#define RES_PRF_HEAD1 0x0100 +#define RES_PRF_HEAD2 0x0200 +#define RES_PRF_TTLID 0x0400 +#define RES_PRF_HEADX 0x0800 +#define RES_PRF_QUERY 0x1000 +#define RES_PRF_REPLY 0x2000 +#define RES_PRF_INIT 0x4000 +/* 0x8000 */ + +#define _res (*_res_status()) +#define h_errno (_res_get_error()) + +#include <sys/cdefs.h> +#include <stdio.h> + +/* Private routines shared between libc/net, named, nslookup and others. */ +#define dn_skipname __dn_skipname +#define fp_query __fp_query +#define hostalias __hostalias +#define putlong __putlong +#define putshort __putshort +#define p_class __p_class +#define p_time __p_time +#define p_type __p_type +__BEGIN_DECLS +struct __res_state *_res_status __P_((void)); +int _res_get_error __P_((void)); + +int __dn_skipname __P_((const u_char *, const u_char *)); +void __fp_query __P_((char *, FILE *)); +char *__hostalias __P_((const char *)); +void __putlong __P_((pthread_ipaddr_type, unsigned char *)); +void __putshort __P_((pthread_ipport_type, unsigned char *)); +char *__p_class __P_((int)); +char *__p_time __P_((unsigned long)); +char *__p_type __P_((int)); + +int dn_comp __P_((const unsigned char *, unsigned char *, int, + unsigned char **, unsigned char **)); +int dn_expand __P_((const unsigned char *, const unsigned char *, + const unsigned char *, unsigned char *, int)); +int res_init __P_((void)); +int res_mkquery __P_((int, const char *, int, int, const char *, int, + const char *, char *, int)); +int res_send __P_((const char *, int, char *, int)); +__END_DECLS + +#endif /* !_RESOLV_H_ */ + diff --git a/lib/libpthread/include/signal.h b/lib/libpthread/include/signal.h new file mode 100644 index 00000000000..9fb1ec6e2c8 --- /dev/null +++ b/lib/libpthread/include/signal.h @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 1991, 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. + * + * @(#)signal.h 8.3 (Berkeley) 3/30/94 + */ + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#include <sys/types.h> +#include <sys/cdefs.h> +#include <sys/__signal.h> + +__BEGIN_DECLS + +int raise __P_((int)); +/* RETSIGTYPE signal __P_((int __sig, RETSIGTYPE)); */ + +#ifndef _ANSI_SOURCE + +int sigfillset __P_((sigset_t *)); +int sigemptyset __P_((sigset_t *)); +int sigaddset __P_((sigset_t *, int)); +int sigdelset __P_((sigset_t *, int)); +int sigismember __P_((const sigset_t *, int)); +int sigsuspend __P_((const sigset_t *)); +int sigprocmask __P_((int, const sigset_t *, sigset_t *)); + +/* Still need work */ +int kill __P_((pid_t, int)); +int sigaction __P_((int, const struct sigaction *, struct sigaction *)); +int sigpending __P_((sigset_t *)); + +#ifndef _POSIX_SOURCE + +int killpg __P_((pid_t, int)); +int siginterrupt __P_((int, int)); +void psignal __P_((unsigned int, const char *)); + +/* int sigpause __P_((int)); */ +/* int sigsetmask __P_((int)); */ +/* int sigblock __P_((int)); */ +/* int sigreturn __P_((struct sigcontext *)); */ +/* int sigvec __P_((int, struct sigvec *, struct sigvec *)); */ +/* int sigstack __P_((const struct sigstack *, struct sigstack *)); */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +__END_DECLS + +#endif /* !_USER_SIGNAL_H */ diff --git a/lib/libpthread/include/stdlib.h b/lib/libpthread/include/stdlib.h new file mode 100644 index 00000000000..f51c7edf694 --- /dev/null +++ b/lib/libpthread/include/stdlib.h @@ -0,0 +1,127 @@ +/* + * 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: stdlib.h,v 1.1 1998/07/21 13:19:10 peter Exp $ + */ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#include <sys/__stdlib.h> + +/* Returned by `div'. */ +typedef struct + { + int quot; /* Quotient. */ + int rem; /* Remainder. */ + } div_t; + +/* Returned by `ldiv'. */ +typedef struct + { + long quot; /* Quotient. */ + long rem; /* Remainder. */ + } ldiv_t; + +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif + +#define EXIT_FAILURE 1 /* Failing exit status. */ +#define EXIT_SUCCESS 0 /* Successful exit status. */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +double atof __P_((const char *)); +int atoi __P_((const char *)); +long atol __P_((const char *)); +double strtod __P_((const char *, char **)); +long strtol __P_((const char *, char **, int)); +unsigned long strtoul __P_((const char *, char **, int)); + +int rand __P_((void)); +void srand __P_((unsigned int)); + +long random __P_((void)); +void srandom __P_((unsigned int)); +char * initstate __P_((unsigned int, char *, int)); +char * setstate __P_((char *)); + +void * malloc __P_((size_t)); +void * realloc __P_((void *, size_t)); +void * calloc __P_((size_t, size_t)); +void free __P_((void *)); + +__NORETURN void abort __P_((void)); +int atexit __P_((void (* __func)() )); +__NORETURN void exit __P_((int)); +int system __P_((const char *)); + +extern char ** environ; + +char * getenv __P_((const char *)); +int putenv __P_((const char *)); +int setenv __P_((const char *, const char *, int)); +void unsetenv __P_((const char *)); + +void * bsearch __P_((const void *, const void *, size_t, size_t, + int (* __func)__P_((const void *, const void *)) )); +void qsort __P_((void *, size_t, size_t, + int (* __func)__P_((const void *, const void *)) )); + +int abs __P_((int)); +long labs __P_((long)); +div_t div __P_((int, int)); +ldiv_t ldiv __P_((long, long)); + +void * memchr __P_((const void *, int, size_t)); + +/* Stuff to do */ +int mblen __P_((const char *, size_t)); +int mbtowc __P_((wchar_t *, const char *, size_t)); +int wctomb __P_((char *, wchar_t)); +size_t mbstowcs __P_((wchar_t *, const char *, size_t)); +size_t wcstombs __P_((char *, const wchar_t *, size_t)); + + +__END_DECLS + +#endif /* !_STDLIB_H_ */ diff --git a/lib/libpthread/include/string.h b/lib/libpthread/include/string.h new file mode 100644 index 00000000000..4143a1cfec7 --- /dev/null +++ b/lib/libpthread/include/string.h @@ -0,0 +1,85 @@ +/* $NetBSD: string.h,v 1.6 1994/10/26 00:56:30 cgd Exp $ */ + +/*- + * 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. + * + * @(#)string.h 5.10 (Berkeley) 3/9/91 + */ + +#ifndef _STRING_H_ +#define _STRING_H_ +#include <sys/cdefs.h> +#include <pthread/types.h> +#include <pthread/posix.h> +#include <sys/__string.h> + +#ifndef NULL +#define NULL 0 +#endif + +__BEGIN_DECLS +void *memchr __P_((const void *, int, size_t)); +int memcmp __P_((const void *, const void *, size_t)); +void *memcpy __P_((void *, const void *, size_t)); +void *memmove __P_((void *, const void *, size_t)); +void *memset __P_((void *, int, size_t)); +char *strcat __P_((char *, const char *)); +char *strchr __P_((const char *, int)); +int strcmp __P_((const char *, const char *)); +int strcoll __P_((const char *, const char *)); +char *strcpy __P_((char *, const char *)); +size_t strcspn __P_((const char *, const char *)); +char *strerror __P_((int)); +size_t strlen __P_((const char *)); +char *strncat __P_((char *, const char *, size_t)); +int strncmp __P_((const char *, const char *, size_t)); +char *strncpy __P_((char *, const char *, size_t)); +char *strpbrk __P_((const char *, const char *)); +char *strrchr __P_((const char *, int)); +size_t strspn __P_((const char *, const char *)); +char *strstr __P_((const char *, const char *)); +char *strtok __P_((char *, const char *)); +char *strtok_r __P_((char *, const char *, char **)); +size_t strxfrm __P_((char *, const char *, size_t)); + +/* Nonstandard routines common to all pthreads supported platforms */ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +int ffs __P_((int)); +void *memccpy __P_((void *, const void *, int, size_t)); +int strcasecmp __P_((const char *, const char *)); +int strncasecmp __P_((const char *, const char *, size_t)); +char *strsignal __P_((int)); +void swab __P_((const void *, void *, size_t)); +#endif +__END_DECLS + +#endif /* _STRING_H_ */ diff --git a/lib/libpthread/include/syslog.h b/lib/libpthread/include/syslog.h new file mode 100644 index 00000000000..31b42285fc1 --- /dev/null +++ b/lib/libpthread/include/syslog.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)syslog.h 7.8 (Berkeley) 5/26/88 + */ + +#ifndef SYSLOG_H +#define SYSLOG_H + +/* Added __[BEGIN/END]_DECLS so this file would work with C++. (mevans) */ +#include <sys/cdefs.h> +#include <stdarg.h> + +/* Discipline: openlog(), closelog(), and setlogmask() are not thread-safe + * and should only be called when other threads will not be calling syslog + * functions. syslog() and vsyslog() are thread-safe and may be called + * asynchronously, even if openlog() has not been called. */ + +/* + * Facility codes + */ + +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* security/authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define LOG_NFACILITIES 24 /* maximum number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) /* facility of pri */ + +/* + * Priorities (these are ordered) + */ + +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but signification condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) /* extract priority */ + +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#ifdef KERNEL +#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ +#endif + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything; LOG_NDELAY is the + * inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ + +__BEGIN_DECLS + +/* Syslogging functions. */ +void syslog(int pri, char *fmt, ...); +void vsyslog(int pri, char *fmt, va_list args); +void openlog(char *ident, int logstat, int logfac); +void closelog(void); +int setlogmask(int pmask); + +__END_DECLS + +#endif + diff --git a/lib/libpthread/include/time.h b/lib/libpthread/include/time.h new file mode 100644 index 00000000000..c27e66838a3 --- /dev/null +++ b/lib/libpthread/include/time.h @@ -0,0 +1,102 @@ +/* + * 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:10 peter Exp $ + */ + +#ifndef _TIME_H_ +#define _TIME_H_ + +#include <sys/__time.h> + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef __hpux__ +struct tm { + int tm_sec; /* seconds after the minute [0-60] */ + int tm_min; /* minutes after the hour [0-59] */ + int tm_hour; /* hours since midnight [0-23] */ + int tm_mday; /* day of the month [1-31] */ + int tm_mon; /* months since January [0-11] */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday [0-6] */ + int tm_yday; /* days since January 1 [0-365] */ + int tm_isdst; /* Daylight Savings Time flag */ + long tm_gmtoff; /* offset from CUT in seconds */ + char *tm_zone; /* timezone abbreviation */ +}; +#endif /* __hpux__ */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +/* clock_t clock __P_((void)); */ + +char * asctime __P_((const struct tm *)); +double difftime __P_((time_t, time_t)); +char * ctime __P_((const time_t *)); +struct tm * gmtime __P_((const time_t *)); +struct tm * localtime __P_((const time_t *)); + +char * asctime_r __P_((const struct tm *, char *)); +char * ctime_r __P_((const time_t *, char *)); +struct tm * gmtime_r __P_((const time_t *, struct tm *)); +struct tm * localtime_r __P_((const time_t *, struct tm *)); + +time_t mktime __P_((struct tm *)); + +/* size_t strftime __P_((char *, size_t, const char *, const struct tm *)); */ +time_t time __P_((time_t *)); + +#if !defined(_ANSI_SOURCE) +/* #define CLK_TCK 100 */ +extern char *tzname[2]; +void tzset __P_((void)); +#endif /* not ANSI */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +/* char *timezone __P_((int, int)); */ +void tzsetwall __P_((void)); +#endif /* neither ANSI nor POSIX */ + +__END_DECLS + +#endif /* !_TIME_H_ */ diff --git a/lib/libpthread/include/timers.h b/lib/libpthread/include/timers.h new file mode 100644 index 00000000000..af9db4a5b01 --- /dev/null +++ b/lib/libpthread/include/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 13:19:10 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _TIMERS_H_ +#define _TIMERS_H_ + +#include <sys/timers.h> + +#endif diff --git a/lib/libpthread/include/tzfile.h b/lib/libpthread/include/tzfile.h new file mode 100644 index 00000000000..95bbc424be7 --- /dev/null +++ b/lib/libpthread/include/tzfile.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 1988 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Arthur David Olson of the National Cancer Institute. + * + * 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: @(#)tzfile.h 5.10 (Berkeley) 4/3/91 + * $Id: tzfile.h,v 1.1 1998/07/21 13:19:10 peter Exp $ + */ + +#ifndef _TZFILE_H_ +#define _TZFILE_H_ + +#include <pthread/paths.h> + +/* + * Information about time zone files. + */ +#define TZDIR _PATH_TZDIR +#define TZDEFAULT _PATH_TZFILE +#define TZDEFRULES "posixrules" + +/* +** Each file begins with. . . +*/ + +struct tzhead { + char tzh_reserved[24]; /* reserved for future use */ + char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ + char tzh_leapcnt[4]; /* coded number of leap seconds */ + char tzh_timecnt[4]; /* coded number of transition times */ + char tzh_typecnt[4]; /* coded number of local time types */ + char tzh_charcnt[4]; /* coded number of abbr. chars */ +}; + +/* +** . . .followed by. . . +** +** tzh_timecnt (char [4])s coded transition times a la time(2) +** tzh_timecnt (unsigned char)s types of local time starting at above +** tzh_typecnt repetitions of +** one (char [4]) coded GMT offset in seconds +** one (unsigned char) used to set tm_isdst +** one (unsigned char) that's an abbreviation list index +** tzh_charcnt (char)s '\0'-terminated zone abbreviations +** tzh_leapcnt repetitions of +** one (char [4]) coded leap second transition times +** one (char [4]) total correction after above +** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition +** time is standard time, if FALSE, +** transition time is wall clock time +** if absent, transition times are +** assumed to be wall clock time +*/ + +/* +** In the current implementation, "tzset()" refuses to deal with files that +** exceed any of the limits below. +*/ + +/* +** The TZ_MAX_TIMES value below is enough to handle a bit more than a +** year's worth of solar time (corrected daily to the nearest second) or +** 138 years of Pacific Presidential Election time +** (where there are three time zone transitions every fourth year). +*/ +#define TZ_MAX_TIMES 370 + +#define NOSOLAR /* 4BSD doesn't currently handle solar time */ + +#ifndef NOSOLAR +#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ +#else +#define TZ_MAX_TYPES 10 /* Maximum number of local time types */ +#endif + +#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ + +#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ + +#define SECSPERMIN 60 +#define MINSPERHOUR 60 +#define HOURSPERDAY 24 +#define DAYSPERWEEK 7 +#define DAYSPERNYEAR 365 +#define DAYSPERLYEAR 366 +#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) +#define MONSPERYEAR 12 + +#define TM_SUNDAY 0 +#define TM_MONDAY 1 +#define TM_TUESDAY 2 +#define TM_WEDNESDAY 3 +#define TM_THURSDAY 4 +#define TM_FRIDAY 5 +#define TM_SATURDAY 6 + +#define TM_JANUARY 0 +#define TM_FEBRUARY 1 +#define TM_MARCH 2 +#define TM_APRIL 3 +#define TM_MAY 4 +#define TM_JUNE 5 +#define TM_JULY 6 +#define TM_AUGUST 7 +#define TM_SEPTEMBER 8 +#define TM_OCTOBER 9 +#define TM_NOVEMBER 10 +#define TM_DECEMBER 11 + +#define TM_YEAR_BASE 1900 + +#define EPOCH_YEAR 1970 +#define EPOCH_WDAY TM_THURSDAY + +/* +** Accurate only for the past couple of centuries; +** that will probably do. +*/ + +#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) + +#endif /* !_TZFILE_H_ */ + diff --git a/lib/libpthread/include/unistd.h b/lib/libpthread/include/unistd.h new file mode 100644 index 00000000000..213aa983172 --- /dev/null +++ b/lib/libpthread/include/unistd.h @@ -0,0 +1,183 @@ +/*- + * Copyright (c) 1991 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. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include <sys/cdefs.h> +#include <sys/__unistd.h> + +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 + +#ifndef SEEK_SET +#define SEEK_SET 0 /* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* set file offset to EOF plus offset */ +#endif + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +__BEGIN_DECLS +void _exit __P_((int)); +int access __P_((const char *, int)); +int chdir __P_((const char *)); +int chown __P_((const char *, uid_t, gid_t)); +int close __P_((int)); +int dup __P_((int)); +int dup2 __P_((int, int)); +int execve __P_((const char *, char * const *, char * const *)); +pid_t fork __P_((void)); +int isatty __P_((int)); +int link __P_((const char *, const char *)); +off_t lseek __P_((int, off_t, int)); +int pipe __P_((int *)); +ssize_t read __P_((int, void *, size_t)); +unsigned sleep __P_((unsigned)); +char *ttyname __P_((int)); +int unlink __P_((const char *)); +ssize_t write __P_((int, const void *, size_t)); + +/* Not implemented for threads yet */ +unsigned alarm __P_((unsigned)); +char *cuserid __P_((char *)); +int execl __P_((const char *, const char *, ...)); +int execle __P_((const char *, const char *, ...)); +int execlp __P_((const char *, const char *, ...)); +int execv __P_((const char *, char * const *)); +int execvp __P_((const char *, char * const *)); +long fpathconf __P_((int, int)); /* not yet */ +char *getcwd __P_((char *, size_t)); +gid_t getegid __P_((void)); +uid_t geteuid __P_((void)); +gid_t getgid __P_((void)); +int getgroups __P_((int, gid_t *)); /* XXX (gid_t *) */ +char *getlogin __P_((void)); +pid_t getpgrp __P_((void)); +pid_t getpid __P_((void)); +pid_t getppid __P_((void)); +uid_t getuid __P_((void)); +long pathconf __P_((const char *, int)); /* not yet */ +int pause __P_((void)); +int rmdir __P_((const char *)); +int setgid __P_((gid_t)); +int setpgid __P_((pid_t, pid_t)); +pid_t setsid __P_((void)); +int setuid __P_((uid_t)); +long sysconf __P_((int)); /* not yet */ +pid_t tcgetpgrp __P_((int)); +int tcsetpgrp __P_((int, pid_t)); + +#ifndef _POSIX_SOURCE + +int acct __P_((const char *)); +int async_daemon __P_((void)); +char *brk __P_((const char *)); +/* int chflags __P_((const char *, long)); */ +int chroot __P_((const char *)); +char *crypt __P_((const char *, const char *)); +int des_cipher __P_((const char *, char *, long, int)); +void des_setkey __P_((const char *key)); +void encrypt __P_((char *, int)); +void endusershell __P_((void)); +int exect __P_((const char *, char * const *, char * const *)); +int fchdir __P_((int)); +/* int fchflags __P_((int, long)); */ +int fchown __P_((int, uid_t, gid_t)); +int fsync __P_((int)); +int ftruncate __P_((int, off_t)); +int getdtablesize __P_((void)); +long gethostid __P_((void)); +int gethostname __P_((char *, int)); +mode_t getmode __P_((const void *, mode_t)); +int getpagesize __P_((void)); +char *getpass __P_((const char *)); +char *getusershell __P_((void)); +char *getwd __P_((char *)); /* obsoleted by getcwd() */ +int initgroups __P_((const char *, gid_t)); +int mknod __P_((const char *, mode_t, dev_t)); +int mkstemp __P_((char *)); +char *mktemp __P_((char *)); +int nfssvc __P_((int)); +int nice __P_((int)); +void psignal __P_((unsigned, const char *)); +/* extern char *sys_siglist[]; */ +int profil __P_((char *, int, int, int)); +int rcmd __P_((char **, int, const char *, + const char *, const char *, int *)); +char *re_comp __P_((const char *)); +int re_exec __P_((const char *)); +int readlink __P_((const char *, char *, int)); +int reboot __P_((int)); +int revoke __P_((const char *)); +int rresvport __P_((int *)); +int ruserok __P_((const char *, int, const char *, const char *)); +char *sbrk __P_((int)); +int setegid __P_((gid_t)); +int seteuid __P_((uid_t)); +int setgroups __P_((int, const gid_t *)); +void sethostid __P_((long)); +int sethostname __P_((const char *, int)); +void setkey __P_((const char *)); +int setlogin __P_((const char *)); +void *setmode __P_((const char *)); +int setpgrp __P_((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */ +int setregid __P_((int, int)); +int setreuid __P_((int, int)); +int setrgid __P_((gid_t)); +int setruid __P_((uid_t)); +void setusershell __P_((void)); +int swapon __P_((const char *)); +int symlink __P_((const char *, const char *)); +void sync __P_((void)); +int syscall __P_((int, ...)); +int truncate __P_((const char *, off_t)); +int ttyslot __P_((void)); +unsigned ualarm __P_((unsigned, unsigned)); +void usleep __P_((unsigned)); +int vfork __P_((void)); + +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/alpha-osf1/__math.h b/lib/libpthread/machdep/alpha-osf1/__math.h new file mode 100755 index 00000000000..12fdc85678c --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__math.h @@ -0,0 +1,16 @@ +/* + * ANSI required entries in math.h + * + */ +#ifdef _ANSI_C_SOURCE + +#if defined(_IEEE_FP) +# define HUGE_VAL 1.8e308 +#else +# define HUGE_VAL 1.797693134862315708e308 +#endif + +#endif /*_ANSI_C_SOURCE */ + + + diff --git a/lib/libpthread/machdep/alpha-osf1/__signal.h b/lib/libpthread/machdep/alpha-osf1/__signal.h new file mode 100755 index 00000000000..2bb13380314 --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__signal.h @@ -0,0 +1,106 @@ +#include <standards.h> + +typedef int sig_atomic_t; /* accessable as an atomic entity (ANSI) */ + +/* + * valid signal values: all undefined values are reserved for future use + * note: POSIX requires a value of 0 to be used as the null signal in kill() + */ +#define SIGHUP 1 /* hangup, generated when terminal disconnects */ +#define SIGINT 2 /* interrupt, generated from terminal special char */ +#define SIGQUIT 3 /* (*) quit, generated from terminal special char */ +#define SIGILL 4 /* (*) illegal instruction (not reset when caught)*/ +#define SIGTRAP 5 /* (*) trace trap (not reset when caught) */ +#define SIGABRT 6 /* (*) abort process */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* (*) floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* (*) bus error (specification exception) */ +#define SIGSEGV 11 /* (*) segmentation violation */ +#define SIGSYS 12 /* (*) bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock timeout */ +#define SIGTERM 15 /* software termination signal */ +#define SIGURG 16 /* (+) urgent contition on I/O channel */ +#define SIGSTOP 17 /* (@) stop (cannot be caught or ignored) */ +#define SIGTSTP 18 /* (@) interactive stop */ +#define SIGCONT 19 /* (!) continue (cannot be caught or ignored) */ +#define SIGCHLD 20 /* (+) sent to parent on child stop or exit */ +#define SIGTTIN 21 /* (@) background read attempted from control terminal*/ +#define SIGTTOU 22 /* (@) background write attempted to control terminal */ +#define SIGIO 23 /* (+) I/O possible, or completed */ +#define SIGXCPU 24 /* cpu time limit exceeded (see setrlimit()) */ +#define SIGXFSZ 25 /* file size limit exceeded (see setrlimit()) */ +#define SIGVTALRM 26 /* virtual time alarm (see setitimer) */ +#define SIGPROF 27 /* profiling time alarm (see setitimer) */ +#define SIGWINCH 28 /* (+) window size changed */ +#define SIGINFO 29 /* information request */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ +#define SIGMAX 31 +#define NSIG 31 + +/* + * additional signal names supplied for compatibility, only + */ +#define SIGIOINT SIGURG /* printer to backend error signal */ +#define SIGAIO SIGIO /* base lan i/o */ +#define SIGPTY SIGIO /* pty i/o */ +#define SIGPOLL SIGIO /* STREAMS version of this signal */ +#define SIGIOT SIGABRT /* abort (terminate) process */ +#define SIGLOST SIGIOT /* old BSD signal ?? */ +#define SIGPWR SIGINFO /* Power Fail/Restart -- SVID3/SVR4 */ +#define SIGCLD SIGCHLD + +/* + * valid signal action values; other values => pointer to handler function + */ +#define SIG_DFL (void (*)())0 +#define SIG_IGN (void (*)())1 + +/* + * values of "how" argument to sigprocmask() call + */ +#define SIG_BLOCK 1 +#define SIG_UNBLOCK 2 +#define SIG_SETMASK 3 + +/* + * sigaction structure used in sigaction() system call + * The order of the fields in this structure must match those in + * the sigvec structure (below). + */ +struct sigaction { + void (*sa_handler)(); /* signal handler, or action value */ + sigset_t sa_mask; /* signals to block while in handler */ + int sa_flags; /* signal action flags */ +}; + +#define __SIGEMPTYSET 0 +#define __SIGFILLSET 0xffffffff +#define __SIGADDSET(s, n) ( *(s) |= 1L << ((n) - 1), 0) +#define __SIGDELSET(s, n) ( *(s) &= ~(1L << ((n) - 1)), 0) +#define __SIGISMEMBER(s, n) ( (*(s) & (1L << ((n) - 1))) != (sigset_t)0) + + +#define SIGSTKSZ (16384) +#define MINSIGSTKSZ (4096) + +/* + * valid flags define for sa_flag field of sigaction structure + */ +#define SA_ONSTACK 0x00000001 /* run on special signal stack */ +#define SA_RESTART 0x00000002 /* restart system calls on sigs */ +#define SA_NOCLDSTOP 0x00000004 /* do not set SIGCHLD for child stops*/ +#define SA_NODEFER 0x00000008 /* don't block while handling */ +#define SA_RESETHAND 0x00000010 /* old sys5 style behavior */ +#define SA_NOCLDWAIT 0x00000020 /* no zombies */ +#define SA_SIGINFO 0x00000040 /* deliver siginfo to handler */ + +/* This is for sys/time.h */ +/* Removed for OSF1 V3.2 +typedef union sigval { + int sival_int; + void *sival_ptr; +} sigval_t; +*/ diff --git a/lib/libpthread/machdep/alpha-osf1/__stdio.h b/lib/libpthread/machdep/alpha-osf1/__stdio.h new file mode 100755 index 00000000000..39801b125c8 --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__stdio.h @@ -0,0 +1,13 @@ + +#ifndef _FPOS_T +#define _FPOS_T +typedef pthread_fpos_t fpos_t; /* Must match off_t <sys/types.h> */ +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +#define HAVE_SYS_ERRLIST_WITHOUT_CONST + diff --git a/lib/libpthread/machdep/alpha-osf1/__stdlib.h b/lib/libpthread/machdep/alpha-osf1/__stdlib.h new file mode 100755 index 00000000000..79ca737e0c8 --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__stdlib.h @@ -0,0 +1,3 @@ +/* bleah */ + +#include <stddef.h> diff --git a/lib/libpthread/machdep/alpha-osf1/__string.h b/lib/libpthread/machdep/alpha-osf1/__string.h new file mode 100755 index 00000000000..6558102a282 --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__string.h @@ -0,0 +1,19 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +__BEGIN_DECLS + +/* +void * memchr __P_((const void *, int , size_t )); +void * memcpy __P_((void *, const void *, size_t )); +void * memset __P_((void *, int , size_t )); +size_t strcspn __P_((const char *, const char *)); +size_t strlen __P_((const char *)); +size_t strspn __P_((const char *, const char *)); +*/ + +__END_DECLS + diff --git a/lib/libpthread/machdep/alpha-osf1/__time.h b/lib/libpthread/machdep/alpha-osf1/__time.h new file mode 100755 index 00000000000..b4ce1ead2bf --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__time.h @@ -0,0 +1,21 @@ +#include <pthread/types.h> +#include <machine/machtime.h> /* CLOCKS_PER_SEC is defined here */ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef pthread_clock_t clock_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef pthread_time_t time_t; +#endif + +#ifndef CLK_TCK +#define CLK_TCK 60 +#endif diff --git a/lib/libpthread/machdep/alpha-osf1/__unistd.h b/lib/libpthread/machdep/alpha-osf1/__unistd.h new file mode 100755 index 00000000000..2a7fbe9389b --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/__unistd.h @@ -0,0 +1,6 @@ +#include <sys/types.h> + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef long ssize_t; /* Added by monty */ +#endif diff --git a/lib/libpthread/machdep/alpha-osf1/cdefs.h b/lib/libpthread/machdep/alpha-osf1/cdefs.h new file mode 100755 index 00000000000..c9b54f033ec --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/cdefs.h @@ -0,0 +1,62 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#define __INLINE static +#define inline +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +typedef int int32_t; +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +typedef short int16_t; +#endif + +#endif diff --git a/lib/libpthread/machdep/alpha-osf1/compat.h b/lib/libpthread/machdep/alpha-osf1/compat.h new file mode 100755 index 00000000000..4c2801e05de --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/compat.h @@ -0,0 +1 @@ +#define omsghdr msghdr diff --git a/lib/libpthread/machdep/alpha-osf1/dirent.h b/lib/libpthread/machdep/alpha-osf1/dirent.h new file mode 100755 index 00000000000..697ef7b8a8c --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/dirent.h @@ -0,0 +1,7 @@ +struct dirent { + ino_t d_ino; + ushort_t d_reclen, d_namlen; + char d_name[256]; +}; +#define d_fileno d_ino +#define MAXNAMLEN 256 diff --git a/lib/libpthread/machdep/alpha-osf1/signal.h b/lib/libpthread/machdep/alpha-osf1/signal.h new file mode 100755 index 00000000000..c387f9f31ad --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/signal.h @@ -0,0 +1,3 @@ + + +#include <signal.h> diff --git a/lib/libpthread/machdep/alpha-osf1/socket.h b/lib/libpthread/machdep/alpha-osf1/socket.h new file mode 100755 index 00000000000..28e17ca463d --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/socket.h @@ -0,0 +1,296 @@ +/* + * Copyright (c) 1982,1985,1986,1988 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. + * + * @(#)socket.h 7.13 (Berkeley) 4/20/91 + */ + +#ifndef _SOCKET_H_ +#define _SOCKET_H_ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 4 /* raw-protocol interface */ +#define SOCK_RDM 5 /* reliably-delivered message */ +#define SOCK_SEQPACKET 6 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get/set protocol type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_NBS 7 /* nbs protocols */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_NIT 17 /* Network Interface Tap */ +#define AF_802 18 /* IEEE 802.2, also ISO 8802 */ +#define AF_ISO 19 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_X25 20 /* CCITT X.25 in particular */ +#define AF_OSINET 21 +#define AF_GOSIP 22 +#define AF_MAX 22 + +/* Not supported by solaris */ +/* #define AF_ROUTE 17 /* Internal Routing Protocol */ +/* #define AF_LINK 18 /* Link layer interface */ +/* #define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ + + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_NIT AF_NIT +#define PF_802 AF_802 +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_X25 AF_X25 +#define PF_OSINET AF_OSINET +#define PF_GOSIP AF_GOSIP +#define PF_MAX AF_MAX + +/* #define PF_ROUTE AF_ROUTE */ +/* #define PF_LINK AF_LINK */ +/* #define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#define MSG_MAXIOVLEN 16 + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +/* #define MSG_EOR 0x8 data completes record */ +/* #define MSG_TRUNC 0x10 data discarded before delivery */ +/* #define MSG_CTRUNC 0x20 control data lost before delivery */ +/* #define MSG_WAITALL 0x40 wait for full request or error */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct adatahdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct adatahdr, return pointer to next adatahdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +#define SYS_socketcall 83 + +#define SO_ACCEPT 1 +#define SO_BIND 2 +#define SO_CONNECT 3 +#define SO_GETPEERNAME 4 +#define SO_GETSOCKNAME 5 +#define SO_GETSOCKOPT 6 +#define SO_LISTEN 7 +#define SO_RECV 8 +#define SO_RECVFROM 9 +#define SO_SEND 10 +#define SO_SENDTO 11 +#define SO_SETSOCKOPT 12 +#define SO_SHUTDOWN 13 +#define SO_SOCKET 14 +#define SO_SOCKPOLL 15 +#define SO_GETIPDOMAIN 16 +#define SO_SETIPDOMAIN 17 +#define SO_ADJTIME 18 + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +int getsockname __P_((int, struct sockaddr *, int *)); +int getsockopt __P_((int, int, int, void *, int *)); +int listen __P_((int, int)); +/* original definitions +int recv __P_((int, void *, int, int)); +int recvfrom __P_((int, void *, int, int, + struct sockaddr *, int *)); +int recvmsg __P_((int, struct msghdr *, int)); +int send __P_((int, const void *, int, int)); +int sendto __P_((int, const void *, int, int, const struct sockaddr *, int)); +int sendmsg __P_((int, const struct msghdr *, int)); +*/ +ssize_t recv __P_((int, void *, size_t, int)); +ssize_t recvfrom __P_((int, void *, size_t, int, + struct sockaddr *, int *)); +ssize_t recvmsg __P_((int, struct msghdr *, int)); +ssize_t send __P_((int, const void *, size_t, int)); +ssize_t sendto __P_((int, const void *, size_t, int, + const struct sockaddr *, int)); +ssize_t sendmsg __P_((int, const struct msghdr *, int)); +int setsockopt __P_((int, int, int, const void *, int)); +int shutdown __P_((int, int)); +int socket __P_((int, int, int)); +int socketpair __P_((int, int, int, int *)); +__END_DECLS + +#endif /* !_SOCKET_H_ */ diff --git a/lib/libpthread/machdep/alpha-osf1/timers.h b/lib/libpthread/machdep/alpha-osf1/timers.h new file mode 100755 index 00000000000..7ee020db1fc --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/timers.h @@ -0,0 +1,60 @@ +/* ==== 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:21 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 <sys/types.h> +#include <time.h> + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +#endif diff --git a/lib/libpthread/machdep/alpha-osf1/uio.h b/lib/libpthread/machdep/alpha-osf1/uio.h new file mode 100755 index 00000000000..8d494672ee4 --- /dev/null +++ b/lib/libpthread/machdep/alpha-osf1/uio.h @@ -0,0 +1,12 @@ +/* N.B.: The Alpha, under OSF/1, does *not* use size_t for the length, + or for the returned values from readv and writev. */ + +struct iovec { + void *iov_base; + int iov_len; +}; + +/* I'm assuming the iovec structures are const. I haven't verified + it. */ +extern ssize_t readv (int, const struct iovec *, int); +extern ssize_t writev (int, const struct iovec *, int); diff --git a/lib/libpthread/machdep/bsdi-1.1/compat.h b/lib/libpthread/machdep/bsdi-1.1/compat.h new file mode 100755 index 00000000000..a529ad4c0ea --- /dev/null +++ b/lib/libpthread/machdep/bsdi-1.1/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 13:19:21 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/bsdi-1.1/dirent.h b/lib/libpthread/machdep/bsdi-1.1/dirent.h new file mode 100755 index 00000000000..9fa2fb6ad26 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-1.1/dirent.h @@ -0,0 +1,73 @@ +/* BSDI $Id: dirent.h,v 1.1 1998/07/21 13:19:21 peter Exp $ */ + +/*- + * 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 { + unsigned long + d_fileno; /* file number of entry */ + unsigned short + d_reclen; /* length of this record */ + unsigned 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 +}; + +/* + * There should probably be no need for this. In the BSDI sources, + * it is excluded if _POSIX_SOURCE is defined, and pthreads are supposed + * to be posix. Sources that use d_ino should really be using d_fileno. + * mbd + */ +#define d_ino d_fileno /* backward compatibility */ + +#endif /* !_SYS_DIRENT_H_ */ + diff --git a/lib/libpthread/machdep/bsdi-1.1/errno.h b/lib/libpthread/machdep/bsdi-1.1/errno.h new file mode 100755 index 00000000000..3da61d692a3 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-1.1/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/machdep/bsdi-1.1/socket.h b/lib/libpthread/machdep/bsdi-1.1/socket.h new file mode 100755 index 00000000000..0c9ab9a0c59 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-1.1/socket.h @@ -0,0 +1,277 @@ +/* BSDI $Id: socket.h,v 1.1 1998/07/21 13:19:21 peter Exp $ */ + +/* + * Copyright (c) 1982,1985,1986,1988 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. + * + * @(#)socket.h 7.13 (Berkeley) 4/20/91 + */ + +#ifndef _SOCKET_H_ +#define _SOCKET_H_ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ + +#define AF_MAX 20 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_char sa_len; /* total length */ + u_char sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct adatahdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct adatahdr, return pointer to next adatahdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#ifndef KERNEL + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +int getsockname __P_((int, struct sockaddr *, int *)); +int getsockopt __P_((int, int, int, void *, int *)); +int listen __P_((int, int)); +/* original definitions +int recv __P_((int, void *, int, int)); +int recvfrom __P_((int, void *, int, int, + struct sockaddr *, int *)); +int recvmsg __P_((int, struct msghdr *, int)); +int send __P_((int, const void *, int, int)); +int sendto __P_((int, const void *, int, int, const struct sockaddr *, int)); +int sendmsg __P_((int, const struct msghdr *, int)); +*/ +ssize_t recv __P_((int, void *, size_t, int)); +ssize_t recvfrom __P_((int, void *, size_t, int, + struct sockaddr *, int *)); +ssize_t recvmsg __P_((int, struct msghdr *, int)); +ssize_t send __P_((int, const void *, size_t, int)); +ssize_t sendto __P_((int, const void *, size_t, int, + const struct sockaddr *, int)); +ssize_t sendmsg __P_((int, const struct msghdr *, int)); +int setsockopt __P_((int, int, int, const void *, int)); +int shutdown __P_((int, int)); +int socket __P_((int, int, int)); +int socketpair __P_((int, int, int, int *)); +__END_DECLS + +#endif /* !KERNEL */ + +#endif /* !_SOCKET_H_ */ diff --git a/lib/libpthread/machdep/bsdi-1.1/timers.h b/lib/libpthread/machdep/bsdi-1.1/timers.h new file mode 100755 index 00000000000..2ed79c49df7 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-1.1/timers.h @@ -0,0 +1,59 @@ +/* ==== 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:21 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 <sys/time.h> + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +#endif diff --git a/lib/libpthread/machdep/bsdi-2.0/__math.h b/lib/libpthread/machdep/bsdi-2.0/__math.h new file mode 100755 index 00000000000..2c919472f33 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__math.h @@ -0,0 +1,6 @@ +/* + * ANSI/POSIX + */ +/* Generate an overflow to create +Inf; the multiply shuts up gcc 1 */ +#define HUGE_VAL (1e250*1e250) /* IEEE: positive infinity */ + diff --git a/lib/libpthread/machdep/bsdi-2.0/__path.h b/lib/libpthread/machdep/bsdi-2.0/__path.h new file mode 100755 index 00000000000..9c347016f5f --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__path.h @@ -0,0 +1,13 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * __path.h,v 1.1 1995/01/03 12:53:32 proven 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/bsdi-2.0/__signal.h b/lib/libpthread/machdep/bsdi-2.0/__signal.h new file mode 100755 index 00000000000..d3deecf15e2 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__signal.h @@ -0,0 +1,7 @@ +#include <sys/signal.h> + +#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/bsdi-2.0/__stdio.h b/lib/libpthread/machdep/bsdi-2.0/__stdio.h new file mode 100755 index 00000000000..d4d37c2017c --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__stdio.h @@ -0,0 +1,7 @@ +#include <machine/ansi.h> +#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 <sys/types.h> */ diff --git a/lib/libpthread/machdep/bsdi-2.0/__stdlib.h b/lib/libpthread/machdep/bsdi-2.0/__stdlib.h new file mode 100755 index 00000000000..189bb5e8799 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__stdlib.h @@ -0,0 +1,60 @@ +/*- + * 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 + * __stdlib.h,v 1.1 1995/01/03 12:53:34 proven Exp + */ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <machine/ansi.h> + +#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; +#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/bsdi-2.0/__string.h b/lib/libpthread/machdep/bsdi-2.0/__string.h new file mode 100755 index 00000000000..275032946ea --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__string.h @@ -0,0 +1,19 @@ +#include <machine/ansi.h> +#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/bsdi-2.0/__time.h b/lib/libpthread/machdep/bsdi-2.0/__time.h new file mode 100755 index 00000000000..bc4d956486d --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__time.h @@ -0,0 +1,63 @@ +/* + * 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 + * __time.h,v 1.1 1994/12/13 07:18:55 proven Exp + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include <machine/ansi.h> + +#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 + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/bsdi-2.0/__unistd.h b/lib/libpthread/machdep/bsdi-2.0/__unistd.h new file mode 100755 index 00000000000..4a5ee6a245e --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/__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 + * __unistd.h,v 1.1 1995/01/03 12:53:35 proven Exp + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> + +#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 ((unsigned char)'\377') + +/* 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/bsdi-2.0/compat.h b/lib/libpthread/machdep/bsdi-2.0/compat.h new file mode 100755 index 00000000000..0dfdc27f9e8 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/compat.h @@ -0,0 +1,65 @@ +/*- + * 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/bsdi-2.0/dirent.h b/lib/libpthread/machdep/bsdi-2.0/dirent.h new file mode 100755 index 00000000000..0dfdc27f9e8 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/dirent.h @@ -0,0 +1,65 @@ +/*- + * 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/bsdi-2.0/errno.h b/lib/libpthread/machdep/bsdi-2.0/errno.h new file mode 100755 index 00000000000..1a3c37d0147 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/errno.h @@ -0,0 +1,162 @@ + +/* $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/bsdi-2.0/time.h b/lib/libpthread/machdep/bsdi-2.0/time.h new file mode 100755 index 00000000000..a8bf0ff8f82 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/time.h @@ -0,0 +1,6 @@ +#ifndef ts_sec +#define ts_sec tv_sec +#define ts_nsec tv_nsec +#endif +#include "/usr/include/sys/time.h" + diff --git a/lib/libpthread/machdep/bsdi-2.0/timers.h b/lib/libpthread/machdep/bsdi-2.0/timers.h new file mode 100755 index 00000000000..b603b78e6b2 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/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. + * + * timers.h,v 1.50 1994/08/08 03:44:09 proven Exp + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_TIMERS_H_ +#define _SYS_TIMERS_H_ + +#include <sys/time.h> + +#endif diff --git a/lib/libpthread/machdep/bsdi-2.0/wait.h b/lib/libpthread/machdep/bsdi-2.0/wait.h new file mode 100755 index 00000000000..5f7635a73a7 --- /dev/null +++ b/lib/libpthread/machdep/bsdi-2.0/wait.h @@ -0,0 +1,159 @@ +/* $NetBSD: wait.h,v 1.7 1994/06/29 06:46:23 cgd Exp $ */ + +/* + * 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 + */ + +/* + * 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 <machine/endian.h> + +/* + * 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 <sys/types.h> +#include <sys/cdefs.h> + +__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 + diff --git a/lib/libpthread/machdep/engine-alpha-netbsd-1.1.c b/lib/libpthread/machdep/engine-alpha-netbsd-1.1.c new file mode 100644 index 00000000000..c1ff04db16d --- /dev/null +++ b/lib/libpthread/machdep/engine-alpha-netbsd-1.1.c @@ -0,0 +1,196 @@ +/* ==== 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 <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/syscall.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * 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)); +} diff --git a/lib/libpthread/machdep/engine-alpha-netbsd-1.1.h b/lib/libpthread/machdep/engine-alpha-netbsd-1.1.h new file mode 100644 index 00000000000..50c872da7b6 --- /dev/null +++ b/lib/libpthread/machdep/engine-alpha-netbsd-1.1.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 <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +/* 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-alpha-netbsd-1.3.c b/lib/libpthread/machdep/engine-alpha-netbsd-1.3.c new file mode 100644 index 00000000000..0932c421ea2 --- /dev/null +++ b/lib/libpthread/machdep/engine-alpha-netbsd-1.3.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 <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/syscall.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * 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 new file mode 100644 index 00000000000..50c872da7b6 --- /dev/null +++ b/lib/libpthread/machdep/engine-alpha-netbsd-1.3.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 <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +/* 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-alpha-osf1.c b/lib/libpthread/machdep/engine-alpha-osf1.c new file mode 100644 index 00000000000..0e970b6c0d1 --- /dev/null +++ b/lib/libpthread/machdep/engine-alpha-osf1.c @@ -0,0 +1,207 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for SunOS-4.1.3 on sparc + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-alpha-osf1.c,v 1.1 1998/07/21 13:19:13 peter Exp $"; +#endif + +#include <pthread.h> +#include <stdlib.h> + +/* These would be defined in setjmp.h, if _POSIX_SOURCE and _XOPEN_SOURCE + were both undefined. But we've already included it, and lost the + opportunity. */ +#define JB_PC 2 +#define JB_RA 30 +#define JB_PV 31 +#define JB_SP 34 + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return setjmp (pthread_run->machdep_data.machdep_state); +} + +/* ========================================================================== + * machdep_restore_state() + */ +extern void machdep_restore_from_setjmp (jmp_buf, long); +void machdep_restore_state(void) +{ + machdep_restore_from_setjmp (pthread_run->machdep_data.machdep_state, 1); +} + +void machdep_save_float_state (void) { } +void machdep_restore_float_state (void) { } + +/* ========================================================================== + * 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; + + setjmp(machdep_pthread->machdep_state); + + /* 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_state[JB_RA] = 0; + machdep_pthread->machdep_state[JB_PC] = (long)machdep_pthread_start; + machdep_pthread->machdep_state[JB_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_state[JB_SP] = stk_addr; + } +} + +/* ========================================================================== + * 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 pid, int * statusp, int options) +{ + return machdep_sys_wait4 (pid, statusp, options, NULL); +} + +/* These are found in flsbuf.o in the Alpha libc. I don't know what + they're for, precisely. */ +static xxx; +_bufsync (p) + char *p; +{ + long a1 = *(long *)(p+48); + long t0 = *(long *)(p+8); + long v0 = a1 - t0; + long t1, t2; + + abort (); + + v0 += xxx; + if (v0 < 0) + { + *(char**)(p + 8) = p; + return v0; + } + t1 = *(int*)p; + t2 = v0 - t1; + if (t2 < 0) + *(int*)p = (int) v0; + return v0; +} + +_findbuf () { abort (); } +_wrtchk () { abort (); } +_xflsbuf () { abort (); } +_flsbuf () { abort (); } + +void __xxx_never_called () { + /* Force other stuff to get dragged in. */ + _cleanup (); + fflush (NULL); + fclose (NULL); +} + +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; +} diff --git a/lib/libpthread/machdep/engine-alpha-osf1.h b/lib/libpthread/machdep/engine-alpha-osf1.h new file mode 100644 index 00000000000..993d8d370d5 --- /dev/null +++ b/lib/libpthread/machdep/engine-alpha-osf1.h @@ -0,0 +1,110 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1994 Chris Provenzano (proven@athena.mit.edu) and + * Ken Raeburn (raeburn@mit.edu). + * + * $Id: engine-alpha-osf1.h,v 1.1 1998/07/21 13:19:13 peter Exp $ + * + */ + +#ifndef sigwait +#define sigwait __bogus_osf1_sigwait +#endif + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +#undef sigwait + +/* 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) + +/* + * 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, 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)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/machdep/engine-hppa-hpux-10.20.c b/lib/libpthread/machdep/engine-hppa-hpux-10.20.c new file mode 100644 index 00000000000..f6f0b2e0f1d --- /dev/null +++ b/lib/libpthread/machdep/engine-hppa-hpux-10.20.c @@ -0,0 +1,169 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for HP-UX 9.03 on hppa + * + * 1.00 93/12/14 proven + * -Started coding this file. + */ + +#include <pthread.h> +#include <setjmp.h> +#include <stdlib.h> +#include <unistd.h> + +volatile int setupStack = 0; + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * machdep_save_float_state() + */ +void machdep_save_float_state(struct pthread * pthread) +{ + return; +} + +/* ========================================================================== + * machdep_restore_float_state() + */ +void machdep_restore_float_state() +{ + return; +} + +/* ========================================================================== + * 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(jmp_buf j) +{ + setjmp(j); + if( setupStack ) + return; + + 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) +{ + jmp_buf tmp_jmp_buf; + + 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(). + */ + setjmp(machdep_pthread->machdep_state); + + /* get the stack frame from the real machdep_pthread_start */ + setupStack = 1; +/* machdep_pthread_start(machdep_pthread->machdep_state); */ + machdep_pthread_start(tmp_jmp_buf); + setupStack = 0; + + /* copy over the interesting part of the frame */ + ((int *)machdep_pthread->machdep_state)[44] = ((int *)tmp_jmp_buf)[44]; + + /* Stack starts low and builds up, but needs two start frames */ + ((int *)machdep_pthread->machdep_state)[1] = + (int)machdep_pthread->machdep_stack + (64 * 2); +} + +int machdep_sys_getdtablesize() +{ + return sysconf(_SC_OPEN_MAX); +} + +void sig_check_and_resume() +{ + return; +} + +void ___exit(int status) +{ + exit(status); + PANIC(); +} diff --git a/lib/libpthread/machdep/engine-hppa-hpux-10.20.h b/lib/libpthread/machdep/engine-hppa-hpux-10.20.h new file mode 100644 index 00000000000..9cbe3349a3d --- /dev/null +++ b/lib/libpthread/machdep/engine-hppa-hpux-10.20.h @@ -0,0 +1,143 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * Stuff for compiling + */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const +#endif +#define inline +#define signed +#define volatile +#endif + +/* + * The first machine dependent functions are the SEMAPHORES + * needing the test and set instruction. + * + * Note: The set and clear defines are backwards. + */ +#define SEMAPHORE_CLEAR { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } +#define SEMAPHORE_SET 0 + +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ +long real_addr; \ +long temp; \ + \ +real_addr = ((long)((*lock) + 15) & ~15); \ + \ +__asm__ volatile("ldcwx %%r0(%2),%0" \ + :"=r" (temp) \ + :"0" (temp),"r" (real_addr)); \ +temp ? 0 : 1; \ +}) + +#define SEMAPHORE_RESET(lock) \ +({ \ +char *real_addr; \ + \ +real_addr = (char*)((long)((*lock) + 15) & ~15); \ +*real_addr = 0xff; \ +}) + +/* + * New types + * The semaphore is really 16 bytes but must be aligened on a 16 byte + * boundary. By specifing 31 bytes the macros can frob it correctly. + */ +typedef char semaphore[31]; + +/* + * Macros for sigset_t + */ +#define SIGMAX 30 +/* see hpux-9.03/__signal.h for SIG_ANY */ + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + jmp_buf machdep_state; + /* long machdep_state[_JBLEN]; */ +}; + +/* + * 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 4096 + +/* + * Some fd flag defines that are necessary to distinguish between posix + * behavior and bsd4.3 behavior. + */ +#define __FD_NONBLOCK O_NONBLOCK + +/* + * page size + */ +#define getpagesize() 4096 + +/* + * 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-hppa-hpux-9.03.c b/lib/libpthread/machdep/engine-hppa-hpux-9.03.c new file mode 100644 index 00000000000..3770a2e106a --- /dev/null +++ b/lib/libpthread/machdep/engine-hppa-hpux-9.03.c @@ -0,0 +1,153 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for HP-UX 9.03 on hppa + * + * 1.00 93/12/14 proven + * -Started coding this file. + */ + +#include <pthread.h> +#include <setjmp.h> +#include <stdlib.h> +#include <unistd.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * machdep_save_float_state() + */ +void machdep_save_float_state(struct pthread * pthread) +{ + return; +} + +/* ========================================================================== + * machdep_restore_float_state() + */ +void machdep_restore_float_state() +{ + return; +} + +/* ========================================================================== + * 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; + + 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(). + */ + ((int *)machdep_pthread->machdep_state)[0] = (int)machdep_pthread_start; + + /* Stack starts low and builds up, but needs two start frames */ + ((int *)machdep_pthread->machdep_state)[1] = + (int)machdep_pthread->machdep_stack + (64 * 2); +} + +int machdep_sys_getdtablesize() +{ + return sysconf(_SC_OPEN_MAX); +} + +void sig_check_and_resume() +{ + return; +} + +void ___exit(int status) +{ + exit(status); + PANIC(); +} diff --git a/lib/libpthread/machdep/engine-hppa-hpux-9.03.h b/lib/libpthread/machdep/engine-hppa-hpux-9.03.h new file mode 100644 index 00000000000..7c599400e3e --- /dev/null +++ b/lib/libpthread/machdep/engine-hppa-hpux-9.03.h @@ -0,0 +1,141 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * Stuff for compiling + */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#define const +#define inline +#define signed +#define volatile +#endif + +/* + * The first machine dependent functions are the SEMAPHORES + * needing the test and set instruction. + * + * Note: The set and clear defines are backwards. + */ +#define SEMAPHORE_CLEAR { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } +#define SEMAPHORE_SET 0 + +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ +long real_addr; \ +long temp; \ + \ +real_addr = ((long)((*lock) + 15) & ~15); \ + \ +__asm__ volatile("ldcwx %%r0(%2),%0" \ + :"=r" (temp) \ + :"0" (temp),"r" (real_addr)); \ +temp ? 0 : 1; \ +}) + +#define SEMAPHORE_RESET(lock) \ +({ \ +char *real_addr; \ + \ +real_addr = (char*)((long)((*lock) + 15) & ~15); \ +*real_addr = 0xff; \ +}) + +/* + * New types + * The semaphore is really 16 bytes but must be aligened on a 16 byte + * boundary. By specifing 31 bytes the macros can frob it correctly. + */ +typedef char semaphore[31]; + +/* + * Macros for sigset_t + */ +#define SIGMAX 30 +/* see hpux-9.03/__signal.h for SIG_ANY */ + +/* + * New Strutures + */ +struct machdep_pthread { + void *(*start_routine)(void *); + void *start_argument; + void *machdep_stack; + struct itimerval machdep_timer; + jmp_buf machdep_state; + /* long machdep_state[_JBLEN]; */ +}; + +/* + * 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 4096 + +/* + * Some fd flag defines that are necessary to distinguish between posix + * behavior and bsd4.3 behavior. + */ +#define __FD_NONBLOCK O_NONBLOCK + +/* + * page size + */ +#define getpagesize() 4096 + +/* + * 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-i386-bsdi-1.1.c b/lib/libpthread/machdep/engine-i386-bsdi-1.1.c new file mode 100644 index 00000000000..0a58c03c448 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-bsdi-1.1.c @@ -0,0 +1,180 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-bsdi-1.1.c,v 1.1 1998/07/21 13:19:13 peter Exp $"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + _longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * 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(); + sig_check_and_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_pthread_create() + */ +void machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, long stack_size, + void *stack_start, long nsec) +{ + machdep_pthread->machdep_stack = stack_start; + + 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; + + _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_send() + */ +machdep_sys_send(int s, const void *buf, int len, int flags) +{ + return(machdep_sys_sendto(s, buf, len, flags, (struct sockaddr*)NULL, 0)); +} + +/* ========================================================================== + * machdep_sys_recv() + */ +machdep_sys_recv(int s, void *buf, int len, int flags) +{ + return(machdep_sys_recvfrom(s, buf, len, flags, (struct sockaddr*)NULL, 0)); +} diff --git a/lib/libpthread/machdep/engine-i386-bsdi-1.1.h b/lib/libpthread/machdep/engine-i386-bsdi-1.1.h new file mode 100644 index 00000000000..538c0e5195e --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-bsdi-1.1.h @@ -0,0 +1,84 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-bsdi-1.1.h,v 1.1 1998/07/21 13:19:13 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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; +}; + +/* + * 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) + +int machdep_save_state __P_((void)); + +#endif + +__END_DECLS + diff --git a/lib/libpthread/machdep/engine-i386-bsdi-2.0.c b/lib/libpthread/machdep/engine-i386-bsdi-2.0.c new file mode 100644 index 00000000000..a35ca4e59a7 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-bsdi-2.0.c @@ -0,0 +1,210 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-bsdi-2.0.c,v 1.1 1998/07/21 13:19:13 peter Exp $"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_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) +{ + _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; + + _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)); +} + diff --git a/lib/libpthread/machdep/engine-i386-bsdi-2.0.h b/lib/libpthread/machdep/engine-i386-bsdi-2.0.h new file mode 100644 index 00000000000..3be254b4090 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-bsdi-2.0.h @@ -0,0 +1,98 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * engine-i386-netbsd-1.0.h,v 1.53 1994/12/13 07:17:23 proven Exp + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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|O_NDELAY) + +/* + * 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-i386-freebsd-1.1.c b/lib/libpthread/machdep/engine-i386-freebsd-1.1.c new file mode 100644 index 00000000000..125603dfbdb --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-freebsd-1.1.c @@ -0,0 +1,179 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-freebsd-1.1.c,v 1.1 1998/07/21 13:19:13 peter Exp $"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + _longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * 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(); + sig_check_and_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_pthread_create() + */ +void machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, long stack_size, + void *stack_start, long nsec) +{ + machdep_pthread->machdep_stack = stack_start; + + 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; + + _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_send() + */ +machdep_sys_send(int s, const void *buf, int len, int flags) +{ + return(machdep_sys_sendto(s, buf, len, flags, NULL, 0)); +} + +/* ========================================================================== + * machdep_sys_recv() + */ +machdep_sys_recv(int s, void *buf, int len, int flags) +{ + return(machdep_sys_recvfrom(s, buf, len, flags, NULL, 0)); +} diff --git a/lib/libpthread/machdep/engine-i386-freebsd-1.1.h b/lib/libpthread/machdep/engine-i386-freebsd-1.1.h new file mode 100644 index 00000000000..4585440e814 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-freebsd-1.1.h @@ -0,0 +1,83 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-freebsd-1.1.h,v 1.1 1998/07/21 13:19:13 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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; +}; + +/* + * 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) + +int machdep_save_state __P_((void)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/machdep/engine-i386-freebsd-2.0.c b/lib/libpthread/machdep/engine-i386-freebsd-2.0.c new file mode 100644 index 00000000000..3b6b8f31ae0 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-freebsd-2.0.c @@ -0,0 +1,208 @@ +/* ==== 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 <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * 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->_jb[0] = (int)machdep_pthread_start; + + /* Stack starts high and builds down. */ + machdep_pthread->machdep_state->_jb[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)); +} + diff --git a/lib/libpthread/machdep/engine-i386-freebsd-2.0.h b/lib/libpthread/machdep/engine-i386-freebsd-2.0.h new file mode 100644 index 00000000000..a98219939de --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-freebsd-2.0.h @@ -0,0 +1,97 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-freebsd-2.0.h,v 1.1 1998/07/21 13:19:14 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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-i386-linux-1.0.c b/lib/libpthread/machdep/engine-i386-linux-1.0.c new file mode 100644 index 00000000000..b3ab3ba7dce --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-linux-1.0.c @@ -0,0 +1,503 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for Linux-1.0 on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-linux-1.0.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> +#include <stdlib.h> +#include <sys/uio.h> +#include <sys/types.h> +#include <sys/param.h> /* for OPEN_MAX */ +#include <sys/socket.h> +#include <sys/socketcall.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * machdep_save_float_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_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} }; + + 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 flag) +{ + 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; + + 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->__pc = (char *)machdep_pthread_start; + machdep_pthread->machdep_state->__bp = (char *)0;/* So the backtrace + * is sensible (mevans) * + + /* Stack starts high and builds down. */ + machdep_pthread->machdep_state->__sp = + (char *)machdep_pthread->machdep_stack + stack_size; +} + + +/* ========================================================================== + * Linux Socket calls are a bit different + * ========================================================================== + * machdep_sys_socket() + */ +int machdep_sys_socket(int a, int b, int c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_SOCKET, array)); +} + +/* ========================================================================== + * machdep_sys_accept() + */ +int machdep_sys_accept(int a, struct sockaddr * b, int * c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_ACCEPT, array)); +} + +/* ========================================================================== + * machdep_sys_bind() + */ +int machdep_sys_bind(int a, const struct sockaddr * b, int c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_BIND, array)); +} + +/* ========================================================================== + * machdep_sys_connect() + */ +int machdep_sys_connect(int a, const struct sockaddr * b, int c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_CONNECT, array)); +} + +/* ========================================================================== + * machdep_sys_listen() + */ +int machdep_sys_listen(int a, const struct sockaddr * b, int c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_LISTEN, array)); +} + +/* ========================================================================== + * machdep_sys_shutdown() + */ +int machdep_sys_shutdown(int a, int b) +{ + int array[2]; + + array[0] = (int)a; + array[1] = (int)b; + + return(machdep_sys_socketcall(SYS_SHUTDOWN, array)); +} + +/* ========================================================================== + * machdep_sys_getsockopt() + */ +int machdep_sys_getsockopt(int a, int b, int c, char *d, int *e) +{ + int array[5]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + array[4] = (int)e; + + return(machdep_sys_socketcall(SYS_GETSOCKOPT, array)); +} + +/* ========================================================================== + * machdep_sys_setsockopt() + */ +int machdep_sys_setsockopt(int a, int b, int c, char *d, int e) +{ + int array[5]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + array[4] = (int)e; + + return(machdep_sys_socketcall(SYS_SETSOCKOPT, array)); +} + +/* ========================================================================== + * machdep_sys_getpeername() + */ +int machdep_sys_getpeername(int a, struct sockaddr *b, int *c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_GETPEERNAME, array)); +} + +/* ========================================================================== + * machdep_sys_send() + */ +int machdep_sys_send(int a, char *b, int c, int d) +{ + int array[4]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + + return(machdep_sys_socketcall(SYS_SEND, array)); +} + +/* ========================================================================== + * machdep_sys_sendto() + */ +int machdep_sys_sendto(int a, char *b, int c, int d, + struct sockaddr *e, int f) +{ + int array[6]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + array[4] = (int)e; + array[5] = (int)f; + + return(machdep_sys_socketcall(SYS_SENDTO, array)); +} + +/* ========================================================================== + * machdep_sys_recv() + */ +int machdep_sys_recv(int a, char *b, int c, int d) +{ + int array[4]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + + return(machdep_sys_socketcall(SYS_RECV, array)); +} + +/* ========================================================================== + * machdep_sys_recvfrom() + */ +int machdep_sys_recvfrom(int a, char *b, int c, int d, + struct sockaddr *e, int *f) +{ + int array[6]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + array[4] = (int)e; + array[5] = (int)f; + + return(machdep_sys_socketcall(SYS_RECVFROM, array)); +} + +/* ========================================================================== + * machdep_sys_socketpair() + */ +int machdep_sys_socketpair(int a, int b, int c, int d[2]) +{ + int array[4]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + array[3] = (int)d; + + return(machdep_sys_socketcall(SYS_SOCKETPAIR, array)); +} + +/* ========================================================================== + * machdep_sys_getsockname() + */ +int machdep_sys_getsockname(int a, char * b, int * c) +{ + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_GETSOCKNAME, array)); +} + +/* ========================================================================== + * machdep_sys_sendmsg() + */ +int machdep_sys_sendmsg(int a, char * b, int c) +{ +#ifdef SYS_SENDMSG + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_SENDMSG, array)); +#else + return(-ENOSYS); +#endif +} + +/* ========================================================================== + * machdep_sys_recvmsg() + */ +int machdep_sys_recvmsg(int a, char * b, int c) +{ +#ifdef SYS_RECVMSG + int array[3]; + + array[0] = (int)a; + array[1] = (int)b; + array[2] = (int)c; + + return(machdep_sys_socketcall(SYS_RECVMSG, array)); +#else + return(-ENOSYS); +#endif +} + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +int machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + int ret; + + if ((ret = machdep_sys_readdir(fd, buf, 1)) > 0) { + return(1); + } + return(ret); +} + +/* ========================================================================== + * 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)); +} + +/* getdtablesize */ +machdep_sys_getdtablesize () +{ + return OPEN_MAX; +} + +struct stat; + +/* ========================================================================== + * _fxstat() + */ +int _fxstat(int __ver, int fd, struct stat *buf) +{ + int ret; + + if ((ret = fd_lock(fd, FD_READ, NULL)) == OK) { + ret = machdep_sys_fstat(fd_table[fd]->fd.i, buf); + fd_unlock(fd, FD_READ); + } + return(ret); +} + +/* ========================================================================== + * _lxstat() + */ +int _lxstat(int __ver, const char * path, struct stat * buf) +{ + int ret; + + if ((ret = machdep_sys_lstat(path, buf)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * _xstat() + */ +int _xstat(int __ver, const char * path, struct stat * buf) +{ + int ret; + + if ((ret = machdep_sys_stat(path, buf)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * strtol() + */ +__strtol_internal(char * a, char ** b, int c) +{ + return(strtol(a, b, c)); +} + + diff --git a/lib/libpthread/machdep/engine-i386-linux-1.0.h b/lib/libpthread/machdep/engine-i386-linux-1.0.h new file mode 100644 index 00000000000..3794af34a82 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-linux-1.0.h @@ -0,0 +1,98 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-linux-1.0.h,v 1.1 1998/07/21 13:19:14 peter Exp $ + */ + + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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) \ +({ \ +volatile long temp = SEMAPHORE_SET; \ + \ +__asm__("xchgl %0,(%2)" \ + :"=r" (temp) \ + :"0" (temp),"r" (lock)); \ +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; + 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 + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) + +/* + * 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-i386-netbsd-0.9.c b/lib/libpthread/machdep/engine-i386-netbsd-0.9.c new file mode 100644 index 00000000000..f9bc2e0947a --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-netbsd-0.9.c @@ -0,0 +1,155 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-netbsd-0.9.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + _longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * 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(); + sig_check_and_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_pthread_create() + */ +void machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, long stack_size, + void *stack_start, long nsec) +{ + machdep_pthread->machdep_stack = stack_start; + + 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; + + _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_send() + */ +machdep_sys_send(int s, const void *buf, int len, int flags) +{ + return(machdep_sys_sendto(s, buf, len, flags, (struct sockaddr*)NULL, 0)); +} + +/* ========================================================================== + * machdep_sys_recv() + */ +machdep_sys_recv(int s, void *buf, int len, int flags) +{ + return(machdep_sys_recvfrom(s, buf, len, flags, (struct sockaddr*)NULL, 0)); +} diff --git a/lib/libpthread/machdep/engine-i386-netbsd-0.9.h b/lib/libpthread/machdep/engine-i386-netbsd-0.9.h new file mode 100644 index 00000000000..abdf63dd5d0 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-netbsd-0.9.h @@ -0,0 +1,83 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-netbsd-0.9.h,v 1.1 1998/07/21 13:19:14 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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; +}; + +/* + * 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) + +int machdep_save_state __P_((void)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/machdep/engine-i386-netbsd-1.0.c b/lib/libpthread/machdep/engine-i386-netbsd-1.0.c new file mode 100644 index 00000000000..ab4d62f3118 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-netbsd-1.0.c @@ -0,0 +1,218 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-netbsd-1.0.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_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) +{ + _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; + + _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-netbsd-1.0.h b/lib/libpthread/machdep/engine-i386-netbsd-1.0.h new file mode 100644 index 00000000000..2015daabf84 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-netbsd-1.0.h @@ -0,0 +1,97 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-netbsd-1.0.h,v 1.1 1998/07/21 13:19:14 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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-i386-netbsd-1.3.c b/lib/libpthread/machdep/engine-i386-netbsd-1.3.c new file mode 100644 index 00000000000..5e00303f301 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-netbsd-1.3.c @@ -0,0 +1,225 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-i386-netbsd-1.3.c,v 1.1 1998/07/21 13:19:19 peter Exp $"; +#endif + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_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) +{ + _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; + + _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)); +} + +/* ========================================================================== + * 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-i386-netbsd-1.3.h b/lib/libpthread/machdep/engine-i386-netbsd-1.3.h new file mode 100644 index 00000000000..2959b3ca841 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-netbsd-1.3.h @@ -0,0 +1,97 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-i386-netbsd-1.3.h,v 1.1 1998/07/21 13:19:19 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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-i386-openbsd-2.0.c b/lib/libpthread/machdep/engine-i386-openbsd-2.0.c new file mode 100644 index 00000000000..09ff0072fdc --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-openbsd-2.0.c @@ -0,0 +1,215 @@ +/* ==== 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 <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> + +/* ========================================================================== + * 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 new file mode 100644 index 00000000000..71ac156b20c --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-openbsd-2.0.h @@ -0,0 +1,97 @@ +/* ==== 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 <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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-i386-sco-3.2v5.c b/lib/libpthread/machdep/engine-i386-sco-3.2v5.c new file mode 100755 index 00000000000..95f0d757585 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-sco-3.2v5.c @@ -0,0 +1,1072 @@ + +/* ==== 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 SCO3.2v5 on i386 + * + * 1.00 96/11/21 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 <pthread.h> +#include <sys/types.h> +#include <sys/timeb.h> +#include <sys/stat.h> +#include <stropts.h> +#include <sys/socket.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> +#include <errno.h> +#include <sys/unistd.h> +#include <sys/utsname.h> +#include <sys/sysi86.h> + +void machdep_sys_abort(char*fname,int lineno) + +{ + char buf[128]; + + sprintf(buf,"panic: %s => %d\n", fname, lineno); + machdep_sys_write(1, buf, strlen(buf)); + abort(); +} + +#if 0 +int setitimer(int which, struct itimerval* value, struct itimerval* ovalue) + +{ + register int ret; + if ((ret = machdep_sys_setitimer(which,value,ovalue))<0) { + errno = -ret; + return -1; + } + else { + return 0; + } +} +#endif + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(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) +{ + 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 (machdep_sys_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 = machdep_sys_setitimer(ITIMER_VIRTUAL, &zeroval, + &(machdep_pthread->machdep_timer)); + } else { + ret = machdep_sys_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; + + 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[JB_PC] = (int)machdep_pthread_start; + + /* Stack starts high and builds down. */ + machdep_pthread->machdep_state[JB_SP] = + (int)machdep_pthread->machdep_stack + stack_size; +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +machdep_sys_wait3(int * b, int c, int * d) +{ +#if 0 + return(machdep_sys_wait4(0, b, c, d)); +#else + return -ENOSYS; +#endif +} + +/* ========================================================================== + * machdep_sys_fstat() + */ +machdep_sys_fstat(int f, struct stat* b) +{ + return machdep_sys_fxstat(0x33, f, b); +} + +/* ========================================================================== + * machdep_sys_dup2() + */ +machdep_sys_dup2(int a, int b) +{ + machdep_sys_close(b); + return machdep_sys_fcntl(a, F_DUPFD, b); +} + +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +machdep_sys_getdtablesize() + +{ + register int ret; + if ((ret = machdep_sys_sysconf(_SC_OPEN_MAX))<0) + PANIC(); + return ret; +} + +/* ========================================================================== + * machdep_sys_fchown() + */ +machdep_sys_fchown(int fd,uid_t owner,gid_t group) + +{ + return -ENOSYS; +} + +/* ========================================================================== + * machdep_sys_fchmod() + */ +machdep_sys_fchmod(int fd,mode_t mode) + +{ + return -ENOSYS; +} + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +int machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + return(machdep_sys_getdents(fd, buf, len)); +} + +/* ========================================================================== + * SCO Socket calls are a bit different + * ========================================================================== + * machdep_sys_socket() + */ +int machdep_sys_socket(int domain, int type, int protocol) +{ + register int s, fd, ret; + struct socksysreq req; + + if ((s = machdep_sys_open("/dev/socksys", 0))<0) + return s; + + req.args[0] = SO_SOCKET; + req.args[1] = (int)domain; + req.args[2] = (int)type; + req.args[3] = (int)protocol; + if ((fd = machdep_sys_ioctl(s, SIOCSOCKSYS, &req))<0) { + machdep_sys_close(s); + return fd; + } + + if ((ret=machdep_sys_dup2(fd, s))<0) { + machdep_sys_close(fd); + return ret; + } + + machdep_sys_close(fd); + return s; + +} + +/* ========================================================================== + * machdep_sys_accept() + */ +int machdep_sys_accept(int s, struct sockaddr * b, int * c) +{ + struct socksysreq req; + + req.args[0] = SO_ACCEPT; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_bind() + */ +int machdep_sys_bind(int s, const struct sockaddr * b, int c) +{ + struct socksysreq req; + + req.args[0] = SO_BIND; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_connect() + */ +int machdep_sys_connect(int s, const struct sockaddr * b, int c) +{ + struct socksysreq req; + + req.args[0] = SO_CONNECT; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_listen() + */ +int machdep_sys_listen(int s, int backlog) +{ + struct socksysreq req; + + req.args[0] = SO_LISTEN; + req.args[1] = (int)s; + req.args[2] = (int)backlog; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_shutdown() + */ +int machdep_sys_shutdown(int s, int b) +{ + struct socksysreq req; + + req.args[0] = SO_SHUTDOWN; + req.args[1] = (int)s; + req.args[2] = (int)b; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_getsockopt() + */ +int machdep_sys_getsockopt(int s, int b, int c, char *d, int *e) +{ + struct socksysreq req; + + req.args[0] = SO_GETSOCKOPT; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + req.args[4] = (int)d; + req.args[5] = (int)e; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_setsockopt() + */ +int machdep_sys_setsockopt(int s, int b, int c, char *d, int e) +{ + struct socksysreq req; + + req.args[0] = SO_SETSOCKOPT; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + req.args[4] = (int)d; + req.args[5] = (int)e; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_getpeername() + */ +int machdep_sys_getpeername(int s, struct sockaddr *b, int *c) +{ + struct socksysreq req; + + req.args[0] = SO_GETPEERNAME; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_send() + */ +int machdep_sys_send(int s, char *b, int c, int d) +{ + struct socksysreq req; + + req.args[0] = SO_SEND; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + req.args[4] = (int)d; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_sendto() + */ +int machdep_sys_sendto(int s, char *b, int c, int d, + struct sockaddr *e, int f) +{ + struct socksysreq req; + + req.args[0] = SO_SENDTO; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + req.args[4] = (int)d; + req.args[5] = (int)e; + req.args[6] = (int)f; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_recv() + */ +int machdep_sys_recv(int s, char *b, int c, int d) +{ + struct socksysreq req; + + req.args[0] = SO_RECV; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + req.args[4] = (int)d; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_recvfrom() + */ +int machdep_sys_recvfrom(int s, char *buf, int len, int flags, + struct sockaddr *from, int *fromlen) +{ + struct socksysreq req; + + req.args[0] = SO_RECVFROM; + req.args[1] = (int)s; + req.args[2] = (int)buf; + req.args[3] = (int)len; + req.args[4] = (int)flags; + req.args[5] = (int)from; + req.args[6] = (int)fromlen; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +/* ========================================================================== + * machdep_sys_socketpair() + */ +int machdep_sys_socketpair(int d, int type, int protocol, int sv[2]) + +{ + register int s1, s2; + register int ret; + struct socksysreq req; + + if (d != AF_UNIX) + return -EPROTONOSUPPORT; + if ((s1=machdep_sys_socket(d,type,protocol))<0) { + return s1; + } + if ((s2=machdep_sys_socket(d,type,protocol))<0) { + machdep_sys_close(s1); + return s2; + } + req.args[0] = SO_SOCKPAIR; + req.args[1] = s1; + req.args[2] = s2; + if ((ret=machdep_sys_ioctl(s1,SIOCSOCKSYS,&req))<0) { + machdep_sys_close(s1); + machdep_sys_close(s2); + return ret; + } + sv[0] = s1; + sv[1] = s2; + return 0; +} + +/* ========================================================================== + * machdep_sys_getsockname() + */ +int machdep_sys_getsockname(int s, char * b, int * c) +{ + struct socksysreq req; + + req.args[0] = SO_GETSOCKNAME; + req.args[1] = (int)s; + req.args[2] = (int)b; + req.args[3] = (int)c; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +int machdep_sys_sendmsg(int s, const struct msghdr *msg, int flags) + +{ + struct socksysreq req; + + req.args[0] = SO_SENDMSG; + req.args[1] = (int)s; + req.args[2] = (int)msg; + req.args[3] = (int)flags; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +int machdep_sys_recvmsg(int s, struct msghdr *msg, int flags) + +{ + struct socksysreq req; + + req.args[0] = SO_RECVMSG; + req.args[1] = (int)s; + req.args[2] = (int)msg; + req.args[3] = (int)flags; + + return(machdep_sys_ioctl(s, SIOCSOCKSYS, &req)); +} + +u_short ntohs(u_short n) + +{ + union { + unsigned char u_nc[4]; + u_short u_ns; + } ns; + register unsigned char* p = &ns.u_nc[0]; + + ns.u_ns = n; + return (p[0]<<8)|p[1]; +} + +u_short htons(u_short h) + +{ + union { + unsigned char u_nc[2]; + u_short u_ns; + } ns; + register unsigned char* p = &ns.u_nc[0]; + p[0] = (h>>8)&0xFF; + p[1] = (h&0xFF); + return ns.u_ns; +} + + +u_long ntohl(u_long n) + +{ + union { + unsigned char u_nc[4]; + u_long u_nl; + } nl; + register unsigned char* p = &nl.u_nc[0]; + + nl.u_nl = n; + return (p[0]<<24)|(p[1]<<16)|(p[2]<<8)|p[3]; +} + +u_long htonl(u_long h) + +{ + union { + unsigned char u_nc[4]; + u_long u_nl; + } nl; + register unsigned char* p = &nl.u_nc[0]; + p[0] = (h>>24)&0xFF; + p[1] = (h>>16)&0xFF; + p[2] = (h>>8)&0xFF; + p[3] = (h&0xFF); + return nl.u_nl; +} + +int getdomainname(char* domain,int len) + +{ + /* edi = len */ + struct socksysreq req; + register int ret, fd; + if (len>MAXHOSTNAMELEN) + len = MAXHOSTNAMELEN; + + if ((fd = machdep_sys_open("/dev/socksys", 0)) < 0) + return fd; + + req.args[0] = SO_GETIPDOMAIN; + req.args[1] = (int)domain; + req.args[2] = (int)len; + if((ret=machdep_sys_ioctl(fd, SIOCSOCKSYS, &req))<0) { + machdep_sys_close(fd); + return ret; + } + + machdep_sys_close(fd); + domain[len-1] = '\0'; + return 0; +} + +int gethostname(char* name, int namelen) + +{ + struct utsname uts; + register int ret, len; + char domain[MAXHOSTNAMELEN+1]; + + if (name==NULL) + return -EFAULT; + if ((ret=machdep_sys_uname(&uts))<0) + return ret; + if (namelen<(len=strlen(uts.nodename))) + return -EFAULT; + strncpy(name,uts.nodename,len); + if (namelen>len) + name[len] = '\0'; + if ((ret=getdomainname(domain, namelen - len))<0) + return ret; + if (domain[0]=='\0') + return 0; + if (len + strlen(domain) + 2 > namelen) + return -EFAULT; + strcat(name, "."); + strcat(name, domain); + return 0; +} + +int gettimeofday(struct timeval* tp, struct timezone* tz) + +{ + register int ret; + if ((ret = machdep_sys_gettimeofday(tp, NULL))<0) { + errno = -ret; + return -1; + } + else { + return 0; + } +} + +int kill(pid_t pid, int signo) + +{ + register int ret; + if ((ret = machdep_sys_kill(pid,signo))<0) { + errno = -ret; + return -1; + } + else { + return 0; + } +} + +typedef void (*signal_t(int signo, void (*func)(int)))(int); + +signal_t* _libc_signal = NULL; + +void (*signal(int signo, void (*func)(int)))(int) + +{ + int ret; + void (*oldfunc)(int); + extern void (*machdep_sys_signal(int signo, void (*func)(int),int* r))(int); + if (_libc_signal!=NULL) + return (*_libc_signal)(signo, func); + + oldfunc = machdep_sys_signal(signo, func, &ret); + if (ret!=0) { + errno = ret; + return SIG_ERR; + } + else { + return oldfunc; + } +} + +int (*_libc_sigaction)(int ,const struct sigaction *, struct sigaction *) = NULL; +int sigaction(int sig,const struct sigaction *act, struct sigaction *oact) + +{ + register int ret; + if (_libc_sigaction!=NULL) + return (*_libc_sigaction)(sig,act,oact); + if ((ret = machdep_sys_sigaction(sig,act,oact))<0) { + errno = -ret; + return -1; + } + else { + return 0; + } +} + +int (*_libc_sigprocmask)(int, const sigset_t *, sigset_t *) = NULL; + +int sigprocmask(int how, const sigset_t *set, sigset_t * oset) + +{ + register int ret; + if (_libc_sigprocmask!=NULL) + return (*_libc_sigprocmask)(how,set,oset); + if ((ret = machdep_sys_sigprocmask(how,set,oset))<0) { + errno = -ret; + return -1; + } + else { + return 0; + } +} + +int (*_libc_sigsuspend)(const sigset_t *) = NULL; + +int sigsuspend(const sigset_t *set) +{ + register int ret; + if (_libc_sigsuspend!=NULL) + return (*_libc_sigsuspend)(set); + if ((ret = machdep_sys_sigsuspend(set))<0) { + errno = -ret; + return -1; + } + else { + return 0; + } +} + +int _sigrelse(sig) +int sig; + +{ + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, sig); + return sigprocmask(SIG_UNBLOCK,&mask,NULL); +} + +int _sighold(sig) +int sig; + +{ + sigset_t mask; + sigemptyset(&mask); + sigaddset(&mask, sig); + return sigprocmask(SIG_BLOCK,&mask,NULL); +} + +void (*sigset(int sig, void (*func)(int)))(int) +{ + return signal(sig, func); +} + + +int (*_libc_getmsg)(int , struct strbuf *, struct strbuf *, int *) = NULL; + +int getmsg(int fd, struct strbuf * ctlptr, struct strbuf * dataptr, + int * flags) +{ + register int ret; + if (_libc_getmsg != NULL) + return (*_libc_getmsg)(fd,ctlptr,dataptr,flags); + else if ((ret=machdep_sys_getmsg(fd,ctlptr,dataptr,flags))<0) { + errno = -ret; + return -1; + } + else + return ret; +} + +int (*_libc_putmsg)(int , const struct strbuf *, const struct strbuf *, int) = NULL; + +int putmsg(int fd, const struct strbuf * ctlptr, const struct strbuf * dataptr, + int flags) +{ + register int ret; + if (_libc_putmsg != NULL) + return (*_libc_putmsg)(fd,ctlptr,dataptr,flags); + else if ((ret=machdep_sys_putmsg(fd,ctlptr,dataptr,flags))<0) { + errno = -ret; + return -1; + } + else + return ret; +} + +int ftime(struct timeb* tp) + +{ + register int ret; + if ((ret=machdep_sys_ftime(tp))<0) { + errno = -ret; + return NOTOK; + } + return 0; +} + +int getpagesize() + +{ + register int ret; +#if 0 + if ((ret = machdep_sys_sysconf(_SC_PAGE_SIZE))<0) { + PANIC(); + SET_ERRNO(-ret); + return -1; + } + else { + return 0; + } +#else + return PAGESIZE; +#endif +} + +static pthread_mutex_t machdep_mutex = +{ MUTEX_TYPE_COUNTING_FAST, PTHREAD_QUEUE_INITIALIZER, \ + NULL, SEMAPHORE_CLEAR, { NULL }, MUTEX_FLAGS_INITED }; + +static pthread_mutex_t malloc_mutex = +{ MUTEX_TYPE_COUNTING_FAST, PTHREAD_QUEUE_INITIALIZER, \ + NULL, SEMAPHORE_CLEAR, { NULL }, MUTEX_FLAGS_INITED }; + +struct stdlock { + volatile long init; + pthread_mutex_t* mutex; +}; + +static void machdep_stdinitlock(struct stdlock* lock) + +{ + if (lock==0) PANIC(); + pthread_mutex_lock(&machdep_mutex); + if (!lock->init) { + register pthread_mutex_t* mutex; + pthread_mutexattr_t attr; + + lock->init = 1; + lock->mutex = &machdep_mutex; + mutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t)); + pthread_mutexattr_init (&attr); + pthread_mutexattr_settype (&attr, MUTEX_TYPE_COUNTING_FAST); + pthread_mutex_init(mutex, &attr); + lock->mutex = mutex; + } + pthread_mutex_unlock(&machdep_mutex); +} + +void machdep_stdlock(struct stdlock* lock) + +{ + if (lock==0) PANIC(); + if (!lock->init) + machdep_stdinitlock(lock); + pthread_mutex_lock(lock->mutex); +} + +void machdep_stdunlock(struct stdlock* lock) + +{ + if (lock==0) PANIC(); + if (!lock->init) + machdep_stdinitlock(lock); + pthread_mutex_unlock(lock->mutex); +} + +int machdep_stdtrylock(struct stdlock* lock) + +{ + if (lock==0) PANIC(); + if (!lock->init) + machdep_stdinitlock(lock); + return pthread_mutex_trylock(lock->mutex); +} + +int machdep_stdtryunlock(struct stdlock* lock) + +{ + if (lock==0) PANIC(); + if (!lock->init) + machdep_stdinitlock(lock); + if (pthread_mutex_trylock(lock->mutex)) + return pthread_mutex_unlock(lock->mutex); + return 0; +} + +extern void (*_libc_stdlock)(struct stdlock* lock); +extern void (*_libc_stdunlock)(struct stdlock* lock); +extern int (*_libc_stdtrylock)(struct stdlock* lock); +extern int (*_libc_stdtryunlock)(struct stdlock* lock); + +int machdep_sys_init() + +{ + typedef void (*voidfunc_t)(); + extern voidfunc_t _libc_read; + extern voidfunc_t _libc_write; + extern voidfunc_t _libc_readv; + extern voidfunc_t _libc_writev; + extern voidfunc_t _libc_open; + extern voidfunc_t _libc_close; + extern voidfunc_t _libc_fork; + extern voidfunc_t _libc_fcntl; + extern voidfunc_t _libc_dup; + extern voidfunc_t _libc_pipe; + extern voidfunc_t _libc_select; + extern voidfunc_t _libc_malloc; + extern voidfunc_t _libc_realloc; + extern voidfunc_t _libc_free; + extern ssize_t pthread_read (int , char*, int ); + extern ssize_t pthread_write (int , char*, int ); + extern int pthread_close (int); + extern int pthread_dup (int); + extern int pthread_fork (); + extern int pthread_pipe (int*); + extern int pthread_fcntl(int, int, ...); + extern int pthread_open(const char *, int, ...); + extern ssize_t pthread_readv (int , const struct iovec *, int ); + extern ssize_t pthread_writev (int , const struct iovec *, int ); + extern int pthread_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + extern int pthread_getmsg(int , struct strbuf *, struct strbuf *,int*); + extern int pthread_putmsg(int , const struct strbuf *, const struct strbuf *,int); + extern void (*pthread_signal(int , void (*)(int)))(int); + extern int pthread_sigaction(int,const struct sigaction *, struct sigaction *); + extern int pthread_sigprocmask(int, const sigset_t *, sigset_t *); + extern int pthread_sigsuspend(const sigset_t *); + + + static struct { + voidfunc_t *p; + voidfunc_t f; + } maptable[] = { + {(voidfunc_t*)&_libc_read, (voidfunc_t) pthread_read}, + {(voidfunc_t*)&_libc_write, (voidfunc_t) pthread_write}, + {(voidfunc_t*)&_libc_readv, (voidfunc_t) pthread_readv}, + {(voidfunc_t*)&_libc_writev, (voidfunc_t) pthread_writev}, + {(voidfunc_t*)&_libc_open, (voidfunc_t) pthread_open}, + {(voidfunc_t*)&_libc_close, (voidfunc_t) pthread_close}, + {(voidfunc_t*)&_libc_fork, (voidfunc_t) pthread_fork}, + {(voidfunc_t*)&_libc_fcntl, (voidfunc_t) pthread_fcntl}, + {(voidfunc_t*)&_libc_dup, (voidfunc_t) pthread_dup}, + {(voidfunc_t*)&_libc_pipe, (voidfunc_t) pthread_pipe}, + {(voidfunc_t*)&_libc_select, (voidfunc_t) pthread_select}, + {(voidfunc_t*)&_libc_getmsg, (voidfunc_t) pthread_getmsg}, + {(voidfunc_t*)&_libc_putmsg, (voidfunc_t) pthread_putmsg}, + {(voidfunc_t*)&_libc_signal, (voidfunc_t) pthread_signal}, + {(voidfunc_t*)&_libc_sigaction, (voidfunc_t) pthread_sigaction}, + {(voidfunc_t*)&_libc_sigprocmask, (voidfunc_t) pthread_sigprocmask}, + {(voidfunc_t*)&_libc_sigsuspend, (voidfunc_t) pthread_sigsuspend}, + {(voidfunc_t*) 0, (voidfunc_t) 0} + }; + register int i; + + for (i=0; maptable[i].p; i++) + *maptable[i].p = maptable[i].f; + + _libc_stdlock = machdep_stdlock; + _libc_stdunlock = machdep_stdunlock; + _libc_stdtrylock = machdep_stdtrylock; + _libc_stdtryunlock = machdep_stdtryunlock; + return 0; +} + +#if 0 +extern end; +char* nd = (char*) &end; +char* brk(const char* endds) + +{ + register int ret; + + if ((ret = machdep_sys_brk((char*)endds))<0) { + SET_ERRNO(-ret); + return (char*) -1; + } + else { + nd = (char*) endds; + return 0; + } +} + +char *sbrk(int incr) + +{ + register char* ret; + if (incr!=0 && (ret=brk(nd + incr))!=0) + return ret; + else + return nd - incr; +} +#endif + +sigset_t sigmask(int sig) + +{ + sigset_t oset; + sigemptyset(&oset); + sigaddset(&oset, sig); + return oset; +} + +sigset_t sigsetmask(sigset_t set) + +{ + sigset_t oset; + sigprocmask(SIG_SETMASK,&set,&oset); + return oset; +} + +sigset_t sigblock(sigset_t set) + +{ + sigset_t oset; + sigprocmask(SIG_BLOCK,&set,&oset); + return oset; +} diff --git a/lib/libpthread/machdep/engine-i386-sco-3.2v5.h b/lib/libpthread/machdep/engine-i386-sco-3.2v5.h new file mode 100644 index 00000000000..8b2aa362f06 --- /dev/null +++ b/lib/libpthread/machdep/engine-i386-sco-3.2v5.h @@ -0,0 +1,104 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * engine-i386-freebsd-2.0.h,v 1.1.4.1 1995/12/13 05:41:52 proven Exp + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +#ifndef __NORETURN +#define __NORETURN +#endif + +/* + * 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; +#define JB_BP 3 +#define JB_SP 4 +#define JB_PC 5 + 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 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)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/machdep/engine-ip22-irix-5.2.c b/lib/libpthread/machdep/engine-ip22-irix-5.2.c new file mode 100644 index 00000000000..e673e9502f0 --- /dev/null +++ b/lib/libpthread/machdep/engine-ip22-irix-5.2.c @@ -0,0 +1,225 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1995 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for IRIX-5.2 on the IP22 + * + * 1.00 95/04/26 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-ip22-irix-5.2.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdlib.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * 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) +{ + int i; + + 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; + + if (setjmp(machdep_pthread->machdep_state)) { + machdep_pthread_start(); + } + + /* + * Set up new stact frame so that it looks like it + * returned from a longjmp() to the beginning of + * machdep_pthread_start(). + */ + + /* IP22 stack starts high and builds down. */ + machdep_pthread->machdep_state[JB_SP] = + (int)machdep_pthread->machdep_stack + stack_size - 1024; + machdep_pthread->machdep_state[JB_SP] &= ~7; + + memcpy((void *)machdep_pthread->machdep_state[JB_SP], + (char *)(((int)&i) - 24), 32); + +} + +/* ========================================================================== + * machdep_sys_dup2() + */ +machdep_sys_dup2(int a, int b) +{ + machdep_sys_close(b); + machdep_sys_fcntl(a, F_DUPFD, b); +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +machdep_sys_wait3(int * b, int c, int * d) +{ + return(machdep_sys_waitsys(0, b, c, d)); +} + +/* ========================================================================== + * machdep_sys_waitpid() + */ +machdep_sys_waitpid(int a, int * b, int c) +{ + return(machdep_sys_waitsys(a, b, c, NULL)); +} + +struct stat; + +/* ========================================================================== + * _fxstat() + */ +int _fxstat(int __ver, int fd, struct stat *buf) +{ + int ret; + + if ((ret = fd_lock(fd, FD_READ, NULL)) == OK) { + if ((ret = machdep_sys_fstat(fd_table[fd]->fd.i, buf)) < OK) { + SET_ERRNO(-ret); + } + fd_unlock(fd, FD_READ); + } + return(ret); +} + +/* ========================================================================== + * _lxstat() + */ +int _lxstat(int __ver, const char * path, struct stat * buf) +{ + int ret; + + if ((ret = machdep_sys_lstat(path, buf)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * _xstat() + */ +int _xstat(int __ver, const char * path, struct stat * buf) +{ + int ret; + + if ((ret = machdep_sys_stat(path, buf)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * getdtablesize() + */ +machdep_sys_getdtablesize() +{ + return(sysconf(_SC_OPEN_MAX)); +} + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +int machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + int i; + + i = machdep_sys_getdents(fd, buf, len); + return i; +} diff --git a/lib/libpthread/machdep/engine-ip22-irix-5.2.h b/lib/libpthread/machdep/engine-ip22-irix-5.2.h new file mode 100644 index 00000000000..5440808733d --- /dev/null +++ b/lib/libpthread/machdep/engine-ip22-irix-5.2.h @@ -0,0 +1,108 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-ip22-irix-5.2.h,v 1.1 1998/07/21 13:19:14 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +/* + * The first machine dependent functions are the SEMAPHORES + * needing the test and set instruction. + */ +#define SEMAPHORE_CLEAR 0 +#define SEMAPHORE_SET 0xff + +/* + * More machine dependent macros + */ +#ifdef PTHREAD_KERNEL + +#define machdep_save_float_state(x) +#define machdep_restore_float_state() + +#endif + +/* + * New types + */ +typedef char semaphore; + +/* + * sigset_t macros + */ +#define SIGMAX 32 +#define SIG_ANY(sig) \ +({ \ + sigset_t *sig_addr = (sigset_t *)&sig; \ + int ret = 0; \ + int i; \ + \ + for (i = 1; i <= SIGMAX; i++) { \ + if (sigismember(sig_addr, i)) { \ + ret = 1; \ + break; \ + } \ + } \ + ret; \ +}) + +/* + * 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, 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 new file mode 100644 index 00000000000..0cf0b035d6f --- /dev/null +++ b/lib/libpthread/machdep/engine-m68000-netbsd.h @@ -0,0 +1,77 @@ +/* ==== 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 <unistd.h> +#include <setjmp.h> +#include <sys/time.h> + +/* + * 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/engine-r2000-ultrix-4.2.c b/lib/libpthread/machdep/engine-r2000-ultrix-4.2.c new file mode 100644 index 00000000000..5abca177515 --- /dev/null +++ b/lib/libpthread/machdep/engine-r2000-ultrix-4.2.c @@ -0,0 +1,209 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for decstation with r2000/r3000 + * + * 1.00 93/07/21 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-r2000-ultrix-4.2.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <pthread.h> +#include <stdlib.h> +#include <errno.h> + +/* + * The r2000/r3000 processors do not have a test and set instruction, so + * the semaphore TEST_AND_SET macro is linked very closely to the interrupt + * handelling of the pthreads package. + */ + +/* ========================================================================== + * semaphore_test_and_set() + * + * SEMAPHORE_TEST_AND_SET prevents interrupts, tests the lock and then + * turns interrupts back on, checking to see if any interrupts have occured + * between the prevent and resume. + */ +int semaphore_test_and_set(semaphore *lock) +{ + int rval; + +/* None of this should be necessary + sig_prevent(); + if (!(rval = (*lock))) { + *lock = SEMAPHORE_SET; + } + sig_check_and_resume(); + return(rval); +*/ +} + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_save_float_state() + */ +void machdep_save_float_state(struct pthread * pthread) +{ + return; +} + +/* ========================================================================== + * fake_longjmp() + */ +void fake_longjmp(jmp_buf env) +{ + asm("li $5,1; sw $5, 20($4); li $2,103; syscall"); +} + +/* ========================================================================== + * machdep_restore_state() + * + * When I redo machdep_save_state, I'll put the asm in machdep_save_state() + * and machdep_restore_state() and I won't have to do an additional function + * call. + */ +void machdep_restore_state(void) +{ + fake_longjmp(pthread_run->machdep_data.machdep_state); + /* longjmp(pthread_run->machdep_data.machdep_state, 1); */ +} + +/* ========================================================================== + * machdep_restore_float_state() + */ +void machdep_restore_float_state(void) +{ + return; +} + +/* ========================================================================== + * 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; + + 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[JB_RA] = (int)machdep_pthread_start; + machdep_pthread->machdep_state[JB_PC] = (int)machdep_pthread_start; + + /* Stack starts high and builds down. */ + machdep_pthread->machdep_state[JB_SP] = + (int)machdep_pthread->machdep_stack + stack_size; + + /* This is the real global pointer */ + /* machdep_pthread->machdep_state[JB_GP] = 0; */ +} + +/* ========================================================================== + * machdep_sys_sigprocmask() + * This isn't a real implementation; we can make the assumption that the + * pthreads library is not using oset, and that it is always blocking or + * unblocking all signals at once. + */ +int machdep_sys_sigprocmask(int how, const sigset_t *set, sigset_t *oset) +{ + switch(how) { + case SIG_BLOCK: + sigblock(*set); + break; + case SIG_UNBLOCK: + sigsetmask(~*set); + break; + case SIG_SETMASK: + sigsetmask(*set); + break; + default: + return -EINVAL; + } + return(OK); +} + diff --git a/lib/libpthread/machdep/engine-r2000-ultrix-4.2.h b/lib/libpthread/machdep/engine-r2000-ultrix-4.2.h new file mode 100644 index 00000000000..0a3d537b6dc --- /dev/null +++ b/lib/libpthread/machdep/engine-r2000-ultrix-4.2.h @@ -0,0 +1,107 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-r2000-ultrix-4.2.h,v 1.1 1998/07/21 13:19:14 peter Exp $ + * + * Description : Machine dependent header for decstation with r2000/r3000 + * running Ultrix-4.2 + * + * 1.00 93/07/21 proven + * -Started coding this file. + */ + +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +/* + * 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) semaphore_test_and_set(lock) +#define SEMAPHORE_RESET(lock) *lock = SEMAPHORE_CLEAR + +/* + * New types + */ +typedef long semaphore; + +#if !defined(_POSIX_SOURCE) + +/* typedef int ssize_t; */ + +#if !defined(__GNUC__) + +/* + * sigset_t macros + */ +typedef int sigset_t; +#define sigaddset(set, num) ((*set) |= (1 << (num - 1))) +#define sigemptyset(set) (*set = 0) + +#endif +#endif + +#define SIG_ANY(sig) (sig) +#define SIGMAX 31 + +/* + * New Structures + */ +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, 100000 } }, 0 } + + +/* + * Min stacksize, arch dependent + */ +#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 | O_NDELAY) + +/* + * 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 semaphore_test_and_set __P_((semaphore *)); +int machdep_save_state __P_((void)); + +#endif + +__END_DECLS diff --git a/lib/libpthread/machdep/engine-romp-bsd.c b/lib/libpthread/machdep/engine-romp-bsd.c new file mode 100644 index 00000000000..ef362aa0dc1 --- /dev/null +++ b/lib/libpthread/machdep/engine-romp-bsd.c @@ -0,0 +1,99 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for NetBSD on i386 + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-romp-bsd.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <pthread.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + return(_pthread_save(pthread_run->machdep_data.machdep_state, 0, 0)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + _pthread_restore(pthread_run->machdep_data.machdep_state); +} + +/* ========================================================================== + * 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(); + sig_check_and_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_pthread_create() + */ +void machdep_pthread_create(struct machdep_pthread *machdep_pthread, + void *(* start_routine)(), void *start_argument, long stack_size, + void *stack_start, long nsec) +{ + machdep_pthread->machdep_stack = stack_start; + + 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; + + _pthread_save(machdep_pthread->machdep_state, + (void *)((int)machdep_pthread->machdep_stack + stack_size), + machdep_pthread_start); +} + diff --git a/lib/libpthread/machdep/engine-romp-bsd.h b/lib/libpthread/machdep/engine-romp-bsd.h new file mode 100644 index 00000000000..3a6b7a5f3e7 --- /dev/null +++ b/lib/libpthread/machdep/engine-romp-bsd.h @@ -0,0 +1,100 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1993 John F. Carr, jfc@athena.mit.edu + * + * Description : Machine dependent header for IBM/RT + * + * 1.00 93/09/xx jfc + * -Coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-romp-bsd.h,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include <setjmp.h> +#include <sys/time.h> +#include <sys/types.h> + +/* + * Stuff for compiling + */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#define const +#define inline +#define signed +#define volatile +#endif + +#define SEMAPHORE_CLEAR 0x0000 +#define SEMAPHORE_SET 0xff00 +#define SEMAPHORE_TEST_AND_SET(lock) _tsh(lock) +#define SEMAPHORE_RESET(lock) *(lock) = SEMAPHORE_CLEAR +extern unsigned short _tsh(volatile unsigned short *); + +typedef unsigned short semaphore; + +/* + * sigset_t macros + */ +#define SIG_ANY(sig) (sig) +#define SIGMAX 31 + + +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, 100000 } }, 0 } + +/* + * Min pthread stacksize + */ +#define PTHREAD_STACK_MIN 1024 + +/* + * Some fd defines that are necessary to distinguish between posix + * behavior and bsd4.3 behavior. + */ +#define __FD_NONBLOCK O_NONBLOCK + +#if defined(PTHREAD_KERNEL) + +int machdep_save_state __P_((void)); + +/* save(jmp_buf, stack pointer, restart proc) */ +extern int _pthread_save(jmp_buf, void *, void (*)()); +extern void _pthread_restore(jmp_buf); + +typedef int ssize_t; +typedef unsigned int sigset_t; +#define sigemptyset(sp) *(sp) = 0 +#define sigprocmask(op, nssp, ossp) if (ossp) *(int *)ossp = sigsetmask(*nssp); else sigsetmask(*nssp) +#define sigdelset(sp, i) *(sp) &= ~(1 << (i)) +#define sigaddset(sp, i) *(sp) |= (1 << (i)) +#define sigismember(sp, i) (*(sp) & (1 << (i))) +#endif diff --git a/lib/libpthread/machdep/engine-sparc-sunos-4.1.3.c b/lib/libpthread/machdep/engine-sparc-sunos-4.1.3.c new file mode 100644 index 00000000000..b42311be44c --- /dev/null +++ b/lib/libpthread/machdep/engine-sparc-sunos-4.1.3.c @@ -0,0 +1,227 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for SunOS-4.1.3 on sparc + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-sparc-sunos-4.1.3.c,v 1.1 1998/07/21 13:19:14 peter Exp $"; +#endif + +#include "config.h" +#include <pthread.h> +#include <stdlib.h> +#include <errno.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + /* Save register windows onto stackframe */ + __asm__ ("ta 3"); + + return(setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + longjmp(pthread_run->machdep_data.machdep_state, 1); +} +/* ========================================================================== + * machdep_save_float_state() + */ +void machdep_save_float_state(struct pthread * pthread) +{ + return; +} + +/* ========================================================================== + * machdep_restore_float_state() + */ +void machdep_restore_float_state(void) +{ + return; +} + +/* ========================================================================== + * 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; + + /* Save register windows onto stackframe */ + __asm__ ("ta 3"); + + 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[3] = (int)machdep_pthread_start; + machdep_pthread->machdep_state[4] = (int)machdep_pthread_start; + + /* Sparc stack starts high and builds down. */ + machdep_pthread->machdep_state[2] = + (int)machdep_pthread->machdep_stack + stack_size - 1024; + machdep_pthread->machdep_state[2] &= ~7; + +} + +#if defined(HAVE_SYSCALL_GETDENTS) +/* ========================================================================== + * machdep_sys_getdirentries() + * + * Always use getdents in place of getdirentries if possible --proven + */ +int machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + return(machdep_sys_getdents(fd, buf, len)); +} +#endif + +/* ========================================================================== + * 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 pid, int * statusp, int options) +{ + if (pid == -1) + pid = 0; + else if (pid == 0) + pid = - getpgrp (); + return machdep_sys_wait4 (pid, statusp, options, NULL); +} + +#if !defined(HAVE_SYSCALL_SIGPROCMASK) +/* ========================================================================== + * machdep_sys_sigprocmask() + * This isn't a real implementation; we can make the assumption that the + * pthreads library is not using oset, and that it is always blocking or + * unblocking all signals at once. + */ +int machdep_sys_sigprocmask(int how, const sigset_t *set, sigset_t *oset) +{ + switch(how) { + case SIG_BLOCK: + sigblock(*set); + break; + case SIG_UNBLOCK: + sigsetmask(~*set); + break; + case SIG_SETMASK: + sigsetmask(*set); + break; + default: + return -EINVAL; + } + return(OK); +} + +/* ========================================================================== + * sigaction() + * + * Temporary until I do machdep_sys_sigaction() + */ +int sigaction(int sig, const struct sigaction *act, struct sigaction *oldact) +{ + return(sigvec(sig, (struct sigvec *)act, (struct sigvec *)oldact)); +} +#endif + +#if !defined(HAVE_SYSCALL_GETDTABLESIZE) +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +machdep_sys_getdtablesize() +{ + return(sysconf(_SC_OPEN_MAX)); +} +#endif diff --git a/lib/libpthread/machdep/engine-sparc-sunos-4.1.3.h b/lib/libpthread/machdep/engine-sparc-sunos-4.1.3.h new file mode 100644 index 00000000000..ecc311194e5 --- /dev/null +++ b/lib/libpthread/machdep/engine-sparc-sunos-4.1.3.h @@ -0,0 +1,105 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-sparc-sunos-4.1.3.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +/* + * The first machine dependent functions are the SEMAPHORES + * needing the test and set instruction. + */ +#define SEMAPHORE_CLEAR 0 +#define SEMAPHORE_SET 0xff + +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ +char *p = lock; \ +long temp; \ + \ +__asm__ volatile("ldstub %1,%0" \ + :"=r" (temp) \ + :"m" (*p) \ + :"memory"); \ +temp; \ +}) + +#define SEMAPHORE_RESET(lock) \ +{ \ +__asm__ volatile("stb %1, %0" \ + :"=m" (*lock) \ + :"r" (SEMAPHORE_CLEAR) \ + :"memory"); \ +} + +/* + * 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; +}; + +/* + * 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 | O_NDELAY) + +/* + * 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-sparc-sunos-5.3.c b/lib/libpthread/machdep/engine-sparc-sunos-5.3.c new file mode 100644 index 00000000000..924f3279141 --- /dev/null +++ b/lib/libpthread/machdep/engine-sparc-sunos-5.3.c @@ -0,0 +1,308 @@ +/* ==== machdep.c ============================================================ + * Copyright (c) 1993, 1994 Chris Provenzano, proven@athena.mit.edu + * + * Description : Machine dependent functions for SunOS-4.1.3 on sparc + * + * 1.00 93/08/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: engine-sparc-sunos-5.3.c,v 1.1 1998/07/21 13:19:15 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> +#include <fcntl.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/socket.h> +#include <sys/procset.h> +#include <sys/systeminfo.h> +#include <poll.h> + +/* ========================================================================== + * machdep_save_state() + */ +int machdep_save_state(void) +{ + /* Save register windows onto stackframe */ + __asm__ ("ta 3"); + + return(setjmp(pthread_run->machdep_data.machdep_state)); +} + +/* ========================================================================== + * machdep_restore_state() + */ +void machdep_restore_state(void) +{ + longjmp(pthread_run->machdep_data.machdep_state, 1); +} + +/* ========================================================================== + * 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; + + /* Save register windows onto stackframe */ + __asm__ ("ta 3"); + + if (setjmp(machdep_pthread->machdep_state)) { + machdep_pthread_start(); + } + + /* + * Set up new stact frame so that it looks like it + * returned from a longjmp() to the beginning of + * machdep_pthread_start(). + */ + + /* Sparc stack starts high and builds down. */ + machdep_pthread->machdep_state[1] = + (int)machdep_pthread->machdep_stack + stack_size - 1024; + machdep_pthread->machdep_state[1] &= ~7; + +} + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +int machdep_sys_getdirentries(int fd, char * buf, int len, int * seek) +{ + return(machdep_sys_getdents(fd, buf, len)); +} + +/* ========================================================================== + * machdep_sys_wait3() + */ +machdep_sys_wait3(int * b, int c, int * d) +{ + return(-ENOSYS); + /* return(machdep_sys_wait4(0, b, c, d)); */ +} + +/* ========================================================================== + * machdep_sys_waitpid() + */ +machdep_sys_waitpid(int a, int * b, int c) +{ + idtype_t id; + + switch (a) { + case -1: + id = P_ALL; + break; + case 0: + a = machdep_sys_pgrpsys(0); + id = P_PGID; + break; + default: + if (a < 0) { + id = P_PGID; + a = -a; + } else { + id = P_PID; + } + break; + } + + return(machdep_sys_waitsys(id, a, b, c)); +} + +/* ========================================================================== + * machdep_sys_dup2() + */ +machdep_sys_dup2(int a, int b) +{ + machdep_sys_close(b); + machdep_sys_fcntl(a, F_DUPFD, b); +} + +/* ========================================================================== + * machdep_sys_ftruncate() + */ +machdep_sys_ftruncate(int a, off_t b) +{ + flock_t c; + + c.l_len = 0; + c.l_start = b; + c.l_whence = 0; + return(machdep_sys_fcntl(a, F_FREESP, c)); +} + +/* ========================================================================== + * machdep_sys_select() + * Recoded to be quicker by Monty + */ +static fd_set bogus_fds; /* Always zero, never changed */ + +machdep_sys_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) +{ + struct pollfd fds[64],*ptr; + int i, fds_count, time_out, found; + + /* Make sure each arg has a valid pointer */ + if ((readfds == NULL) || (writefds == NULL) || (exceptfds == NULL)) { + if (exceptfds == NULL) { + exceptfds = &bogus_fds; + } + if (writefds == NULL) { + writefds = &bogus_fds; + } + if (readfds == NULL) { + readfds = &bogus_fds; + } + } + + ptr=fds; + for (i = 0 ; i < nfds; i++) + { + if (FD_ISSET(i, readfds)) + { + if (FD_ISSET(i, writefds)) + ptr->events= POLLIN | POLLOUT; + else + ptr->events= POLLIN; + (ptr++)->fd=i; + } + else if (FD_ISSET(i, writefds)) + { + ptr->events=POLLOUT; + (ptr++)->fd=i; + } + } + FD_ZERO(readfds); + FD_ZERO(writefds); + FD_ZERO(exceptfds); + time_out = timeout->tv_usec / 1000 + timeout->tv_sec * 1000; + fds_count=(int) (ptr-fds); + while ((found = machdep_sys_poll(fds, fds_count, time_out)) <= 0) + { + if (found != -ERESTART) /* Try again if restartable */ + return(found); /* Usually 0 ; Cant read or write */ + } + + while (ptr-- != fds) + { + if (ptr->revents & POLLIN) + FD_SET(ptr->fd, readfds); + if (ptr->revents & POLLOUT) + FD_SET(ptr->fd,writefds); + } + return(found); +} + +/* ========================================================================== + * machdep_sys_getdtablesize() + */ +machdep_sys_getdtablesize() +{ + return(sysconf(_SC_OPEN_MAX)); +} + +/* ========================================================================== + * getpagesize() + */ +getpagesize() +{ + return(sysconf(_SC_PAGESIZE)); +} + +/* ========================================================================== + * gethostname() + */ +int gethostname(char * name, int namelen) +{ + if (sysinfo(SI_HOSTNAME, name, namelen) == NOTOK) { + return(NOTOK); + } else { + return(OK); + } +} + +/* ========================================================================== + * machdep_sys_sigaction() + * + * This is VERY temporary. + */ +int machdep_sys_sigaction(int a, void * b, void * c) +{ + return(sigaction(a, b, c)); +} diff --git a/lib/libpthread/machdep/engine-sparc-sunos-5.3.h b/lib/libpthread/machdep/engine-sparc-sunos-5.3.h new file mode 100644 index 00000000000..8a569f7b92e --- /dev/null +++ b/lib/libpthread/machdep/engine-sparc-sunos-5.3.h @@ -0,0 +1,129 @@ +/* ==== machdep.h ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@athena.mit.edu + * + * $Id: engine-sparc-sunos-5.3.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + */ + +#include <unistd.h> +#include <setjmp.h> +#include <sys/time.h> +#include <sys/cdefs.h> + +/* + * The first machine dependent functions are the SEMAPHORES + * needing the test and set instruction. + */ +#define SEMAPHORE_CLEAR 0 +#define SEMAPHORE_SET 0xff + +#define SEMAPHORE_TEST_AND_SET(lock) \ +({ \ +char *p = lock; \ +long temp; \ + \ +__asm__ volatile("ldstub %1,%0" \ + :"=r" (temp) \ + :"m" (*p) \ + :"memory"); \ +temp; \ +}) + +#define SEMAPHORE_RESET(lock) \ +{ \ +__asm__ volatile("stb %1, %0" \ + :"=m" (*lock) \ + :"r" (SEMAPHORE_CLEAR) \ + :"memory"); \ +} + +/* + * More machine dependent macros + */ +#ifdef PTHREAD_KERNEL + +#define machdep_save_float_state(x) +#define machdep_restore_float_state() + +#endif + +/* + * New types + */ +typedef char semaphore; + +/* + * sigset_t macros + */ +#define SIGMAX 31 +#define SIG_ANY(sig) \ +({ \ + sigset_t *sig_addr = (sigset_t *)&sig; \ + int ret = 0; \ + int i; \ + \ + for (i = 1; i <= SIGMAX; i++) { \ + if (sigismember(sig_addr, i)) { \ + ret = 1; \ + break; \ + } \ + } \ + ret; \ +}) + +/* + * 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, 100000 } }, 0 } + +/* + * Minimum stack size + */ +#undef PTHREAD_STACK_MIN /* Defined in limits.h */ +#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 | O_NDELAY) + +/* + * 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/freebsd-1.1/compat.h b/lib/libpthread/machdep/freebsd-1.1/compat.h new file mode 100755 index 00000000000..14c110d3975 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-1.1/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 13:19:23 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/freebsd-1.1/dirent.h b/lib/libpthread/machdep/freebsd-1.1/dirent.h new file mode 100755 index 00000000000..5226443f86b --- /dev/null +++ b/lib/libpthread/machdep/freebsd-1.1/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/machdep/freebsd-1.1/socket.h b/lib/libpthread/machdep/freebsd-1.1/socket.h new file mode 100755 index 00000000000..c0f4ee45916 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-1.1/socket.h @@ -0,0 +1,267 @@ +/* + * Copyright (c) 1982,1985,1986,1988 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: @(#)socket.h 7.13 (Berkeley) 4/20/91 + * $Id: socket.h,v 1.1 1998/07/21 13:19:23 peter Exp $ + */ + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ 1 + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ +#define AF_RMP 20 /* HP's Remote Maint Protocol */ +#define AF_MAX 21 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_char sa_len; /* total length */ + u_char sa_family; /* address family */ + char sa_data[14]; /* actually longer; address value */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#define PF_RMP AF_RMP + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct adatahdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct adatahdr, return pointer to next adatahdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#ifndef KERNEL + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +int getsockname __P_((int, struct sockaddr *, int *)); +int getsockopt __P_((int, int, int, void *, int *)); +int listen __P_((int, int)); +ssize_t recv __P_((int, void *, size_t, int)); +ssize_t recvfrom __P_((int, void *, size_t, int, + struct sockaddr *, int *)); +int recvmsg __P_((int, struct msghdr *, int)); +ssize_t send __P_((int, const void *, size_t, int)); +ssize_t sendto __P_((int, const void *, size_t, int, + const struct sockaddr *, int)); +int sendmsg __P_((int, const struct msghdr *, int)); +int setsockopt __P_((int, int, int, const void *, int)); +int shutdown __P_((int, int)); +int socket __P_((int, int, int)); +int socketpair __P_((int, int, int, int *)); +__END_DECLS + +#endif /* !KERNEL */ +#endif /* _SYS_SOCKET_H_ */ diff --git a/lib/libpthread/machdep/freebsd-1.1/timers.h b/lib/libpthread/machdep/freebsd-1.1/timers.h new file mode 100755 index 00000000000..4509e1ec9da --- /dev/null +++ b/lib/libpthread/machdep/freebsd-1.1/timers.h @@ -0,0 +1,68 @@ +/* ==== 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:23 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 <sys/types.h> +#include <time.h> + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/freebsd-2.0/__math.h b/lib/libpthread/machdep/freebsd-2.0/__math.h new file mode 100755 index 00000000000..27ed0f2575d --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__math.h @@ -0,0 +1,6 @@ +/* + * ANSI/POSIX + */ +extern char __infinity[]; +#define HUGE_VAL (*(double *) __infinity) + diff --git a/lib/libpthread/machdep/freebsd-2.0/__path.h b/lib/libpthread/machdep/freebsd-2.0/__path.h new file mode 100755 index 00000000000..7557aaeb353 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__path.h @@ -0,0 +1,14 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: __path.h,v 1.1 1998/07/21 13:19:24 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/freebsd-2.0/__signal.h b/lib/libpthread/machdep/freebsd-2.0/__signal.h new file mode 100755 index 00000000000..918955c9948 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__signal.h @@ -0,0 +1,8 @@ +#include <sys/signal.h> + +#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/freebsd-2.0/__stdio.h b/lib/libpthread/machdep/freebsd-2.0/__stdio.h new file mode 100755 index 00000000000..d60b9df7a54 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__stdio.h @@ -0,0 +1,8 @@ + +#include <machine/ansi.h> +#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 <sys/types.h> */ diff --git a/lib/libpthread/machdep/freebsd-2.0/__stdlib.h b/lib/libpthread/machdep/freebsd-2.0/__stdlib.h new file mode 100755 index 00000000000..a9ef660d50d --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__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 13:19:24 peter Exp $ + */ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <machine/ansi.h> + +#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/freebsd-2.0/__string.h b/lib/libpthread/machdep/freebsd-2.0/__string.h new file mode 100755 index 00000000000..93d4fcf9dd2 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__string.h @@ -0,0 +1,21 @@ + +#include <machine/ansi.h> +#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/freebsd-2.0/__time.h b/lib/libpthread/machdep/freebsd-2.0/__time.h new file mode 100755 index 00000000000..5859188a3d7 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__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 13:19:24 peter Exp $ + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include <machine/ansi.h> +#include <machine/limits.h> + +#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/freebsd-2.0/__unistd.h b/lib/libpthread/machdep/freebsd-2.0/__unistd.h new file mode 100755 index 00000000000..e10b422700b --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/__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 13:19:24 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> + +#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/freebsd-2.0/compat.h b/lib/libpthread/machdep/freebsd-2.0/compat.h new file mode 100755 index 00000000000..01ad47dbdb5 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/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 13:19:24 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/freebsd-2.0/dirent.h b/lib/libpthread/machdep/freebsd-2.0/dirent.h new file mode 100755 index 00000000000..5226443f86b --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/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/machdep/freebsd-2.0/errno.h b/lib/libpthread/machdep/freebsd-2.0/errno.h new file mode 100755 index 00000000000..3da61d692a3 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/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/machdep/freebsd-2.0/timers.h b/lib/libpthread/machdep/freebsd-2.0/timers.h new file mode 100755 index 00000000000..a590b25df06 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/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 13:19:24 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 <sys/time.h> + +#endif diff --git a/lib/libpthread/machdep/freebsd-2.0/wait.h b/lib/libpthread/machdep/freebsd-2.0/wait.h new file mode 100755 index 00000000000..3284d6911e1 --- /dev/null +++ b/lib/libpthread/machdep/freebsd-2.0/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 13:19:24 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 <machine/endian.h> + +/* + * 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 <sys/types.h> +#include <sys/cdefs.h> + +__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/hpux-10.20/__math.h b/lib/libpthread/machdep/hpux-10.20/__math.h new file mode 100755 index 00000000000..8066bd60713 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__math.h @@ -0,0 +1,3 @@ +#define HUGE_VAL 1.7976931348623157e+308 + + diff --git a/lib/libpthread/machdep/hpux-10.20/__signal.h b/lib/libpthread/machdep/hpux-10.20/__signal.h new file mode 100755 index 00000000000..fbb1d6ce2b1 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__signal.h @@ -0,0 +1,28 @@ +#include <sys/signal.h> + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif + +/* #define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) */ +#define sigword(n) (((unsigned int)((n) - 1))>>5) + +#define __SIGEMPTYSET { 0, 0, 0, 0, 0, 0, 0, 0 } +#define __SIGFILLSET { 0xffffffff,0xffffffff,0xffffffff,0xffffffff,\ + 0xffffffff,0xffffffff,0xffffffff,0xffffffff} +#define __SIGADDSET(s, n) ((s)->sigset[sigword(n)] |= sigmask(n)) +#define __SIGDELSET(s, n) ((s)->sigset[sigword(n)] &= ~sigmask(n)) +#define __SIGISMEMBER(s, n) ((s)->sigset[sigword(n)] & sigmask(n)) + +#define SIGSET_SIZE sizeof(sigset_t)/sizeof(long) + +#define SIG_ANY(sig) sig_any(&sig) + +static inline int sig_any(sigset_t *sig) { + int i; + for (i=0; i < SIGSET_SIZE; i++) + if (sig->sigset[i] != 0) + return 1; + return 0; +} + diff --git a/lib/libpthread/machdep/hpux-10.20/__stdio.h b/lib/libpthread/machdep/hpux-10.20/__stdio.h new file mode 100755 index 00000000000..b8f1a07d9d6 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__stdio.h @@ -0,0 +1,11 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +#include <sys/types.h> +/* +typedef pthread_fpos_t fpos_t; +*/ + diff --git a/lib/libpthread/machdep/hpux-10.20/__stdlib.h b/lib/libpthread/machdep/hpux-10.20/__stdlib.h new file mode 100755 index 00000000000..c6e8dc5a3cf --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__stdlib.h @@ -0,0 +1,24 @@ +/* $Id: __stdlib.h,v 1.1 1998/07/21 13:19:36 peter Exp $ */ + +#ifndef __sys_stdtypes_h + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef unsigned int wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif + +#endif diff --git a/lib/libpthread/machdep/hpux-10.20/__string.h b/lib/libpthread/machdep/hpux-10.20/__string.h new file mode 100755 index 00000000000..1badf6d660c --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__string.h @@ -0,0 +1,20 @@ + +#ifndef _SYS_STDSYMS_INCLUDED +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +/* Non-standard SunOS 4.x 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 *)); +__END_DECLS +#endif diff --git a/lib/libpthread/machdep/hpux-10.20/__time.h b/lib/libpthread/machdep/hpux-10.20/__time.h new file mode 100755 index 00000000000..e9d8e8d31c4 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__time.h @@ -0,0 +1,31 @@ +/* $Id: __time.h,v 1.1 1998/07/21 13:19:37 peter Exp $ */ + +#ifndef __sys_stdtypes_h + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#define CLOCKS_PER_SEC 1000000 + +#if !defined(_ANSI_SOURCE) && !defined(CLK_TCK) +#define CLK_TCK 60 +#endif /* not ANSI */ + +#endif + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/hpux-10.20/__unistd.h b/lib/libpthread/machdep/hpux-10.20/__unistd.h new file mode 100755 index 00000000000..218e13d14ec --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/__unistd.h @@ -0,0 +1,68 @@ +/* /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/machdep/hpux-9.03/__unist +d.h,v 1.2 1995/03/10 03:59:53 snl Exp */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/stdsyms.h> +#include <sys/types.h> +#include <utime.h> + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _GID_T +#define _GID_T +typedef long gid_t; +#endif + +#ifndef _UID_T +#define _UID_T +typedef long uid_t; +#endif + +#ifndef _PID_T +#define _PID_T +typedef long pid_t; +#endif + +#ifndef _OFF_T +#define _OFF_T +typedef long off_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef int ssize_t; +#endif + +#define ioctl_request_type int /* For fd.c */ + +/* Symbolic constants for sysconf() variables defined by POSIX.1-1988: 0-7 */ + +#define _SC_ARG_MAX 0 /* ARG_MAX: Max length of argument to exec() + including environment data */ +#define _SC_CHILD_MAX 1 /* CHILD_MAX: Max of processes per userid */ +#define _SC_CLK_TCK 2 /* Number of clock ticks per second */ +#define _SC_NGROUPS_MAX 3 /* NGROUPS_MAX: Max of simultaneous + supplementary group IDs per process */ +#define _SC_OPEN_MAX 4 /* OPEN_MAX: Max of files that one process + can have open at any one time */ +#define _SC_JOB_CONTROL 5 /* _POSIX_JOB_CONTROL: 1 iff supported */ +#define _SC_SAVED_IDS 6 /* _POSIX_SAVED_IDS: 1 iff supported */ +#define _SC_1_VERSION_88 7 /* _POSIX_VERSION: Date of POSIX.1-1988 */ + +/* Symbolic constants for sysconf() variables added by POSIX.1-1990: 100-199 */ + +#define _SC_STREAM_MAX 100 /* STREAM_MAX: Max of open stdio FILEs */ +#define _SC_TZNAME_MAX 101 /* TZNAME_MAX: Max length of timezone name */ +#define _SC_1_VERSION_90 102 /* _POSIX_VERSION: Date of POSIX.1-1990 */ + +#endif /* _SYS___UNISTD_H_ */ + diff --git a/lib/libpthread/machdep/hpux-10.20/cdefs.h b/lib/libpthread/machdep/hpux-10.20/cdefs.h new file mode 100755 index 00000000000..643089e6df6 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/cdefs.h @@ -0,0 +1,67 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +#include <sys/_inttypes.h> + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __INLINE static +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +/* +typedef int int32_t; +*/ +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +/* +typedef short int16_t; +*/ +#endif + +#endif diff --git a/lib/libpthread/machdep/hpux-10.20/compat.h b/lib/libpthread/machdep/hpux-10.20/compat.h new file mode 100755 index 00000000000..17b3e50f228 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:37 peter Exp $ + * + * Description : Compatibility header for networking code. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/hpux-10.20/dirent.h b/lib/libpthread/machdep/hpux-10.20/dirent.h new file mode 100755 index 00000000000..5f17af345db --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/dirent.h @@ -0,0 +1,61 @@ +/*- + * 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 + +#endif /* !_SYS_DIRENT_H_ */ diff --git a/lib/libpthread/machdep/hpux-10.20/socket.h b/lib/libpthread/machdep/hpux-10.20/socket.h new file mode 100755 index 00000000000..c7a37706940 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/socket.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 1982, 1985, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)socket.h 7.3 (Berkeley) 6/27/88 + */ + +/* + * Definitions related to sockets: types, address families, options. + */ + +#include <sys/stdsyms.h> +#include <pthread/posix.h> +#include <sys/cdefs.h> + +/* + * Types of sockets + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_SND_COPYAVOID 0x1009 /* avoid copy on send*/ +#define SO_RCV_COPYAVOID 0x100a /* avoid copy on rcv */ + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_NBS 7 /* nbs protocols */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_OTS 17 /* Used for OSI in the ifnets */ +#define AF_NIT 18 /* NIT */ + +#define AF_MAX 19 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 20 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#define MSG_MAXIOVLEN 16 + +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); + +__END_DECLS + diff --git a/lib/libpthread/machdep/hpux-10.20/stdtypes.h b/lib/libpthread/machdep/hpux-10.20/stdtypes.h new file mode 100755 index 00000000000..2b22abbf818 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/stdtypes.h @@ -0,0 +1,74 @@ +/* @(#)stdtypes.h 1.6 90/01/04 SMI */ + +/* + * Suppose you have an ANSI C or POSIX thingy that needs a typedef + * for thingy_t. Put it here and include this file wherever you + * define the thingy. This is used so that we don't have size_t in + * N (N > 1) different places and so that we don't have to have + * types.h included all the time and so that we can include this in + * the lint libs instead of termios.h which conflicts with ioctl.h. + */ +#ifndef __sys_stdtypes_h +#define __sys_stdtypes_h + +#ifndef _SIGSET_T_ +#define _SIGSET_T_ +typedef int sigset_t; /* signal mask - may change */ +#endif + +#ifndef _SPEED_T_ +#define _SPEED_T_ +typedef unsigned int speed_t; /* tty speeds */ +#endif + +#ifndef _TCFLAG_T_ +#define _TCFLAG_T_ +typedef unsigned long tcflag_t; /* tty line disc modes */ +#endif + +#ifndef _CC_T_ +#define _CC_T_ +typedef unsigned char cc_t; /* tty control char */ +#endif + +#ifndef _PID_T_ +#define _PID_T_ +typedef int pid_t; /* process id */ +#endif + +#ifndef _MODE_T_ +#define _MODE_T_ +typedef unsigned short mode_t; /* file mode bits */ +#endif + +#ifndef _NLINK_T_ +#define _NLINK_T_ +typedef short nlink_t; /* links to a file */ +#endif + +#ifndef _CLOCK_T_ +#define _CLOCK_T_ +typedef long clock_t; /* units=ticks (typically 60/sec) */ +#endif + +#ifndef _TIME_T_ +#define _TIME_T_ +typedef long time_t; /* value = secs since epoch */ +#endif + +#ifndef _SIZE_T_ +#define _SIZE_T_ +typedef int size_t; /* ??? */ +#endif + +#ifndef _PTRDIFF_T_ +#define _PTRDIFF_T_ +typedef int ptrdiff_t; /* result of subtracting two pointers */ +#endif + +#ifndef _WCHAR_T_ +#define _WCHAR_T_ +typedef unsigned short wchar_t; /* big enough for biggest char set */ +#endif + +#endif /* !__sys_stdtypes_h */ diff --git a/lib/libpthread/machdep/hpux-10.20/time.h b/lib/libpthread/machdep/hpux-10.20/time.h new file mode 100755 index 00000000000..2ad2aa0cb77 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/time.h @@ -0,0 +1,228 @@ +/* $Header: /cvs/OpenBSD/src/lib/libpthread/machdep/hpux-10.20/Attic/time.h,v 1.1 1998/07/21 13:19:37 peter Exp $ */ + +#ifndef _SYS_TIME_INCLUDED +#define _SYS_TIME_INCLUDED + +/* time.h: Definitions for time handling functions */ + +#ifdef _KERNEL_BUILD +#include "../h/stdsyms.h" +#else /* ! _KERNEL_BUILD */ +#include <sys/stdsyms.h> +#endif /* _KERNEL_BUILD */ + +#include <sys/types.h> + +/* ANSI C time constants, types, and structures */ + +#ifdef _INCLUDE__STDC__ +# define CLOCKS_PER_SEC 1000000 + +# ifndef NULL +# define NULL 0 +# endif + +# ifndef _CLOCK_T +# define _CLOCK_T + typedef unsigned long clock_t; +# endif /* _CLOCK_T */ + +# ifndef _TIME_T +# define _TIME_T + typedef long time_t; +# endif /* _TIME_T */ + +# ifndef _SIZE_T +# define _SIZE_T + typedef unsigned int size_t; +# endif /* _SIZE_T */ + + /* Structure used with gmtime(), localtime(), mktime(), strftime(). */ + struct tm { + int tm_sec; /* second (0-61, allows for leap seconds) */ + int tm_min; /* minute (0-59) */ + int tm_hour; /* hour (0-23) */ + int tm_mday; /* day of the month (1-31) */ + int tm_mon; /* month (0-11) */ + int tm_year; /* years since 1900 */ + int tm_wday; /* day of the week (0-6) */ + int tm_yday; /* day of the year (0-365) */ + int tm_isdst; /* non-0 if daylight savings time is in effect */ + }; +#endif /* _INCLUDE__STDC__ */ + + +/* Additional types needed for HP-UX */ + +#ifdef _INCLUDE_HPUX_SOURCE +# ifndef _STRUCT_TIMEVAL +# define _STRUCT_TIMEVAL + /* Structure returned by gettimeofday(2) system call and others */ + struct timeval { + unsigned long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ + }; +# endif /* _STRUCT_TIMEVAL */ + + /* Structure used to represent timezones for gettimeofday(2) and others */ + struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ + }; + + /* Structure defining a timer setting. */ + struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ + }; +#endif /* _INCLUDE_HPUX_SOURCE */ + + +/* Function prototypes and external variable declarations */ + +#ifndef _KERNEL +#ifdef __cplusplus + extern "C" { +#endif /* __cplusplus */ + +#ifdef _INCLUDE__STDC__ +# ifdef _PROTOTYPES + extern double difftime(time_t, time_t); + extern time_t mktime(struct tm *); + extern time_t time(time_t *); + extern char *ctime(const time_t *); + extern struct tm *gmtime(const time_t *); + extern struct tm *localtime(const time_t *); + extern size_t strftime(char *, size_t, const char *, const struct tm *); +# else /* not _PROTOTYPES */ + extern double difftime(); + extern time_t mktime(); + extern time_t time(); + extern char *ctime(); + extern struct tm *gmtime(); + extern struct tm *localtime(); + extern size_t strftime(); +# endif /* not _PROTOTYPES */ + +# ifdef _CLASSIC_ANSI_TYPES + extern long clock(); +# else /* not _CLASSIC_ANSI_TYPES */ +# ifdef _PROTOTYPES + extern clock_t clock(void); +# else /* not _PROTOTYPES */ + extern clock_t clock(); +# endif /* not _PROTOTYPES */ +# endif /* not _CLASSIC_ANSI_TYPES */ +#endif /* _INCLUDE__STDC__ */ + +#ifdef _INCLUDE_POSIX_SOURCE +# ifdef _PROTOTYPES + extern void tzset(void); +# else /* not _PROTOTYPES */ + extern void tzset(); +# endif /* not _PROTOTYPES */ + + extern char *tzname[2]; +#endif /* _INCLUDE_POSIX_SOURCE */ + + +#ifdef _INCLUDE_XOPEN_SOURCE +# ifdef _PROTOTYPES + extern char *strptime(const char *, const char *, struct tm *); +# else /* not _PROTOTYPES */ + extern char *strptime(); +# endif /* not _PROTOTYPES */ + + extern long timezone; + extern int daylight; +#endif /* _INCLUDE_XOPEN_SOURCE */ + + +#ifdef _INCLUDE_HPUX_SOURCE +# ifdef _PROTOTYPES + extern struct tm *getdate(const char *); + extern char *nl_asctime(struct tm *, char *, int); + extern char *nl_ctime(long *, char *, int); + extern char *nl_ascxtime(struct tm *, char *); + extern char *nl_cxtime(long *, char *); + extern int getitimer(int, struct itimerval *); + extern int setitimer(int, const struct itimerval *, struct itimerval *); + extern int gettimeofday(struct timeval *, struct timezone *); + extern int settimeofday(const struct timeval *, const struct timezone *); + extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + extern int stime(const time_t *); +# else /* not _PROTOTYPES */ + extern struct tm *getdate(); + extern char *nl_asctime(); + extern char *nl_ctime(); + extern char *nl_ascxtime(); + extern char *nl_cxtime(); + extern int getitimer(); + extern int setitimer(); + extern int gettimeofday(); + extern int settimeofday(); + extern int select(); + extern int stime(); +# endif /* not _PROTOTYPES */ + extern int getdate_err; +#endif /* _INCLUDE_HPUX_SOURCE */ + +#ifdef __cplusplus + } +#endif /* __cplusplus */ +#endif /* not _KERNEL */ + + +/* + * CLK_TCK is needed by the kernel, and also in the POSIX namespace. + */ + +#ifdef _INCLUDE_POSIX_SOURCE +# ifndef CLK_TCK +# ifdef __hp9000s300 +# define CLK_TCK 50 +# endif /* __hp9000s300 */ +# ifdef __hp9000s800 +# define CLK_TCK 100 +# endif /* __hp9000s800 */ +# endif /* CLK_TCK */ +#endif + + +/* Additional HP-UX structures, macros, and constants */ + +#ifdef _INCLUDE_HPUX_SOURCE + + /* Kernel instrumentation time value */ + struct ki_timeval { + long tv_sec; /* seconds */ + long tv_nunit; /* and native units */ + }; + + /* Kinds of daylight savings time */ +# define DST_NONE 0 /* not on dst */ +# define DST_USA 1 /* USA style dst */ +# define DST_AUST 2 /* Australian style dst */ +# define DST_WET 3 /* Western European dst */ +# define DST_MET 4 /* Middle European dst */ +# define DST_EET 5 /* Eastern European dst */ + + /* + * Operations on timevals. + * + * NB: timercmp does not work for >= or <=. + */ +# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +# define timercmp(tvp, uvp, cmp) \ + ((tvp)->tv_sec cmp (uvp)->tv_sec || \ + (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) + + /* Names of the interval timers */ +# define ITIMER_REAL 0 +# define ITIMER_VIRTUAL 1 +# define ITIMER_PROF 2 + +#endif /* _INCLUDE_HPUX_SOURCE */ + +#endif /* _SYS_TIME_INCLUDED */ diff --git a/lib/libpthread/machdep/hpux-10.20/timers.h b/lib/libpthread/machdep/hpux-10.20/timers.h new file mode 100755 index 00000000000..2debff0686f --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/timers.h @@ -0,0 +1,71 @@ +/* ==== 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:37 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 <sys/signal.h> +#include <sys/types.h> +#include <time.h> + +/* +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +*/ + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/hpux-10.20/uio.h b/lib/libpthread/machdep/hpux-10.20/uio.h new file mode 100755 index 00000000000..d1ec4c94f22 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/uio.h @@ -0,0 +1,25 @@ +/* ==== uio.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct HP-UX header file. + */ + +#ifndef _PTHREAD_UIO_H_ +#define _PTHREAD_UIO_H_ + +#include <sys/cdefs.h> + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +__BEGIN_DECLS + +int readv __P_((int, const struct iovec *, int)); +int writev __P_((int, const struct iovec *, int)); + +__END_DECLS + +#endif + diff --git a/lib/libpthread/machdep/hpux-10.20/wait.h b/lib/libpthread/machdep/hpux-10.20/wait.h new file mode 100755 index 00000000000..f4369043bb9 --- /dev/null +++ b/lib/libpthread/machdep/hpux-10.20/wait.h @@ -0,0 +1,92 @@ +/* + * 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. + * + * from: @(#)wait.h 8.1 (Berkeley) 6/2/93 + * $Id: wait.h,v 1.1 1998/07/21 13:19:37 peter Exp $ + */ + +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +/* + * Macros to test the exit status returned by wait + * and extract the relevant values. + */ +#define _W_INT(i) (i) +#define WCOREFLAG 0200 + +#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 + +#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 */ + +#define WSTOPPED _WSTOPPED +#endif /* _POSIX_SOURCE */ + +#include <sys/types.h> +#include <sys/cdefs.h> + +__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 *)); +#endif + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/hpux-9.03/__math.h b/lib/libpthread/machdep/hpux-9.03/__math.h new file mode 100755 index 00000000000..8066bd60713 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__math.h @@ -0,0 +1,3 @@ +#define HUGE_VAL 1.7976931348623157e+308 + + diff --git a/lib/libpthread/machdep/hpux-9.03/__signal.h b/lib/libpthread/machdep/hpux-9.03/__signal.h new file mode 100755 index 00000000000..fbb1d6ce2b1 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__signal.h @@ -0,0 +1,28 @@ +#include <sys/signal.h> + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif + +/* #define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) */ +#define sigword(n) (((unsigned int)((n) - 1))>>5) + +#define __SIGEMPTYSET { 0, 0, 0, 0, 0, 0, 0, 0 } +#define __SIGFILLSET { 0xffffffff,0xffffffff,0xffffffff,0xffffffff,\ + 0xffffffff,0xffffffff,0xffffffff,0xffffffff} +#define __SIGADDSET(s, n) ((s)->sigset[sigword(n)] |= sigmask(n)) +#define __SIGDELSET(s, n) ((s)->sigset[sigword(n)] &= ~sigmask(n)) +#define __SIGISMEMBER(s, n) ((s)->sigset[sigword(n)] & sigmask(n)) + +#define SIGSET_SIZE sizeof(sigset_t)/sizeof(long) + +#define SIG_ANY(sig) sig_any(&sig) + +static inline int sig_any(sigset_t *sig) { + int i; + for (i=0; i < SIGSET_SIZE; i++) + if (sig->sigset[i] != 0) + return 1; + return 0; +} + diff --git a/lib/libpthread/machdep/hpux-9.03/__stdio.h b/lib/libpthread/machdep/hpux-9.03/__stdio.h new file mode 100755 index 00000000000..091b065a2e9 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__stdio.h @@ -0,0 +1,8 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +typedef pthread_fpos_t fpos_t; + diff --git a/lib/libpthread/machdep/hpux-9.03/__stdlib.h b/lib/libpthread/machdep/hpux-9.03/__stdlib.h new file mode 100755 index 00000000000..fe4a8ef75a8 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__stdlib.h @@ -0,0 +1,24 @@ +/* $Id: __stdlib.h,v 1.1 1998/07/21 13:19:25 peter Exp $ */ + +#ifndef __sys_stdtypes_h + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef unsigned int wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif + +#endif diff --git a/lib/libpthread/machdep/hpux-9.03/__string.h b/lib/libpthread/machdep/hpux-9.03/__string.h new file mode 100755 index 00000000000..1badf6d660c --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__string.h @@ -0,0 +1,20 @@ + +#ifndef _SYS_STDSYMS_INCLUDED +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +/* Non-standard SunOS 4.x 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 *)); +__END_DECLS +#endif diff --git a/lib/libpthread/machdep/hpux-9.03/__time.h b/lib/libpthread/machdep/hpux-9.03/__time.h new file mode 100755 index 00000000000..7e890fb28fb --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__time.h @@ -0,0 +1,31 @@ +/* $Id: __time.h,v 1.1 1998/07/21 13:19:25 peter Exp $ */ + +#ifndef __sys_stdtypes_h + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#define CLOCKS_PER_SEC 1000000 + +#if !defined(_ANSI_SOURCE) && !defined(CLK_TCK) +#define CLK_TCK 60 +#endif /* not ANSI */ + +#endif + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/hpux-9.03/__unistd.h b/lib/libpthread/machdep/hpux-9.03/__unistd.h new file mode 100755 index 00000000000..0e8515b1f96 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/__unistd.h @@ -0,0 +1,66 @@ +/* /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/machdep/hpux-9.03/__unist +d.h,v 1.2 1995/03/10 03:59:53 snl Exp */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/stdsyms.h> +#include <sys/types.h> +#include <utime.h> + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _GID_T +#define _GID_T +typedef long gid_t; +#endif + +#ifndef _UID_T +#define _UID_T +typedef long uid_t; +#endif + +#ifndef _PID_T +#define _PID_T +typedef long pid_t; +#endif + +#ifndef _OFF_T +#define _OFF_T +typedef long off_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef int ssize_t; +#endif + +/* Symbolic constants for sysconf() variables defined by POSIX.1-1988: 0-7 */ + +#define _SC_ARG_MAX 0 /* ARG_MAX: Max length of argument to exec() + including environment data */ +#define _SC_CHILD_MAX 1 /* CHILD_MAX: Max of processes per userid */ +#define _SC_CLK_TCK 2 /* Number of clock ticks per second */ +#define _SC_NGROUPS_MAX 3 /* NGROUPS_MAX: Max of simultaneous + supplementary group IDs per process */ +#define _SC_OPEN_MAX 4 /* OPEN_MAX: Max of files that one process + can have open at any one time */ +#define _SC_JOB_CONTROL 5 /* _POSIX_JOB_CONTROL: 1 iff supported */ +#define _SC_SAVED_IDS 6 /* _POSIX_SAVED_IDS: 1 iff supported */ +#define _SC_1_VERSION_88 7 /* _POSIX_VERSION: Date of POSIX.1-1988 */ + +/* Symbolic constants for sysconf() variables added by POSIX.1-1990: 100-199 */ + +#define _SC_STREAM_MAX 100 /* STREAM_MAX: Max of open stdio FILEs */ +#define _SC_TZNAME_MAX 101 /* TZNAME_MAX: Max length of timezone name */ +#define _SC_1_VERSION_90 102 /* _POSIX_VERSION: Date of POSIX.1-1990 */ + +#endif /* _SYS___UNISTD_H_ */ + diff --git a/lib/libpthread/machdep/hpux-9.03/cdefs.h b/lib/libpthread/machdep/hpux-9.03/cdefs.h new file mode 100755 index 00000000000..041300cbe02 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/cdefs.h @@ -0,0 +1,61 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __INLINE static +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +typedef int int32_t; +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +typedef short int16_t; +#endif + +#endif diff --git a/lib/libpthread/machdep/hpux-9.03/compat.h b/lib/libpthread/machdep/hpux-9.03/compat.h new file mode 100755 index 00000000000..3f130da24bc --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:25 peter Exp $ + * + * Description : Compatibility header for networking code. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/hpux-9.03/dirent.h b/lib/libpthread/machdep/hpux-9.03/dirent.h new file mode 100755 index 00000000000..5f17af345db --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/dirent.h @@ -0,0 +1,61 @@ +/*- + * 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 + +#endif /* !_SYS_DIRENT_H_ */ diff --git a/lib/libpthread/machdep/hpux-9.03/socket.h b/lib/libpthread/machdep/hpux-9.03/socket.h new file mode 100755 index 00000000000..c7a37706940 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/socket.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 1982, 1985, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)socket.h 7.3 (Berkeley) 6/27/88 + */ + +/* + * Definitions related to sockets: types, address families, options. + */ + +#include <sys/stdsyms.h> +#include <pthread/posix.h> +#include <sys/cdefs.h> + +/* + * Types of sockets + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_SND_COPYAVOID 0x1009 /* avoid copy on send*/ +#define SO_RCV_COPYAVOID 0x100a /* avoid copy on rcv */ + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_NBS 7 /* nbs protocols */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_OTS 17 /* Used for OSI in the ifnets */ +#define AF_NIT 18 /* NIT */ + +#define AF_MAX 19 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 20 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#define MSG_MAXIOVLEN 16 + +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); + +__END_DECLS + diff --git a/lib/libpthread/machdep/hpux-9.03/stdtypes.h b/lib/libpthread/machdep/hpux-9.03/stdtypes.h new file mode 100755 index 00000000000..2b22abbf818 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/stdtypes.h @@ -0,0 +1,74 @@ +/* @(#)stdtypes.h 1.6 90/01/04 SMI */ + +/* + * Suppose you have an ANSI C or POSIX thingy that needs a typedef + * for thingy_t. Put it here and include this file wherever you + * define the thingy. This is used so that we don't have size_t in + * N (N > 1) different places and so that we don't have to have + * types.h included all the time and so that we can include this in + * the lint libs instead of termios.h which conflicts with ioctl.h. + */ +#ifndef __sys_stdtypes_h +#define __sys_stdtypes_h + +#ifndef _SIGSET_T_ +#define _SIGSET_T_ +typedef int sigset_t; /* signal mask - may change */ +#endif + +#ifndef _SPEED_T_ +#define _SPEED_T_ +typedef unsigned int speed_t; /* tty speeds */ +#endif + +#ifndef _TCFLAG_T_ +#define _TCFLAG_T_ +typedef unsigned long tcflag_t; /* tty line disc modes */ +#endif + +#ifndef _CC_T_ +#define _CC_T_ +typedef unsigned char cc_t; /* tty control char */ +#endif + +#ifndef _PID_T_ +#define _PID_T_ +typedef int pid_t; /* process id */ +#endif + +#ifndef _MODE_T_ +#define _MODE_T_ +typedef unsigned short mode_t; /* file mode bits */ +#endif + +#ifndef _NLINK_T_ +#define _NLINK_T_ +typedef short nlink_t; /* links to a file */ +#endif + +#ifndef _CLOCK_T_ +#define _CLOCK_T_ +typedef long clock_t; /* units=ticks (typically 60/sec) */ +#endif + +#ifndef _TIME_T_ +#define _TIME_T_ +typedef long time_t; /* value = secs since epoch */ +#endif + +#ifndef _SIZE_T_ +#define _SIZE_T_ +typedef int size_t; /* ??? */ +#endif + +#ifndef _PTRDIFF_T_ +#define _PTRDIFF_T_ +typedef int ptrdiff_t; /* result of subtracting two pointers */ +#endif + +#ifndef _WCHAR_T_ +#define _WCHAR_T_ +typedef unsigned short wchar_t; /* big enough for biggest char set */ +#endif + +#endif /* !__sys_stdtypes_h */ diff --git a/lib/libpthread/machdep/hpux-9.03/time.h b/lib/libpthread/machdep/hpux-9.03/time.h new file mode 100755 index 00000000000..1bb568efde0 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/time.h @@ -0,0 +1,228 @@ +/* $Header: /cvs/OpenBSD/src/lib/libpthread/machdep/hpux-9.03/Attic/time.h,v 1.1 1998/07/21 13:19:26 peter Exp $ */ + +#ifndef _SYS_TIME_INCLUDED +#define _SYS_TIME_INCLUDED + +/* time.h: Definitions for time handling functions */ + +#ifdef _KERNEL_BUILD +#include "../h/stdsyms.h" +#else /* ! _KERNEL_BUILD */ +#include <sys/stdsyms.h> +#endif /* _KERNEL_BUILD */ + +#include <sys/types.h> + +/* ANSI C time constants, types, and structures */ + +#ifdef _INCLUDE__STDC__ +# define CLOCKS_PER_SEC 1000000 + +# ifndef NULL +# define NULL 0 +# endif + +# ifndef _CLOCK_T +# define _CLOCK_T + typedef unsigned long clock_t; +# endif /* _CLOCK_T */ + +# ifndef _TIME_T +# define _TIME_T + typedef long time_t; +# endif /* _TIME_T */ + +# ifndef _SIZE_T +# define _SIZE_T + typedef unsigned int size_t; +# endif /* _SIZE_T */ + + /* Structure used with gmtime(), localtime(), mktime(), strftime(). */ + struct tm { + int tm_sec; /* second (0-61, allows for leap seconds) */ + int tm_min; /* minute (0-59) */ + int tm_hour; /* hour (0-23) */ + int tm_mday; /* day of the month (1-31) */ + int tm_mon; /* month (0-11) */ + int tm_year; /* years since 1900 */ + int tm_wday; /* day of the week (0-6) */ + int tm_yday; /* day of the year (0-365) */ + int tm_isdst; /* non-0 if daylight savings time is in effect */ + }; +#endif /* _INCLUDE__STDC__ */ + + +/* Additional types needed for HP-UX */ + +#ifdef _INCLUDE_HPUX_SOURCE +# ifndef _STRUCT_TIMEVAL +# define _STRUCT_TIMEVAL + /* Structure returned by gettimeofday(2) system call and others */ + struct timeval { + unsigned long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ + }; +# endif /* _STRUCT_TIMEVAL */ + + /* Structure used to represent timezones for gettimeofday(2) and others */ + struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ + }; + + /* Structure defining a timer setting. */ + struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ + }; +#endif /* _INCLUDE_HPUX_SOURCE */ + + +/* Function prototypes and external variable declarations */ + +#ifndef _KERNEL +#ifdef __cplusplus + extern "C" { +#endif /* __cplusplus */ + +#ifdef _INCLUDE__STDC__ +# ifdef _PROTOTYPES + extern double difftime(time_t, time_t); + extern time_t mktime(struct tm *); + extern time_t time(time_t *); + extern char *ctime(const time_t *); + extern struct tm *gmtime(const time_t *); + extern struct tm *localtime(const time_t *); + extern size_t strftime(char *, size_t, const char *, const struct tm *); +# else /* not _PROTOTYPES */ + extern double difftime(); + extern time_t mktime(); + extern time_t time(); + extern char *ctime(); + extern struct tm *gmtime(); + extern struct tm *localtime(); + extern size_t strftime(); +# endif /* not _PROTOTYPES */ + +# ifdef _CLASSIC_ANSI_TYPES + extern long clock(); +# else /* not _CLASSIC_ANSI_TYPES */ +# ifdef _PROTOTYPES + extern clock_t clock(void); +# else /* not _PROTOTYPES */ + extern clock_t clock(); +# endif /* not _PROTOTYPES */ +# endif /* not _CLASSIC_ANSI_TYPES */ +#endif /* _INCLUDE__STDC__ */ + +#ifdef _INCLUDE_POSIX_SOURCE +# ifdef _PROTOTYPES + extern void tzset(void); +# else /* not _PROTOTYPES */ + extern void tzset(); +# endif /* not _PROTOTYPES */ + + extern char *tzname[2]; +#endif /* _INCLUDE_POSIX_SOURCE */ + + +#ifdef _INCLUDE_XOPEN_SOURCE +# ifdef _PROTOTYPES + extern char *strptime(const char *, const char *, struct tm *); +# else /* not _PROTOTYPES */ + extern char *strptime(); +# endif /* not _PROTOTYPES */ + + extern long timezone; + extern int daylight; +#endif /* _INCLUDE_XOPEN_SOURCE */ + + +#ifdef _INCLUDE_HPUX_SOURCE +# ifdef _PROTOTYPES + extern struct tm *getdate(const char *); + extern char *nl_asctime(struct tm *, char *, int); + extern char *nl_ctime(long *, char *, int); + extern char *nl_ascxtime(struct tm *, char *); + extern char *nl_cxtime(long *, char *); + extern int getitimer(int, struct itimerval *); + extern int setitimer(int, const struct itimerval *, struct itimerval *); + extern int gettimeofday(struct timeval *, struct timezone *); + extern int settimeofday(const struct timeval *, const struct timezone *); + extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + extern int stime(const time_t *); +# else /* not _PROTOTYPES */ + extern struct tm *getdate(); + extern char *nl_asctime(); + extern char *nl_ctime(); + extern char *nl_ascxtime(); + extern char *nl_cxtime(); + extern int getitimer(); + extern int setitimer(); + extern int gettimeofday(); + extern int settimeofday(); + extern int select(); + extern int stime(); +# endif /* not _PROTOTYPES */ + extern int getdate_err; +#endif /* _INCLUDE_HPUX_SOURCE */ + +#ifdef __cplusplus + } +#endif /* __cplusplus */ +#endif /* not _KERNEL */ + + +/* + * CLK_TCK is needed by the kernel, and also in the POSIX namespace. + */ + +#ifdef _INCLUDE_POSIX_SOURCE +# ifndef CLK_TCK +# ifdef __hp9000s300 +# define CLK_TCK 50 +# endif /* __hp9000s300 */ +# ifdef __hp9000s800 +# define CLK_TCK 100 +# endif /* __hp9000s800 */ +# endif /* CLK_TCK */ +#endif + + +/* Additional HP-UX structures, macros, and constants */ + +#ifdef _INCLUDE_HPUX_SOURCE + + /* Kernel instrumentation time value */ + struct ki_timeval { + long tv_sec; /* seconds */ + long tv_nunit; /* and native units */ + }; + + /* Kinds of daylight savings time */ +# define DST_NONE 0 /* not on dst */ +# define DST_USA 1 /* USA style dst */ +# define DST_AUST 2 /* Australian style dst */ +# define DST_WET 3 /* Western European dst */ +# define DST_MET 4 /* Middle European dst */ +# define DST_EET 5 /* Eastern European dst */ + + /* + * Operations on timevals. + * + * NB: timercmp does not work for >= or <=. + */ +# define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +# define timercmp(tvp, uvp, cmp) \ + ((tvp)->tv_sec cmp (uvp)->tv_sec || \ + (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +# define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) + + /* Names of the interval timers */ +# define ITIMER_REAL 0 +# define ITIMER_VIRTUAL 1 +# define ITIMER_PROF 2 + +#endif /* _INCLUDE_HPUX_SOURCE */ + +#endif /* _SYS_TIME_INCLUDED */ diff --git a/lib/libpthread/machdep/hpux-9.03/timers.h b/lib/libpthread/machdep/hpux-9.03/timers.h new file mode 100755 index 00000000000..839e4202ae9 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/timers.h @@ -0,0 +1,68 @@ +/* ==== 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:26 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 <sys/types.h> +#include <time.h> + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/hpux-9.03/uio.h b/lib/libpthread/machdep/hpux-9.03/uio.h new file mode 100755 index 00000000000..d1ec4c94f22 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/uio.h @@ -0,0 +1,25 @@ +/* ==== uio.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct HP-UX header file. + */ + +#ifndef _PTHREAD_UIO_H_ +#define _PTHREAD_UIO_H_ + +#include <sys/cdefs.h> + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +__BEGIN_DECLS + +int readv __P_((int, const struct iovec *, int)); +int writev __P_((int, const struct iovec *, int)); + +__END_DECLS + +#endif + diff --git a/lib/libpthread/machdep/hpux-9.03/wait.h b/lib/libpthread/machdep/hpux-9.03/wait.h new file mode 100755 index 00000000000..e22ce9caa40 --- /dev/null +++ b/lib/libpthread/machdep/hpux-9.03/wait.h @@ -0,0 +1,92 @@ +/* + * 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. + * + * from: @(#)wait.h 8.1 (Berkeley) 6/2/93 + * $Id: wait.h,v 1.1 1998/07/21 13:19:26 peter Exp $ + */ + +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +/* + * Macros to test the exit status returned by wait + * and extract the relevant values. + */ +#define _W_INT(i) (i) +#define WCOREFLAG 0200 + +#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 + +#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 */ + +#define WSTOPPED _WSTOPPED +#endif /* _POSIX_SOURCE */ + +#include <sys/types.h> +#include <sys/cdefs.h> + +__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 *)); +#endif + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__math.h b/lib/libpthread/machdep/i386-sco-3.2v5/__math.h new file mode 100755 index 00000000000..4852683fcbf --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__math.h @@ -0,0 +1,219 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/__math.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/__math.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/__math.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/__math.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/__math.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___MATH_H +#define ___MATH_H + +#pragma comment(exestr, "xpg4plus @(#) math.h 20.1 94/12/04 ") + +#pragma pack(4) + +#ifdef __cplusplus +extern "C" { +#endif + + +extern double acos(double); +extern double asin(double); +extern double atan(double); +extern double atan2(double, double); +extern double cos(double); +extern double sin(double); +extern double tan(double); + +extern double cosh(double); +extern double sinh(double); +extern double tanh(double); + +extern double exp(double); +extern double frexp(double, int *); +extern double ldexp(double, int); +extern double log(double); +extern double log10(double); +extern double modf(double, double *); + +extern double pow(double, double); +extern double sqrt(double); + +extern double ceil(double); +extern double fabs(double); +extern double floor(double); +extern double fmod(double, double); + +#ifndef HUGE_VAL +extern const double __huge_val; +#define HUGE_VAL (+__huge_val) +#endif + + +extern double erf(double); +extern double erfc(double); +extern double gamma(double); +extern double hypot(double, double); +extern double j0(double); +extern double j1(double); +extern double jn(int, double); +extern double y0(double); +extern double y1(double); +extern double yn(int, double); +extern double lgamma(double); +extern int isnan(double); + +#define MAXFLOAT ((float)3.40282346638528860e+38) + + + +#define HUGE MAXFLOAT + +/* + * The following are all legal as XPG4 external functions but must only + * be declared in the non standards environments as they conflict with + * the user name space + */ + +extern long double frexpl(long double, int *); +extern long double ldexpl(long double, int); +extern long double modfl(long double, long double *); + +extern float acosf(float); +extern float asinf(float); +extern float atanf(float); +extern float atan2f(float, float); +extern float cosf(float); +extern float sinf(float); +extern float tanf(float); + +extern float coshf(float); +extern float sinhf(float); +extern float tanhf(float); + +extern float expf(float); +extern float logf(float); +extern float log10f(float); + +extern float powf(float, float); +extern float sqrtf(float); + +extern float ceilf(float); +extern float fabsf(float); +extern float floorf(float); +extern float fmodf(float, float); +extern float modff(float, float *); + +/* These are all extensions from XPG4 */ + +extern double atof(const char *); +extern double scalb(double, double); +extern double logb(double); +extern double log1p(double); +extern double nextafter(double, double); +extern double acosh(double); +extern double asinh(double); +extern double atanh(double); +extern double cbrt(double); +extern double copysign(double, double); +extern double expm1(double); +extern int ilogb(double); +extern double remainder(double, double); +extern double rint(double); +extern int unordered(double, double); +extern int finite(double); + +extern long double scalbl(long double, long double); +extern long double logbl(long double); +extern long double nextafterl(long double, long double); +extern int unorderedl(long double, long double); +extern int finitel(long double); + + + + +extern int signgam; + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 + + + +#define _ABS(x) ((x) < 0 ? -(x) : (x)) + +#define _REDUCE(TYPE, X, XN, C1, C2) { \ + double x1 = (double)(TYPE)X, x2 = X - x1; \ + X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) +#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) +#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) +#define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) +#define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) +#define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) +#define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) +#define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) +#define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) + + +#ifdef __cplusplus +} +inline int sqr(int i) {return(i*i);} +inline double sqr(double i) {return(i*i);} + +#endif /* __cplusplus */ + +#pragma pack() + +#if __cplusplus && !defined(PI) +#define PI M_PI +#endif /* __cplusplus */ + +#endif /* _MATH_H */ +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__signal.h b/lib/libpthread/machdep/i386-sco-3.2v5/__signal.h new file mode 100755 index 00000000000..6a33d37a261 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__signal.h @@ -0,0 +1,109 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <sys/oldstyle/signal.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/signal.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <sys/posix/__signal.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <sys/ansi/signal.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <sys/ods_30_compat/signal.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___SIGNAL_H +#define ___SIGNAL_H + +#pragma comment(exestr, "xpg4plus @(#) signal.h 20.3 94/12/19 ") + +#ifndef _SIG_ATOMIC_T +#define _SIG_ATOMIC_T + /* atomic entity for signal handling */ +typedef int sig_atomic_t; +#endif + +extern const char * const _sys_siglist[]; +extern const int _sys_nsig; + +#ifndef _SYS_SIGNAL_H +#include <sys/signal.h> +#endif + +#define SignalBad ((SignalHandler)-1) +#define SignalDefault ((SignalHandler)0) +#define SignalIgnore ((SignalHandler)1) + +#define __sigmask(sig) (1 << ((sig) - 1)) +#define __SIGEMPTYSET (~SIGALL) +#define __SIGFILLSET SIGALL +#define __SIGADDSET(s,n) ((*s) |= (__sigmask(n))) +#define __SIGDELSET(s,n) ((*s) &= ~(__sigmask(n))) +#define __SIGISMEMBER(s,n) ((*s) & (__sigmask(n))) + +#if !defined(_SYS_TYPES_H) +#include <sys/types.h> +#endif + + +#if __cplusplus +extern "C" { +#endif + +extern void (*signal(int, void(*)(int)))(int); +extern int raise(int); + +extern void (*bsd_signal(int, void(*)(int)))(int); +extern int ( *ssignal( int, int(*)(int) ) )(int); +extern void ( *sigset( int, void(*)(int) ) )(int); +extern int killpg(pid_t, int); +#ifdef SS_ONSTACK /* Not defined on old versions of the OS */ +extern int sigaltstack(const stack_t *, stack_t *); +extern int sigstack(struct sigstack *, struct sigstack *); +#endif +extern int sighold(int); +extern int sigignore(int); +extern int siginterrupt(int, int); +extern int sigpause(int); +extern int sigrelse(int); + +extern int (sigfillset)(sigset_t *); +extern int (sigemptyset)(sigset_t *); +extern int (sigaddset)(sigset_t *, int); +extern int (sigdelset)(sigset_t *, int); +extern int (sigismember)(const sigset_t *, int); +extern int sigpending(sigset_t *); +extern int sigsuspend(const sigset_t *); +extern int sigprocmask(int, const sigset_t *, sigset_t *); +extern int kill(pid_t, int); +extern int sigaction(int, const struct sigaction *, struct sigaction *); + +#if __cplusplus +}; +#endif + + +#endif /* ___SIGNAL_H */ + +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__stdio.h b/lib/libpthread/machdep/i386-sco-3.2v5/__stdio.h new file mode 100755 index 00000000000..f19672980ec --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__stdio.h @@ -0,0 +1,113 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/__stdio.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/__stdio.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/__stdio.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/__stdio.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/__stdio.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1984-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___STDIO_H +#define ___STDIO_H + +#pragma comment(exestr, "xpg4plus @(#) stdio.h 20.1 94/12/04 ") + +#pragma pack(4) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _FPOS_T +#define _FPOS_T +typedef long fpos_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef long wchar_t; +#endif + +#ifndef _WINT_T +#define _WINT_T +typedef long wint_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#ifndef EOF +#define EOF (-1) +#endif + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef TMP_MAX +#define TMP_MAX 17576 /* 26 * 26 * 26 */ +#endif + +#define BUFSIZ 1024 /* default buffer size */ + + +#define _IOEOF 0020 /* EOF reached on read */ +#define _IOERR 0040 /* I/O error from system */ + +#define _IOREAD 0001 /* currently reading */ +#define _IOWRT 0002 /* currently writing */ +#define _IORW 0200 /* opened for reading and writing */ +#define _IOMYBUF 0010 /* stdio malloc()'d buffer */ + +#define _SBFSIZ 8 + +#define L_cuserid 9 + +/* Non name space polluting version of above */ +#define _P_tmpdir "/usr/tmp/" + +#ifndef _VA_LIST +#define _VA_LIST char * +#endif + + +#ifdef __cplusplus +} +#endif + +#pragma pack() + +#endif /* ___STDIO_H */ +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__stdlib.h b/lib/libpthread/machdep/i386-sco-3.2v5/__stdlib.h new file mode 100755 index 00000000000..db6a8a56151 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__stdlib.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 1984-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___STDLIB_H +#define ___STDLIB_H + +#pragma comment(exestr, "posix @(#) stdlib.h 20.1 94/12/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(4) + +#ifndef _DIV_T +#define _DIV_T +typedef struct +{ + int quot; + int rem; +} div_t; +#endif + +#ifndef _LDIV_T +#define _LDIV_T +typedef struct +{ + long quot; + long rem; +} ldiv_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#if !defined(_SSIZE_T) +#define _SSIZE_T +typedef int ssize_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef long wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define RAND_MAX 077777 + + + +extern unsigned char __ctype[]; + +#define MB_CUR_MAX ((int)__ctype[520]) + +extern double atof(const char *); +extern int atoi(const char *); +extern long atol(const char *); +extern double strtod(const char *, char **); +extern float strtof(const char *, char **); +extern long strtol(const char *, char **, int); +extern unsigned long strtoul(const char *, char **, int); + +extern int rand(void); +extern void srand(unsigned int); + +extern void *calloc(size_t, size_t); +extern void free(void *); +extern void *malloc(size_t); +extern void *realloc(void *, size_t); + +extern void abort(void); +extern void exit(int); +extern char *getenv(const char *); +extern int system(const char *); + +extern void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +extern void qsort(void *, size_t, size_t, + int (*)(const void *, const void *)); + +#ifdef __cplusplus +#ifndef _ABS_INL +#define _ABS_INL +inline int (abs)(int i) {return (i > 0) ? i : -i;} +#endif +#else +extern int (abs)(int); /* Protect from macro definitions */ +#endif + +extern div_t div(int, int); +extern long labs(long); +extern ldiv_t ldiv(long, long); + +extern int mbtowc(wchar_t *, const char *, size_t); +extern int mblen(const char *, size_t); +extern int wctomb(char *, wchar_t); + +extern size_t mbstowcs(wchar_t *, const char *, size_t); +extern size_t wcstombs(char *, const wchar_t *, size_t); + + + + +#define mblen(s, n) mbtowc((wchar_t *)0, s, n) + +#ifdef __cplusplus +} +#endif + +#pragma pack() + +#endif /* ___STDLIB_H */ diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__string.h b/lib/libpthread/machdep/i386-sco-3.2v5/__string.h new file mode 100755 index 00000000000..e4bb93afe5a --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__string.h @@ -0,0 +1,125 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/string.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/string.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/string.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/string.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/string.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___STRING_H +#define ___STRING_H + +#pragma comment(exestr, "xpg4plus @(#) string.h 20.1 94/12/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + + + +extern void *memchr(const void *, int, size_t); +extern void *memcpy(void *, const void *, size_t); +extern void *memccpy(void *, const void *, int, size_t); +extern void *memmove(void *, const void *, size_t); +extern void *memset(void *, int, size_t); + +extern char *strchr(const char *, int); +extern char *strcpy(char *, const char *); +extern char *strncpy(char *, const char *, size_t); +extern char *strcat(char *, const char *); +extern char *strncat(char *, const char *, size_t); +extern char *strpbrk(const char *, const char *); +extern char *strrchr(const char *, int); +extern char *strstr(const char *, const char *); +extern char *strtok(char *, const char *); +extern char *strtok_r(char *, const char *, char **); +extern char *strerror(int); +extern char *strlist(char *, const char *, ...); + +extern int memcmp(const void *, const void *, size_t); +extern int strcmp(const char *, const char *); +extern int strcoll(const char *, const char *); +extern int strncmp(const char *, const char *, size_t); + +extern void perror(const char *); +extern char *strdup(const char *); +extern int strncoll(const char *, const char *, int); +extern size_t strnxfrm(char *, const char *, size_t , int); + +extern size_t strxfrm(char *, const char *, size_t); +extern size_t strcspn(const char *, const char *); +extern size_t strspn(const char *, const char *); +extern size_t strlen(const char *); + +#ifdef __USLC__ +#pragma int_to_unsigned strcspn +#pragma int_to_unsigned strspn +#pragma int_to_unsigned strlen +#endif + +#if !defined(__cplusplus) && defined(__USLC__) +/* Use intrinsic ??? */ +#ifndef strlen +#define strlen __std_hdr_strlen +#endif +#ifndef strcpy +#define strcpy __std_hdr_strcpy +#endif +#ifndef strncpy +#define strncpy __std_hdr_strncpy +#endif +#endif + + +extern int ffs(int); +/* + * The following two functions were withdrawn in XPG3, + * but are provided for backwards compatibility. + */ +extern int nl_strcmp(char *, char *); +extern int nl_strncmp(char *, char *, int n); + + + +#ifdef __cplusplus +} +#endif + +#endif /* ___STRING_H */ +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__time.h b/lib/libpthread/machdep/i386-sco-3.2v5/__time.h new file mode 100755 index 00000000000..4aeee737601 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__time.h @@ -0,0 +1,141 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/time.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/time.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/time.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/time.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/time.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___TIME_H +#define ___TIME_H + +#pragma comment(exestr, "xpg4plus @(#) time.h 20.2 95/01/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; +#endif + +#ifdef _POSIXTIMERS +#include <sys/sudstime.h> +#endif + +#define CLOCKS_PER_SEC 1000000 /* As required by XPG4 and friends */ + +#pragma pack(4) + +#ifndef _STRUCT_TM +#define _STRUCT_TM +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +#define LTZNMAX 50 + long tm_tzadj; + char tm_name[LTZNMAX]; /* name of timezone */ +}; + +#pragma pack() +#endif /* _STRUCT_TM */ + + +extern clock_t clock(void); +extern double difftime(time_t, time_t); +extern time_t mktime(struct tm *); +extern time_t time(time_t *); +extern char *asctime(const struct tm *); +extern char *ctime (const time_t *); +extern struct tm *gmtime(const time_t *); +extern struct tm *localtime(const time_t *); +extern size_t strftime(char *, size_t, const char *, const struct tm *); + + +extern void tzset(void); +extern char *tzname[]; + +#ifndef CLK_TCK +#define CLK_TCK _sysconf(2) /* 2 is _SC_CLK_TCK */ +#endif + +extern long timezone; +extern int daylight; +extern char *strptime(const char *, const char *, struct tm *); + + + + +#include <sys/timeb.h> +extern int ftime ( struct timeb * ); +extern char * nl_cxtime( long *, char * ); +extern char * nl_ascxtime( struct tm *, char * ); +extern int cftime(char *, const char *, const time_t *); +extern int ascftime(char *, const char *, const struct tm *); +extern long altzone; +extern struct tm *getdate(const char *); +extern int getdate_err; +extern char *asctime_r(const struct tm *, char *,int); +extern char *ctime_r(const time_t *, char *,int); +extern struct tm *localtime_r(const time_t *, struct tm *); +extern struct tm *gmtime_r(const time_t *, struct tm *); + + +#ifdef __cplusplus +} +#endif + +#ifndef difftime +#define difftime(t1, t0) ((double)((t1) - (t0))) +#endif + +#endif /* ___TIME_H */ +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/__unistd.h b/lib/libpthread/machdep/i386-sco-3.2v5/__unistd.h new file mode 100755 index 00000000000..408886301f5 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/__unistd.h @@ -0,0 +1,48 @@ +/*- + * 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 + * __unistd.h,v 1.1 1995/01/03 12:54:54 proven Exp + */ + +#ifndef ___UNISTD_H_ +#define ___UNISTD_H_ + +#include <sys/types.h> +#include <stddef.h> + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +#endif + diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/compat.h b/lib/libpthread/machdep/i386-sco-3.2v5/compat.h new file mode 100755 index 00000000000..3befbffa68d --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/compat.h @@ -0,0 +1,46 @@ +/* ==== 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. + * + * compat.h,v 1.52 1995/10/20 09:32:56 proven Exp + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#include <sys/types.h> + +#define omsghdr msghdr +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/dirent.h b/lib/libpthread/machdep/i386-sco-3.2v5/dirent.h new file mode 100755 index 00000000000..6f6804590bb --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/dirent.h @@ -0,0 +1,145 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/dirent.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/dirent.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/dirent.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/dirent.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _DIRENT_H +#define _DIRENT_H + +#pragma comment(exestr, "xpg4plus @(#) dirent.h 20.1 94/12/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(4) + +#define MAXNAMLEN 512 /* maximum filename length */ +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif +#undef DIRBLKSIZ +#define DIRBLKSIZ 1048 /* buffer size for fs-indep. dirs */ + +#ifndef _SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H +#ifdef __STDC__ +#pragma comment(exestr, "@(#) dirent.h 25.8 94/09/22 ") +#else +#ident "@(#) dirent.h 25.8 94/09/22 " +#endif +/* + * Copyright (C) 1988-1994 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ +/* Copyright (c) 1984, 1986, 1987, 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +/* #ident "@)#(head.sys:dirent.h 1.3" */ + +/* + * The following structure defines the file + * system independent directory entry. + * + */ + +#include <sys/types.h> + +#ifdef _M_I386 +#pragma pack(4) +#else +#pragma pack(2) +#endif + +#ifdef _INKERNEL +/* + * dirent used by the kernel + */ +struct dirent { + ino32_t d_ino; /* inode number of entry */ + off_t d_off; /* offset of disk directory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[MAXNAMLEN+1]; /* name of file */ +}; + +#else /* !_INKERNEL */ +/* + * dirent as used by application code + * For now leave the declaration as is. When the new development system + * is implemented, ino_t may be ushort or ulong. If ino_t is ulong, there + * will be no d_pad field. + */ +struct dirent /* data from readdir() */ + { +#if defined(_IBCS2) + long d_ino; +#else /* !_IBCS2 */ + ino_t d_ino; /* inode number of entry */ +#if defined(_INO_16_T) + short d_pad; /* because ino_t is ushort */ +#endif /* defined(_INO_16_T) */ +#endif /* defined(_IBCS2) */ + off_t d_off; /* offset of disk directory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[MAXNAMLEN+1]; /* name of file */ + }; +#endif /* _INKERNEL */ + +typedef struct dirent dirent_t; + +#pragma pack() +#endif /* _SYS_DIRENT_H */ + +#define d_fileno d_ino +#define d_namlen d_reclen + +#ifdef __cplusplus +} +#endif + +#pragma pack() + +#endif /* _DIRENT_H */ +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/posix/__signal.h b/lib/libpthread/machdep/i386-sco-3.2v5/posix/__signal.h new file mode 100755 index 00000000000..5680fc1491a --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/posix/__signal.h @@ -0,0 +1,69 @@ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___SIGNAL_H +#define ___SIGNAL_H + +#pragma comment(exestr, "posix @(#) signal.h 20.3 94/12/19 ") + +#ifndef _SIG_ATOMIC_T +#define _SIG_ATOMIC_T + /* atomic entity for signal handling */ +typedef int sig_atomic_t; +#endif + + +#ifndef _SYS_SIGNAL_H +#include <sys/signal.h> +#endif + +#if !defined(_SYS_TYPES_H) +#include <sys/types.h> +#endif + + +#if __cplusplus +extern "C" { +#endif + +extern void (*signal(int, void(*)(int)))(int); +extern int raise(int); + + + +extern int (sigfillset)(sigset_t *); +extern int (sigemptyset)(sigset_t *); +extern int (sigaddset)(sigset_t *, int); +extern int (sigdelset)(sigset_t *, int); +extern int (sigismember)(const sigset_t *, int); +extern int sigpending(sigset_t *); +extern int sigsuspend(const sigset_t *); +extern int sigprocmask(int, const sigset_t *, sigset_t *); +extern int kill(pid_t, int); +extern int sigaction(int, const struct sigaction *, struct sigaction *); + +#if __cplusplus +}; +#endif + + +#endif /* ___SIGNAL_H */ + diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/socket.h b/lib/libpthread/machdep/i386-sco-3.2v5/socket.h new file mode 100755 index 00000000000..4a53c7176f9 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/socket.h @@ -0,0 +1,490 @@ +/* @(#)socket.h 6.23 7/18/94 - STREAMware TCP/IP source */ +/* + * Copyrighted as an unpublished work. + * (c) Copyright 1987-1994 Legent Corporation + * All rights reserved. + * + * RESTRICTED RIGHTS + * + * These programs are supplied under a license. They may be used, + * disclosed, and/or copied only as permitted under such license + * agreement. Any copy must contain the above copyright notice and + * this restricted rights notice. Use, copying, and/or disclosure + * of the programs is strictly prohibited unless otherwise provided + * in the license agreement. + * + */ +/* SCCS IDENTIFICATION */ +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef __sys_socket_h +#define __sys_socket_h + +#if !defined(FD_SETSIZE) +/* Pick up select stuff from standard system include */ +#include <sys/types.h> +#endif + +/* socket.h 6.1 83/07/29 */ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_ORDREL 0x0200 /* give use orderly release */ +#define SO_IMASOCKET 0x0400 /* use socket semantics (affects bind) */ +#define SO_MGMT 0x0800 /* => it is used for mgmt. purposes */ +#define SO_REUSEPORT 0x1000 /* allow local port reuse */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get/set protocol type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * An option specification consists of an opthdr, followed by the value of + * the option. An options buffer contains one or more options. The len + * field of opthdr specifies the length of the option value in bytes. This + * length must be a multiple of sizeof(long) (use OPTLEN macro). + */ + +struct opthdr { + long level; /* protocol level affected */ + long name; /* option to modify */ + long len; /* length of option value */ +}; + +#define OPTLEN(x) ((((x) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) +#define OPTVAL(opt) ((char *)(opt + 1)) + +#if defined(INKERNEL) || defined(_KERNEL) || defined(_INKERNEL) +/* + * the optdefault structure is used for internal tables of option default + * values. + */ +struct optdefault { + int optname;/* the option */ + char *val; /* ptr to default value */ + int len; /* length of value */ +}; + +/* + * the opproc structure is used to build tables of options processing + * functions for in_dooptions(). + */ +struct opproc { + int level; /* options level this function handles */ + int (*func) (); /* the function */ +}; +#endif + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ + +#define AF_MAX 20 + +/* + * Structure used by kernel to store most addresses. + */ +struct sockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recmvsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; +#define msg_accrights msg_control +#define msg_accrightslen msg_controllen + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ /*notused*/ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ /*notused*/ + +#define MSG_MAXIOVLEN 16 + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + * In STREAMware, we shuffle the fields around a little from what + * they were in net-2, so that they line up the same as an opthdr + * which simplifies our socket implementation amazingly. + * + * Unfortunately, the opthdrs don't include their own length, which the + * cmsghdrs do. What this means is that TLI programmers will not be + * able to take something returned using these macros and immediately give + * it back to the stack. The size of the struct cmsghdr will have to be + * subtracted out. + * There doesn't seem to be a way to avoid this, since several applications + * look into the cmsg_len field and won't work if it doesn't include the size + * of the struct cmsghdr. + */ +struct cmsghdr { + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ + u_int cmsg_len; /* data byte count, including hdr */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct adatahdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct adatahdr, return pointer to next adatahdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + OPTLEN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +/* + * This ioctl code uses BSD style ioctls to avoid copyin/out problems. + * Ioctls have the command encoded in the lower word, and the size of any in + * or out parameters in the upper word. The high 2 bits of the upper word + * are used to encode the in/out status of the parameter; for now we restrict + * parameters to at most 128 bytes. + */ +#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +/* the 0x20000000 is so we can distinguish new ioctls from old */ +#define _IOS(x,y) (IOC_VOID|(x<<8)|y) +#define _IOSR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +#define _IOSW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +/* this should be _IOSRW, but stdio got there first */ +#define _IOSWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) + +/* + * Socket ioctl commands + */ + +#define SIOCSHIWAT _IOSW('S', 1, int) /* set high watermark */ +#define SIOCGHIWAT _IOSR('S', 2, int) /* get high watermark */ +#define SIOCSLOWAT _IOSW('S', 3, int) /* set low watermark */ +#define SIOCGLOWAT _IOSR('S', 4, int) /* get low watermark */ +#define SIOCATMARK _IOSR('S', 5, int) /* at oob mark? */ +#define SIOCSPGRP _IOSW('S', 6, int) /* set process group */ +#define SIOCGPGRP _IOSR('S', 7, int) /* get process group */ +#define FIONREAD _IOSR('S', 8, int) /* BSD compatibilty */ +#define FIONBIO _IOSW('S', 9, int) /* BSD compatibilty */ +#define FIOASYNC _IOSW('S', 10, int) /* BSD compatibilty */ +#define SIOCPROTO _IOSW('S', 11, struct socknewproto) /* link proto */ +#define SIOCGETNAME _IOSR('S', 12, struct sockaddr) /* getsockname */ +#define SIOCGETPEER _IOSR('S', 13, struct sockaddr) /* getpeername */ +#define IF_UNITSEL _IOSW('S', 14, int) /* set unit number */ +#define SIOCXPROTO _IOS('S', 15) /* empty proto table */ +#define SIOCSHRDTYPE _IOSW('S', 16, int) /* set hardware type */ + +#define SIOCADDRT _IOSW('R', 9, struct ortentry) /* add route */ +#define SIOCDELRT _IOSW('R', 10, struct ortentry) /* delete route */ + +#define SIOCSIFADDR _IOSW('I', 11, struct ifreq) /* set ifnet address */ +#define SIOCGIFADDR _IOSWR('I', 12, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOSW('I', 13, struct ifreq) /* set p-p address */ +#define SIOCGIFDSTADDR _IOSWR('I', 14, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOSW('I', 15, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOSWR('I', 16, struct ifreq) /* get ifnet flags */ +#define SIOCGIFCONF _IOSWR('I', 17, struct ifconf) /* get ifnet list */ + +#define SIOCSIFMTU _IOSW('I', 21, struct ifreq) /* get if_mtu */ +#define SIOCGIFMTU _IOSWR('I', 22, struct ifreq) /* set if_mtu */ + + +#define SIOCGIFBRDADDR _IOSWR('I', 32, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOSW('I', 33, struct ifreq) /* set broadcast addr */ +#define SIOCGIFNETMASK _IOSWR('I', 34, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOSW('I', 35, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOSWR('I', 36, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOSW('I', 37, struct ifreq) /* set IF metric */ + +#define SIOCSARP _IOSW('I', 38, struct arpreq) /* set arp entry */ +#define SIOCGARP _IOSWR('I', 39, struct arpreq) /* get arp entry */ +#define SIOCDARP _IOSW('I', 40, struct arpreq) /* delete arp entry */ + +#define SIOCSIFNAME _IOSW('I', 41, struct ifreq) /* set interface name */ +#define SIOCGIFONEP _IOSWR('I', 42, struct ifreq) /* get one-packet params */ +#define SIOCSIFONEP _IOSW('I', 43, struct ifreq) /* set one-packet params */ +#define SIOCDIFADDR _IOSW('I', 44, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOSW('I', 45, struct ifaliasreq) /*add/change IF alias*/ +#define SIOCADDMULTI _IOSW('I', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOSW('I', 50, struct ifreq) /* del m'cast addr */ +#define SIOCGIFALIAS _IOSWR('I', 51, struct ifaliasreq) /* get IF alias */ + + +#define SIOCSOCKSYS _IOSW('I', 66, struct socksysreq) /* Pseudo socket syscall */ + +/* these use ifr_metric to pass the information */ +#define SIOCSIFDEBUG _IOSW('I', 67, struct ifreq) /* set if debug level */ +#define SIOCGIFDEBUG _IOSWR('I', 68, struct ifreq) /* get if debug level */ + +#define SIOCSIFTYPE _IOSW('I', 69, struct ifreq) /* set if MIB type */ +#define SIOCGIFTYPE _IOSWR('I', 70, struct ifreq) /* get if MIB type */ + +#define SIOCGIFNUM _IOSR('I', 71, int) /* get number of ifs */ +/* + * This returns the number of ifreqs that SIOCGIFCONF would return, including + * aliases. This is the preferred way of sizing a buffer big enough to hold + * all interfaces. + */ +#define SIOCGIFANUM _IOSR('I', 72, int) /* get number of ifreqs */ +/* + * Interface specific performance tuning + */ +#define SIOCGIFPERF _IOSR('I', 73, struct ifreq) /* get perf info */ +#define SIOCSIFPERF _IOSR('I', 74, struct ifreq) /* get perf info */ + +/* + * This structure is used to encode pseudo system calls + */ +struct socksysreq { + /* When porting, make this the widest thing it can be */ + int args[7]; +}; + +/* + * This structure is used for adding new protocols to the list supported by + * sockets. + */ +struct socknewproto { + int family; /* address family (AF_INET, etc.) */ + int type; /* protocol type (SOCK_STREAM, etc.) */ + int proto; /* per family proto number */ + dev_t dev; /* major/minor to use (must be a clone) */ + int flags; /* protosw flags */ +}; + +/* + * utility definitions. + */ + +#ifdef MIN +#undef MIN +#endif +#define MIN(x,y) ((x) < (y) ? (x) : (y)) +#ifndef MAX +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#endif + +#define MAXHOSTNAMELEN 256 + +#define NBBY 8 /* number of bits in a byte */ + + +/* defines for user/kernel interface */ + +#define MAX_MINOR (makedev(1,0) - 1) /* could be non-portable */ + +#define SOCKETSYS 140 /* SCO 3.2v5 */ + +#define SO_ACCEPT 1 +#define SO_BIND 2 +#define SO_CONNECT 3 +#define SO_GETPEERNAME 4 +#define SO_GETSOCKNAME 5 +#define SO_GETSOCKOPT 6 +#define SO_LISTEN 7 +#define SO_RECV 8 +#define SO_RECVFROM 9 +#define SO_SEND 10 +#define SO_SENDTO 11 +#define SO_SETSOCKOPT 12 +#define SO_SHUTDOWN 13 +#define SO_SOCKET 14 +#define SO_SELECT 15 +#define SO_GETIPDOMAIN 16 +#define SO_SETIPDOMAIN 17 +#define SO_ADJTIME 18 +#define SO_SETREUID 19 +#define SO_SETREGID 20 +#define SO_GETTIME 21 +#define SO_SETTIME 22 +#define SO_GETITIMER 23 +#define SO_SETITIMER 24 +#define SO_RECVMSG 25 +#define SO_SENDMSG 26 +#define SO_SOCKPAIR 27 + +/* + * message flags + */ +#define M_BCAST 0x80000000 + +/* Definitions and structures used for extracting */ +/* the size and/or the contents of kernel tables */ + +/* Copyin/out values */ +#define GIARG 0x1 +#define CONTI 0x2 +#define GITAB 0x4 + +struct gi_arg { + caddr_t gi_where; + unsigned gi_size; +}; + +#if !defined(_KERNEL) && !defined(INKERNEL) && !defined(_INKERNEL) + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +int getsockname __P_((int, struct sockaddr *, int *)); +int getsockopt __P_((int, int, int, void *, int *)); +int setsockopt __P_((int, int, int, const void *, int)); +int listen __P_((int, int)); +ssize_t recv __P_((int, void *, size_t, int)); +ssize_t recvfrom __P_((int, void *, size_t, int, struct sockaddr *, int *)); +int recvmsg __P_((int, struct msghdr *, int)); +ssize_t send __P_((int, const void *, size_t, int)); +int sendmsg __P_((int, const struct msghdr *, int)); +ssize_t sendto __P_((int, const void *, size_t, int, const struct sockaddr *, int)); +int shutdown __P_((int, int)); +int socket __P_((int, int, int)); +int socketpair __P_((int, int, int, int[2])); +__END_DECLS + +#endif /* !INKERNEL */ +#endif /* __sys_socket_h */ diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/syscall.h b/lib/libpthread/machdep/i386-sco-3.2v5/syscall.h new file mode 100755 index 00000000000..f49fba81b6e --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/syscall.h @@ -0,0 +1,175 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/syscall.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/syscall.h> +#else /* Normal, default environment */ +/* +/ Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ + +#ident "xpg4plus @(#) sys.i386 20.1 94/12/04 " +/* #ident "xpg4plus @(#)head:sys.i386 1.2" */ + +/* +/* Definitions of Kernel Entry Call Gates +*/ + +#ifndef _SYSCALL_H_ +#define _SYSCALL_H_ + +/*#define SYSCALL $0x7,$0*/ +/*#define SIGCALL $0xF,$0*/ + +/* +/* Definitions of System Call Entry Point Numbers +*/ + +#define SYS_access 33 +#define SYS_acct 51 +#define SYS_advfs 70 +#define SYS_alarm 27 +#define SYS_break 17 +#define SYS_brk 17 +#define SYS_chdir 12 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_chroot 61 +#define SYS_close 6 +#define SYS_creat 8 +#define SYS_dup 41 +#define SYS_exec 11 +#define SYS_execve 59 +#define SYS_exit 1 +#define SYS_fcntl 62 +#define SYS_fork 2 +#define SYS_fstat 28 +#define SYS_fstatfs 38 +#define SYS_fxstat 125 +#define SYS_getdents 81 +#define SYS_getgid 47 +#define SYS_getmsg 85 +#define SYS_getpid 20 +#define SYS_gettimeofday 171 +#define SYS_getuid 24 +#define SYS_gtty 32 +#define SYS_ioctl 54 +#define SYS_kill 37 +#define SYS_link 9 +#define SYS_lock 45 +#define SYS_lseek 19 +#define SYS_lstat 91 +#define SYS_lxstat 124 +#define SYS_mkdir 80 +#define SYS_mknod 14 +#define SYS_mount 21 +#define SYS_msgsys 49 +#define SYS_nice 34 +#define SYS_open 5 +#define SYS_pause 29 +#define SYS_pipe 42 +#define SYS_plock 45 +#define SYS_poll 87 +#define SYS_prof 44 +#define SYS_ptrace 26 +#define SYS_putmsg 86 +#define SYS_rdebug 76 +#define SYS_read 3 +#define SYS_readlink 92 +#define SYS_readv 121 +#define SYS_rfstart 74 +#define SYS_rfstop 77 +#define SYS_rfsys 78 +#define SYS_rmdir 79 +#define SYS_rmount 72 +#define SYS_rumount 73 +#define SYS_seek 19 +#define SYS_semsys 53 +#define SYS_setgid 46 +#define SYS_setpgrp 39 +#define SYS_settimeofday 172 +#define SYS_setuid 23 +#define SYS_shmsys 52 +#define SYS_signal 48 +#define SYS_stat 18 +#define SYS_statfs 35 +#define SYS_stime 25 +#define SYS_stty 31 +#define SYS_symlink 90 +#define SYS_sync 36 +#define SYS_sys3b 50 +#define SYS_sysi86 50 +#define SYS_sysacct 51 +#define SYS_sysfs 84 +#define SYS_time 13 +#define SYS_times 43 +#define SYS_uadmin 55 +#define SYS_ulimit 63 +#define SYS_umask 60 +#define SYS_umount 22 +#define SYS_unadvfs 71 +#define SYS_unlink 10 +#define SYS_utime 30 +#define SYS_utssys 57 +#define SYS_wait 7 +#define SYS_write 4 +#define SYS_writev 122 +#define SYS_xstat 123 +#define SYS_ftruncate 192 + +/* cxenix numbers are created by the formula + * (table index << 8) + CXENIX + */ + +#define CXENIX 0x28 /* Decimal 40 */ + +#define XLOCKING 0x0128 +#define CREATSEM 0x0228 +#define OPENSEM 0x0328 +#define SIGSEM 0x0428 +#define WAITSEM 0x0528 +#define NBWAITSEM 0x0628 +#define RDCHK 0x0728 +#define CHSIZE 0x0a28 +#define SYS_ftime 0x0b28 +#define NAP 0x0c28 +#define SDGET 0x0d28 +#define SDFREE 0x0e28 +#define SDENTER 0x0f28 +#define SDLEAVE 0x1028 +#define SDGETV 0x1128 +#define SDWAITV 0x1228 +#define PROCTL 0x2028 +#define EXECSEG 0x2128 +#define UNEXECSEG 0x2228 +#define SYS_select 0x2428 +#define SYS_eaccess 0x2528 +#define SYS_paccess 0x2628 +#define SYS_sigaction 0x2728 +#define SYS_sigprocmask 0x2828 +#define SYS_sigpending 0x2928 +#define SYS_sigsuspend 0x2a28 +#define SYS_getgroups 0x2b28 +#define SYS_setgroups 0x2c28 +#define SYS_sysconf 0x2d28 +#define SYS_pathconf 0x2e28 +#define SYS_fpathconf 0x2f28 +#define SYS_rename 0x3028 +#define SYS_setitimer 0x3828 + +#define CLOCAL 127 +#endif +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/timers.h b/lib/libpthread/machdep/i386-sco-3.2v5/timers.h new file mode 100755 index 00000000000..cbc48ccc8d8 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/timers.h @@ -0,0 +1,68 @@ +/* ==== 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. + * + * timers.h,v 1.50.8.1 1996/03/05 08:28:36 proven Exp + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_TIMERS_H_ +#define _SYS_TIMERS_H_ + +#include <sys/types.h> +#include <time.h> + +struct timespec { + long tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/i386-sco-3.2v5/trash.can b/lib/libpthread/machdep/i386-sco-3.2v5/trash.can new file mode 100755 index 00000000000..33edf65aab6 --- /dev/null +++ b/lib/libpthread/machdep/i386-sco-3.2v5/trash.can @@ -0,0 +1 @@ +make: *** No targets specified and no makefile found. Stop. diff --git a/lib/libpthread/machdep/irix-5.2/__math.h b/lib/libpthread/machdep/irix-5.2/__math.h new file mode 100755 index 00000000000..229d5121524 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__math.h @@ -0,0 +1,4 @@ + +extern char __infinity[]; +#define HUGE_VAL (*(double *) __infinity) + diff --git a/lib/libpthread/machdep/irix-5.2/__signal.h b/lib/libpthread/machdep/irix-5.2/__signal.h new file mode 100755 index 00000000000..87797da3198 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__signal.h @@ -0,0 +1,15 @@ +#include <sys/signal.h> + +typedef int sig_atomic_t; + +#ifndef sigmask +#define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) +#endif +#define sigword(n) (((unsigned int)((n) - 1))>>5) + +#define __SIGEMPTYSET { 0, 0, 0, 0 }; +#define __SIGFILLSET { 0xffffffff,0xffffffff,0xffffffff,0xffffffff }; +#define __SIGADDSET(s, n) ((s)->sigbits[sigword(n)] |= sigmask(n)) +#define __SIGDELSET(s, n) ((s)->sigbits[sigword(n)] &= ~sigmask(n)) +#define __SIGISMEMBER(s, n) (sigmask(n) & (s)->sigbits[sigword(n)]) + diff --git a/lib/libpthread/machdep/irix-5.2/__stdio.h b/lib/libpthread/machdep/irix-5.2/__stdio.h new file mode 100755 index 00000000000..bb4c14b32c6 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__stdio.h @@ -0,0 +1,6 @@ +#if !defined(_SIZE_T) && !defined(_SIZE_T_) +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +typedef pthread_fpos_t fpos_t; diff --git a/lib/libpthread/machdep/irix-5.2/__stdlib.h b/lib/libpthread/machdep/irix-5.2/__stdlib.h new file mode 100755 index 00000000000..2bec122c5f1 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__stdlib.h @@ -0,0 +1,30 @@ +#include <sgidefs.h> + +#if !defined(_SIZE_T) && !defined(_SIZE_T_) +#define _SIZE_T +#if (_MIPS_SZLONG == 32) +typedef unsigned int size_t; +#endif +#if (_MIPS_SZLONG == 64) +typedef unsigned long size_t; +#endif +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +#if (_MIPS_SZLONG == 32) +typedef long wchar_t; +#endif +#if (_MIPS_SZLONG == 64) +typedef __int32_t wchar_t; +#endif +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif + +#ifndef NULL +#define NULL 0 +#endif + diff --git a/lib/libpthread/machdep/irix-5.2/__string.h b/lib/libpthread/machdep/irix-5.2/__string.h new file mode 100755 index 00000000000..50261e73cfc --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__string.h @@ -0,0 +1,5 @@ +#if !defined(_SIZE_T) && !defined(_SIZE_T_) +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + diff --git a/lib/libpthread/machdep/irix-5.2/__time.h b/lib/libpthread/machdep/irix-5.2/__time.h new file mode 100755 index 00000000000..51fb993b38d --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__time.h @@ -0,0 +1,21 @@ +#if !defined(_SIZE_T) && !defined(_SIZE_T_) +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef pthread_clock_t clock_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef pthread_time_t time_t; +#endif /* !_TIME_T */ + +#define CLOCKS_PER_SEC 1000000 + +#ifndef CLK_TCK +#define CLK_TCK sysconf(3) /* clock ticks per second */ + /* 3 is _SC_CLK_TCK */ +#endif diff --git a/lib/libpthread/machdep/irix-5.2/__unistd.h b/lib/libpthread/machdep/irix-5.2/__unistd.h new file mode 100755 index 00000000000..0d71d631a5b --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/__unistd.h @@ -0,0 +1,8 @@ +#include <sys/types.h> +#include <sys/unistd.h> + +#ifndef NULL +#define NULL 0 +#endif + +#define ioctl_request_type int /* For fd.c */ diff --git a/lib/libpthread/machdep/irix-5.2/compat.h b/lib/libpthread/machdep/irix-5.2/compat.h new file mode 100755 index 00000000000..6ae1a096428 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:26 peter Exp $ + * + * Description : + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/irix-5.2/dirent.h b/lib/libpthread/machdep/irix-5.2/dirent.h new file mode 100755 index 00000000000..79fe486951d --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/dirent.h @@ -0,0 +1,21 @@ +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#if !defined(_POSIX_SOURCE) +#define MAXNAMLEN 255 /* maximum filename length */ +#define DIRBUF 4096 /* buffer size for fs-indep. dirs */ +#endif /* !defined(_POSIX_SOURCE) */ + +#include <sys/types.h> + +struct dirent { /* data from readdir() */ + ino_t d_ino; /* inode number of entry */ + off_t d_off; /* offset of disk direntory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[MAXNAMLEN+1];/* name of file */ +}; + +#define d_namlen d_reclen +#define d_fileno d_ino + +#endif /* _SYS_DIRENT_H */ diff --git a/lib/libpthread/machdep/irix-5.2/socket.h b/lib/libpthread/machdep/irix-5.2/socket.h new file mode 100755 index 00000000000..b08d3939802 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/socket.h @@ -0,0 +1,304 @@ +#ifndef __SYS_TPI_SOCKET_H__ +#ifndef __SYS_SOCKET_H__ +#define __SYS_SOCKET_H__ +/* + * Copyright (c) 1982,1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)socket.h 7.1 (Berkeley) 6/4/86 + */ +#include <sys/cdefs.h> +#include <sys/bsd_types.h> + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#ifdef _STYPES_LATER /* old ABI */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ +#else /* !_STYPES_LATER, new ABI */ + +#ifndef NC_TPI_CLTS +#define NC_TPI_CLTS 1 /* must agree with netconfig.h */ +#define NC_TPI_COTS 2 /* must agree with netconfig.h */ +#define NC_TPI_COTS_ORD 3 /* must agree with netconfig.h */ +#define NC_TPI_RAW 4 /* must agree with netconfig.h */ +#endif /* !NC_TPI_CLTS */ + +#define SOCK_DGRAM NC_TPI_CLTS /* datagram socket */ +#define SOCK_STREAM NC_TPI_COTS /* stream socket */ +#define SOCK_RAW NC_TPI_RAW /* raw-protocol interface */ +#define SOCK_RDM 5 /* reliably-delivered message */ +#define SOCK_SEQPACKET 6 /* sequenced packet stream */ + +#ifdef _KERNEL +#define IRIX4_SOCK_STREAM 1 /* stream socket */ +#define IRIX4_SOCK_DGRAM 2 /* datagram socket */ +#define IRIX4_SOCK_RAW 3 /* raw-protocol interface */ +#define IRIX4_SOCK_RDM 4 /* reliably-delivered message */ +#define IRIX4_SOCK_SEQPACKET 5 /* sequenced packet stream */ +#endif /* _KERNEL */ +#endif /* _STYPES_LATER */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* allow local address,port reuse */ +#define SO_ORDREL 0x0200 /* MIPS ABI - unimplemented */ +#define SO_IMASOCKET 0x0400 /* use libsocket (not TLI) semantics */ +#define SO_CHAMELEON 0x1000 /* (cipso) set label to 1st req rcvd */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get protocol type (libsocket) */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + * XTP really is not an address family, but is included here to take + * up space, because other AF_ entries are numerically equal to their + * PF_ counterparts. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* DEC Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#ifdef __sgi +#define AF_RAW 18 /* Raw link layer interface */ +#else +#define AF_LINK 18 /* Link layer interface */ +#endif +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ + +/* MIPS ABI VALUES - unimplemented */ +#define AF_NIT 17 /* Network Interface Tap */ +#define AF_802 18 /* IEEE 802.2, also ISO 8802 */ +#define AF_OSI 19 /* umbrella for all families used */ +#define AF_X25 20 /* CCITT X.25 in particular */ +#define AF_OSINET 21 /* AFI = 47, IDI = 4 */ +#define AF_GOSIP 22 /* U.S. Government OSI */ + + +#define AF_SDL 23 /* SGI Data Link for DLPI */ + +#define AF_MAX (AF_SDL+1) + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + u_short sp_family; /* address family */ + u_short sp_protocol; /* protocol */ +}; + +/* + * An option specification consists of an opthdr, followed by the value of + * the option. An options buffer contains one or more options. The len + * field of opthdr specifies the length of the option value in bytes. This + * length must be a multiple of sizeof(long) (use OPTLEN macro). + */ + +struct opthdr { + long level; /* protocol level affected */ + long name; /* option to modify */ + long len; /* length of option value */ +}; + +#define OPTLEN(x) ((((x) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) +#define OPTVAL(opt) ((char *)(opt + 1)) + +/* + * the optdefault structure is used for internal tables of option default + * values. + */ +struct optdefault { + int optname; /* the option */ + char *val; /* ptr to default value */ + int len; /* length of value */ +}; + +struct tpisocket; +struct T_optmgmt_req; +struct msgb; + +/* + * the opproc structure is used to build tables of options processing + * functions for dooptions(). + */ +struct opproc { + int level; /* options level this function handles */ + int (*func)(struct tpisocket *, struct T_optmgmt_req *, + struct opthdr *, struct msgb *); + /* the function */ +}; + +/* + * This structure is used to encode pseudo system calls + */ +struct socksysreq { + int args[7]; +}; + +/* + * This structure is used for adding new protocols to the list supported by + * sockets. + */ + +struct socknewproto { + int family; /* address family (AF_INET, etc.) */ + int type; /* protocol type (SOCK_STREAM, etc.) */ + int proto; /* per family proto number */ + dev_t dev; /* major/minor to use (must be a clone) */ + int flags; /* protosw flags */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_ISO AF_ISO +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ +#ifdef __sgi +#define PF_RAW AF_RAW +#endif + +/* MIPS ABI VALUES - unimplemented */ +#define PF_NIT AF_NIT /* Network Interface Tap */ +#define PF_802 AF_802 /* IEEE 802.2, also ISO 8802 */ +#define PF_OSI AF_OSI /* umbrella for all families used */ +#define PF_X25 AF_X25 /* CCITT X.25 in particular */ +#define PF_OSINET AF_OSINET /* AFI = 47, IDI = 4 */ +#define PF_GOSIP AF_GOSIP /* U.S. Government OSI */ + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record (OSI only) */ +#ifdef XTP +#define MSG_BTAG 0x40 /* XTP packet with BTAG field */ +#define MSG_ETAG 0x80 /* XTP packet with ETAG field */ +#endif + +#define MSG_MAXIOVLEN 16 + +__BEGIN_DECLS +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +int getsockname __P_((int, struct sockaddr *, int *)); +int getsockopt __P_((int, int, int, void *, int *)); +int listen __P_((int, int)); +ssize_t recv __P_((int, void *, size_t, int)); +ssize_t recvfrom __P_((int, void *, size_t, int, struct sockaddr *, int *)); +int recvmsg __P_((int, struct msghdr *, int)); +ssize_t send __P_((int, const void *, size_t, int)); +ssize_t sendto __P_((int, const void *, size_t, int, + const struct sockaddr *, int)); +int sendmsg __P_((int, const struct msghdr *, int)); +int setsockopt __P_((int, int, int, const void *, int)); +int shutdown __P_((int, int)); +int socket __P_((int, int, int)); +int socketpair __P_((int, int, int, int *)); +__END_DECLS + +#endif /* !__SYS_SOCKET_H__ */ +#endif /* !__SYS_TPI_SOCKET_H__ */ diff --git a/lib/libpthread/machdep/irix-5.2/timers.h b/lib/libpthread/machdep/irix-5.2/timers.h new file mode 100755 index 00000000000..ffa24dc9a15 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/timers.h @@ -0,0 +1,18 @@ +#ifndef __SYS_TIMERS_H__ +#define __SYS_TIMERS_H__ + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +#endif /* !__SYS_TIMERS_H__ */ diff --git a/lib/libpthread/machdep/irix-5.2/wait.h b/lib/libpthread/machdep/irix-5.2/wait.h new file mode 100755 index 00000000000..c0a7e7113d8 --- /dev/null +++ b/lib/libpthread/machdep/irix-5.2/wait.h @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)wait.h 7.4 (Berkeley) 1/27/88 + */ +#ifndef __SYS_WAIT_H__ +#define __SYS_WAIT_H__ + +#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 WSTOPFLG 0177 +#define WIFSTOPPED(stat) ((_W_INT(stat)&0377)==_WSTOPPED&&((_W_INT(stat)>>8)&0377)!=0) +#define WSTOPSIG(stat) ((_W_INT(stat)>>8)&0377) +#define WIFSIGNALED(stat) ((_W_INT(stat)&0377)>0&&((_W_INT(stat)>>8)&0377)==0) +#define WTERMSIG(stat) (_W_INT(stat)&0177) +#define WIFEXITED(stat) ((_W_INT(stat)&0377)==0) +#define WEXITSTATUS(stat) ((_W_INT(stat)>>8)&0377) +#define WCOREDUMP(stat) (_W_INT(stat) & WCOREFLAG) + +/* + * Option bits for the second argument of wait3. 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 0100 +#define WUNTRACED 0004 /* for POSIX */ + +#if !defined(_POSIX_SOURCE) + +/* + * Structure of the information in the first word returned by both + * wait and wait3. If w_stopval==_WSTOPPED, then the second structure + * describes the information returned, else the first. See WUNTRACED below. + */ +typedef union wait { + int w_status; /* used in syscall */ + /* + * Terminated process status. + */ + struct { +#ifdef _MIPSEL + 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 +#ifdef _MIPSEB + 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 { +#ifdef _MIPSEL + unsigned int w_Stopval:8, /* == W_STOPPED if stopped */ + w_Stopsig:8, /* signal that stopped us */ + w_Filler:16; /* upper bits filler */ +#endif +#ifdef _MIPSEB + 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; +} wait_t; +#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 0004 /* wait for processes stopped by signals */ +#endif /* !defined(_POSIX_SOURCE) */ + +#include <sys/types.h> +#include <sys/cdefs.h> +__BEGIN_DECLS +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 + +#endif /* __SYS_WAIT_H__ */ diff --git a/lib/libpthread/machdep/linux-1.0/__math.h b/lib/libpthread/machdep/linux-1.0/__math.h new file mode 100755 index 00000000000..05c65d58321 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__math.h @@ -0,0 +1,4 @@ +#ifndef HUGE_VAL +#define HUGE_VAL DBL_MAX +#endif + diff --git a/lib/libpthread/machdep/linux-1.0/__path.h b/lib/libpthread/machdep/linux-1.0/__path.h new file mode 100755 index 00000000000..ee53529e2ee --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__path.h @@ -0,0 +1,14 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: __path.h,v 1.1 1998/07/21 13:19:27 peter Exp $ + */ + +#ifndef _SYS__PATH_H_ +#define _SYS__PATH_H_ + +#define _PATH_PTY "/dev/" +#define _PATH_TZDIR "/usr/lib/zoneinfo" +#define _PATH_TZFILE "/usr/lib/zoneinfo/localtime" + +#endif /* !_SYS__PATH_H_ */ + diff --git a/lib/libpthread/machdep/linux-1.0/__signal.h b/lib/libpthread/machdep/linux-1.0/__signal.h new file mode 100755 index 00000000000..4cd671f155c --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__signal.h @@ -0,0 +1,24 @@ +#include <features.h> +#include <linux/signal.h> + +#ifndef SIGCLD +#define SIGCLD SIGCHLD +#endif + +typedef int sig_atomic_t; + +typedef __sighandler_t SignalHandler; + +#define SignalBad ((SignalHandler)-1) +#define SignalDefault ((SignalHandler)0) +#define SignalIgnore ((SignalHandler)1) + +#define __sigmask(sig) (1 << ((sig) - 1)) +#define sigmask __sigmask + +#define __SIGFILLSET 0xffffffff +#define __SIGEMPTYSET 0 +#define __SIGADDSET(s,n) ((*s) |= (__sigmask(n))) +#define __SIGDELSET(s,n) ((*s) &= ~(__sigmask(n))) +#define __SIGISMEMBER(s,n) ((*s) & (__sigmask(n))) + diff --git a/lib/libpthread/machdep/linux-1.0/__stdio.h b/lib/libpthread/machdep/linux-1.0/__stdio.h new file mode 100755 index 00000000000..eb7e904c34d --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__stdio.h @@ -0,0 +1,7 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +typedef pthread_fpos_t fpos_t; diff --git a/lib/libpthread/machdep/linux-1.0/__stdlib.h b/lib/libpthread/machdep/linux-1.0/__stdlib.h new file mode 100755 index 00000000000..eaa0bb988ee --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__stdlib.h @@ -0,0 +1,20 @@ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <features.h> + +/* Get size_t, wchar_t and NULL from <stddef.h>. */ +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include <stddef.h> + +#define __need_Emath +#include <errno.h> + +/* Get HUGE_VAL (returned by strtod on overflow) from <float.h>. */ +#define __need_HUGE_VAL +#include <float.h> + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/__string.h b/lib/libpthread/machdep/linux-1.0/__string.h new file mode 100755 index 00000000000..8a5e09608e0 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__string.h @@ -0,0 +1,18 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +/* Non-standard Linux 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 *)); +char *strsep __P_((char **, const char *)); +__END_DECLS +#endif diff --git a/lib/libpthread/machdep/linux-1.0/__time.h b/lib/libpthread/machdep/linux-1.0/__time.h new file mode 100755 index 00000000000..0f060feebf1 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__time.h @@ -0,0 +1,72 @@ +/* ==== __time.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: __time.h,v 1.1 1998/07/21 13:19:28 peter Exp $ + * + * Description : System specific time header. + * + * 1.00 94/11/07 proven + * -Started coding this file. + */ + +#ifndef _SYS___TIME_H_ +#define _SYS___TIME_H_ + +#include <features.h> + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *) 0) +#endif +#endif +#endif + +#define CLOCKS_PER_SEC 100 +#define CLK_TCK 100 + +extern long int timezone; +extern int daylight; + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/__unistd.h b/lib/libpthread/machdep/linux-1.0/__unistd.h new file mode 100755 index 00000000000..20102c99a9e --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/__unistd.h @@ -0,0 +1,55 @@ +/*- + * 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:28 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <features.h> + +/* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988. */ +#define _POSIX_VERSION 199009L +#define _POSIX2_C_BIND 1 +#define _POSIX2_C_DEV 1 +#define _POSIX2_SW_DEV 1 + +#define __need_size_t + +#include <posix_opt.h> +#include <sys/types.h> +#include <stddef.h> + +#endif + diff --git a/lib/libpthread/machdep/linux-1.0/cdefs.h b/lib/libpthread/machdep/linux-1.0/cdefs.h new file mode 100755 index 00000000000..f9d5668cfe6 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/cdefs.h @@ -0,0 +1,23 @@ +/* This is intended to eventually find /usr/include/sys/cdefs.h + * if it's inside the ifdef then it won't work if this file is + * found in the include files path more than once. + * + * include_next is a GNU C extension, we might eventually want + * to have our own cdefs in here simply to avoid GNU C dependencies + * (though there are already enough in the asm stuff anyways) + * [gsstark:19950419.0307EST] + */ +#include_next <sys/cdefs.h> + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#if !defined(__cplusplus) +#define __CAN_DO_EXTERN_INLINE +#endif + +#endif /* _PTHREAD_SYS_CDEFS_H_ */ diff --git a/lib/libpthread/machdep/linux-1.0/compat.h b/lib/libpthread/machdep/linux-1.0/compat.h new file mode 100755 index 00000000000..9b5645e53fb --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/compat.h @@ -0,0 +1,47 @@ +/* ==== 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:28 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#include <sys/types.h> + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/dirent.h b/lib/libpthread/machdep/linux-1.0/dirent.h new file mode 100755 index 00000000000..7f783a198e0 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/dirent.h @@ -0,0 +1,27 @@ + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#include <sys/types.h> +#include <linux/limits.h> + +struct dirent { + long d_ino; + off_t d_off; + unsigned short d_reclen; + char d_name[NAME_MAX+1]; +}; + +#ifndef d_fileno +#define d_fileno d_ino +#endif + +#ifndef d_namlen +#define d_namlen d_reclen +#endif + +#ifndef MAXNAMLEN +#define MAXNAMLEN NAME_MAX +#endif + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/errno.h b/lib/libpthread/machdep/linux-1.0/errno.h new file mode 100755 index 00000000000..a94a56b0437 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/errno.h @@ -0,0 +1,12 @@ +/* ==== errno.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Errno is already broken up into data/prototyes. + */ + +#ifndef _SYS_ERRNO_H_ +#define _SYS_ERRNO_H_ + +#include <linux/errno.h> + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/socket.h b/lib/libpthread/machdep/linux-1.0/socket.h new file mode 100755 index 00000000000..cc4c0fd262e --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/socket.h @@ -0,0 +1,193 @@ +/* ==== socket.h.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Linux header file. + */ + +#ifndef _PTHREAD_SOCKET_H_ +#define _PTHREAD_SOCKET_H_ + +/* #include <linux/socket.h> */ +#ifndef _LINUX_SOCKET_H +#define _LINUX_SOCKET_H + +/* IP options */ +#define IP_TOS 1 +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IP_TTL 2 +#ifndef IP_HDRINCL +#define IP_HDRINCL 3 +#endif +#ifdef V1_3_WILL_DO_THIS_FUNKY_STUFF +#define IP_OPTIONS 4 +#endif + +#endif + +/* #include <asm/socket.h> arch-dependent defines */ +#include <linux/sockios.h> /* the SIOCxxx I/O controls */ +#include <pthread/posix.h> + +struct sockaddr { + unsigned short sa_family; /* address family, AF_xxx */ + char sa_data[14]; /* 14 bytes of protocol address */ +}; + +struct linger { + int l_onoff; /* Linger active */ + int l_linger; /* How long to linger for */ +}; + +struct msghdr +{ + void * msg_name; /* Socket name */ + int msg_namelen; /* Length of name */ + struct iovec * msg_iov; /* Data blocks */ + int msg_iovlen; /* Number of blocks */ + void * msg_accrights; /* Per protocol magic (eg BSD file descriptor passing) */ + int msg_accrightslen;/* Length of rights list */ +}; + +/* Socket types. */ +#define SOCK_STREAM 1 /* stream (connection) socket */ +#define SOCK_DGRAM 2 /* datagram (conn.less) socket */ +#define SOCK_RAW 3 /* raw socket */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequential packet socket */ +#define SOCK_PACKET 10 /* linux specific way of */ + /* getting packets at the dev */ + /* level. For writing rarp and */ + /* other similar things on the */ + /* user level. */ + +/* Supported address families. */ +#define AF_UNSPEC 0 +#define AF_UNIX 1 /* Unix domain sockets */ +#define AF_INET 2 /* Internet IP Protocol */ +#define AF_AX25 3 /* Amateur Radio AX.25 */ +#define AF_IPX 4 /* Novell IPX */ +#define AF_APPLETALK 5 /* Appletalk DDP */ +#define AF_NETROM 6 /* Amateur radio NetROM */ +#define AF_BRIDGE 7 /* Multiprotocol bridge */ +#define AF_AAL5 8 /* Reserved for Werner's ATM */ +#define AF_X25 9 /* Reserved for X.25 project */ +#define AF_INET6 10 /* IP version 6 */ +#define AF_MAX 12 /* For now.. */ + +/* Protocol families, same as address families. */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_AX25 AF_AX25 +#define PF_IPX AF_IPX +#define PF_APPLETALK AF_APPLETALK +#define PF_NETROM AF_NETROM +#define PF_BRIDGE AF_BRIDGE +#define PF_AAL5 AF_AAL5 +#define PF_X25 AF_X25 +#define PF_INET6 AF_INET6 + +#define PF_MAX AF_MAX + +/* Maximum queue length specificable by listen. */ +#define SOMAXCONN 128 + +/* Flags we can use with send/ and recv. */ +#define MSG_OOB 1 +#define MSG_PEEK 2 +#define MSG_DONTROUTE 4 + +/* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ +#define SOL_SOCKET 1 +#define SOL_IP 0 +#define SOL_IPX 256 +#define SOL_AX25 257 +#define SOL_ATALK 258 +#define SOL_NETROM 259 +#define SOL_TCP 6 +#define SOL_UDP 17 + +/* For setsockoptions(2) */ +#define SO_DEBUG 1 +#define SO_REUSEADDR 2 +#define SO_TYPE 3 +#define SO_ERROR 4 +#define SO_DONTROUTE 5 +#define SO_BROADCAST 6 +#define SO_SNDBUF 7 +#define SO_RCVBUF 8 +#define SO_KEEPALIVE 9 +#define SO_OOBINLINE 10 +#define SO_NO_CHECK 11 +#define SO_PRIORITY 12 +#define SO_LINGER 13 +/* To add :#define SO_REUSEPORT 14 */ + + +#define IP_MULTICAST_IF 32 +#define IP_MULTICAST_TTL 33 +#define IP_MULTICAST_LOOP 34 +#define IP_ADD_MEMBERSHIP 35 +#define IP_DROP_MEMBERSHIP 36 + + +/* These need to appear somewhere around here */ +#define IP_DEFAULT_MULTICAST_TTL 1 +#define IP_DEFAULT_MULTICAST_LOOP 1 +#define IP_MAX_MEMBERSHIPS 20 + +/* IPX options */ +#define IPX_TYPE 1 + +/* TCP options - this way around because someone left a set in the c library includes */ +#define TCP_NODELAY 1 +#define TCP_MAXSEG 2 + +/* The various priorities. */ +#define SOPRI_INTERACTIVE 0 +#define SOPRI_NORMAL 1 +#define SOPRI_BACKGROUND 2 + +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); + +int getsockopt __P_((int __s, int __level, int __optname, + void *__optval, int *__optlen)); +int setsockopt __P_((int __s, int __level, int __optname, + __const void *__optval, int optlen)); +int getsockname __P_((int __sockfd, struct sockaddr *__addr, + int *__paddrlen)); +int getpeername __P_((int __sockfd, struct sockaddr *__peer, + int *__paddrlen)); +ssize_t send __P_((int __sockfd, __const void *__buff, size_t __len, int __flags)); +ssize_t recv __P_((int __sockfd, void *__buff, size_t __len, int __flags)); +ssize_t sendto __P_((int __sockfd, __const void *__buff, size_t __len, + int __flags, __const struct sockaddr *__to, + int __tolen)); +ssize_t recvfrom __P_((int __sockfd, void *__buff, size_t __len, + int __flags, struct sockaddr *__from, + int *__fromlen)); +extern ssize_t sendmsg __P_((int __fd, __const struct msghdr *__message, + int __flags)); +extern ssize_t recvmsg __P_((int __fd, struct msghdr *__message, + int __flags)); +int shutdown __P_((int __sockfd, int __how)); + +__END_DECLS + +#endif + + + + diff --git a/lib/libpthread/machdep/linux-1.0/timers.h b/lib/libpthread/machdep/linux-1.0/timers.h new file mode 100755 index 00000000000..9e40724cbec --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/timers.h @@ -0,0 +1,71 @@ +/* ==== 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:28 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 <pthread/config.h> +#include <sys/types.h> +#include <time.h> + +#ifndef _OS_HAS_TIMESPEC +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/uio.h b/lib/libpthread/machdep/linux-1.0/uio.h new file mode 100755 index 00000000000..67af5bf76e0 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/uio.h @@ -0,0 +1,15 @@ +/* ==== uio.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Linux header file. + */ + +#ifndef _PTHREAD_UIO_H_ +#define _PTHREAD_UIO_H_ + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +#endif diff --git a/lib/libpthread/machdep/linux-1.0/wait.h b/lib/libpthread/machdep/linux-1.0/wait.h new file mode 100755 index 00000000000..bcc28c5ef58 --- /dev/null +++ b/lib/libpthread/machdep/linux-1.0/wait.h @@ -0,0 +1,98 @@ +/* $NetBSD: wait.h,v 1.7 1994/06/29 06:46:23 cgd Exp $ */ + +/* + * 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 + */ + +/* + * 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. Union wait is no supported with pthreads. + */ +#define __W_INT(i) (i) +#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 + +/* 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 */ + +#define WSTOPPED __WSTOPPED +#endif /* _POSIX_SOURCE */ + +#include <sys/types.h> +#include <sys/cdefs.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +__BEGIN_DECLS +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 diff --git a/lib/libpthread/machdep/netbsd-0.9/dirent.h b/lib/libpthread/machdep/netbsd-0.9/dirent.h new file mode 100755 index 00000000000..5226443f86b --- /dev/null +++ b/lib/libpthread/machdep/netbsd-0.9/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/machdep/netbsd-1.0/__math.h b/lib/libpthread/machdep/netbsd-1.0/__math.h new file mode 100755 index 00000000000..dc009d822f4 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__math.h @@ -0,0 +1,6 @@ +/* + * ANSI/POSIX + */ +extern char __infinity[]; +#define HUGE_VAL (*(double *) __infinity) + diff --git a/lib/libpthread/machdep/netbsd-1.0/__path.h b/lib/libpthread/machdep/netbsd-1.0/__path.h new file mode 100755 index 00000000000..854a7817282 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__path.h @@ -0,0 +1,14 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * $Id: __path.h,v 1.1 1998/07/21 13:19:29 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/netbsd-1.0/__signal.h b/lib/libpthread/machdep/netbsd-1.0/__signal.h new file mode 100755 index 00000000000..918955c9948 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__signal.h @@ -0,0 +1,8 @@ +#include <sys/signal.h> + +#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/netbsd-1.0/__stdio.h b/lib/libpthread/machdep/netbsd-1.0/__stdio.h new file mode 100755 index 00000000000..d60b9df7a54 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__stdio.h @@ -0,0 +1,8 @@ + +#include <machine/ansi.h> +#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 <sys/types.h> */ diff --git a/lib/libpthread/machdep/netbsd-1.0/__stdlib.h b/lib/libpthread/machdep/netbsd-1.0/__stdlib.h new file mode 100755 index 00000000000..b2c2a4da399 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__stdlib.h @@ -0,0 +1,60 @@ +/*- + * 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:29 peter Exp $ + */ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <machine/ansi.h> + +#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; +#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/netbsd-1.0/__string.h b/lib/libpthread/machdep/netbsd-1.0/__string.h new file mode 100755 index 00000000000..1ebee28e708 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__string.h @@ -0,0 +1,20 @@ + +#include <machine/ansi.h> +#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/netbsd-1.0/__time.h b/lib/libpthread/machdep/netbsd-1.0/__time.h new file mode 100755 index 00000000000..58e80c6d5b9 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__time.h @@ -0,0 +1,69 @@ +/* + * 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:29 peter Exp $ + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include <machine/ansi.h> + +#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(_ANSI_SOURCE) +#define CLK_TCK 100 +#endif /* not ANSI */ + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/netbsd-1.0/__unistd.h b/lib/libpthread/machdep/netbsd-1.0/__unistd.h new file mode 100755 index 00000000000..4820b55ac48 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/__unistd.h @@ -0,0 +1,107 @@ +/*- + * 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:29 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> + +#ifndef NULL +#define NULL 0 +#endif + +/* 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 ((unsigned char)'\377') + +/* 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/netbsd-1.0/compat.h b/lib/libpthread/machdep/netbsd-1.0/compat.h new file mode 100755 index 00000000000..667f37a6e17 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/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 13:19:29 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/netbsd-1.0/dirent.h b/lib/libpthread/machdep/netbsd-1.0/dirent.h new file mode 100755 index 00000000000..5226443f86b --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/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/machdep/netbsd-1.0/errno.h b/lib/libpthread/machdep/netbsd-1.0/errno.h new file mode 100755 index 00000000000..3da61d692a3 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/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/machdep/netbsd-1.0/time.h b/lib/libpthread/machdep/netbsd-1.0/time.h new file mode 100755 index 00000000000..f2cc61f8d75 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/time.h @@ -0,0 +1,125 @@ +/* $NetBSD: time.h,v 1.8 1994/06/29 06:45:44 cgd Exp $ */ + +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)time.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; + +/* + * Structure defined by POSIX.4 to be like a timeval. + */ +struct timespec { + long tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ + +/* Operations on timevals. */ +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * Getkerninfo clock information structure + */ +struct clockinfo { + int hz; /* clock frequency */ + int tick; /* micro-seconds per hz tick */ + int stathz; /* statistics clock frequency */ + int profhz; /* profiling clock frequency */ +}; + +#include <time.h> + +#ifndef _POSIX_SOURCE +#include <sys/cdefs.h> + +__BEGIN_DECLS +int adjtime __P_((const struct timeval *, struct timeval *)); +int getitimer __P_((int, struct itimerval *)); +int gettimeofday __P_((struct timeval *, struct timezone *)); +int setitimer __P_((int, const struct itimerval *, struct itimerval *)); +int settimeofday __P_((const struct timeval *, const struct timezone *)); +int utimes __P_((const char *, const struct timeval *)); +__END_DECLS +#endif /* !POSIX */ + +#endif /* !_SYS_TIME_H_ */ diff --git a/lib/libpthread/machdep/netbsd-1.0/timers.h b/lib/libpthread/machdep/netbsd-1.0/timers.h new file mode 100755 index 00000000000..b1dd182f1e7 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/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 13:19:30 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 <sys/time.h> + +#endif diff --git a/lib/libpthread/machdep/netbsd-1.0/wait.h b/lib/libpthread/machdep/netbsd-1.0/wait.h new file mode 100755 index 00000000000..c1cd876d052 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.0/wait.h @@ -0,0 +1,158 @@ +/* $NetBSD: wait.h,v 1.7 1994/06/29 06:46:23 cgd Exp $ */ + +/* + * 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 + */ + +/* + * 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 <machine/endian.h> + +/* + * 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 <sys/types.h> +#include <sys/cdefs.h> + +__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 diff --git a/lib/libpthread/machdep/netbsd-1.1/__math.h b/lib/libpthread/machdep/netbsd-1.1/__math.h new file mode 100755 index 00000000000..dc009d822f4 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__math.h @@ -0,0 +1,6 @@ +/* + * ANSI/POSIX + */ +extern char __infinity[]; +#define HUGE_VAL (*(double *) __infinity) + diff --git a/lib/libpthread/machdep/netbsd-1.1/__path.h b/lib/libpthread/machdep/netbsd-1.1/__path.h new file mode 100755 index 00000000000..be7f9f6c658 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__path.h @@ -0,0 +1,14 @@ +/* + * from: @(#)time.h 5.12 (Berkeley) 3/9/91 + * __path.h,v 1.1 1995/01/03 12:53:32 proven 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/netbsd-1.1/__signal.h b/lib/libpthread/machdep/netbsd-1.1/__signal.h new file mode 100755 index 00000000000..918955c9948 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__signal.h @@ -0,0 +1,8 @@ +#include <sys/signal.h> + +#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/netbsd-1.1/__stdio.h b/lib/libpthread/machdep/netbsd-1.1/__stdio.h new file mode 100755 index 00000000000..d60b9df7a54 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__stdio.h @@ -0,0 +1,8 @@ + +#include <machine/ansi.h> +#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 <sys/types.h> */ diff --git a/lib/libpthread/machdep/netbsd-1.1/__stdlib.h b/lib/libpthread/machdep/netbsd-1.1/__stdlib.h new file mode 100755 index 00000000000..189bb5e8799 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__stdlib.h @@ -0,0 +1,60 @@ +/*- + * 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 + * __stdlib.h,v 1.1 1995/01/03 12:53:34 proven Exp + */ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <machine/ansi.h> + +#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; +#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/netbsd-1.1/__string.h b/lib/libpthread/machdep/netbsd-1.1/__string.h new file mode 100755 index 00000000000..1ebee28e708 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__string.h @@ -0,0 +1,20 @@ + +#include <machine/ansi.h> +#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/netbsd-1.1/__time.h b/lib/libpthread/machdep/netbsd-1.1/__time.h new file mode 100755 index 00000000000..27ceb815852 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__time.h @@ -0,0 +1,69 @@ +/* + * 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 + * __time.h,v 1.1 1994/12/13 07:18:55 proven Exp + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include <machine/ansi.h> + +#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(_ANSI_SOURCE) +#define CLK_TCK 100 +#endif /* not ANSI */ + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/netbsd-1.1/__unistd.h b/lib/libpthread/machdep/netbsd-1.1/__unistd.h new file mode 100755 index 00000000000..cea3165c229 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/__unistd.h @@ -0,0 +1,107 @@ +/*- + * 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 + * __unistd.h,v 1.1 1995/01/03 12:53:35 proven Exp + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> + +#ifndef NULL +#define NULL 0 +#endif + +/* 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 ((unsigned char)'\377') + +/* 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/netbsd-1.1/compat.h b/lib/libpthread/machdep/netbsd-1.1/compat.h new file mode 100755 index 00000000000..f843795cc0a --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/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. + * + * compat.h,v 1.50 1994/08/08 03:44:05 proven 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/netbsd-1.1/dirent.h b/lib/libpthread/machdep/netbsd-1.1/dirent.h new file mode 100755 index 00000000000..cf004a274d6 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/dirent.h @@ -0,0 +1,95 @@ +/* $NetBSD: dirent.h,v 1.12 1996/04/09 20:55:25 cgd Exp $ */ + +/*- + * Copyright (c) 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. + * + * @(#)dirent.h 8.3 (Berkeley) 8/10/94 + */ + +/* + * The dirent structure defines the format of directory entries returned by + * the getdirentries(2) system call. + * + * 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_int32_t d_fileno; /* file number of entry */ + u_int16_t d_reclen; /* length of this record */ + u_int8_t d_type; /* file type, see below */ + u_int8_t 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 +}; + +#ifdef PTHREAD_KERNEL +#define d_ino d_fileno +#endif + +/* + * File types + */ +#define DT_UNKNOWN 0 +#define DT_FIFO 1 +#define DT_CHR 2 +#define DT_DIR 4 +#define DT_BLK 6 +#define DT_REG 8 +#define DT_LNK 10 +#define DT_SOCK 12 +#define DT_WHT 14 + +/* + * Convert between stat structure types and directory types. + */ +#define IFTODT(mode) (((mode) & 0170000) >> 12) +#define DTTOIF(dirtype) ((dirtype) << 12) + +#if defined(_KERNEL) +/* + * The DIRENT_SIZE macro gives the minimum record length which will hold + * the directory entry. This requires the amount of space in struct dirent + * without the d_name field, plus enough space for the name with a terminating + * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. + */ +#define DIRENT_SIZE(dp) \ + ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3)) + +#endif /* !_KERNEL */ diff --git a/lib/libpthread/machdep/netbsd-1.1/errno.h b/lib/libpthread/machdep/netbsd-1.1/errno.h new file mode 100755 index 00000000000..c313b578c5a --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/errno.h @@ -0,0 +1,170 @@ +/* $NetBSD: errno.h,v 1.10 1996/01/20 01:33:53 jtc 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 _KERNEL +extern int errno; /* global error number */ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +extern int sys_nerr; +extern const char *const sys_errlist[]; +#endif +#endif + +#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 */ + +#ifdef _KERNEL +/* pseudo-errors returned inside kernel to modify return to process */ +#define ERESTART -1 /* restart syscall */ +#define EJUSTRETURN -2 /* don't modify regs, just return */ +#endif diff --git a/lib/libpthread/machdep/netbsd-1.1/time.h b/lib/libpthread/machdep/netbsd-1.1/time.h new file mode 100755 index 00000000000..a701db9c62e --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/time.h @@ -0,0 +1,153 @@ +/* $NetBSD: time.h,v 1.17 1996/02/01 00:10:36 jtc Exp $ */ + +/* + * Copyright (c) 1982, 1986, 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. + * + * @(#)time.h 8.2 (Berkeley) 7/10/94 + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include <sys/types.h> + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; + +/* + * Structure defined by POSIX.1b to be like a timeval. + */ +struct timespec { + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ + +/* Operations on timevals. */ +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#define timeradd(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \ + if ((vvp)->tv_usec >= 1000000) { \ + (vvp)->tv_sec++; \ + (vvp)->tv_usec -= 1000000; \ + } \ + } while (0) +#define timersub(tvp, uvp, vvp) \ + do { \ + (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ + (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ + if ((vvp)->tv_usec < 0) { \ + (vvp)->tv_sec--; \ + (vvp)->tv_usec += 1000000; \ + } \ + } while (0) + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +/* + * Getkerninfo clock information structure + */ +struct clockinfo { + int hz; /* clock frequency */ + int tick; /* micro-seconds per hz tick */ + int tickadj; /* clock skew rate for adjtime() */ + int stathz; /* statistics clock frequency */ + int profhz; /* profiling clock frequency */ +}; + +#ifdef _KERNEL +int itimerfix __P_((struct timeval *tv)); +int itimerdecr __P_((struct itimerval *itp, int usec)); +void microtime __P_((struct timeval *tv)); +#else /* !_KERNEL */ +#include <time.h> + +#ifndef _POSIX_SOURCE +#include <sys/cdefs.h> + +__BEGIN_DECLS +int adjtime __P_((const struct timeval *, struct timeval *)); +int getitimer __P_((int, struct itimerval *)); +int gettimeofday __P_((struct timeval *, struct timezone *)); +int setitimer __P_((int, const struct itimerval *, struct itimerval *)); +int settimeofday __P_((const struct timeval *, const struct timezone *)); +int utimes __P_((const char *, const struct timeval *)); +__END_DECLS +#endif /* !POSIX */ + +#endif /* !_KERNEL */ + +#endif /* !_SYS_TIME_H_ */ diff --git a/lib/libpthread/machdep/netbsd-1.1/timers.h b/lib/libpthread/machdep/netbsd-1.1/timers.h new file mode 100755 index 00000000000..b603b78e6b2 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/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. + * + * timers.h,v 1.50 1994/08/08 03:44:09 proven Exp + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_TIMERS_H_ +#define _SYS_TIMERS_H_ + +#include <sys/time.h> + +#endif diff --git a/lib/libpthread/machdep/netbsd-1.1/wait.h b/lib/libpthread/machdep/netbsd-1.1/wait.h new file mode 100755 index 00000000000..0a1e9285e56 --- /dev/null +++ b/lib/libpthread/machdep/netbsd-1.1/wait.h @@ -0,0 +1,163 @@ +/* $NetBSD: wait.h,v 1.11 1996/04/09 20:55:51 cgd Exp $ */ + +/* + * Copyright (c) 1982, 1986, 1989, 1993, 1994 + * 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.2 (Berkeley) 7/10/94 + */ + +#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 /* don't 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 <machine/endian.h> + +/* + * 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 <sys/types.h> +#include <sys/cdefs.h> + +__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 /* !_SYS_WAIT_H_ */ diff --git a/lib/libpthread/machdep/openbsd-2.0/__math.h b/lib/libpthread/machdep/openbsd-2.0/__math.h new file mode 100755 index 00000000000..27ed0f2575d --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__math.h @@ -0,0 +1,6 @@ +/* + * 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 new file mode 100755 index 00000000000..3f3e8f826f5 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__path.h @@ -0,0 +1,14 @@ +/* + * 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 new file mode 100755 index 00000000000..918955c9948 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__signal.h @@ -0,0 +1,8 @@ +#include <sys/signal.h> + +#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 new file mode 100755 index 00000000000..d60b9df7a54 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__stdio.h @@ -0,0 +1,8 @@ + +#include <machine/ansi.h> +#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 <sys/types.h> */ diff --git a/lib/libpthread/machdep/openbsd-2.0/__stdlib.h b/lib/libpthread/machdep/openbsd-2.0/__stdlib.h new file mode 100755 index 00000000000..6b0730e3ef3 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__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 13:19:41 peter Exp $ + */ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <machine/ansi.h> + +#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 new file mode 100755 index 00000000000..93d4fcf9dd2 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__string.h @@ -0,0 +1,21 @@ + +#include <machine/ansi.h> +#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 new file mode 100755 index 00000000000..9423e10411b --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__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 13:19:41 peter Exp $ + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include <machine/ansi.h> +#include <machine/limits.h> + +#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 new file mode 100755 index 00000000000..2ad0f99c8c9 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/__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 13:19:41 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> + +#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 new file mode 100755 index 00000000000..b85e46458a6 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/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 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 new file mode 100755 index 00000000000..5226443f86b --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/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/machdep/openbsd-2.0/errno.h b/lib/libpthread/machdep/openbsd-2.0/errno.h new file mode 100755 index 00000000000..3da61d692a3 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/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/machdep/openbsd-2.0/timers.h b/lib/libpthread/machdep/openbsd-2.0/timers.h new file mode 100755 index 00000000000..a4e39867166 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/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 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 <sys/time.h> + +#endif diff --git a/lib/libpthread/machdep/openbsd-2.0/wait.h b/lib/libpthread/machdep/openbsd-2.0/wait.h new file mode 100755 index 00000000000..b68a8a38c35 --- /dev/null +++ b/lib/libpthread/machdep/openbsd-2.0/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 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 <machine/endian.h> + +/* + * 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 <sys/types.h> +#include <sys/cdefs.h> + +__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-alpha-osf1.h b/lib/libpthread/machdep/posix-alpha-osf1.h new file mode 100644 index 00000000000..1d8bb6c5c4b --- /dev/null +++ b/lib/libpthread/machdep/posix-alpha-osf1.h @@ -0,0 +1,7 @@ +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#define __WAIT_STATUS int * +#include <pthread/types.h> + +#endif diff --git a/lib/libpthread/machdep/posix-bsdi-1.1.h b/lib/libpthread/machdep/posix-bsdi-1.1.h new file mode 100644 index 00000000000..0a2d3d874af --- /dev/null +++ b/lib/libpthread/machdep/posix-bsdi-1.1.h @@ -0,0 +1,34 @@ +/* ==== 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-bsdi-1.1.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#define __NORETURN + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif + diff --git a/lib/libpthread/machdep/posix-bsdi-2.0.h b/lib/libpthread/machdep/posix-bsdi-2.0.h new file mode 100644 index 00000000000..f5f286d2a13 --- /dev/null +++ b/lib/libpthread/machdep/posix-bsdi-2.0.h @@ -0,0 +1,34 @@ +/* ==== 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-bsdi-2.0.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#define __NORETURN + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif + diff --git a/lib/libpthread/machdep/posix-freebsd-1.1.h b/lib/libpthread/machdep/posix-freebsd-1.1.h new file mode 100644 index 00000000000..419fce5c0f6 --- /dev/null +++ b/lib/libpthread/machdep/posix-freebsd-1.1.h @@ -0,0 +1,33 @@ +/* ==== 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-freebsd-1.1.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#define __NORETURN + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-freebsd-2.0.h b/lib/libpthread/machdep/posix-freebsd-2.0.h new file mode 100644 index 00000000000..6a615cc51bc --- /dev/null +++ b/lib/libpthread/machdep/posix-freebsd-2.0.h @@ -0,0 +1,31 @@ +/* ==== 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-freebsd-2.0.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-hpux-10.20.h b/lib/libpthread/machdep/posix-hpux-10.20.h new file mode 100644 index 00000000000..ba896868287 --- /dev/null +++ b/lib/libpthread/machdep/posix-hpux-10.20.h @@ -0,0 +1,23 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-hpux-10.20.h,v 1.1 1998/07/21 13:19:18 peter Exp $ + * + * Description : Convert an Ultrix-4.2 system to a more or less POSIX system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif + diff --git a/lib/libpthread/machdep/posix-hpux-9.03.h b/lib/libpthread/machdep/posix-hpux-9.03.h new file mode 100644 index 00000000000..731d03b423a --- /dev/null +++ b/lib/libpthread/machdep/posix-hpux-9.03.h @@ -0,0 +1,23 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-hpux-9.03.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * Description : Convert an Ultrix-4.2 system to a more or less POSIX system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif + diff --git a/lib/libpthread/machdep/posix-i386-sco-3.2v5.h b/lib/libpthread/machdep/posix-i386-sco-3.2v5.h new file mode 100644 index 00000000000..ab91311612d --- /dev/null +++ b/lib/libpthread/machdep/posix-i386-sco-3.2v5.h @@ -0,0 +1,35 @@ +/* ==== 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. + * + * posix-freebsd-2.0.h,v 1.1 1995/03/01 01:21:30 proven Exp + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __NORETURN +#define __NORETURN +#endif + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-irix-5.2.h b/lib/libpthread/machdep/posix-irix-5.2.h new file mode 100644 index 00000000000..c22cf6f72eb --- /dev/null +++ b/lib/libpthread/machdep/posix-irix-5.2.h @@ -0,0 +1,31 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1995 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Convert an IRIX-5.2 system to a more or less POSIX system. + * + * $Id: posix-irix-5.2.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 95/06/01 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-linux-1.0.h b/lib/libpthread/machdep/posix-linux-1.0.h new file mode 100644 index 00000000000..20767eabcac --- /dev/null +++ b/lib/libpthread/machdep/posix-linux-1.0.h @@ -0,0 +1,31 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993, 1994 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-linux-1.0.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * Description : Convert a Linux-1.0 system to a more or less POSIX system. + * Mostly POSIX already + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#define __INLINE extern inline +/* + * OK now do stuff to make the code compile. + * Every OS has its own prototypes for each function + */ +#ifdef malloc +#undef malloc +#endif + +#ifdef free +#undef free +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-netbsd-0.9.h b/lib/libpthread/machdep/posix-netbsd-0.9.h new file mode 100644 index 00000000000..f10516917ec --- /dev/null +++ b/lib/libpthread/machdep/posix-netbsd-0.9.h @@ -0,0 +1,22 @@ +/* ==== 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-netbsd-0.9.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#define __NORETURN + +#endif diff --git a/lib/libpthread/machdep/posix-netbsd-1.0.h b/lib/libpthread/machdep/posix-netbsd-1.0.h new file mode 100644 index 00000000000..3557d0c5310 --- /dev/null +++ b/lib/libpthread/machdep/posix-netbsd-1.0.h @@ -0,0 +1,31 @@ +/* ==== 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-netbsd-1.0.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-netbsd-1.1.h b/lib/libpthread/machdep/posix-netbsd-1.1.h new file mode 100644 index 00000000000..f4ff1dfae05 --- /dev/null +++ b/lib/libpthread/machdep/posix-netbsd-1.1.h @@ -0,0 +1,31 @@ +/* ==== 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. + * + * posix-netbsd-1.0.h,v 1.53 1995/02/17 03:41:34 proven Exp + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-openbsd-2.0.h b/lib/libpthread/machdep/posix-openbsd-2.0.h new file mode 100644 index 00000000000..55c127e8136 --- /dev/null +++ b/lib/libpthread/machdep/posix-openbsd-2.0.h @@ -0,0 +1,31 @@ +/* ==== 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 <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-romp-bsd.h b/lib/libpthread/machdep/posix-romp-bsd.h new file mode 100644 index 00000000000..1b9752f8f90 --- /dev/null +++ b/lib/libpthread/machdep/posix-romp-bsd.h @@ -0,0 +1,33 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Convert a system to a more or less POSIX system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: posix-romp-bsd.h,v 1.1 1998/07/21 13:19:15 peter Exp $"; +#endif + +#ifndef O_NONBLOCK +#ifdef FNDELAY +#define O_NONBLOCK FNDELAY +#endif +#endif + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY|O_RDWR|O_WRONLY) +#endif + +#ifndef S_ISREG +#define S_ISREG(x) ((x & S_IFMT) == S_IFREG) +#endif + +#ifndef ENOSYS +#define ENOSYS EINVAL +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> diff --git a/lib/libpthread/machdep/posix-sco-3.2v5.h b/lib/libpthread/machdep/posix-sco-3.2v5.h new file mode 100644 index 00000000000..ab91311612d --- /dev/null +++ b/lib/libpthread/machdep/posix-sco-3.2v5.h @@ -0,0 +1,35 @@ +/* ==== 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. + * + * posix-freebsd-2.0.h,v 1.1 1995/03/01 01:21:30 proven Exp + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* More stuff for compiling */ +#if defined(__GNUC__) +#define __INLINE extern inline +#else +#define __INLINE static +#endif + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __NORETURN +#define __NORETURN +#endif + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-sunos-4.1.3.h b/lib/libpthread/machdep/posix-sunos-4.1.3.h new file mode 100644 index 00000000000..68617e47f66 --- /dev/null +++ b/lib/libpthread/machdep/posix-sunos-4.1.3.h @@ -0,0 +1,27 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-sunos-4.1.3.h,v 1.1 1998/07/21 13:19:15 peter Exp $ + * + * Description : Do the right thing for a sunos 4.1.3 system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +extern long strtol(); +extern unsigned long strtoul(); + +#endif diff --git a/lib/libpthread/machdep/posix-sunos-5.3.h b/lib/libpthread/machdep/posix-sunos-5.3.h new file mode 100644 index 00000000000..ba9b18cf3ed --- /dev/null +++ b/lib/libpthread/machdep/posix-sunos-5.3.h @@ -0,0 +1,22 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-sunos-5.3.h,v 1.1 1998/07/21 13:19:16 peter Exp $ + * + * Description : Do the right thing for a sunos 4.1.3 system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-sunos-5.5.h b/lib/libpthread/machdep/posix-sunos-5.5.h new file mode 100644 index 00000000000..3d642bc5076 --- /dev/null +++ b/lib/libpthread/machdep/posix-sunos-5.5.h @@ -0,0 +1,22 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-sunos-5.5.h,v 1.1 1998/07/21 13:19:19 peter Exp $ + * + * Description : Do the right thing for a sunos 4.1.3 system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/posix-ultrix-4.2.h b/lib/libpthread/machdep/posix-ultrix-4.2.h new file mode 100644 index 00000000000..e35ee87c113 --- /dev/null +++ b/lib/libpthread/machdep/posix-ultrix-4.2.h @@ -0,0 +1,24 @@ +/* ==== posix.h ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu + * + * $Id: posix-ultrix-4.2.h,v 1.1 1998/07/21 13:19:16 peter Exp $ + * + * Description : Convert an Ultrix-4.2 system to a more or less POSIX system. + * + * 1.00 93/07/20 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_POSIX_H_ +#define _PTHREAD_POSIX_H_ + +#include <sys/cdefs.h> + +/* Make sure we have size_t defined */ +#include <pthread/types.h> + +#ifndef __WAIT_STATUS +#define __WAIT_STATUS int * +#endif + +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/__math.h b/lib/libpthread/machdep/sco-3.2v5/__math.h new file mode 100755 index 00000000000..4852683fcbf --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__math.h @@ -0,0 +1,219 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/__math.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/__math.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/__math.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/__math.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/__math.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___MATH_H +#define ___MATH_H + +#pragma comment(exestr, "xpg4plus @(#) math.h 20.1 94/12/04 ") + +#pragma pack(4) + +#ifdef __cplusplus +extern "C" { +#endif + + +extern double acos(double); +extern double asin(double); +extern double atan(double); +extern double atan2(double, double); +extern double cos(double); +extern double sin(double); +extern double tan(double); + +extern double cosh(double); +extern double sinh(double); +extern double tanh(double); + +extern double exp(double); +extern double frexp(double, int *); +extern double ldexp(double, int); +extern double log(double); +extern double log10(double); +extern double modf(double, double *); + +extern double pow(double, double); +extern double sqrt(double); + +extern double ceil(double); +extern double fabs(double); +extern double floor(double); +extern double fmod(double, double); + +#ifndef HUGE_VAL +extern const double __huge_val; +#define HUGE_VAL (+__huge_val) +#endif + + +extern double erf(double); +extern double erfc(double); +extern double gamma(double); +extern double hypot(double, double); +extern double j0(double); +extern double j1(double); +extern double jn(int, double); +extern double y0(double); +extern double y1(double); +extern double yn(int, double); +extern double lgamma(double); +extern int isnan(double); + +#define MAXFLOAT ((float)3.40282346638528860e+38) + + + +#define HUGE MAXFLOAT + +/* + * The following are all legal as XPG4 external functions but must only + * be declared in the non standards environments as they conflict with + * the user name space + */ + +extern long double frexpl(long double, int *); +extern long double ldexpl(long double, int); +extern long double modfl(long double, long double *); + +extern float acosf(float); +extern float asinf(float); +extern float atanf(float); +extern float atan2f(float, float); +extern float cosf(float); +extern float sinf(float); +extern float tanf(float); + +extern float coshf(float); +extern float sinhf(float); +extern float tanhf(float); + +extern float expf(float); +extern float logf(float); +extern float log10f(float); + +extern float powf(float, float); +extern float sqrtf(float); + +extern float ceilf(float); +extern float fabsf(float); +extern float floorf(float); +extern float fmodf(float, float); +extern float modff(float, float *); + +/* These are all extensions from XPG4 */ + +extern double atof(const char *); +extern double scalb(double, double); +extern double logb(double); +extern double log1p(double); +extern double nextafter(double, double); +extern double acosh(double); +extern double asinh(double); +extern double atanh(double); +extern double cbrt(double); +extern double copysign(double, double); +extern double expm1(double); +extern int ilogb(double); +extern double remainder(double, double); +extern double rint(double); +extern int unordered(double, double); +extern int finite(double); + +extern long double scalbl(long double, long double); +extern long double logbl(long double); +extern long double nextafterl(long double, long double); +extern int unorderedl(long double, long double); +extern int finitel(long double); + + + + +extern int signgam; + +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 + + + +#define _ABS(x) ((x) < 0 ? -(x) : (x)) + +#define _REDUCE(TYPE, X, XN, C1, C2) { \ + double x1 = (double)(TYPE)X, x2 = X - x1; \ + X = x1 - (XN) * (C1); X += x2; X -= (XN) * (C2); } + +#define DOMAIN 1 +#define SING 2 +#define OVERFLOW 3 +#define UNDERFLOW 4 +#define TLOSS 5 +#define PLOSS 6 + +#define _POLY1(x, c) ((c)[0] * (x) + (c)[1]) +#define _POLY2(x, c) (_POLY1((x), (c)) * (x) + (c)[2]) +#define _POLY3(x, c) (_POLY2((x), (c)) * (x) + (c)[3]) +#define _POLY4(x, c) (_POLY3((x), (c)) * (x) + (c)[4]) +#define _POLY5(x, c) (_POLY4((x), (c)) * (x) + (c)[5]) +#define _POLY6(x, c) (_POLY5((x), (c)) * (x) + (c)[6]) +#define _POLY7(x, c) (_POLY6((x), (c)) * (x) + (c)[7]) +#define _POLY8(x, c) (_POLY7((x), (c)) * (x) + (c)[8]) +#define _POLY9(x, c) (_POLY8((x), (c)) * (x) + (c)[9]) + + +#ifdef __cplusplus +} +inline int sqr(int i) {return(i*i);} +inline double sqr(double i) {return(i*i);} + +#endif /* __cplusplus */ + +#pragma pack() + +#if __cplusplus && !defined(PI) +#define PI M_PI +#endif /* __cplusplus */ + +#endif /* _MATH_H */ +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/__signal.h b/lib/libpthread/machdep/sco-3.2v5/__signal.h new file mode 100755 index 00000000000..6a33d37a261 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__signal.h @@ -0,0 +1,109 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <sys/oldstyle/signal.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/signal.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <sys/posix/__signal.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <sys/ansi/signal.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <sys/ods_30_compat/signal.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___SIGNAL_H +#define ___SIGNAL_H + +#pragma comment(exestr, "xpg4plus @(#) signal.h 20.3 94/12/19 ") + +#ifndef _SIG_ATOMIC_T +#define _SIG_ATOMIC_T + /* atomic entity for signal handling */ +typedef int sig_atomic_t; +#endif + +extern const char * const _sys_siglist[]; +extern const int _sys_nsig; + +#ifndef _SYS_SIGNAL_H +#include <sys/signal.h> +#endif + +#define SignalBad ((SignalHandler)-1) +#define SignalDefault ((SignalHandler)0) +#define SignalIgnore ((SignalHandler)1) + +#define __sigmask(sig) (1 << ((sig) - 1)) +#define __SIGEMPTYSET (~SIGALL) +#define __SIGFILLSET SIGALL +#define __SIGADDSET(s,n) ((*s) |= (__sigmask(n))) +#define __SIGDELSET(s,n) ((*s) &= ~(__sigmask(n))) +#define __SIGISMEMBER(s,n) ((*s) & (__sigmask(n))) + +#if !defined(_SYS_TYPES_H) +#include <sys/types.h> +#endif + + +#if __cplusplus +extern "C" { +#endif + +extern void (*signal(int, void(*)(int)))(int); +extern int raise(int); + +extern void (*bsd_signal(int, void(*)(int)))(int); +extern int ( *ssignal( int, int(*)(int) ) )(int); +extern void ( *sigset( int, void(*)(int) ) )(int); +extern int killpg(pid_t, int); +#ifdef SS_ONSTACK /* Not defined on old versions of the OS */ +extern int sigaltstack(const stack_t *, stack_t *); +extern int sigstack(struct sigstack *, struct sigstack *); +#endif +extern int sighold(int); +extern int sigignore(int); +extern int siginterrupt(int, int); +extern int sigpause(int); +extern int sigrelse(int); + +extern int (sigfillset)(sigset_t *); +extern int (sigemptyset)(sigset_t *); +extern int (sigaddset)(sigset_t *, int); +extern int (sigdelset)(sigset_t *, int); +extern int (sigismember)(const sigset_t *, int); +extern int sigpending(sigset_t *); +extern int sigsuspend(const sigset_t *); +extern int sigprocmask(int, const sigset_t *, sigset_t *); +extern int kill(pid_t, int); +extern int sigaction(int, const struct sigaction *, struct sigaction *); + +#if __cplusplus +}; +#endif + + +#endif /* ___SIGNAL_H */ + +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/__stdio.h b/lib/libpthread/machdep/sco-3.2v5/__stdio.h new file mode 100755 index 00000000000..f19672980ec --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__stdio.h @@ -0,0 +1,113 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/__stdio.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/__stdio.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/__stdio.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/__stdio.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/__stdio.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1984-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___STDIO_H +#define ___STDIO_H + +#pragma comment(exestr, "xpg4plus @(#) stdio.h 20.1 94/12/04 ") + +#pragma pack(4) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _FPOS_T +#define _FPOS_T +typedef long fpos_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef long wchar_t; +#endif + +#ifndef _WINT_T +#define _WINT_T +typedef long wint_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#ifndef EOF +#define EOF (-1) +#endif + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +#ifndef TMP_MAX +#define TMP_MAX 17576 /* 26 * 26 * 26 */ +#endif + +#define BUFSIZ 1024 /* default buffer size */ + + +#define _IOEOF 0020 /* EOF reached on read */ +#define _IOERR 0040 /* I/O error from system */ + +#define _IOREAD 0001 /* currently reading */ +#define _IOWRT 0002 /* currently writing */ +#define _IORW 0200 /* opened for reading and writing */ +#define _IOMYBUF 0010 /* stdio malloc()'d buffer */ + +#define _SBFSIZ 8 + +#define L_cuserid 9 + +/* Non name space polluting version of above */ +#define _P_tmpdir "/usr/tmp/" + +#ifndef _VA_LIST +#define _VA_LIST char * +#endif + + +#ifdef __cplusplus +} +#endif + +#pragma pack() + +#endif /* ___STDIO_H */ +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/__stdlib.h b/lib/libpthread/machdep/sco-3.2v5/__stdlib.h new file mode 100755 index 00000000000..db6a8a56151 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__stdlib.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 1984-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___STDLIB_H +#define ___STDLIB_H + +#pragma comment(exestr, "posix @(#) stdlib.h 20.1 94/12/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(4) + +#ifndef _DIV_T +#define _DIV_T +typedef struct +{ + int quot; + int rem; +} div_t; +#endif + +#ifndef _LDIV_T +#define _LDIV_T +typedef struct +{ + long quot; + long rem; +} ldiv_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#if !defined(_SSIZE_T) +#define _SSIZE_T +typedef int ssize_t; +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef long wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define RAND_MAX 077777 + + + +extern unsigned char __ctype[]; + +#define MB_CUR_MAX ((int)__ctype[520]) + +extern double atof(const char *); +extern int atoi(const char *); +extern long atol(const char *); +extern double strtod(const char *, char **); +extern float strtof(const char *, char **); +extern long strtol(const char *, char **, int); +extern unsigned long strtoul(const char *, char **, int); + +extern int rand(void); +extern void srand(unsigned int); + +extern void *calloc(size_t, size_t); +extern void free(void *); +extern void *malloc(size_t); +extern void *realloc(void *, size_t); + +extern void abort(void); +extern void exit(int); +extern char *getenv(const char *); +extern int system(const char *); + +extern void *bsearch(const void *, const void *, size_t, size_t, + int (*)(const void *, const void *)); +extern void qsort(void *, size_t, size_t, + int (*)(const void *, const void *)); + +#ifdef __cplusplus +#ifndef _ABS_INL +#define _ABS_INL +inline int (abs)(int i) {return (i > 0) ? i : -i;} +#endif +#else +extern int (abs)(int); /* Protect from macro definitions */ +#endif + +extern div_t div(int, int); +extern long labs(long); +extern ldiv_t ldiv(long, long); + +extern int mbtowc(wchar_t *, const char *, size_t); +extern int mblen(const char *, size_t); +extern int wctomb(char *, wchar_t); + +extern size_t mbstowcs(wchar_t *, const char *, size_t); +extern size_t wcstombs(char *, const wchar_t *, size_t); + + + + +#define mblen(s, n) mbtowc((wchar_t *)0, s, n) + +#ifdef __cplusplus +} +#endif + +#pragma pack() + +#endif /* ___STDLIB_H */ diff --git a/lib/libpthread/machdep/sco-3.2v5/__string.h b/lib/libpthread/machdep/sco-3.2v5/__string.h new file mode 100755 index 00000000000..e4bb93afe5a --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__string.h @@ -0,0 +1,125 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/string.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/string.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/string.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/string.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/string.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___STRING_H +#define ___STRING_H + +#pragma comment(exestr, "xpg4plus @(#) string.h 20.1 94/12/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + + + +extern void *memchr(const void *, int, size_t); +extern void *memcpy(void *, const void *, size_t); +extern void *memccpy(void *, const void *, int, size_t); +extern void *memmove(void *, const void *, size_t); +extern void *memset(void *, int, size_t); + +extern char *strchr(const char *, int); +extern char *strcpy(char *, const char *); +extern char *strncpy(char *, const char *, size_t); +extern char *strcat(char *, const char *); +extern char *strncat(char *, const char *, size_t); +extern char *strpbrk(const char *, const char *); +extern char *strrchr(const char *, int); +extern char *strstr(const char *, const char *); +extern char *strtok(char *, const char *); +extern char *strtok_r(char *, const char *, char **); +extern char *strerror(int); +extern char *strlist(char *, const char *, ...); + +extern int memcmp(const void *, const void *, size_t); +extern int strcmp(const char *, const char *); +extern int strcoll(const char *, const char *); +extern int strncmp(const char *, const char *, size_t); + +extern void perror(const char *); +extern char *strdup(const char *); +extern int strncoll(const char *, const char *, int); +extern size_t strnxfrm(char *, const char *, size_t , int); + +extern size_t strxfrm(char *, const char *, size_t); +extern size_t strcspn(const char *, const char *); +extern size_t strspn(const char *, const char *); +extern size_t strlen(const char *); + +#ifdef __USLC__ +#pragma int_to_unsigned strcspn +#pragma int_to_unsigned strspn +#pragma int_to_unsigned strlen +#endif + +#if !defined(__cplusplus) && defined(__USLC__) +/* Use intrinsic ??? */ +#ifndef strlen +#define strlen __std_hdr_strlen +#endif +#ifndef strcpy +#define strcpy __std_hdr_strcpy +#endif +#ifndef strncpy +#define strncpy __std_hdr_strncpy +#endif +#endif + + +extern int ffs(int); +/* + * The following two functions were withdrawn in XPG3, + * but are provided for backwards compatibility. + */ +extern int nl_strcmp(char *, char *); +extern int nl_strncmp(char *, char *, int n); + + + +#ifdef __cplusplus +} +#endif + +#endif /* ___STRING_H */ +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/__time.h b/lib/libpthread/machdep/sco-3.2v5/__time.h new file mode 100755 index 00000000000..4aeee737601 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__time.h @@ -0,0 +1,141 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/time.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/time.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/time.h> +#elif _STRICT_ANSI /* Pure Ansi/ISO environment */ +#include <ansi/time.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/time.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___TIME_H +#define ___TIME_H + +#pragma comment(exestr, "xpg4plus @(#) time.h 20.2 95/01/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif /* NULL */ + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; +#endif + +#ifdef _POSIXTIMERS +#include <sys/sudstime.h> +#endif + +#define CLOCKS_PER_SEC 1000000 /* As required by XPG4 and friends */ + +#pragma pack(4) + +#ifndef _STRUCT_TM +#define _STRUCT_TM +struct tm +{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +#define LTZNMAX 50 + long tm_tzadj; + char tm_name[LTZNMAX]; /* name of timezone */ +}; + +#pragma pack() +#endif /* _STRUCT_TM */ + + +extern clock_t clock(void); +extern double difftime(time_t, time_t); +extern time_t mktime(struct tm *); +extern time_t time(time_t *); +extern char *asctime(const struct tm *); +extern char *ctime (const time_t *); +extern struct tm *gmtime(const time_t *); +extern struct tm *localtime(const time_t *); +extern size_t strftime(char *, size_t, const char *, const struct tm *); + + +extern void tzset(void); +extern char *tzname[]; + +#ifndef CLK_TCK +#define CLK_TCK _sysconf(2) /* 2 is _SC_CLK_TCK */ +#endif + +extern long timezone; +extern int daylight; +extern char *strptime(const char *, const char *, struct tm *); + + + + +#include <sys/timeb.h> +extern int ftime ( struct timeb * ); +extern char * nl_cxtime( long *, char * ); +extern char * nl_ascxtime( struct tm *, char * ); +extern int cftime(char *, const char *, const time_t *); +extern int ascftime(char *, const char *, const struct tm *); +extern long altzone; +extern struct tm *getdate(const char *); +extern int getdate_err; +extern char *asctime_r(const struct tm *, char *,int); +extern char *ctime_r(const time_t *, char *,int); +extern struct tm *localtime_r(const time_t *, struct tm *); +extern struct tm *gmtime_r(const time_t *, struct tm *); + + +#ifdef __cplusplus +} +#endif + +#ifndef difftime +#define difftime(t1, t0) ((double)((t1) - (t0))) +#endif + +#endif /* ___TIME_H */ +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/__unistd.h b/lib/libpthread/machdep/sco-3.2v5/__unistd.h new file mode 100755 index 00000000000..408886301f5 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/__unistd.h @@ -0,0 +1,48 @@ +/*- + * 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 + * __unistd.h,v 1.1 1995/01/03 12:54:54 proven Exp + */ + +#ifndef ___UNISTD_H_ +#define ___UNISTD_H_ + +#include <sys/types.h> +#include <stddef.h> + +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + +#endif + diff --git a/lib/libpthread/machdep/sco-3.2v5/compat.h b/lib/libpthread/machdep/sco-3.2v5/compat.h new file mode 100755 index 00000000000..3befbffa68d --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/compat.h @@ -0,0 +1,46 @@ +/* ==== 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. + * + * compat.h,v 1.52 1995/10/20 09:32:56 proven Exp + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#include <sys/types.h> + +#define omsghdr msghdr +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/dirent.h b/lib/libpthread/machdep/sco-3.2v5/dirent.h new file mode 100755 index 00000000000..6f6804590bb --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/dirent.h @@ -0,0 +1,145 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/dirent.h> +#elif defined(_XOPEN_SOURCE) || defined(_XPG4_VERS) /* Xpg4 environment */ +#include <xpg4/dirent.h> +#elif defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) /* Posix environment */ +#include <posix/dirent.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/dirent.h> +#else /* Normal, default environment */ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef _DIRENT_H +#define _DIRENT_H + +#pragma comment(exestr, "xpg4plus @(#) dirent.h 20.1 94/12/04 ") + +#ifdef __cplusplus +extern "C" { +#endif + +#pragma pack(4) + +#define MAXNAMLEN 512 /* maximum filename length */ +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif +#undef DIRBLKSIZ +#define DIRBLKSIZ 1048 /* buffer size for fs-indep. dirs */ + +#ifndef _SYS_TYPES_H +#include <sys/types.h> +#endif + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H +#ifdef __STDC__ +#pragma comment(exestr, "@(#) dirent.h 25.8 94/09/22 ") +#else +#ident "@(#) dirent.h 25.8 94/09/22 " +#endif +/* + * Copyright (C) 1988-1994 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ +/* Copyright (c) 1984, 1986, 1987, 1988 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +/* #ident "@)#(head.sys:dirent.h 1.3" */ + +/* + * The following structure defines the file + * system independent directory entry. + * + */ + +#include <sys/types.h> + +#ifdef _M_I386 +#pragma pack(4) +#else +#pragma pack(2) +#endif + +#ifdef _INKERNEL +/* + * dirent used by the kernel + */ +struct dirent { + ino32_t d_ino; /* inode number of entry */ + off_t d_off; /* offset of disk directory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[MAXNAMLEN+1]; /* name of file */ +}; + +#else /* !_INKERNEL */ +/* + * dirent as used by application code + * For now leave the declaration as is. When the new development system + * is implemented, ino_t may be ushort or ulong. If ino_t is ulong, there + * will be no d_pad field. + */ +struct dirent /* data from readdir() */ + { +#if defined(_IBCS2) + long d_ino; +#else /* !_IBCS2 */ + ino_t d_ino; /* inode number of entry */ +#if defined(_INO_16_T) + short d_pad; /* because ino_t is ushort */ +#endif /* defined(_INO_16_T) */ +#endif /* defined(_IBCS2) */ + off_t d_off; /* offset of disk directory entry */ + unsigned short d_reclen; /* length of this record */ + char d_name[MAXNAMLEN+1]; /* name of file */ + }; +#endif /* _INKERNEL */ + +typedef struct dirent dirent_t; + +#pragma pack() +#endif /* _SYS_DIRENT_H */ + +#define d_fileno d_ino +#define d_namlen d_reclen + +#ifdef __cplusplus +} +#endif + +#pragma pack() + +#endif /* _DIRENT_H */ +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/posix/__signal.h b/lib/libpthread/machdep/sco-3.2v5/posix/__signal.h new file mode 100755 index 00000000000..5680fc1491a --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/posix/__signal.h @@ -0,0 +1,69 @@ +/* + * Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ +/* All Rights Reserved */ + +/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF */ +/* UNIX System Laboratories, Inc. */ +/* The copyright notice above does not evidence any */ +/* actual or intended publication of such source code. */ + +#ifndef ___SIGNAL_H +#define ___SIGNAL_H + +#pragma comment(exestr, "posix @(#) signal.h 20.3 94/12/19 ") + +#ifndef _SIG_ATOMIC_T +#define _SIG_ATOMIC_T + /* atomic entity for signal handling */ +typedef int sig_atomic_t; +#endif + + +#ifndef _SYS_SIGNAL_H +#include <sys/signal.h> +#endif + +#if !defined(_SYS_TYPES_H) +#include <sys/types.h> +#endif + + +#if __cplusplus +extern "C" { +#endif + +extern void (*signal(int, void(*)(int)))(int); +extern int raise(int); + + + +extern int (sigfillset)(sigset_t *); +extern int (sigemptyset)(sigset_t *); +extern int (sigaddset)(sigset_t *, int); +extern int (sigdelset)(sigset_t *, int); +extern int (sigismember)(const sigset_t *, int); +extern int sigpending(sigset_t *); +extern int sigsuspend(const sigset_t *); +extern int sigprocmask(int, const sigset_t *, sigset_t *); +extern int kill(pid_t, int); +extern int sigaction(int, const struct sigaction *, struct sigaction *); + +#if __cplusplus +}; +#endif + + +#endif /* ___SIGNAL_H */ + diff --git a/lib/libpthread/machdep/sco-3.2v5/socket.h b/lib/libpthread/machdep/sco-3.2v5/socket.h new file mode 100755 index 00000000000..4a53c7176f9 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/socket.h @@ -0,0 +1,490 @@ +/* @(#)socket.h 6.23 7/18/94 - STREAMware TCP/IP source */ +/* + * Copyrighted as an unpublished work. + * (c) Copyright 1987-1994 Legent Corporation + * All rights reserved. + * + * RESTRICTED RIGHTS + * + * These programs are supplied under a license. They may be used, + * disclosed, and/or copied only as permitted under such license + * agreement. Any copy must contain the above copyright notice and + * this restricted rights notice. Use, copying, and/or disclosure + * of the programs is strictly prohibited unless otherwise provided + * in the license agreement. + * + */ +/* SCCS IDENTIFICATION */ +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef __sys_socket_h +#define __sys_socket_h + +#if !defined(FD_SETSIZE) +/* Pick up select stuff from standard system include */ +#include <sys/types.h> +#endif + +/* socket.h 6.1 83/07/29 */ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ +#define SO_ORDREL 0x0200 /* give use orderly release */ +#define SO_IMASOCKET 0x0400 /* use socket semantics (affects bind) */ +#define SO_MGMT 0x0800 /* => it is used for mgmt. purposes */ +#define SO_REUSEPORT 0x1000 /* allow local port reuse */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get/set protocol type */ + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * An option specification consists of an opthdr, followed by the value of + * the option. An options buffer contains one or more options. The len + * field of opthdr specifies the length of the option value in bytes. This + * length must be a multiple of sizeof(long) (use OPTLEN macro). + */ + +struct opthdr { + long level; /* protocol level affected */ + long name; /* option to modify */ + long len; /* length of option value */ +}; + +#define OPTLEN(x) ((((x) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) +#define OPTVAL(opt) ((char *)(opt + 1)) + +#if defined(INKERNEL) || defined(_KERNEL) || defined(_INKERNEL) +/* + * the optdefault structure is used for internal tables of option default + * values. + */ +struct optdefault { + int optname;/* the option */ + char *val; /* ptr to default value */ + int len; /* length of value */ +}; + +/* + * the opproc structure is used to build tables of options processing + * functions for in_dooptions(). + */ +struct opproc { + int level; /* options level this function handles */ + int (*func) (); /* the function */ +}; +#endif + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_ISO 7 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_ROUTE 17 /* Internal Routing Protocol */ +#define AF_LINK 18 /* Link layer interface */ +#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ + +#define AF_MAX 20 + +/* + * Structure used by kernel to store most addresses. + */ +struct sockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_ROUTE AF_ROUTE +#define PF_LINK AF_LINK +#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ + +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recmvsg, value only for sendmsg. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + u_int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; +#define msg_accrights msg_control +#define msg_accrightslen msg_controllen + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#define MSG_EOR 0x8 /* data completes record */ /*notused*/ +#define MSG_TRUNC 0x10 /* data discarded before delivery */ +#define MSG_CTRUNC 0x20 /* control data lost before delivery */ +#define MSG_WAITALL 0x40 /* wait for full request or error */ /*notused*/ + +#define MSG_MAXIOVLEN 16 + +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + * In STREAMware, we shuffle the fields around a little from what + * they were in net-2, so that they line up the same as an opthdr + * which simplifies our socket implementation amazingly. + * + * Unfortunately, the opthdrs don't include their own length, which the + * cmsghdrs do. What this means is that TLI programmers will not be + * able to take something returned using these macros and immediately give + * it back to the stack. The size of the struct cmsghdr will have to be + * subtracted out. + * There doesn't seem to be a way to avoid this, since several applications + * look into the cmsg_len field and won't work if it doesn't include the size + * of the struct cmsghdr. + */ +struct cmsghdr { + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ + u_int cmsg_len; /* data byte count, including hdr */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct adatahdr, return pointer to data */ +#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct adatahdr, return pointer to next adatahdr */ +#define CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + OPTLEN((cmsg)->cmsg_len))) + +#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +#define SCM_RIGHTS 0x01 /* access rights (array of int) */ + +/* + * This ioctl code uses BSD style ioctls to avoid copyin/out problems. + * Ioctls have the command encoded in the lower word, and the size of any in + * or out parameters in the upper word. The high 2 bits of the upper word + * are used to encode the in/out status of the parameter; for now we restrict + * parameters to at most 128 bytes. + */ +#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ +#define IOC_VOID 0x20000000 /* no parameters */ +#define IOC_OUT 0x40000000 /* copy out parameters */ +#define IOC_IN 0x80000000 /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) +/* the 0x20000000 is so we can distinguish new ioctls from old */ +#define _IOS(x,y) (IOC_VOID|(x<<8)|y) +#define _IOSR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +#define _IOSW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) +/* this should be _IOSRW, but stdio got there first */ +#define _IOSWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) + +/* + * Socket ioctl commands + */ + +#define SIOCSHIWAT _IOSW('S', 1, int) /* set high watermark */ +#define SIOCGHIWAT _IOSR('S', 2, int) /* get high watermark */ +#define SIOCSLOWAT _IOSW('S', 3, int) /* set low watermark */ +#define SIOCGLOWAT _IOSR('S', 4, int) /* get low watermark */ +#define SIOCATMARK _IOSR('S', 5, int) /* at oob mark? */ +#define SIOCSPGRP _IOSW('S', 6, int) /* set process group */ +#define SIOCGPGRP _IOSR('S', 7, int) /* get process group */ +#define FIONREAD _IOSR('S', 8, int) /* BSD compatibilty */ +#define FIONBIO _IOSW('S', 9, int) /* BSD compatibilty */ +#define FIOASYNC _IOSW('S', 10, int) /* BSD compatibilty */ +#define SIOCPROTO _IOSW('S', 11, struct socknewproto) /* link proto */ +#define SIOCGETNAME _IOSR('S', 12, struct sockaddr) /* getsockname */ +#define SIOCGETPEER _IOSR('S', 13, struct sockaddr) /* getpeername */ +#define IF_UNITSEL _IOSW('S', 14, int) /* set unit number */ +#define SIOCXPROTO _IOS('S', 15) /* empty proto table */ +#define SIOCSHRDTYPE _IOSW('S', 16, int) /* set hardware type */ + +#define SIOCADDRT _IOSW('R', 9, struct ortentry) /* add route */ +#define SIOCDELRT _IOSW('R', 10, struct ortentry) /* delete route */ + +#define SIOCSIFADDR _IOSW('I', 11, struct ifreq) /* set ifnet address */ +#define SIOCGIFADDR _IOSWR('I', 12, struct ifreq) /* get ifnet address */ +#define SIOCSIFDSTADDR _IOSW('I', 13, struct ifreq) /* set p-p address */ +#define SIOCGIFDSTADDR _IOSWR('I', 14, struct ifreq) /* get p-p address */ +#define SIOCSIFFLAGS _IOSW('I', 15, struct ifreq) /* set ifnet flags */ +#define SIOCGIFFLAGS _IOSWR('I', 16, struct ifreq) /* get ifnet flags */ +#define SIOCGIFCONF _IOSWR('I', 17, struct ifconf) /* get ifnet list */ + +#define SIOCSIFMTU _IOSW('I', 21, struct ifreq) /* get if_mtu */ +#define SIOCGIFMTU _IOSWR('I', 22, struct ifreq) /* set if_mtu */ + + +#define SIOCGIFBRDADDR _IOSWR('I', 32, struct ifreq) /* get broadcast addr */ +#define SIOCSIFBRDADDR _IOSW('I', 33, struct ifreq) /* set broadcast addr */ +#define SIOCGIFNETMASK _IOSWR('I', 34, struct ifreq) /* get net addr mask */ +#define SIOCSIFNETMASK _IOSW('I', 35, struct ifreq) /* set net addr mask */ +#define SIOCGIFMETRIC _IOSWR('I', 36, struct ifreq) /* get IF metric */ +#define SIOCSIFMETRIC _IOSW('I', 37, struct ifreq) /* set IF metric */ + +#define SIOCSARP _IOSW('I', 38, struct arpreq) /* set arp entry */ +#define SIOCGARP _IOSWR('I', 39, struct arpreq) /* get arp entry */ +#define SIOCDARP _IOSW('I', 40, struct arpreq) /* delete arp entry */ + +#define SIOCSIFNAME _IOSW('I', 41, struct ifreq) /* set interface name */ +#define SIOCGIFONEP _IOSWR('I', 42, struct ifreq) /* get one-packet params */ +#define SIOCSIFONEP _IOSW('I', 43, struct ifreq) /* set one-packet params */ +#define SIOCDIFADDR _IOSW('I', 44, struct ifreq) /* delete IF addr */ +#define SIOCAIFADDR _IOSW('I', 45, struct ifaliasreq) /*add/change IF alias*/ +#define SIOCADDMULTI _IOSW('I', 49, struct ifreq) /* add m'cast addr */ +#define SIOCDELMULTI _IOSW('I', 50, struct ifreq) /* del m'cast addr */ +#define SIOCGIFALIAS _IOSWR('I', 51, struct ifaliasreq) /* get IF alias */ + + +#define SIOCSOCKSYS _IOSW('I', 66, struct socksysreq) /* Pseudo socket syscall */ + +/* these use ifr_metric to pass the information */ +#define SIOCSIFDEBUG _IOSW('I', 67, struct ifreq) /* set if debug level */ +#define SIOCGIFDEBUG _IOSWR('I', 68, struct ifreq) /* get if debug level */ + +#define SIOCSIFTYPE _IOSW('I', 69, struct ifreq) /* set if MIB type */ +#define SIOCGIFTYPE _IOSWR('I', 70, struct ifreq) /* get if MIB type */ + +#define SIOCGIFNUM _IOSR('I', 71, int) /* get number of ifs */ +/* + * This returns the number of ifreqs that SIOCGIFCONF would return, including + * aliases. This is the preferred way of sizing a buffer big enough to hold + * all interfaces. + */ +#define SIOCGIFANUM _IOSR('I', 72, int) /* get number of ifreqs */ +/* + * Interface specific performance tuning + */ +#define SIOCGIFPERF _IOSR('I', 73, struct ifreq) /* get perf info */ +#define SIOCSIFPERF _IOSR('I', 74, struct ifreq) /* get perf info */ + +/* + * This structure is used to encode pseudo system calls + */ +struct socksysreq { + /* When porting, make this the widest thing it can be */ + int args[7]; +}; + +/* + * This structure is used for adding new protocols to the list supported by + * sockets. + */ +struct socknewproto { + int family; /* address family (AF_INET, etc.) */ + int type; /* protocol type (SOCK_STREAM, etc.) */ + int proto; /* per family proto number */ + dev_t dev; /* major/minor to use (must be a clone) */ + int flags; /* protosw flags */ +}; + +/* + * utility definitions. + */ + +#ifdef MIN +#undef MIN +#endif +#define MIN(x,y) ((x) < (y) ? (x) : (y)) +#ifndef MAX +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#endif + +#define MAXHOSTNAMELEN 256 + +#define NBBY 8 /* number of bits in a byte */ + + +/* defines for user/kernel interface */ + +#define MAX_MINOR (makedev(1,0) - 1) /* could be non-portable */ + +#define SOCKETSYS 140 /* SCO 3.2v5 */ + +#define SO_ACCEPT 1 +#define SO_BIND 2 +#define SO_CONNECT 3 +#define SO_GETPEERNAME 4 +#define SO_GETSOCKNAME 5 +#define SO_GETSOCKOPT 6 +#define SO_LISTEN 7 +#define SO_RECV 8 +#define SO_RECVFROM 9 +#define SO_SEND 10 +#define SO_SENDTO 11 +#define SO_SETSOCKOPT 12 +#define SO_SHUTDOWN 13 +#define SO_SOCKET 14 +#define SO_SELECT 15 +#define SO_GETIPDOMAIN 16 +#define SO_SETIPDOMAIN 17 +#define SO_ADJTIME 18 +#define SO_SETREUID 19 +#define SO_SETREGID 20 +#define SO_GETTIME 21 +#define SO_SETTIME 22 +#define SO_GETITIMER 23 +#define SO_SETITIMER 24 +#define SO_RECVMSG 25 +#define SO_SENDMSG 26 +#define SO_SOCKPAIR 27 + +/* + * message flags + */ +#define M_BCAST 0x80000000 + +/* Definitions and structures used for extracting */ +/* the size and/or the contents of kernel tables */ + +/* Copyin/out values */ +#define GIARG 0x1 +#define CONTI 0x2 +#define GITAB 0x4 + +struct gi_arg { + caddr_t gi_where; + unsigned gi_size; +}; + +#if !defined(_KERNEL) && !defined(INKERNEL) && !defined(_INKERNEL) + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +int getsockname __P_((int, struct sockaddr *, int *)); +int getsockopt __P_((int, int, int, void *, int *)); +int setsockopt __P_((int, int, int, const void *, int)); +int listen __P_((int, int)); +ssize_t recv __P_((int, void *, size_t, int)); +ssize_t recvfrom __P_((int, void *, size_t, int, struct sockaddr *, int *)); +int recvmsg __P_((int, struct msghdr *, int)); +ssize_t send __P_((int, const void *, size_t, int)); +int sendmsg __P_((int, const struct msghdr *, int)); +ssize_t sendto __P_((int, const void *, size_t, int, const struct sockaddr *, int)); +int shutdown __P_((int, int)); +int socket __P_((int, int, int)); +int socketpair __P_((int, int, int, int[2])); +__END_DECLS + +#endif /* !INKERNEL */ +#endif /* __sys_socket_h */ diff --git a/lib/libpthread/machdep/sco-3.2v5/syscall.h b/lib/libpthread/machdep/sco-3.2v5/syscall.h new file mode 100755 index 00000000000..f49fba81b6e --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/syscall.h @@ -0,0 +1,175 @@ +/* Copyright 1994-1995 The Santa Cruz Operation, Inc. All Rights Reserved. */ + + +#if defined(_NO_PROTOTYPE) /* Old, crufty environment */ +#include <oldstyle/syscall.h> +#elif defined(_SCO_ODS_30) /* Old, Tbird compatible environment */ +#include <ods_30_compat/syscall.h> +#else /* Normal, default environment */ +/* +/ Portions Copyright (C) 1983-1995 The Santa Cruz Operation, Inc. + * All Rights Reserved. + * + * The information in this file is provided for the exclusive use of + * the licensees of The Santa Cruz Operation, Inc. Such users have the + * right to use, modify, and incorporate this code into other products + * for purposes authorized by the license agreement provided they include + * this notice and the associated copyright notice with any such product. + * The information in this file is provided "AS IS" without warranty. + */ + +/* Portions Copyright (c) 1990, 1991, 1992, 1993 UNIX System Laboratories, Inc. */ +/* Portions Copyright (c) 1979 - 1990 AT&T */ + +#ident "xpg4plus @(#) sys.i386 20.1 94/12/04 " +/* #ident "xpg4plus @(#)head:sys.i386 1.2" */ + +/* +/* Definitions of Kernel Entry Call Gates +*/ + +#ifndef _SYSCALL_H_ +#define _SYSCALL_H_ + +/*#define SYSCALL $0x7,$0*/ +/*#define SIGCALL $0xF,$0*/ + +/* +/* Definitions of System Call Entry Point Numbers +*/ + +#define SYS_access 33 +#define SYS_acct 51 +#define SYS_advfs 70 +#define SYS_alarm 27 +#define SYS_break 17 +#define SYS_brk 17 +#define SYS_chdir 12 +#define SYS_chmod 15 +#define SYS_chown 16 +#define SYS_chroot 61 +#define SYS_close 6 +#define SYS_creat 8 +#define SYS_dup 41 +#define SYS_exec 11 +#define SYS_execve 59 +#define SYS_exit 1 +#define SYS_fcntl 62 +#define SYS_fork 2 +#define SYS_fstat 28 +#define SYS_fstatfs 38 +#define SYS_fxstat 125 +#define SYS_getdents 81 +#define SYS_getgid 47 +#define SYS_getmsg 85 +#define SYS_getpid 20 +#define SYS_gettimeofday 171 +#define SYS_getuid 24 +#define SYS_gtty 32 +#define SYS_ioctl 54 +#define SYS_kill 37 +#define SYS_link 9 +#define SYS_lock 45 +#define SYS_lseek 19 +#define SYS_lstat 91 +#define SYS_lxstat 124 +#define SYS_mkdir 80 +#define SYS_mknod 14 +#define SYS_mount 21 +#define SYS_msgsys 49 +#define SYS_nice 34 +#define SYS_open 5 +#define SYS_pause 29 +#define SYS_pipe 42 +#define SYS_plock 45 +#define SYS_poll 87 +#define SYS_prof 44 +#define SYS_ptrace 26 +#define SYS_putmsg 86 +#define SYS_rdebug 76 +#define SYS_read 3 +#define SYS_readlink 92 +#define SYS_readv 121 +#define SYS_rfstart 74 +#define SYS_rfstop 77 +#define SYS_rfsys 78 +#define SYS_rmdir 79 +#define SYS_rmount 72 +#define SYS_rumount 73 +#define SYS_seek 19 +#define SYS_semsys 53 +#define SYS_setgid 46 +#define SYS_setpgrp 39 +#define SYS_settimeofday 172 +#define SYS_setuid 23 +#define SYS_shmsys 52 +#define SYS_signal 48 +#define SYS_stat 18 +#define SYS_statfs 35 +#define SYS_stime 25 +#define SYS_stty 31 +#define SYS_symlink 90 +#define SYS_sync 36 +#define SYS_sys3b 50 +#define SYS_sysi86 50 +#define SYS_sysacct 51 +#define SYS_sysfs 84 +#define SYS_time 13 +#define SYS_times 43 +#define SYS_uadmin 55 +#define SYS_ulimit 63 +#define SYS_umask 60 +#define SYS_umount 22 +#define SYS_unadvfs 71 +#define SYS_unlink 10 +#define SYS_utime 30 +#define SYS_utssys 57 +#define SYS_wait 7 +#define SYS_write 4 +#define SYS_writev 122 +#define SYS_xstat 123 +#define SYS_ftruncate 192 + +/* cxenix numbers are created by the formula + * (table index << 8) + CXENIX + */ + +#define CXENIX 0x28 /* Decimal 40 */ + +#define XLOCKING 0x0128 +#define CREATSEM 0x0228 +#define OPENSEM 0x0328 +#define SIGSEM 0x0428 +#define WAITSEM 0x0528 +#define NBWAITSEM 0x0628 +#define RDCHK 0x0728 +#define CHSIZE 0x0a28 +#define SYS_ftime 0x0b28 +#define NAP 0x0c28 +#define SDGET 0x0d28 +#define SDFREE 0x0e28 +#define SDENTER 0x0f28 +#define SDLEAVE 0x1028 +#define SDGETV 0x1128 +#define SDWAITV 0x1228 +#define PROCTL 0x2028 +#define EXECSEG 0x2128 +#define UNEXECSEG 0x2228 +#define SYS_select 0x2428 +#define SYS_eaccess 0x2528 +#define SYS_paccess 0x2628 +#define SYS_sigaction 0x2728 +#define SYS_sigprocmask 0x2828 +#define SYS_sigpending 0x2928 +#define SYS_sigsuspend 0x2a28 +#define SYS_getgroups 0x2b28 +#define SYS_setgroups 0x2c28 +#define SYS_sysconf 0x2d28 +#define SYS_pathconf 0x2e28 +#define SYS_fpathconf 0x2f28 +#define SYS_rename 0x3028 +#define SYS_setitimer 0x3828 + +#define CLOCAL 127 +#endif +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/timers.h b/lib/libpthread/machdep/sco-3.2v5/timers.h new file mode 100755 index 00000000000..cbc48ccc8d8 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/timers.h @@ -0,0 +1,68 @@ +/* ==== 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. + * + * timers.h,v 1.50.8.1 1996/03/05 08:28:36 proven Exp + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_TIMERS_H_ +#define _SYS_TIMERS_H_ + +#include <sys/types.h> +#include <time.h> + +struct timespec { + long tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/sco-3.2v5/trash.can b/lib/libpthread/machdep/sco-3.2v5/trash.can new file mode 100755 index 00000000000..33edf65aab6 --- /dev/null +++ b/lib/libpthread/machdep/sco-3.2v5/trash.can @@ -0,0 +1 @@ +make: *** No targets specified and no makefile found. Stop. diff --git a/lib/libpthread/machdep/sunos-4.1.3/__math.h b/lib/libpthread/machdep/sunos-4.1.3/__math.h new file mode 100755 index 00000000000..9de1dc6d4bd --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__math.h @@ -0,0 +1,5 @@ +/* + * Posix (actually ansi C) section + */ +#define HUGE_VAL (__infinity()) /* Produces IEEE Infinity. */ + diff --git a/lib/libpthread/machdep/sunos-4.1.3/__path.h b/lib/libpthread/machdep/sunos-4.1.3/__path.h new file mode 100755 index 00000000000..62317368a75 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__path.h @@ -0,0 +1,12 @@ +/* + * $Id: __path.h,v 1.1 1998/07/21 13:19:32 peter Exp $ + */ + +#ifndef _SYS__PATH_H_ +#define _SYS__PATH_H_ + +#define _PATH_PTY "/dev/" +#define _PATH_TZDIR "/usr/share/zoneinfo" +#define _PATH_TZFILE "localtime" + +#endif /* !_SYS__PATH_H_ */ diff --git a/lib/libpthread/machdep/sunos-4.1.3/__signal.h b/lib/libpthread/machdep/sunos-4.1.3/__signal.h new file mode 100755 index 00000000000..f8b4fb8b6de --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__signal.h @@ -0,0 +1,11 @@ + +#include <sys/signal.h> +#include <sys/stdtypes.h> + +typedef int sig_atomic_t; + +#define __SIGFILLSET 0xffffffff +#define __SIGEMPTYSET 0 +#define __SIGADDSET(s,n) ((*s) |= (1 << ((n) - 1))) +#define __SIGDELSET(s,n) ((*s) &= ~(1 << ((n) - 1))) +#define __SIGISMEMBER(s,n) ((*s) & (1 << ((n) - 1))) diff --git a/lib/libpthread/machdep/sunos-4.1.3/__stdio.h b/lib/libpthread/machdep/sunos-4.1.3/__stdio.h new file mode 100755 index 00000000000..6ca5e57396d --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__stdio.h @@ -0,0 +1,4 @@ + +typedef pthread_fpos_t fpos_t; + +#include <sys/stdtypes.h> diff --git a/lib/libpthread/machdep/sunos-4.1.3/__stdlib.h b/lib/libpthread/machdep/sunos-4.1.3/__stdlib.h new file mode 100755 index 00000000000..c995332aab4 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__stdlib.h @@ -0,0 +1,28 @@ +/* $Id: __stdlib.h,v 1.1 1998/07/21 13:19:32 peter Exp $ */ + +#ifndef __sys_stdtypes_h + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <sys/stdtypes.h> /* to get size_t */ + +#if (! defined _SIZE_T_ ) && (! defined(_GCC_SIZE_T)) +#define _SIZE_T_ +#define _GCC_SIZE_T +typedef pthread_size_t size_t; +#endif + +#if (! defined _WCHAR_T_ ) && (! defined(_GCC_WCHAR_T)) +#define _WCHAR_T_ +#define _GCC_WCHAR_T +typedef unsigned int wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif + +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/__string.h b/lib/libpthread/machdep/sunos-4.1.3/__string.h new file mode 100755 index 00000000000..0859a80cf24 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__string.h @@ -0,0 +1,14 @@ + +#include <sys/stdtypes.h> + +/* Non-standard SunOS 4.x 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 *)); +__END_DECLS +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/__time.h b/lib/libpthread/machdep/sunos-4.1.3/__time.h new file mode 100755 index 00000000000..1ffa0e47d3f --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__time.h @@ -0,0 +1,2 @@ + +#include <sys/stdtypes.h> diff --git a/lib/libpthread/machdep/sunos-4.1.3/__unistd.h b/lib/libpthread/machdep/sunos-4.1.3/__unistd.h new file mode 100755 index 00000000000..ae29cc458a8 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/__unistd.h @@ -0,0 +1,73 @@ +/*- + * 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:33 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/cdefs.h> +#include <sys/types.h> + +#define _SC_ARG_MAX 1 /* space for argv & envp */ +#define _SC_CHILD_MAX 2 /* maximum children per process??? */ +#define _SC_CLK_TCK 3 /* clock ticks/sec */ +#define _SC_NGROUPS_MAX 4 /* number of groups if multple supp. */ +#define _SC_OPEN_MAX 5 /* max open files per process */ +#define _SC_JOB_CONTROL 6 /* do we have job control */ +#define _SC_SAVED_IDS 7 /* do we have saved uid/gids */ +#define _SC_VERSION 8 /* POSIX version supported */ + +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_VERSION 198808 + +#define _PC_LINK_MAX 1 /* max links to file/dir */ +#define _PC_MAX_CANON 2 /* max line length */ +#define _PC_MAX_INPUT 3 /* max "packet" to a tty device */ +#define _PC_NAME_MAX 4 /* max pathname component length */ +#define _PC_PATH_MAX 5 /* max pathname length */ +#define _PC_PIPE_BUF 6 /* size of a pipe */ +#define _PC_CHOWN_RESTRICTED 7 /* can we give away files */ +#define _PC_NO_TRUNC 8 /* trunc or error on >NAME_MAX */ +#define _PC_VDISABLE 9 /* best char to shut off tty c_cc */ +#define _PC_LAST 9 /* highest value of any _PC_* */ + +#ifndef NULL +#define NULL 0 /* null pointer constant */ +#endif + +typedef int ssize_t; + +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/cdefs.h b/lib/libpthread/machdep/sunos-4.1.3/cdefs.h new file mode 100755 index 00000000000..a059fa3d3fc --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/cdefs.h @@ -0,0 +1,61 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#define __INLINE static +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +typedef int int32_t; +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +typedef short int16_t; +#endif + +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/compat.h b/lib/libpthread/machdep/sunos-4.1.3/compat.h new file mode 100755 index 00000000000..b097178ce19 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:33 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/dirent.h b/lib/libpthread/machdep/sunos-4.1.3/dirent.h new file mode 100755 index 00000000000..c2048b1741c --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/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 { + off_t d_off; /* offset of next disk dir entry */ + 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 + +#endif /* !_SYS_DIRENT_H_ */ + + diff --git a/lib/libpthread/machdep/sunos-4.1.3/fcntlcom.h b/lib/libpthread/machdep/sunos-4.1.3/fcntlcom.h new file mode 100755 index 00000000000..2b7acce7696 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/fcntlcom.h @@ -0,0 +1,163 @@ +/* @(#)fcntlcom.h 1.13 91/06/18 SMI; from UCB fcntl.h 5.2 1/8/86 */ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef __sys_fcntlcom_h +#define __sys_fcntlcom_h + +#include <sys/cdefs.h> + +/* + * Rewack the FXXXXX values as _FXXXX so that _POSIX_SOURCE works. + */ +#define _FOPEN (-1) /* from sys/file.h, kernel use only */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FNDELAY 0x0004 /* non blocking I/O (4.2 style) */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FSETBLK 0x0010 /* use block offsets */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FMARK 0x10000 /* internal; mark during gc() */ +#define _FDEFER 0x20000 /* internal; defer for next gc pass */ + +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) + +/* + * Flag values for open(2) and fcntl(2) + * The kernel adds 1 to the open modes to turn it into some + * combination of FREAD and FWRITE. + */ +#define O_RDONLY 0 /* +1 == FREAD */ +#define O_WRONLY 1 /* +1 == FWRITE */ +#define O_RDWR 2 /* +1 == FREAD|FWRITE */ +#define O_APPEND _FAPPEND +#define O_CREAT _FCREAT +#define O_TRUNC _FTRUNC +#define O_EXCL _FEXCL +/* O_SYNC _FSYNC not posix, defined below */ +/* O_NDELAY _FNDELAY set in include/fcntl.h */ +/* O_NDELAY _FNBIO set in 5include/fcntl.h */ +#define O_NONBLOCK _FNONBLOCK +#define O_NOCTTY _FNOCTTY + +#ifndef _POSIX_SOURCE + +#define O_SYNC _FSYNC + +/* + * Flags that work for fcntl(fd, F_SETFL, FXXXX) + */ +#define FAPPEND _FAPPEND +#define FSYNC _FSYNC +#define FASYNC _FASYNC +#define FNBIO _FNBIO +#define FNONBIO _FNONBLOCK /* XXX fix to be NONBLOCK everywhere */ +#define FNDELAY _FNDELAY + +/* + * Flags that are disallowed for fcntl's (FCNTLCANT); + * used for opens, internal state, or locking. + */ +#define FREAD _FREAD +#define FWRITE _FWRITE +#define FMARK _FMARK +#define FDEFER _FDEFER +#define FSETBLK _FSETBLK +#define FSHLOCK _FSHLOCK +#define FEXLOCK _FEXLOCK + +/* + * The rest of the flags, used only for opens + */ +#define FOPEN _FOPEN +#define FCREAT _FCREAT +#define FTRUNC _FTRUNC +#define FEXCL _FEXCL +#define FNOCTTY _FNOCTTY + +#endif !_POSIX_SOURCE + +/* XXX close on exec request; must match UF_EXCLOSE in user.h */ +#define FD_CLOEXEC 1 /* posix */ + +/* fcntl(2) requests */ +#define F_DUPFD 0 /* Duplicate fildes */ +#define F_GETFD 1 /* Get fildes flags (close on exec) */ +#define F_SETFD 2 /* Set fildes flags (close on exec) */ +#define F_GETFL 3 /* Get file flags */ +#define F_SETFL 4 /* Set file flags */ +#ifndef _POSIX_SOURCE +#define F_GETOWN 5 /* Get owner - for ASYNC */ +#define F_SETOWN 6 /* Set owner - for ASYNC */ +#endif /* !_POSIX_SOURCE */ +#define F_GETLK 7 /* Get record-locking information */ +#define F_SETLK 8 /* Set or Clear a record-lock (Non-Blocking) */ +#define F_SETLKW 9 /* Set or Clear a record-lock (Blocking) */ +#ifndef _POSIX_SOURCE +#define F_RGETLK 10 /* Test a remote lock to see if it is blocked */ +#define F_RSETLK 11 /* Set or unlock a remote lock */ +#define F_CNVT 12 /* Convert a fhandle to an open fd */ +#define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */ +#endif /* !_POSIX_SOURCE */ + +/* fcntl(2) flags (l_type field of flock structure) */ +#define F_RDLCK 1 /* read lock */ +#define F_WRLCK 2 /* write lock */ +#define F_UNLCK 3 /* remove lock(s) */ +#ifndef _POSIX_SOURCE +#define F_UNLKSYS 4 /* remove remote locks for a given system */ +#endif /* !_POSIX_SOURCE */ + +#include <sys/stdtypes.h> + +/* file segment locking set data type - information passed to system by user */ +struct flock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ +}; + +#ifndef _POSIX_SOURCE +/* extended file segment locking set data type */ +struct eflock { + short l_type; /* F_RDLCK, F_WRLCK, or F_UNLCK */ + short l_whence; /* flag to choose starting offset */ + long l_start; /* relative offset, in bytes */ + long l_len; /* length, in bytes; 0 means lock to EOF */ + short l_pid; /* returned with F_GETLK */ + short l_xxx; /* reserved for future use */ + long l_rpid; /* Remote process id wanting this lock */ + long l_rsys; /* Remote system id wanting this lock */ +}; +#endif /* !_POSIX_SOURCE */ + +#ifndef KERNEL +#include <sys/stat.h> /* sigh. for the mode bits for open/creat */ +#include <sys/cdefs.h> + +__BEGIN_DECLS + +int open __P_((const char *path, int flags, ...)); +int creat __P_((const char *path, mode_t modes)); +int fcntl __P_((int fd, int cmd, ...)); + +__END_DECLS + +#endif /* !KERNEL */ +#endif /* !__sys_fcntlcom_h */ diff --git a/lib/libpthread/machdep/sunos-4.1.3/signal.h b/lib/libpthread/machdep/sunos-4.1.3/signal.h new file mode 100755 index 00000000000..02a19860922 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/signal.h @@ -0,0 +1,98 @@ +#ifndef __sys_signal_h +#define __sys_signal_h + +#define NSIG 32 + +/* + * If any signal defines (SIG*) are added, deleted, or changed, the same + * changes must be made in /usr/include/signal.h as well. + */ +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGCLD 20 /* System V name for SIGCHLD */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGPOLL SIGIO /* System V name for SIGIO */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window changed */ +#define SIGLOST 29 /* resource lost (eg, record-lock lost) */ +#define SIGUSR1 30 /* user defined signal 1 */ +#define SIGUSR2 31 /* user defined signal 2 */ + +struct sigvec { + void (*sv_handler)(); /* signal handler */ + int sv_mask; /* signal mask to apply */ + int sv_flags; /* see signal options below */ +}; +#define SV_ONSTACK 0x0001 /* take signal on signal stack */ +#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */ +#define SV_RESETHAND 0x0004 /* reset signal handler to SIG_DFL when signal taken */ +/* + * If any SA_NOCLDSTOP or SV_NOCLDSTOP is change, the same + * changes must be made in /usr/include/signal.h as well. + */ +#define SV_NOCLDSTOP 0x0008 /* don't send a SIGCHLD on child stop */ +#define SA_ONSTACK SV_ONSTACK +#define SA_INTERRUPT SV_INTERRUPT +#define SA_RESETHAND SV_RESETHAND + +#define SA_NOCLDSTOP SV_NOCLDSTOP +#define sv_onstack sv_flags /* isn't compatibility wonderful! */ + +/* + * If SIG_ERR, SIG_DFL, SIG_IGN, or SIG_HOLD are changed, the same changes + * must be made in /usr/include/signal.h as well. + */ +#define SIG_ERR (void (*)())-1 +#define SIG_DFL (void (*)())0 +#define SIG_IGN (void (*)())1 + +/* + * Macro for converting signal number to a mask suitable for sigblock(). + */ +#define sigmask(m) (1 << ((m)-1)) + +/* + * If SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK are changed, the same changes + * must be made in /usr/include/signal.h as well. + */ +#define SIG_BLOCK 0x0001 +#define SIG_UNBLOCK 0x0002 +#define SIG_SETMASK 0x0004 + +/* + * If changes are made to sigset_t or struct sigaction, the same changes + * must be made in /usr/include/signal.h as well. + */ +#include <sys/stdtypes.h> + +struct sigaction { + void (*sa_handler)(); + sigset_t sa_mask; + int sa_flags; +}; + +#endif /* !__sys_signal_h */ diff --git a/lib/libpthread/machdep/sunos-4.1.3/stat.h b/lib/libpthread/machdep/sunos-4.1.3/stat.h new file mode 100755 index 00000000000..35e7f760204 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/stat.h @@ -0,0 +1,94 @@ +/* @(#)stat.h 2.19 90/01/24 SMI; from UCB 4.7 83/05/21 */ + +/* + * NOTE: changes to this file should also be made to xpg2include/sys/stat.h + */ + +#ifndef __sys_stat_h +#define __sys_stat_h + +#include <sys/cdefs.h> +#include <sys/types.h> + +struct stat { + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + short st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + time_t st_atime; + int st_spare1; + time_t st_mtime; + int st_spare2; + time_t st_ctime; + int st_spare3; + long st_blksize; + long st_blocks; + long st_spare4[2]; +}; + +#define _IFMT 0170000 /* type of file */ +#define _IFDIR 0040000 /* directory */ +#define _IFCHR 0020000 /* character special */ +#define _IFBLK 0060000 /* block special */ +#define _IFREG 0100000 /* regular */ +#define _IFLNK 0120000 /* symbolic link */ +#define _IFSOCK 0140000 /* socket */ +#define _IFIFO 0010000 /* fifo */ + +#define S_ISUID 0004000 /* set user id on execution */ +#define S_ISGID 0002000 /* set group id on execution */ +#ifndef _POSIX_SOURCE +#define S_ISVTX 0001000 /* save swapped text even after use */ +#define S_IREAD 0000400 /* read permission, owner */ +#define S_IWRITE 0000200 /* write permission, owner */ +#define S_IEXEC 0000100 /* execute/search permission, owner */ + +#define S_ENFMT 0002000 /* enforcement-mode locking */ + +#define S_IFMT _IFMT +#define S_IFDIR _IFDIR +#define S_IFCHR _IFCHR +#define S_IFBLK _IFBLK +#define S_IFREG _IFREG +#define S_IFLNK _IFLNK +#define S_IFSOCK _IFSOCK +#define S_IFIFO _IFIFO +#endif !_POSIX_SOURCE + +#define S_IRWXU 0000700 /* rwx, owner */ +#define S_IRUSR 0000400 /* read permission, owner */ +#define S_IWUSR 0000200 /* write permission, owner */ +#define S_IXUSR 0000100 /* execute/search permission, owner */ +#define S_IRWXG 0000070 /* rwx, group */ +#define S_IRGRP 0000040 /* read permission, group */ +#define S_IWGRP 0000020 /* write permission, grougroup */ +#define S_IXGRP 0000010 /* execute/search permission, group */ +#define S_IRWXO 0000007 /* rwx, other */ +#define S_IROTH 0000004 /* read permission, other */ +#define S_IWOTH 0000002 /* write permission, other */ +#define S_IXOTH 0000001 /* execute/search permission, other */ + +#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) +#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) +#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) +#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) +#define S_ISREG(m) (((m)&_IFMT) == _IFREG) +#ifndef _POSIX_SOURCE +#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) +#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) +#endif + +__BEGIN_DECLS +int chmod __P_((const char *path, mode_t mode)); +int fstat __P_((int fd, struct stat *sbuf)); +int mkdir __P_((char *path, mode_t mode)); +int mkfifo __P_((char *path, mode_t mode)); +int stat __P_((const char *path, struct stat *sbuf)); +mode_t umask __P_((mode_t mask)); +__END_DECLS + +#endif /* !__sys_stat_h */ diff --git a/lib/libpthread/machdep/sunos-4.1.3/time.h b/lib/libpthread/machdep/sunos-4.1.3/time.h new file mode 100755 index 00000000000..20bb085e4d8 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/time.h @@ -0,0 +1,69 @@ +/* @(#)time.h 2.12 91/05/22 SMI; from UCB 7.1 6/4/86 */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include <sys/cdefs.h> +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ + +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + +/* + * Operations on timevals. + * + * NB: timercmp does not work for >= or <=. + */ +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + ((tvp)->tv_sec cmp (uvp)->tv_sec || \ + (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; + +__BEGIN_DECLS +int gettimeofday __P_((struct timeval *, struct timezone *)); +__END_DECLS + + +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/timers.h b/lib/libpthread/machdep/sunos-4.1.3/timers.h new file mode 100755 index 00000000000..5f5b476e195 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/timers.h @@ -0,0 +1,68 @@ +/* ==== 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:33 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 <sys/types.h> +#include <time.h> + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/sunos-4.1.3/wait.h b/lib/libpthread/machdep/sunos-4.1.3/wait.h new file mode 100755 index 00000000000..97f5fb261f7 --- /dev/null +++ b/lib/libpthread/machdep/sunos-4.1.3/wait.h @@ -0,0 +1,22 @@ +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +#define WNOHANG 1 /* dont hang in wait */ +#define WUNTRACED 2 /* tell about stopped, untraced children */ + +pid_t wait __P_((int *)); +pid_t waitpid __P_((pid_t, int *, int)); + +#define _W_INT(i) (i) +#define WCOREFLAG 0200 + +#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) + +#endif /* _SYS_WAIT_H_ */ diff --git a/lib/libpthread/machdep/sunos-5.3/__math.h b/lib/libpthread/machdep/sunos-5.3/__math.h new file mode 100755 index 00000000000..5404b52c661 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__math.h @@ -0,0 +1,16 @@ +/* + * ANSI/POSIX + */ +typedef union _h_val { + unsigned long _i[2]; + double _d; +} _h_val; + +#ifdef __STDC__ +extern const _h_val __huge_val; +#else +extern _h_val __huge_val; +#endif + +#define HUGE_VAL __huge_val._d + diff --git a/lib/libpthread/machdep/sunos-5.3/__signal.h b/lib/libpthread/machdep/sunos-5.3/__signal.h new file mode 100755 index 00000000000..638c1ca7331 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__signal.h @@ -0,0 +1,19 @@ +#include <sys/feature_tests.h> +#include <sys/signal.h> + +/* +typedef struct { + unsigned long __sigbits[4]; +} sigset_t; +*/ + +typedef int sig_atomic_t; + +#define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) +#define sigword(n) (((unsigned int)((n) - 1))>>5) + +#define __SIGEMPTYSET { 0, 0, 0, 0 }; +#define __SIGFILLSET { 0xffffffff,0xffffffff,0xffffffff,0xffffffff }; +#define __SIGADDSET(s, n) ((s)->__sigbits[sigword(n)] |= sigmask(n)) +#define __SIGDELSET(s, n) ((s)->__sigbits[sigword(n)] &= ~sigmask(n)) +#define __SIGISMEMBER(s, n) (sigmask(n) & (s)->__sigbits[sigword(n)]) diff --git a/lib/libpthread/machdep/sunos-5.3/__stdio.h b/lib/libpthread/machdep/sunos-5.3/__stdio.h new file mode 100755 index 00000000000..4dd4becdbe9 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__stdio.h @@ -0,0 +1,6 @@ +typedef pthread_fpos_t fpos_t; + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/__stdlib.h b/lib/libpthread/machdep/sunos-5.3/__stdlib.h new file mode 100755 index 00000000000..a0717ce3c2b --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__stdlib.h @@ -0,0 +1,27 @@ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <sys/feature_tests.h> + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _UID_T +#define _UID_T +typedef long uid_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef long wchar_t; +#endif + + +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/__string.h b/lib/libpthread/machdep/sunos-5.3/__string.h new file mode 100755 index 00000000000..9cb12a07bb7 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__string.h @@ -0,0 +1,12 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +/* Non-standard NetBSD string routines. */ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +__BEGIN_DECLS +char *strdup __P_((const char *)); +__END_DECLS +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/__time.h b/lib/libpthread/machdep/sunos-5.3/__time.h new file mode 100755 index 00000000000..93d15dbadbe --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__time.h @@ -0,0 +1,69 @@ +/* ==== 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: __time.h,v 1.1 1998/07/21 13:19:34 peter Exp $ + * + * Description : System specific time header. + * + * 1.00 94/11/07 proven + * -Started coding this file. + */ + +#ifndef _SYS___TIME_H_ +#define _SYS___TIME_H_ + +#include <sys/feature_tests.h> + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; +#endif +#ifndef _CLOCKID_T +#define _CLOCKID_T +typedef int clockid_t; +#endif +#ifndef _TIMER_T +#define _TIMER_T +typedef int timer_t; +#endif + +#include <sys/time.h> +#include <sys/siginfo.h> + +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/__unistd.h b/lib/libpthread/machdep/sunos-5.3/__unistd.h new file mode 100755 index 00000000000..b65361ef5f1 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/__unistd.h @@ -0,0 +1,47 @@ +/*- + * 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:34 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> +#include <sys/unistd.h> + +#ifndef NULL +#define NULL 0 +#endif + +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/cdefs.h b/lib/libpthread/machdep/sunos-5.3/cdefs.h new file mode 100755 index 00000000000..f95f7b36958 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/cdefs.h @@ -0,0 +1,59 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#define __INLINE static +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +typedef int int32_t; +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +typedef short int16_t; +#endif + +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/compat.h b/lib/libpthread/machdep/sunos-5.3/compat.h new file mode 100755 index 00000000000..048cabd233e --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:34 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/dirent.h b/lib/libpthread/machdep/sunos-5.3/dirent.h new file mode 100755 index 00000000000..303d3d7df2b --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/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 */ + off_t d_off; /* offset of next disk dir entry */ + u_short d_reclen; /* length of this record */ +#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_namlen d_reclen +#define d_ino d_fileno + +#endif /* !_SYS_DIRENT_H_ */ + + diff --git a/lib/libpthread/machdep/sunos-5.3/socket.h b/lib/libpthread/machdep/sunos-5.3/socket.h new file mode 100755 index 00000000000..0b075622fed --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/socket.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1982, 1985, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)socket.h 7.3 (Berkeley) 6/27/88 + */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +/* + * Types of sockets + */ +#define SOCK_STREAM 2 /* stream socket */ +#define SOCK_DGRAM 1 /* datagram socket */ +#define SOCK_RAW 4 /* raw-protocol interface */ +#define SOCK_RDM 5 /* reliably-delivered message */ +#define SOCK_SEQPACKET 6 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get/set protocol type */ + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_NBS 7 /* nbs protocols */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_NIT 17 /* NIT */ +#define AF_802 18 /* IEEE 802.2, also ISO 8802 */ +#define AF_ISO 19 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_X25 20 /* CCITT X.25 in particular */ +#define AF_OSINET 21 +#define AF_GOSIP 22 +#define AF_MAX 22 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_NIT AF_NIT +#define PF_802 AF_802 +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_X25 AF_X25 +#define PF_OSINET AF_OSINET +#define PF_GOSIP AF_GOSIP +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#define MSG_MAXIOVLEN 16 + +#include <sys/cdefs.h> +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); +int setsockopt __P_((int, int, int, const void *, int)); +int getsockname __P_((int, struct sockaddr *, int *)); +int shutdown __P_((int, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +__END_DECLS + +#endif /* _SYS_SOCKET_H */ diff --git a/lib/libpthread/machdep/sunos-5.3/timers.h b/lib/libpthread/machdep/sunos-5.3/timers.h new file mode 100755 index 00000000000..edd2d452e32 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/timers.h @@ -0,0 +1,72 @@ +/* ==== 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:35 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 <sys/types.h> +#include <time.h> + +#define tv_sec tv_sec +#define tv_nsec tv_nsec + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +#ifndef NOT_USED +/* for sleep.h */ +/* int gettimeofday __P_((struct timeval *,struct timezone *)); */ +int gettimeofday __P_((struct timeval *,void *)); +#endif + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/sunos-5.3/uio.h b/lib/libpthread/machdep/sunos-5.3/uio.h new file mode 100755 index 00000000000..7786142dd87 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.3/uio.h @@ -0,0 +1,40 @@ +/* ==== uio.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Solaris header file. + */ + +#ifndef _PTHREAD_UIO_H_ +#define _PTHREAD_UIO_H_ + +#include <sys/cdefs.h> + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +typedef struct iovec iovec_t; + +struct uio { + iovec_t *uio_iov; /* pointer to array of iovecs */ + int uio_iovcnt; /* number of iovecs */ + /* These are all bogus */ + int _uio_offset; /* file offset */ + int uio_segflg; /* address space (kernel or user) */ + short uio_fmode; /* file mode flags */ + int _uio_limit; /* u-limit (maximum "block" offset) */ + int uio_resid; /* residual count */ +}; + +typedef struct uio uio_t; + +__BEGIN_DECLS + +int readv __P_((int, const struct iovec *, int)); +int writev __P_((int, const struct iovec *, int)); + +__END_DECLS + +#endif + diff --git a/lib/libpthread/machdep/sunos-5.5/__math.h b/lib/libpthread/machdep/sunos-5.5/__math.h new file mode 100755 index 00000000000..5404b52c661 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__math.h @@ -0,0 +1,16 @@ +/* + * ANSI/POSIX + */ +typedef union _h_val { + unsigned long _i[2]; + double _d; +} _h_val; + +#ifdef __STDC__ +extern const _h_val __huge_val; +#else +extern _h_val __huge_val; +#endif + +#define HUGE_VAL __huge_val._d + diff --git a/lib/libpthread/machdep/sunos-5.5/__signal.h b/lib/libpthread/machdep/sunos-5.5/__signal.h new file mode 100755 index 00000000000..638c1ca7331 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__signal.h @@ -0,0 +1,19 @@ +#include <sys/feature_tests.h> +#include <sys/signal.h> + +/* +typedef struct { + unsigned long __sigbits[4]; +} sigset_t; +*/ + +typedef int sig_atomic_t; + +#define sigmask(n) ((unsigned int)1 << (((n) - 1) & (32 - 1))) +#define sigword(n) (((unsigned int)((n) - 1))>>5) + +#define __SIGEMPTYSET { 0, 0, 0, 0 }; +#define __SIGFILLSET { 0xffffffff,0xffffffff,0xffffffff,0xffffffff }; +#define __SIGADDSET(s, n) ((s)->__sigbits[sigword(n)] |= sigmask(n)) +#define __SIGDELSET(s, n) ((s)->__sigbits[sigword(n)] &= ~sigmask(n)) +#define __SIGISMEMBER(s, n) (sigmask(n) & (s)->__sigbits[sigword(n)]) diff --git a/lib/libpthread/machdep/sunos-5.5/__stdio.h b/lib/libpthread/machdep/sunos-5.5/__stdio.h new file mode 100755 index 00000000000..4dd4becdbe9 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__stdio.h @@ -0,0 +1,6 @@ +typedef pthread_fpos_t fpos_t; + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/__stdlib.h b/lib/libpthread/machdep/sunos-5.5/__stdlib.h new file mode 100755 index 00000000000..a0717ce3c2b --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__stdlib.h @@ -0,0 +1,27 @@ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <sys/feature_tests.h> + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned int size_t; +#endif + +#ifndef _UID_T +#define _UID_T +typedef long uid_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#ifndef _WCHAR_T +#define _WCHAR_T +typedef long wchar_t; +#endif + + +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/__string.h b/lib/libpthread/machdep/sunos-5.5/__string.h new file mode 100755 index 00000000000..9cb12a07bb7 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__string.h @@ -0,0 +1,12 @@ + +#ifndef _SIZE_T +#define _SIZE_T +typedef pthread_size_t size_t; +#endif + +/* Non-standard NetBSD string routines. */ +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +__BEGIN_DECLS +char *strdup __P_((const char *)); +__END_DECLS +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/__time.h b/lib/libpthread/machdep/sunos-5.5/__time.h new file mode 100755 index 00000000000..f5c1cc92d35 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__time.h @@ -0,0 +1,69 @@ +/* ==== 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: __time.h,v 1.1 1998/07/21 13:19:40 peter Exp $ + * + * Description : System specific time header. + * + * 1.00 94/11/07 proven + * -Started coding this file. + */ + +#ifndef _SYS___TIME_H_ +#define _SYS___TIME_H_ + +#include <sys/feature_tests.h> + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned size_t; +#endif +#ifndef _CLOCK_T +#define _CLOCK_T +typedef long clock_t; +#endif +#ifndef _TIME_T +#define _TIME_T +typedef long time_t; +#endif +#ifndef _CLOCKID_T +#define _CLOCKID_T +typedef int clockid_t; +#endif +#ifndef _TIMER_T +#define _TIMER_T +typedef int timer_t; +#endif + +#include <sys/time.h> +#include <sys/siginfo.h> + +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/__unistd.h b/lib/libpthread/machdep/sunos-5.5/__unistd.h new file mode 100755 index 00000000000..fc3f3b34024 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/__unistd.h @@ -0,0 +1,47 @@ +/*- + * 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:40 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> +#include <sys/unistd.h> + +#ifndef NULL +#define NULL 0 +#endif + +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/cdefs.h b/lib/libpthread/machdep/sunos-5.5/cdefs.h new file mode 100755 index 00000000000..f95f7b36958 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/cdefs.h @@ -0,0 +1,59 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#else /* !__GNUC__ */ +#define __BEGIN_DECLS +#define __END_DECLS +#define __INLINE static +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +typedef int int32_t; +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +typedef short int16_t; +#endif + +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/compat.h b/lib/libpthread/machdep/sunos-5.5/compat.h new file mode 100755 index 00000000000..24a66424646 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:40 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/dirent.h b/lib/libpthread/machdep/sunos-5.5/dirent.h new file mode 100755 index 00000000000..303d3d7df2b --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/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 */ + off_t d_off; /* offset of next disk dir entry */ + u_short d_reclen; /* length of this record */ +#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_namlen d_reclen +#define d_ino d_fileno + +#endif /* !_SYS_DIRENT_H_ */ + + diff --git a/lib/libpthread/machdep/sunos-5.5/socket.h b/lib/libpthread/machdep/sunos-5.5/socket.h new file mode 100755 index 00000000000..0b075622fed --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/socket.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1982, 1985, 1986 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)socket.h 7.3 (Berkeley) 6/27/88 + */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +/* + * Types of sockets + */ +#define SOCK_STREAM 2 /* stream socket */ +#define SOCK_DGRAM 1 /* datagram socket */ +#define SOCK_RAW 4 /* raw-protocol interface */ +#define SOCK_RDM 5 /* reliably-delivered message */ +#define SOCK_SEQPACKET 6 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_PROTOTYPE 0x1009 /* get/set protocol type */ + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_IMPLINK 3 /* arpanet imp addresses */ +#define AF_PUP 4 /* pup protocols: e.g. BSP */ +#define AF_CHAOS 5 /* mit CHAOS protocols */ +#define AF_NS 6 /* XEROX NS protocols */ +#define AF_NBS 7 /* nbs protocols */ +#define AF_ECMA 8 /* european computer manufacturers */ +#define AF_DATAKIT 9 /* datakit protocols */ +#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define AF_SNA 11 /* IBM SNA */ +#define AF_DECnet 12 /* DECnet */ +#define AF_DLI 13 /* Direct data link interface */ +#define AF_LAT 14 /* LAT */ +#define AF_HYLINK 15 /* NSC Hyperchannel */ +#define AF_APPLETALK 16 /* Apple Talk */ +#define AF_NIT 17 /* NIT */ +#define AF_802 18 /* IEEE 802.2, also ISO 8802 */ +#define AF_ISO 19 /* ISO protocols */ +#define AF_OSI AF_ISO +#define AF_X25 20 /* CCITT X.25 in particular */ +#define AF_OSINET 21 +#define AF_GOSIP 22 +#define AF_MAX 22 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET +#define PF_IMPLINK AF_IMPLINK +#define PF_PUP AF_PUP +#define PF_CHAOS AF_CHAOS +#define PF_NS AF_NS +#define PF_NBS AF_NBS +#define PF_ECMA AF_ECMA +#define PF_DATAKIT AF_DATAKIT +#define PF_CCITT AF_CCITT +#define PF_SNA AF_SNA +#define PF_DECnet AF_DECnet +#define PF_DLI AF_DLI +#define PF_LAT AF_LAT +#define PF_HYLINK AF_HYLINK +#define PF_APPLETALK AF_APPLETALK +#define PF_NIT AF_NIT +#define PF_802 AF_802 +#define PF_ISO AF_ISO +#define PF_OSI AF_ISO +#define PF_X25 AF_X25 +#define PF_OSINET AF_OSINET +#define PF_GOSIP AF_GOSIP +#define PF_MAX AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct msghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_PEEK 0x2 /* peek at incoming message */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#define MSG_MAXIOVLEN 16 + +#include <sys/cdefs.h> +/* + * Functions + */ + +__BEGIN_DECLS + +int accept __P_((int, struct sockaddr *, int *)); +int bind __P_((int, const struct sockaddr *, int)); +int connect __P_((int, const struct sockaddr *, int)); +int listen __P_((int, int)); +int socket __P_((int, int, int)); +int setsockopt __P_((int, int, int, const void *, int)); +int getsockname __P_((int, struct sockaddr *, int *)); +int shutdown __P_((int, int)); +int getpeername __P_((int, struct sockaddr *, int *)); +__END_DECLS + +#endif /* _SYS_SOCKET_H */ diff --git a/lib/libpthread/machdep/sunos-5.5/timers.h b/lib/libpthread/machdep/sunos-5.5/timers.h new file mode 100755 index 00000000000..6b0789eaeda --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/timers.h @@ -0,0 +1,70 @@ +/* ==== 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:40 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 <sys/types.h> +#include <time.h> + +#define tv_sec tv_sec +#define tv_nsec tv_nsec + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +#ifdef NOT_USED +int gettimeofday __P_((struct timeval *,struct timezone *)); /* for sleep.h */ +#endif + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/sunos-5.5/uio.h b/lib/libpthread/machdep/sunos-5.5/uio.h new file mode 100755 index 00000000000..7786142dd87 --- /dev/null +++ b/lib/libpthread/machdep/sunos-5.5/uio.h @@ -0,0 +1,40 @@ +/* ==== uio.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Correct Solaris header file. + */ + +#ifndef _PTHREAD_UIO_H_ +#define _PTHREAD_UIO_H_ + +#include <sys/cdefs.h> + +struct iovec { + void *iov_base; + size_t iov_len; +}; + +typedef struct iovec iovec_t; + +struct uio { + iovec_t *uio_iov; /* pointer to array of iovecs */ + int uio_iovcnt; /* number of iovecs */ + /* These are all bogus */ + int _uio_offset; /* file offset */ + int uio_segflg; /* address space (kernel or user) */ + short uio_fmode; /* file mode flags */ + int _uio_limit; /* u-limit (maximum "block" offset) */ + int uio_resid; /* residual count */ +}; + +typedef struct uio uio_t; + +__BEGIN_DECLS + +int readv __P_((int, const struct iovec *, int)); +int writev __P_((int, const struct iovec *, int)); + +__END_DECLS + +#endif + diff --git a/lib/libpthread/machdep/syscall-alpha-netbsd-1.1.S b/lib/libpthread/machdep/syscall-alpha-netbsd-1.1.S new file mode 100644 index 00000000000..5b7dd017426 --- /dev/null +++ b/lib/libpthread/machdep/syscall-alpha-netbsd-1.1.S @@ -0,0 +1,206 @@ +#include <machine/asm.h> +#define CHMK() call_pal 0x83 +#define COMPAT_43 +#include <sys/syscall.h> +#ifndef __CONCAT +#include <sys/cdefs.h> +#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 diff --git a/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S b/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S new file mode 100644 index 00000000000..eda44311281 --- /dev/null +++ b/lib/libpthread/machdep/syscall-alpha-netbsd-1.3.S @@ -0,0 +1,224 @@ +#include <machine/asm.h> +#define CHMK() call_pal 0x83 +#define COMPAT_43 +#include <sys/syscall.h> +#ifndef __CONCAT +#include <sys/cdefs.h> +#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-alpha-osf1.S b/lib/libpthread/machdep/syscall-alpha-osf1.S new file mode 100644 index 00000000000..fad823a7352 --- /dev/null +++ b/lib/libpthread/machdep/syscall-alpha-osf1.S @@ -0,0 +1,97 @@ +#include <asm.h> +#include <regdef.h> +#define COMPAT_43 +#include <syscall.h> + +#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, 2f ;\ + br gp, 1f ;\ +1: ;\ + /* Load gp so we can find cerror to jump to. */;\ + ldgp gp, 0(gp) ;\ + jmp zero, machdep_cerror ;\ +2: + +#define XSYSCALL(x) SYSCALL(x) ; ret ; .end machdep_sys_##x + + .globl machdep_cerror +machdep_cerror: + br t0, 1f +1: + 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 + +/* So is the sigsuspend system call */ + .align 4 + .globl machdep_sys_sigsuspend + .ent machdep_sys_sigsuspend, 0 +machdep_sys_sigsuspend: + .frame sp,0,ra + + bis a0, a0, a1 + ldq a0, 0(a1) + ldiq v0, SYS_sigsuspend + CHMK() + ret + .end machdep_sys_sigsuspend + +/* More stuff ... */ + .align 4 + .globl machdep_restore_from_setjmp + .ent machdep_restore_from_setjmp, 0 +machdep_restore_from_setjmp: + .frame sp, 16, ra + ldgp gp, 0(t12) + lda sp, -16(sp) + stq ra, 0(sp) + ldq v0, 280(a0) + subq v0, 0x00000000acedbade, t0 + bne t0, botch + cmoveq a1, 0x1, a1 + stq a1, 32(a0) + ldiq v0, 0x67 + call_pal 0x83 +botch: + /* This should cause the program to crash. Eventually, fix it + up to print a message first. */ + jsr abort + .end machdep_restore_from_setjmp diff --git a/lib/libpthread/machdep/syscall-hppa-hpux-10.20.S b/lib/libpthread/machdep/syscall-hppa-hpux-10.20.S new file mode 100644 index 00000000000..c63d845bae5 --- /dev/null +++ b/lib/libpthread/machdep/syscall-hppa-hpux-10.20.S @@ -0,0 +1,23 @@ + .CODE + +machdep_error + sub %r0,%r28,%r28 + bv,n %r0(%r2) + +machdep_sys_fork + + .PROC + .CALLINFO NO_CALLS,FRAME=0 + + ldil -0x80000,%r1 + ble 4(%sr7,%r1) + ldi 2 ,%r22 + or,= %r0,%r22,%r0 + b,n machdep_error + or,= %r29,%r0,%r0 + copy %r0,%r28 + bv,n %r0(%r2) + + .PROCEND + .EXPORT machdep_sys_fork,ENTRY + diff --git a/lib/libpthread/machdep/syscall-hppa-hpux-9.03.S b/lib/libpthread/machdep/syscall-hppa-hpux-9.03.S new file mode 100644 index 00000000000..c63d845bae5 --- /dev/null +++ b/lib/libpthread/machdep/syscall-hppa-hpux-9.03.S @@ -0,0 +1,23 @@ + .CODE + +machdep_error + sub %r0,%r28,%r28 + bv,n %r0(%r2) + +machdep_sys_fork + + .PROC + .CALLINFO NO_CALLS,FRAME=0 + + ldil -0x80000,%r1 + ble 4(%sr7,%r1) + ldi 2 ,%r22 + or,= %r0,%r22,%r0 + b,n machdep_error + or,= %r29,%r0,%r0 + copy %r0,%r28 + bv,n %r0(%r2) + + .PROCEND + .EXPORT machdep_sys_fork,ENTRY + diff --git a/lib/libpthread/machdep/syscall-i386-bsdi-1.1.S b/lib/libpthread/machdep/syscall-i386-bsdi-1.1.S new file mode 100644 index 00000000000..596f3c7bf70 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-bsdi-1.1.S @@ -0,0 +1,288 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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-i386-bsdi-1.1.S,v 1.1 1998/07/21 13:19:16 peter Exp $"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <sys/syscall.h> + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +_machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jb 1b; \ + ret; + +/* + * 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_write() + */ +SYSCALL(write) + +/* ========================================================================== + * machdep_sys_read() + */ +SYSCALL(read) + +/* ========================================================================== + * machdep_sys_open() + */ +SYSCALL(open) + +/* ========================================================================== + * machdep_sys_close() + */ +SYSCALL(close) + +/* ========================================================================== + * machdep_sys_fcntl() + */ +SYSCALL(fcntl) + +/* ========================================================================== + * machdep_sys_lseek() + */ +SYSCALL(lseek) + +/* ========================================================================== + * machdep_sys_pipe() + */ +SYSCALL(pipe) + +/* ========================================================================== + * machdep_sys_dup() + */ +SYSCALL(dup) + +/* ========================================================================== + * machdep_sys_dup2() + */ +SYSCALL(dup2) + +/* ========================================================================== + * 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_execve() + */ +SYSCALL(execve) + +/* ========================================================================== + * machdep_sys_fstat() + */ +SYSCALL(fstat) + +/* ========================================================================== + * machdep_sys_fchown() + */ +SYSCALL(fchown) + +/* ========================================================================== + * machdep_sys_fchmod() + */ +SYSCALL(fchmod) + +/* ========================================================================== + * machdep_sys_chown() + */ +SYSCALL(chown) + +/* ========================================================================== + * machdep_sys_chmod() + */ +SYSCALL(chmod) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(chdir) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(link) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(unlink) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(rename) + +/* ========================================================================== + * Nonstandard calls used to make the system work + * + * ========================================================================== + * machdep_sys_select() + */ +SYSCALL(select) + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +SYSCALL(getdirentries) + +/* ========================================================================== + * machdep_sys_wait4() + */ +SYSCALL(wait4) + +/* ========================================================================== + * Berkeley socket stuff + * + * ========================================================================== + * machdep_sys_socket() + */ +SYSCALL(socket) + +/* ========================================================================== + * machdep_sys_bind() + */ +SYSCALL(bind) + +/* ========================================================================== + * machdep_sys_connect() + */ +SYSCALL(connect) + +/* ========================================================================== + * machdep_sys_accept() + */ +SYSCALL(accept) + +/* ========================================================================== + * machdep_sys_listen() + */ +SYSCALL(listen) + +/* ========================================================================== + * machdep_sys_getsockopt() + */ +SYSCALL(getsockopt) + +/* ========================================================================== + * machdep_sys_readv() + */ +SYSCALL(readv) + +/* ========================================================================== + * machdep_sys_writev() + */ +SYSCALL(writev) + +/* ========================================================================== + * machdep_sys_getpeername() + */ +SYSCALL(getpeername) + +/* ========================================================================== + * machdep_sys_getsockname() + */ +SYSCALL(getsockname) + +/* ========================================================================== + * machdep_sys_sendto() + */ +SYSCALL(sendto) + +/* ========================================================================== + * machdep_sys_recvfrom() + */ +SYSCALL(recvfrom) + +/* ========================================================================== + * machdep_sys_sendmsg() + */ +SYSCALL(sendmsg) + +/* ========================================================================== + * machdep_sys_recvmsg() + */ +SYSCALL(recvmsg) + +/* ========================================================================== + * machdep_sys_shutdown() - Is this correct? + */ +SYSCALL(shutdown) + diff --git a/lib/libpthread/machdep/syscall-i386-bsdi-2.0.S b/lib/libpthread/machdep/syscall-i386-bsdi-2.0.S new file mode 100644 index 00000000000..8a56717da31 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-bsdi-2.0.S @@ -0,0 +1,294 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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 "syscall-i386-netbsd-1.0.S,v 1.56 1995/09/26 21:04:05 raeburn Exp"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <sys/syscall.h> + +/* + * 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_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 + + +/* BSDI DEFS.h,v 2.1 1995/02/03 06:28:24 polk Exp */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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. + * + * @(#)DEFS.h 8.1 (Berkeley) 6/4/93 + */ + +#ifdef PROF +#define ENTRY(x) .globl _/**/x; .align 2; _/**/x: \ + .data; 1:; .long 0; .text; \ + pushl %ebp; movl %esp,%ebp; \ + leal 1b,%eax; call mcount; leave +#define ASENTRY(x) .globl x; .align 2; x: \ + .data; 1:; .long 0; .text; \ + pushl %ebp; movl %esp,%ebp; \ + leal 1b,%eax; call mcount; leave +#else +#define ENTRY(x) .globl _/**/x; .align 2; _/**/x: +#define ASENTRY(x) .globl x; .align 2; x: +#endif + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) + .asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93" +#endif /* LIBC_SCCS and not lint */ + +/* + * C library -- _setjmp, _longjmp + * + * _longjmp(a,v) + * will generate a "return(v)" from the last call to + * _setjmp(a) + * by restoring registers from the stack. + * The previous signal state is NOT restored. + */ + + +.globl __setjmp; /* Patch by Jan Legenhausen (monty) */ +.align 2; +__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) + movl $0,%eax + ret + +.globl __longjmp; /* Patch by Jan Legenhausen ? (monty) */ +.align 2; +__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 + cmpl $0,%eax + jne 1f + movl $1,%eax +1: movl %ecx,0(%esp) + ret diff --git a/lib/libpthread/machdep/syscall-i386-freebsd-1.1.S b/lib/libpthread/machdep/syscall-i386-freebsd-1.1.S new file mode 100644 index 00000000000..a2ea1b67e8d --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-freebsd-1.1.S @@ -0,0 +1,293 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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-i386-freebsd-1.1.S,v 1.1 1998/07/21 13:19:16 peter Exp $"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <sys/syscall.h> + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +_machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jb 1b; \ + ret; + +/* + * 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_write() + */ +SYSCALL(write) + +/* ========================================================================== + * machdep_sys_read() + */ +SYSCALL(read) + +/* ========================================================================== + * machdep_sys_open() + */ +SYSCALL(open) + +/* ========================================================================== + * machdep_sys_close() + */ +SYSCALL(close) + +/* ========================================================================== + * machdep_sys_fcntl() + */ +SYSCALL(fcntl) + +/* ========================================================================== + * machdep_sys_lseek() + */ +SYSCALL(lseek) + +/* ========================================================================== + * machdep_sys_stat() + */ +SYSCALL(stat) + +/* ========================================================================== + * machdep_sys_pipe() + */ +SYSCALL(pipe) + +/* ========================================================================== + * machdep_sys_dup() + */ +SYSCALL(dup) + +/* ========================================================================== + * machdep_sys_dup2() + */ +SYSCALL(dup2) + +/* ========================================================================== + * 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_execve() + */ +SYSCALL(execve) + +/* ========================================================================== + * machdep_sys_fstat() + */ +SYSCALL(fstat) + +/* ========================================================================== + * machdep_sys_fchown() + */ +SYSCALL(fchown) + +/* ========================================================================== + * machdep_sys_fchmod() + */ +SYSCALL(fchmod) + +/* ========================================================================== + * machdep_sys_chown() + */ +SYSCALL(chown) + +/* ========================================================================== + * machdep_sys_chmod() + */ +SYSCALL(chmod) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(chdir) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(link) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(unlink) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL(rename) + +/* ========================================================================== + * Nonstandard calls used to make the system work + * + * ========================================================================== + * machdep_sys_select() + */ +SYSCALL(select) + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +SYSCALL(getdirentries) + +/* ========================================================================== + * machdep_sys_wait4() + */ +SYSCALL(wait4) + +/* ========================================================================== + * Berkeley socket stuff + * + * ========================================================================== + * machdep_sys_socket() + */ +SYSCALL(socket) + +/* ========================================================================== + * machdep_sys_bind() + */ +SYSCALL(bind) + +/* ========================================================================== + * machdep_sys_connect() + */ +SYSCALL(connect) + +/* ========================================================================== + * machdep_sys_accept() + */ +SYSCALL(accept) + +/* ========================================================================== + * machdep_sys_listen() + */ +SYSCALL(listen) + +/* ========================================================================== + * machdep_sys_getsockopt() + */ +SYSCALL(getsockopt) + +/* ========================================================================== + * machdep_sys_readv() + */ +SYSCALL(readv) + +/* ========================================================================== + * machdep_sys_writev() + */ +SYSCALL(writev) + +/* ========================================================================== + * machdep_sys_getpeername() + */ +SYSCALL(getpeername) + +/* ========================================================================== + * machdep_sys_getsockname() + */ +SYSCALL(getsockname) + +/* ========================================================================== + * machdep_sys_sendto() + */ +SYSCALL(sendto) + +/* ========================================================================== + * machdep_sys_recvfrom() + */ +SYSCALL(recvfrom) + +/* ========================================================================== + * machdep_sys_sendmsg() + */ +SYSCALL(sendmsg) + +/* ========================================================================== + * machdep_sys_recvmsg() + */ +SYSCALL(recvmsg) + +/* ========================================================================== + * machdep_sys_shutdown() + */ +SYSCALL(shutdown) + diff --git a/lib/libpthread/machdep/syscall-i386-freebsd-2.0.S b/lib/libpthread/machdep/syscall-i386-freebsd-2.0.S new file mode 100644 index 00000000000..cfdbbc77f73 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-freebsd-2.0.S @@ -0,0 +1,237 @@ +/* ==== 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 <sys/syscall.h> + +#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-i386-linux-1.0.S b/lib/libpthread/machdep/syscall-i386-linux-1.0.S new file mode 100644 index 00000000000..88adb32841a --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-linux-1.0.S @@ -0,0 +1,406 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * 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. + * + * 1.16 94/01/30 proven + * -This file now requires gas version 2.0 or greater. + */ + +#ifndef lint + .text + .asciz "$Id: syscall-i386-linux-1.0.S,v 1.1 1998/07/21 13:19:16 peter Exp $"; +#endif + +#include <sys/syscall.h> +#include <config.h> + +#ifdef __ELF__ + +#define NAME(X) machdep_sys_##X +#define END(X) 1: ; .type NAME(X),@function ; .size NAME(X),1b - NAME(X) + +#else + +#define NAME(X) _machdep_sys_##X +#define END(X) + +#endif + +#define SYSCALL0(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + lea SYS_##x, %eax; \ + int $0x80; \ + pop %ebx; \ + ret; \ + \ + END(x) + +#define SYSCALL1(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + mov 8(%esp), %ebx; \ + lea SYS_##x, %eax; \ + int $0x80; \ + pop %ebx; \ + ret; \ + \ + END(x) + +#define SYSCALL2(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + mov 8(%esp), %ebx; \ + mov 12(%esp), %ecx; \ + lea SYS_##x, %eax; \ + int $0x80; \ + pop %ebx; \ + ret; \ + \ + END(x) + +#define STATCALL2(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + mov 8(%esp), %ebx; \ + mov 12(%esp), %ecx; \ + lea SYS_prev_##x, %eax; \ + int $0x80; \ + pop %ebx; \ + ret; \ + END(x) + +#define SYSCALL3(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + mov 8(%esp), %ebx; \ + mov 12(%esp), %ecx; \ + mov 16(%esp), %edx; \ + lea SYS_##x, %eax; \ + int $0x80; \ + pop %ebx; \ + ret; \ + END(x) + + +#define SYSCALL4(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + push %esi; \ + mov 12(%esp), %ebx; \ + mov 16(%esp), %ecx; \ + mov 20(%esp), %edx; \ + mov 24(%esp), %esi; \ + lea SYS_##x, %eax; \ + int $0x80; \ + pop %esi; \ + pop %ebx; \ + ret; \ + END(x) + +#define SYSCALL5(x) \ + .globl NAME(x) ; \ + \ +NAME(x): \ + \ + push %ebx; \ + push %esi; \ + push %edi; \ + mov 16(%esp), %ebx; \ + mov 20(%esp), %ecx; \ + mov 24(%esp), %edx; \ + mov 28(%esp), %esi; \ + mov 32(%esp), %edi; \ + lea SYS_##x, %eax; \ + int $0x80; \ + pop %edi; \ + pop %esi; \ + pop %ebx; \ + ret; \ + END(x) + +/* ========================================================================= + * exit 1 select 82 + * fork 2 fstatfs 100 + * read 3 socketcall 102 + * write 4 flock 143 + * open 5 readv 145 + * creat 8 writev 146 + * link 9 + * unlink 10 + * execve 11 + * chdir 12 + * chmod 15 + * chown 16 + * lseek 19 + * rename 38 + * dup 41 + * pipe 42 + * ioctl 54 + * fcntl 55 + * dup2 63 + * readdir 89 + * ftruncate 93 + * fchmod 94 + * fchown 95 + */ + +/* + * Initial asm stuff for all functions. + */ + .text + .align 2 + + +/* ========================================================================== + * machdep_sys_read() + */ +SYSCALL3(read) + +/* ========================================================================== + * machdep_sys_write() + */ +SYSCALL3(write) + +/* ========================================================================== + * machdep_sys_open() + */ +SYSCALL3(open) + +/* ========================================================================== + * machdep_sys_close() + */ +SYSCALL1(close) + +/* ========================================================================== + * machdep_sys_creat() + */ +SYSCALL2(creat) + +/* ========================================================================== + * machdep_sys_dup2() + */ +SYSCALL2(dup2) + +/* ========================================================================== + * machdep_sys_fcntl() + */ +SYSCALL3(fcntl) + +/* ========================================================================== + * machdep_sys_fchown() + */ +SYSCALL3(fchown) + +/* ========================================================================== + * machdep_sys_fchmod() + */ +SYSCALL2(fchmod) + +/* ========================================================================== + * machdep_sys_ioctl() + */ +SYSCALL3(ioctl) + +/* ========================================================================== + * machdep_sys_chown() + */ +SYSCALL3(chown) + +/* ========================================================================== + * machdep_sys_chmod() + */ +SYSCALL2(chmod) + +/* ========================================================================== + * machdep_sys_chdir() + */ +SYSCALL1(chdir) + +/* ========================================================================== + * machdep_sys_unlink() + */ +SYSCALL1(unlink) + +/* ========================================================================== + * machdep_sys_link() + */ +SYSCALL2(link) + +/* ========================================================================== + * machdep_sys_rename() + */ +SYSCALL2(rename) + +/* ========================================================================== + * machdep_sys_lseek() + */ +SYSCALL3(lseek) + +/* ========================================================================== + * machdep_sys_pipe() + */ +SYSCALL1(pipe) + +/* ========================================================================== + * machdep_sys_dup() + */ +SYSCALL1(dup) + +/* ========================================================================== + * machdep_sys_fork() + */ +SYSCALL0(fork) + +/* ========================================================================== + * machdep_sys_execve() + */ +SYSCALL3(execve) + +/* ========================================================================== + * machdep_sys_stat() + */ +#ifdef __ELF__ +STATCALL2(stat) +#else +SYSCALL2(stat) +#endif + +/* ========================================================================== + * machdep_sys_fstat() + */ +#ifdef __ELF__ +STATCALL2(fstat) +#else +SYSCALL2(fstat) +#endif + +/* ========================================================================== + * machdep_sys_lstat() + */ +#ifdef __ELF__ +STATCALL2(lstat) +#else +SYSCALL2(lstat) +#endif + +/* ========================================================================== + * machdep_sys_fstatfs() + */ +SYSCALL2(fstatfs) + + +/* ========================================================================== + * machdep_sys_ftruncate() + */ +SYSCALL2(ftruncate) + +/* ========================================================================== + * Nonstandard calls used to make the system work + * + * ========================================================================== + * machdep_sys_select() + */ + + .globl NAME(select) + +NAME(select): + + push %ebx + lea 8(%esp), %ebx + lea SYS_select, %eax + int $0x80 + pop %ebx + ret + END(select) + +/* ========================================================================== + * machdep_sys_wait4() + */ +SYSCALL4(wait4) + +/* ========================================================================== + * machdep_sys_readdir() + */ +SYSCALL3(readdir) + +/* ========================================================================== + * machdep_sys_socketcall() + */ +SYSCALL2(socketcall) + + +SYSCALL1(exit) +SYSCALL3(sigprocmask) + +/* ========================================================================== + * machdep_sys_sigsuspend() + */ + + .globl NAME(sigsuspend) + +NAME(sigsuspend): + + push %ebp + mov %esp,%ebp + push %edi + push %esi + push %ebx + mov 8(%ebp), %edx + mov (%edx), %edx + lea SYS_sigsuspend, %eax + int $0x80 + pop %ebx + pop %esi + pop %edi + mov %ebp,%esp + pop %ebp + ret + END(sigsuspend) + +/* ========================================================================== + * machdep_sys_readv() + */ +#ifdef HAVE_SYSCALL_READV +SYSCALL3(readv) +#endif + +/* ========================================================================== + * machdep_sys_writev() + */ +#ifdef HAVE_SYSCALL_WRITEV +SYSCALL3(writev) +#endif + +/* ========================================================================== + * machdep_sys_flock() + */ +#ifdef HAVE_SYSCALL_FLOCK +SYSCALL2(flock) +#endif diff --git a/lib/libpthread/machdep/syscall-i386-netbsd-0.9.S b/lib/libpthread/machdep/syscall-i386-netbsd-0.9.S new file mode 100644 index 00000000000..2ee3b940413 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-netbsd-0.9.S @@ -0,0 +1,229 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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-i386-netbsd-0.9.S,v 1.1 1998/07/21 13:19:16 peter Exp $"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <machine/asm.h> +#include <sys/syscall.h> + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +_machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jb 1b; \ + ret; + +/* + * 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_write() + */ +SYSCALL(write) + +/* ========================================================================== + * machdep_sys_read() + */ +SYSCALL(read) + +/* ========================================================================== + * machdep_sys_open() + */ +SYSCALL(open) + +/* ========================================================================== + * machdep_sys_close() + */ +SYSCALL(close) + +/* ========================================================================== + * machdep_sys_fcntl() + */ +SYSCALL(fcntl) + +/* ========================================================================== + * machdep_sys_lseek() + */ +SYSCALL(lseek) + +/* ========================================================================== + * machdep_sys_pipe() + */ +SYSCALL(pipe) + +/* ========================================================================== + * machdep_sys_dup() + */ +SYSCALL(dup) + +/* ========================================================================== + * machdep_sys_dup2() + */ +SYSCALL(dup2) + +/* ========================================================================== + * 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_execve() + */ +SYSCALL(execve) + +/* ========================================================================== + * machdep_sys_fstat() + */ +SYSCALL(fstat) + +/* ========================================================================== + * Nonstandard calls used to make the system work + * + * ========================================================================== + * machdep_sys_select() + */ +SYSCALL(select) + +/* ========================================================================== + * machdep_sys_getdirentries() + */ +SYSCALL(getdirentries) + +/* ========================================================================== + * Berkeley socket stuff + * + * ========================================================================== + * machdep_sys_socket() + */ +SYSCALL(socket) + +/* ========================================================================== + * machdep_sys_bind() + */ +SYSCALL(bind) + +/* ========================================================================== + * machdep_sys_connect() + */ +SYSCALL(connect) + +/* ========================================================================== + * machdep_sys_accept() + */ +SYSCALL(accept) + +/* ========================================================================== + * machdep_sys_listen() + */ +SYSCALL(listen) + +/* ========================================================================== + * machdep_sys_getsockopt() + */ +SYSCALL(getsockopt) + +/* ========================================================================== + * machdep_sys_readv() + */ +SYSCALL(readv) + +/* ========================================================================== + * machdep_sys_writev() + */ +SYSCALL(writev) + +/* ========================================================================== + * machdep_sys_getpeername() + */ +SYSCALL(getpeername) + +/* ========================================================================== + * machdep_sys_getsockname() + */ +SYSCALL(getsockname) + +/* ========================================================================== + * machdep_sys_sendto() + */ +SYSCALL(sendto) + +/* ========================================================================== + * machdep_sys_recvfrom() + */ +SYSCALL(recvfrom) + diff --git a/lib/libpthread/machdep/syscall-i386-netbsd-1.0.S b/lib/libpthread/machdep/syscall-i386-netbsd-1.0.S new file mode 100644 index 00000000000..f3d11be9b0a --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-netbsd-1.0.S @@ -0,0 +1,158 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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-i386-netbsd-1.0.S,v 1.1 1998/07/21 13:19:16 peter Exp $"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <machine/asm.h> +#include <sys/syscall.h> + +/* + * 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_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 diff --git a/lib/libpthread/machdep/syscall-i386-netbsd-1.1.S b/lib/libpthread/machdep/syscall-i386-netbsd-1.1.S new file mode 100644 index 00000000000..12e550da3bd --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-netbsd-1.1.S @@ -0,0 +1,181 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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-i386-netbsd-1.1.S,v 1.1 1998/07/21 13:19:16 peter Exp $"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <machine/asm.h> +#include <sys/syscall.h> + +/* + * Initial asm stuff for all functions. + */ + .text + .align 2 + + +/* ========================================================================== + * 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; + int $0x80; + 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; + int $0x80; + jb 3f; + ret + +3: + + 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_sigprocmask() + */ + .globl _machdep_sys_sigprocmask; + +_machdep_sys_sigprocmask:; + + movl 8(%esp),%ecx + movl (%ecx),%ecx + movl %ecx,8(%esp) + movl $(SYS_sigprocmask), %eax; + int $0x80; + jb 3b; + ret + +/* ========================================================================== + * machdep_sys_pipe() + */ + .globl _machdep_sys_pipe; + +_machdep_sys_pipe:; + + movl $(SYS_pipe), %eax; + int $0x80; + jb 3b; + movl 4(%esp),%ecx + movl %eax,(%ecx) + movl %edx,4(%ecx) + xorl %eax,%eax + ret + diff --git a/lib/libpthread/machdep/syscall-i386-netbsd-1.3.S b/lib/libpthread/machdep/syscall-i386-netbsd-1.3.S new file mode 100644 index 00000000000..9e129fc6fb7 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-netbsd-1.3.S @@ -0,0 +1,196 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1990 The Regents of the University of California. + * Copyright (c) 1993 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 + * + * 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-i386-netbsd-1.3.S,v 1.1 1998/07/21 13:19:19 peter Exp $"; +#endif + +#if defined(SYSLIBC_SCCS) && !defined(lint) + .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90" +#endif /* SYSLIBC_SCCS and not lint */ + +#include <machine/asm.h> +#include <sys/syscall.h> + +/* + * Initial asm stuff for all functions. + */ + .text + .align 2 + + +/* ========================================================================== + * 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; + int $0x80; + 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; + int $0x80; + jb 3f; + ret + +3: + + 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_sigprocmask() + */ + .globl _machdep_sys_sigprocmask; + +_machdep_sys_sigprocmask:; + + movl 8(%esp),%ecx + movl (%ecx),%ecx + movl %ecx,8(%esp) + movl $(SYS_sigprocmask), %eax; + int $0x80; + jb 3b; + ret + +/* ========================================================================== + * machdep_sys_pipe() + */ + .globl _machdep_sys_pipe; + +_machdep_sys_pipe:; + + movl $(SYS_pipe), %eax; + int $0x80; + jb 3b; + movl 4(%esp),%ecx + movl %eax,(%ecx) + movl %edx,4(%ecx) + xorl %eax,%eax + ret + +/* ========================================================================== + * machdep_sys_fstat() + */ + .globl _machdep_sys_fstat; + +_machdep_sys_fstat:; + movl $(SYS___fstat13), %eax; + int $0x80; + jb 4f; + ret +4: + neg %eax + movl $0xffffffff,%edx + ret + diff --git a/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S b/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S new file mode 100644 index 00000000000..cfdbbc77f73 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-openbsd-2.0.S @@ -0,0 +1,237 @@ +/* ==== 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 <sys/syscall.h> + +#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-i386-sco-3.2v5.S b/lib/libpthread/machdep/syscall-i386-sco-3.2v5.S new file mode 100644 index 00000000000..0a60dcdd866 --- /dev/null +++ b/lib/libpthread/machdep/syscall-i386-sco-3.2v5.S @@ -0,0 +1,442 @@ +/* ==== 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-sco-3.2v5.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 <sys/errno.h> +#include <sys/syscall.h> + +#ifdef _SCO_ELF + +#define NAME(X) machdep_sys_##X +#define GETADDR(X) \ + call 1f; \ +1: \ + popl %ebx; \ + addl $NAME(X)+[.-1b], %ebx + +#define END(X) 1: ; .type NAME(X),@function ; .size NAME(X),1b - NAME(X) + +#else + +#define NAME(X) _machdep_sys_##X +#define END(X) + +#endif + +#ifdef __STDC__ + +#define SYSCALL(x) \ + .globl NAME(x); \ + \ +NAME(x): \ + movl $(SYS_##x##), %eax; \ + lcall $7, $0; \ + jae 1f; \ + cmp $(ERESTART), %eax; \ + je NAME(x); \ + neg %eax; \ +1: \ + ret; \ +\ + END(x) + + +#else + +#define SYSCALL(x) \ + .globl NAME(x); \ + \ +NAME(x): \ + \ + movl $(SYS_/**/x), %eax; \ + lcall $7, $0; \ + jb 1b; \ + ret; \ + END(x) + +#endif + + +/* + * Initial asm stuff for all functions. + */ + .text + .align 2 + +/* ========================================================================== + * machdep_sys_fork() + */ + .globl NAME(fork); + +NAME(fork):; + movl $(SYS_fork), %eax + lcall $7, $0 + jae 1f + neg %eax + ret +1: + test %edx, %edx + je 2f + xor %eax, %eax +2: + ret; + END(fork) + +/* ========================================================================== + * NAME(getdents) + */ + .globl NAME(getdents); + +NAME(getdents): + movl $(SYS_getdents), %eax; + lcall $7, $0 + jae 1f + neg %eax +1: + ret; + END(getdents) + +/* ========================================================================== + * NAME(fxstat) + */ + .globl NAME(fxstat); + +NAME(fxstat):; + movl $(SYS_fxstat), %eax; + lcall $7, $0 + jae 1f + neg %eax; + ret; +1: + xor %eax, %eax; + ret; + END(fxstat) + +/* ========================================================================== + * NAME(signal) + */ + .globl NAME(signal); + +NAME(signal):; + movl 4(%esp), %ecx + movl $(SYS_signal),%eax +#if 0 + call .L1 +.L1: + popl %edx + addl $(NAME(sigreturn)+[.-.L1]), %edx +#else + movl $NAME(sigreturn), %edx +#endif + lcall $7,$0 + jae 1f +# movl %eax, 12(%esp) + neg %eax + ret +1: +# xor %eax, %eax +# movl %eax, 12(%esp) + ret + END(signal) + +/* ========================================================================== + * NAME(sigaction) + */ + .globl NAME(sigaction); + +NAME(sigaction): + movl $(SYS_sigaction),%eax +#if 0 + call .L2 +.L2: + popl %edx + addl $(NAME(sigreturn)+[.-.L2]), %edx +#else + movl $NAME(sigreturn), %edx +#endif + lcall $7, $0 + jb 1f + xor %eax, %eax + ret +1: + neg %eax + ret + END(sigaction) + + .globl NAME(sigreturn) +NAME(sigreturn): + addl $4,%esp + lcall $0xf, $0 + nop + nop + END(sigreturn) + +/* ========================================================================== + * NAME(waitpid) + */ + .globl NAME(waitpid); + +NAME(waitpid): + .byte 0x9c + popl %eax + orl $0x8c4, %eax + pushl %eax + .byte 0x9d + movl $(SYS_wait), %eax + lcall $7, $0 + jae 2f + cmpl $(ERESTART), %al + je NAME(waitpid) + neg %eax +3: + ret +2: + movl 8(%esp), %ecx + test %ecx,%ecx + je 3b + mov %edx, (%ecx) + ret + END(waitpid) + +/* ========================================================================== + * NAME(uname) + */ + .globl NAME(uname); + +NAME(uname): + pushl $0 + pushl $0 + pushl 12(%esp) + subl $4, %esp + movl $(SYS_utssys), %eax + .byte 0x9a; .long 0; .word 7; + jb 1f + addl $16, %esp + ret +1: + addl $16, %esp + neg %eax + ret + END(uname) + + +/* ========================================================================== + * machdep_sys_ftruncate + */ + +SYSCALL(ftruncate) + +/* ========================================================================== + * machdep_sys_ftime + */ + +SYSCALL(ftime) + +/* ========================================================================== + * machdep_sys_gettimeofday() + */ + +SYSCALL(gettimeofday) + +/* ========================================================================== + * machdep_sys_kill() + */ + +SYSCALL(kill) + +/* ========================================================================== + * pthread_sys_setitimer + */ + .globl NAME(setitimer); + +NAME(setitimer):; + movl $(SYS_setitimer), %eax; + lcall $7, $0 + jae 1f + neg %eax + ret +1: + xor %eax, %eax + ret; + END(setitimer) + +/* ========================================================================== + * pthread_sys_sysconf + */ + .globl NAME(sysconf); + +NAME(sysconf):; + movl $(SYS_sysconf), %eax; + lcall $7, $0 + jae 1f + neg %eax +1: + ret; + END(sysconf) + +/* ========================================================================== + * pthread_sys_sysi86() + */ + .globl NAME(sysi86); + +NAME(sysi86):; + movl $(SYS_sysi86), %eax + lcall $7, $0 + jae 1f + neg %eax +1: + ret; + END(sysi86) + + +/* ========================================================================== + * machdep_sys_brk() + */ + .globl NAME(brk); + +NAME(brk):; + movl $(SYS_break), %eax + lcall $7, $0 + jae 1f + neg %eax + ret +1: + xor %eax, %eax + ret; + END(brk) + +/* ========================================================================== + * machdep_sys_pipe() + */ + .globl NAME(pipe); + +NAME(pipe):; + movl $(SYS_pipe), %eax; + lcall $7, $0 + jae 1f + neg %eax + ret +1: + movl 4(%esp), %ecx + movl %eax, (%ecx) + movl %edx, 4(%ecx) + xor %eax, %eax + ret; + END(brk) + +/* ========================================================================== + * machdep_sys_fcntl() + */ + .globl NAME(fcntl); + +NAME(fcntl):; + movl $(SYS_fcntl), %eax + lcall $7, $0 + jae 1f + neg %eax +1: + ret + END(fcntl) + + +/* ========================================================================== + * machdep_sys_select() + */ + .globl NAME(select); + +NAME(select):; + movl $(SYS_select), %eax + lcall $7, $0 + jae 1f + cmp $(ERESTART), %eax + jne 2f + movl $(EINTR), %eax +2: + neg %eax +1: + ret + END(select) + + +/* ========================================================================== + * setjmp() + */ + .globl setjmp; + +setjmp: + movl 4(%esp),%eax + movl %ebx,(%eax) + movl %esi,4(%eax) + movl %edi,8(%eax) + movl %ebp,12(%eax) + popl %edx + movl %esp,16(%eax) + movl %edx,20(%eax) + subl %eax,%eax + jmp *%edx +1: ; .type setjmp,@function ; .size setjmp,1b - setjmp + +/* ========================================================================== + * longjmp() + */ + .globl longjmp; + +longjmp: + movl 4(%esp),%edx + movl 8(%esp),%eax + movl 0(%edx),%ebx + movl 4(%edx),%esi + movl 8(%edx),%edi + movl 12(%edx),%ebp + movl 16(%edx),%esp + test %eax,%eax + jne 1f + inc %eax +1: + jmp *20(%edx) +1: ; .type longjmp,@function ; .size longjmp,1b - longjmp diff --git a/lib/libpthread/machdep/syscall-ip22-irix-5.2.S b/lib/libpthread/machdep/syscall-ip22-irix-5.2.S new file mode 100644 index 00000000000..ded0fc55e38 --- /dev/null +++ b/lib/libpthread/machdep/syscall-ip22-irix-5.2.S @@ -0,0 +1,106 @@ +#include <sys.s> +#include <sys/regdef.h> + +/* + Kernel syscall interface: + Input: + v0 syscall number + Output: + + This macro is similar to SYSCALL in sys/syscall.h, but not completely. + There's room for optimization, if we assume this will continue to + be assembled as one file. + + Compile with -DPIC for pic code. +*/ + +#ifdef PIC +#define PICOPT .option pic2 +#else +#define PICOPT +#endif + + +#define YSYSCALL(x) \ + PICOPT; \ + .globl machdep_sys_##x; \ + .ent machdep_sys_##x, 0; \ +machdep_sys_##x:; \ + .frame sp,0,ra; \ + .set noreorder; \ + li v0, SYS_##x; \ + syscall; \ + bne a3, zero, 1b; \ + nop; \ + j ra; \ + nop; \ + .end machdep_sys_##x + +/* ========================================================================== + * error code for all syscalls. The error value is returned as the negative + * of the errno value. + */ + +1: + subu v0,zero,v0; + j ra; + +/* ========================================================================== + * lstat + */ + PICOPT; + .globl machdep_sys_lstat; + .ent machdep_sys_lstat, 0; +machdep_sys_lstat:; + .frame sp,0,ra; + .set noreorder; + move a2, a1 + move a1, a0 + li a0, 2 + li v0, SYS_lxstat; + syscall; + bne a3, zero, 1b; + nop; + j ra; + nop; + .end machdep_sys_lstat + +/* ========================================================================== + * fstat + */ + PICOPT; + .globl machdep_sys_fstat; + .ent machdep_sys_fstat, 0; +machdep_sys_fstat:; + .frame sp,0,ra; + .set noreorder; + move a2, a1 + move a1, a0 + li a0, 2 + li v0, SYS_fxstat; + syscall; + bne a3, zero, 1b; + nop; + j ra; + nop; + .end machdep_sys_fstat + +/* ========================================================================== + * stat + */ + PICOPT; + .globl machdep_sys_stat; + .ent machdep_sys_stat, 0; +machdep_sys_stat:; + .frame sp,0,ra; + .set noreorder; + move a2, a1 + move a1, a0 + li a0, 2 + li v0, SYS_xstat; + syscall; + bne a3, zero, 1b; + nop; + j ra; + nop; + .end machdep_sys_stat diff --git a/lib/libpthread/machdep/syscall-r2000-ultrix-4.2.S b/lib/libpthread/machdep/syscall-r2000-ultrix-4.2.S new file mode 100644 index 00000000000..5115e867257 --- /dev/null +++ b/lib/libpthread/machdep/syscall-r2000-ultrix-4.2.S @@ -0,0 +1,166 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent syscalls for decstation with r2000/r3000 + * + * 1.00 93/08/14 proven + * -Started coding this file. + */ + + .text + .ascii "$Id: syscall-r2000-ultrix-4.2.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; + +#include <syscall.h> +#include <machine/regdef.h> + +/* + * 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. Eventually I want to load the errno value directly + * into pthread_run->error but until then ... + */ +machdep_error: + negu v0, v0 /* Return negative of errno value. */ + j ra + +/* ========================================================================== + * Syscalls already done, + * Standard Other important BSD sockets + * fork = 2 select = 93 socket = 97 + * read = 3 readv = 120 connect = 98 + * write = 4 writev = 121 accept = 99 + * open = 5 getdirentries = send = 101 + * close = 6 recv = 102 + * creat = 8 bind = 104 + * link = 9 listen = 106 + * unlink = 10 recvmsg = 113 + * chdir = 12 sendmsg = 114 + * chmod = 15 getsockopt = 118 + * chown = 16 recvfrom = 125 + * lseek = 19 sendto = 133 + * stat = 38 shutdown = 134 + * dup = 41 getpeername = 141 + * pipe = 42 + * execve = 59 + * fstat = 62 + * wait3 = 84 + * dup2 = 90 + * fcntl = 92 + * fchown = 123 + * fchmod = 124 + * rename = 128 + * waitpid = 189 + * ======================================================================= */ + +/* ========================================================================== + * machdep_sys_fork() + */ + .globl machdep_sys_fork + .ent machdep_sys_fork + +machdep_sys_fork: + + .frame sp,0,ra /* No frame, return address in ra */ + + li v0,SYS_fork /* Load fork syscall # into v0 */ + syscall + bne a3,zero,machdep_error /* Error if a3 != 0 */ + beqz v1,__fork_parent /* Second return value = 0, if parent */ + li v0,0 +__fork_parent: + j ra + + .end machdep_sys_fork + +/* ========================================================================== + * machdep_sys_pipe() + */ + .globl machdep_sys_pipe + .ent machdep_sys_pipe + +machdep_sys_pipe: + + .frame sp,0,ra /* No frame, return address in ra */ + + li v0,SYS_pipe /* Load pipe syscall # into v0 */ + syscall + bne a3,zero,machdep_error /* Error if a3 != 0 */ + sw v0, 0(a0) + sw v1, 4(a0) + li v0, 0 + j ra + + .end machdep_sys_pipe + +/* ========================================================================== + * Other important asm routines. + * ======================================================================= */ +/* ========================================================================== + * fake_setjmp() + */ + .globl fake_setjmp + .ent fake_setjmp + +fake_setjmp: + + .frame sp,0,ra /* No frame, return address in ra */ + + /* Save all the important registers */ + sw ra,8(a0) + sw gp,124(a0) + sw sp,128(a0) + sw s0,76(a0) + /* More registers needed. */ + j ra + + .end fake_longjmp + +/* ========================================================================== + * machdep_sys_longjmp() + */ + .globl machdep_sys_longjmp + .ent machdep_sys_longjmp + +machdep_sys_longjmp: + + .frame sp,0,ra /* No frame, return address in ra */ + li a1,1 /* Load 1 into reg a1 */ + sw a1, 20(a0); /* Load a1 into address a0 + 20 */ + li v0,SYS_sigreturn /* Load sigreturn syscall # into v0 */ + syscall /* Do syscall to do longjmp */ + j ra + + .end machdep_sys_longjmp diff --git a/lib/libpthread/machdep/syscall-romp-bsd.S b/lib/libpthread/machdep/syscall-romp-bsd.S new file mode 100644 index 00000000000..4fbe7c24d6f --- /dev/null +++ b/lib/libpthread/machdep/syscall-romp-bsd.S @@ -0,0 +1,327 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1993 by John F. Carr, jfc@mit.edu + * + * 1.00 93/09/xx proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: syscall-romp-bsd.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; +#endif + +/* DO NOT USE COLONS IN THIS FILE, GCC CAN'T HANDLE THEM */ +/* #include <copyright.h> */ + + .globl .oVncs + .text + .align 2 + +/* ========================================================================== + * machdep_sys_write() + */ + .globl _machdep_sys_write + .globl _.machdep_sys_write + + .text 2 +_machdep_sys_write: + .long _.machdep_sys_write + + .text +_.machdep_sys_write: + lcs r0,0(r3) + svc 4(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + + +/* ========================================================================== + * machdep_sys_read() + */ + .globl _machdep_sys_read + .globl _.machdep_sys_read + + .text 2 +_machdep_sys_read: + .long _.machdep_sys_read + + .text +_.machdep_sys_read: + lcs r0,0(r3) + svc 3(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + + +/* ========================================================================== + * machdep_sys_open() + */ + .globl _machdep_sys_open + .globl _.machdep_sys_open + + .text 2 +_machdep_sys_open: + .long _.machdep_sys_open + + .text +_.machdep_sys_open: + lcs r0,0(r2) + svc 5(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + + +/* ========================================================================== + * machdep_sys_bind() + */ + .globl _machdep_sys_bind + .globl _.machdep_sys_bind + + .text 2 +_machdep_sys_bind: + .long _.machdep_sys_bind + + .text +_.machdep_sys_bind: + ls r0,0(r3) + svc 104(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + + +/* ========================================================================== + * machdep_sys_socket() + */ + .globl _machdep_sys_socket + .globl _.machdep_sys_socket + + .text 2 +_machdep_sys_socket: + .long _.machdep_sys_socket + + .text + .align 2 +_.machdep_sys_socket: + svc 97(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + + +/* ========================================================================== + * machdep_sys_close() + */ + .globl _machdep_sys_close + .globl _.machdep_sys_close + + .text 2 +_machdep_sys_close: + .long _.machdep_sys_close + + .text + .align 2 +_.machdep_sys_close: + svc 6(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + + +/* ========================================================================== + * machdep_sys_connect() + */ + .globl _machdep_sys_connect + .globl _.machdep_sys_connect + + .text 2 +_machdep_sys_connect: + .long _.machdep_sys_connect + + .text +_.machdep_sys_connect: + lcs r0,0(r3) + svc 98(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + +/* ========================================================================== + * machdep_sys_accept() + */ + .globl _machdep_sys_accept + .globl _.machdep_sys_accept + + .text 2 +_machdep_sys_accept: + .long _.machdep_sys_accept + + .text +_.machdep_sys_accept: + lcs r0,0(r3) + svc 99(r0) + bntbr r15 + store r2,_errno,r5 + cal r2,-1(r0) + +/* ========================================================================== + * machdep_sys_listen() + */ + .globl _machdep_sys_listen + .globl _.machdep_sys_listen + + .text 2 + .align 2 +_machdep_sys_listen: + .long _.machdep_sys_listen + + .text + .align 2 +_.machdep_sys_listen: + svc 106(r0) + bntbr r15 + brx r15 + twoc r2,r2 + +/* ========================================================================== + * machdep_sys_fcntl() + */ + .globl _.machdep_sys_fcntl + .globl _machdep_sys_fcntl + + .text 2 +_machdep_sys_fcntl: + .long _.machdep_sys_fcntl + .text +_.machdep_sys_fcntl: + lcs r0,0(sp) + svc 92(r0) + bntbr r15 + store r2,_errno,r5 + brx r15 + cal r2,-1(r0) + +/* ========================================================================== + * machdep_sys_getpeername() + */ + .globl _machdep_sys_getpeername + .globl _.machdep_sys_getpeername + + .text 2 +_machdep_sys_getpeername: + .long _.machdep_sys_getpeername + + .text +_.machdep_sys_getpeername: + ls r0,0(sp) + svc 141(r0) + bntbr r15 + brx r15 + twoc r2,r2 + + +/* ========================================================================== + * machdep_sys_getsockopt() + */ + .globl _machdep_sys_getsockopt + .globl _.machdep_sys_getsockopt + + .text 2 +_machdep_sys_getsockopt: + .long _.machdep_sys_getsockopt + + .text +_.machdep_sys_getsockopt: + ls r0,0(sp) + svc 118(r0) + bntbr r15 + brx r15 + twoc r2,r2 + + +/* ========================================================================== + * machdep_sys_select() + */ + + .globl _.machdep_sys_select + .globl _machdep_sys_select + + .text 2 +_machdep_sys_select: + .long _.machdep_sys_select + .text +_.machdep_sys_select: + svc 93(r0) + bntbr r15 + brx r15 + twoc r2,r2 + +/* ========================================================================== + * __tsh() + */ + .globl _._tsh + .globl __tsh + .text 2 +__tsh: .long _._tsh + .text + .align 2 +_._tsh: + brx r15 + tsh r2,0(r2) + + +/* ========================================================================== + * __pthread_save() + */ + .globl __pthread_save + .globl _._pthread_save + .text 2 +__pthread_save: + .long _._pthread_save + .text + .align 2 +_._pthread_save: + ail r5,r4,0 + jne 1f + mr r4,sp + lis r5,0 + stm r4,0(r2) + brx r15 + lis r2,0 +1: + mr r0,r15 # save old return address + ls r15,0(r4) # new return address + mr r5,r4 # r0 to restore + mr r4,r3 # sp to restore + stm r4,0(r2) + brx r0 + lis r2,0 + + +/* ========================================================================== + * __pthread_restore() + */ + .globl __pthread_restore + .globl _._pthread_restore + .text 2 +__pthread_restore: + .long _._pthread_restore + .text + .align 2 +_._pthread_restore: + lm r4,0(r2) + mr r0,r5 + lis r2,1 + brx r15 + mr sp,r4 + + diff --git a/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S b/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S new file mode 100644 index 00000000000..78df3bd8c8a --- /dev/null +++ b/lib/libpthread/machdep/syscall-sparc-netbsd-1.1.S @@ -0,0 +1,102 @@ +/* ==== 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 <sys/syscall.h> + +#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-sparc-sunos-4.1.3.S b/lib/libpthread/machdep/syscall-sparc-sunos-4.1.3.S new file mode 100644 index 00000000000..3e03fcf446f --- /dev/null +++ b/lib/libpthread/machdep/syscall-sparc-sunos-4.1.3.S @@ -0,0 +1,113 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#ifndef lint + .text + .asciz "$Id: syscall-sparc-sunos-4.1.3.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; +#endif + +#include <sys/syscall.h> + +#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; + tst %o1 + bne,a __fork_parent + mov %g0, %o0 +__fork_parent:; + retl + +/* POSIX-compliant getpgrp() takes no arguments. The SunOS syscall wants + one, and gives the POSIXy result if that argument is zero. */ + .globl _getpgrp +_getpgrp: + mov SYS_getpgrp, %g1 + mov 0, %i0 + ta 0 + bcs 1b + nop + retl + nop + +#if 0 +/* I think this bit of magic will do the right thing for other syscalls. + We get here with the new `errno' code in %o0. It should get stored in + *__error(), and -1 returned to the caller. */ + .globl cerror +cerror: + save %sp,-104,%sp + /* Now value is in %i0. Store it in *__error(). */ + call ___error + nop + st %i0,[%o0] + + /* Now also store a copy in global variable errno, for routines + like isatty that want to examine it and which haven't been + converted yet. */ + sethi %hi(_errno), %o0 + st %i0,[%o0+%lo(_errno)] + +#if 0 /* use this if you want -errno returned */ + sub %r0,%i0,%i0 +#else /* return -1 */ + mov -1,%i0 +#endif + retl + restore +#endif diff --git a/lib/libpthread/machdep/syscall-sparc-sunos-5.3.S b/lib/libpthread/machdep/syscall-sparc-sunos-5.3.S new file mode 100644 index 00000000000..afcfecf22b8 --- /dev/null +++ b/lib/libpthread/machdep/syscall-sparc-sunos-5.3.S @@ -0,0 +1,65 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#ifndef lint + .text + .asciz "$Id: syscall-sparc-sunos-5.3.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; +#endif + +#define _ASM +#include <sys/syscall.h> + +/* + * 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_fork() + */ + .globl machdep_sys_fork; + +machdep_sys_fork:; + + mov SYS_fork, %g1; + ta 0; + bcs 1b; + nop; + tst %o1 + bne,a __fork_parent + mov %g0, %o0 +__fork_parent:; + retl + nop; /* Added by monty to keep sparc assembler happy */ + +/* ========================================================================== + * Berkeley socket stuff + * + * ========================================================================== + * machdep_sys_socketcall() + */ + .globl machdep_sys_socketcall; + +machdep_sys_socketcall:; + + mov 83, %g1; + ta 0; + bcs,a 2b; + sub %r0,%o0,%o0; + retl + nop; /* Added by monty to keep sparc assembler happy */ diff --git a/lib/libpthread/machdep/syscall-sparc-sunos4.S b/lib/libpthread/machdep/syscall-sparc-sunos4.S new file mode 100644 index 00000000000..d1d6db6a6a3 --- /dev/null +++ b/lib/libpthread/machdep/syscall-sparc-sunos4.S @@ -0,0 +1,113 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#ifndef lint + .text + .asciz "$Id: syscall-sparc-sunos4.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; +#endif + +#include <sys/syscall.h> + +#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; + tst %o1 + bne,a __fork_parent + mov %g0, %o0 +__fork_parent:; + retl + +/* POSIX-compliant getpgrp() takes no arguments. The SunOS syscall wants + one, and gives the POSIXy result if that argument is zero. */ + .globl _getpgrp +_getpgrp: + mov SYS_getpgrp, %g1 + mov 0, %i0 + ta 0 + bcs 1b + nop + retl + nop + +#if 0 +/* I think this bit of magic will do the right thing for other syscalls. + We get here with the new `errno' code in %o0. It should get stored in + *__error(), and -1 returned to the caller. */ + .globl cerror +cerror: + save %sp,-104,%sp + /* Now value is in %i0. Store it in *__error(). */ + call ___error + nop + st %i0,[%o0] + + /* Now also store a copy in global variable errno, for routines + like isatty that want to examine it and which haven't been + converted yet. */ + sethi %hi(_errno), %o0 + st %i0,[%o0+%lo(_errno)] + +#if 0 /* use this if you want -errno returned */ + sub %r0,%i0,%i0 +#else /* return -1 */ + mov -1,%i0 +#endif + retl + restore +#endif diff --git a/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.1.S b/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.1.S new file mode 100644 index 00000000000..a2941ece7c9 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.1.S @@ -0,0 +1,46 @@ +#include <machine/asm.h> +#define COMPAT_43 +#include <sys/syscall.h> +#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-alpha-netbsd-1.3.S b/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S new file mode 100644 index 00000000000..a2941ece7c9 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-alpha-netbsd-1.3.S @@ -0,0 +1,46 @@ +#include <machine/asm.h> +#define COMPAT_43 +#include <sys/syscall.h> +#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-alpha-osf1.S b/lib/libpthread/machdep/syscall-template-alpha-osf1.S new file mode 100644 index 00000000000..bc4653b5f9e --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-alpha-osf1.S @@ -0,0 +1,46 @@ +#include <asm.h> +#include <regdef.h> +#define COMPAT_43 +#include <syscall.h> + +#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, 2f ;\ + br gp, 1f ;\ +1: ;\ + /* Load gp so we can find cerror to jump to. */;\ + ldgp gp, 0(gp) ;\ + jmp zero, machdep_cerror ;\ +2: + +#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-hppa-hpux-10.20.S b/lib/libpthread/machdep/syscall-template-hppa-hpux-10.20.S new file mode 100644 index 00000000000..0123b1deee7 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-hppa-hpux-10.20.S @@ -0,0 +1,27 @@ +/* ==== syscall.S ============================================================ + * Written 1996 by Stefan Grefen, grefen@convex.com + */ + +#include <sys/syscall.h> + +#define _CAT(a,b)a##b +#define CAT(a,b)_CAT(a,b) + +#define MKNAME(a)CAT(a,SYSCALL_NAME) + + .CODE +machdep_error + sub %r0,%r28,%r28 + bv,n %r0(%r2) + + .label MKNAME(machdep_sys_) + .PROC + .CALLINFO NO_CALLS,FRAME=0 + ldil -0x80000,%r1 + ble 4(%sr7,%r1) + ldi MKNAME(SYS_),%r22 + or,= %r0,%r22,%r0 + b,n machdep_error + bv,n %r0(%r2) + .PROCEND + .EXPORT MKNAME(machdep_sys_) diff --git a/lib/libpthread/machdep/syscall-template-hppa-hpux-9.03.S b/lib/libpthread/machdep/syscall-template-hppa-hpux-9.03.S new file mode 100644 index 00000000000..0123b1deee7 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-hppa-hpux-9.03.S @@ -0,0 +1,27 @@ +/* ==== syscall.S ============================================================ + * Written 1996 by Stefan Grefen, grefen@convex.com + */ + +#include <sys/syscall.h> + +#define _CAT(a,b)a##b +#define CAT(a,b)_CAT(a,b) + +#define MKNAME(a)CAT(a,SYSCALL_NAME) + + .CODE +machdep_error + sub %r0,%r28,%r28 + bv,n %r0(%r2) + + .label MKNAME(machdep_sys_) + .PROC + .CALLINFO NO_CALLS,FRAME=0 + ldil -0x80000,%r1 + ble 4(%sr7,%r1) + ldi MKNAME(SYS_),%r22 + or,= %r0,%r22,%r0 + b,n machdep_error + bv,n %r0(%r2) + .PROCEND + .EXPORT MKNAME(machdep_sys_) diff --git a/lib/libpthread/machdep/syscall-template-i386-bsdi-2.0.S b/lib/libpthread/machdep/syscall-template-i386-bsdi-2.0.S new file mode 100644 index 00000000000..3299f49195f --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-bsdi-2.0.S @@ -0,0 +1,48 @@ +#include <sys/syscall.h> + +#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-i386-freebsd-2.0.S b/lib/libpthread/machdep/syscall-template-i386-freebsd-2.0.S new file mode 100644 index 00000000000..34fb5caaa43 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-freebsd-2.0.S @@ -0,0 +1,48 @@ +#include <sys/syscall.h> + +#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-i386-netbsd-1.1.S b/lib/libpthread/machdep/syscall-template-i386-netbsd-1.1.S new file mode 100644 index 00000000000..c5e76bb4538 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-netbsd-1.1.S @@ -0,0 +1,49 @@ +#include <machine/asm.h> +#include <sys/syscall.h> + +#ifdef __STDC__ + +#define SYSCALL(x) \ + .globl _machdep_sys_##x; \ + \ +_machdep_sys_##x:; \ + \ + movl $(SYS_##x), %eax; \ + int $0x80; \ + jb 1b; \ + ret; + +#else + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +_machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + int $0x80; \ + 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-i386-netbsd-1.3.S b/lib/libpthread/machdep/syscall-template-i386-netbsd-1.3.S new file mode 100644 index 00000000000..c5e76bb4538 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-netbsd-1.3.S @@ -0,0 +1,49 @@ +#include <machine/asm.h> +#include <sys/syscall.h> + +#ifdef __STDC__ + +#define SYSCALL(x) \ + .globl _machdep_sys_##x; \ + \ +_machdep_sys_##x:; \ + \ + movl $(SYS_##x), %eax; \ + int $0x80; \ + jb 1b; \ + ret; + +#else + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +_machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + int $0x80; \ + 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-i386-netbsd1.0.S b/lib/libpthread/machdep/syscall-template-i386-netbsd1.0.S new file mode 100644 index 00000000000..83a2405ed51 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-netbsd1.0.S @@ -0,0 +1,49 @@ +#include <machine/asm.h> +#include <sys/syscall.h> + +#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-i386-openbsd-2.0.S b/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S new file mode 100644 index 00000000000..34fb5caaa43 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-openbsd-2.0.S @@ -0,0 +1,48 @@ +#include <sys/syscall.h> + +#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-i386-sco-3.2v5.S b/lib/libpthread/machdep/syscall-template-i386-sco-3.2v5.S new file mode 100644 index 00000000000..753475b5c3d --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-i386-sco-3.2v5.S @@ -0,0 +1,67 @@ +#include <sys/errno.h> +#include <sys/syscall.h> + +#ifdef _SCO_ELF + +#define NAME(X) machdep_sys_##X +#define END(X) 1: ; .type NAME(X),@function ; .size NAME(X),1b - NAME(X) +#define GETBX(X) \ + push %ebx; \ + call 1f; \ +1: \ + popl %ebx; +#else + +#define NAME(X) _machdep_sys_##X +#define END(X) + +#endif + +#ifdef __STDC__ + +#define SYSCALL(x) \ + .globl NAME(x); \ + \ +NAME(x):; \ + movl $(SYS_##x##), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jae 1f; \ + cmp $(ERESTART), %eax; \ + je NAME(x); \ + neg %eax; \ +1: \ + ret; \ + END(x) + +#else + +#define SYSCALL(x) \ + .globl _machdep_sys_/**/x; \ + \ +machdep_sys_/**/x:; \ + \ + movl $(SYS_/**/x), %eax; \ + .byte 0x9a; .long 0; .word 7; \ + jae 1f; \ + neg %eax; +1: \ + 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. + */ + +#define XSYSCALL(NAME) SYSCALL(NAME) + +XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/machdep/syscall-template-ip22-irix-5.2.S b/lib/libpthread/machdep/syscall-template-ip22-irix-5.2.S new file mode 100644 index 00000000000..722b001671b --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-ip22-irix-5.2.S @@ -0,0 +1,51 @@ +#include <sys.s> +#include <sys/regdef.h> +/* #include <sys/asm.h> */ + +/* + Kernel syscall interface: + Input: + v0 syscall number + Output: + + This macro is similar to SYSCALL in sys/syscall.h, but not completely. + There's room for optimization, if we assume this will continue to + be assembled as one file. + + Compile with -DPIC for pic code. +*/ + +#ifdef PIC +#define PICOPT .option pic2 +#else +#define PICOPT +#endif + + +#define YSYSCALL(x) \ + PICOPT; \ + .globl machdep_sys_##x; \ + .ent machdep_sys_##x, 0; \ +machdep_sys_##x:; \ + .frame sp,0,ra; \ + .set noreorder; \ + li v0, SYS_##x; \ + syscall; \ + bne a3, zero, 1b; \ + nop; \ + j ra; \ + nop; \ + .end machdep_sys_##x + +/* ========================================================================== + * error code for all syscalls. The error value is returned as the negative + * of the errno value. + */ + +1: + subu v0,zero,v0; + j ra; + +#define XSYSCALL(x) YSYSCALL(x) + +XSYSCALL(SYSCALL_NAME) diff --git a/lib/libpthread/machdep/syscall-template-r2000-ultrix-4.2.S b/lib/libpthread/machdep/syscall-template-r2000-ultrix-4.2.S new file mode 100644 index 00000000000..c034d8114b0 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-r2000-ultrix-4.2.S @@ -0,0 +1,77 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1993 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Machine dependent syscalls for decstation with r2000/r3000 + * + * 1.00 93/08/14 proven + * -Started coding this file. + */ + + .text + .ascii "$Id: syscall-template-r2000-ultrix-4.2.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; + +#include <syscall.h> +#include <machine/regdef.h> + +#define SYSCALL(x) \ + \ + .globl machdep_sys_##x; \ + .ent machdep_sys_##x; \ + \ +machdep_sys_##x:; \ + \ + .frame sp,0,ra; /* No frame, return address in ra */ \ + \ + li v0,SYS_##x; /* Load syscall # into v0 */ \ + syscall; \ + bne a3,zero,machdep_error; /* Error if a3 != 0 */ \ + j ra; \ + \ + .end machdep_sys_##x + +/* + * 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. Eventually I want to load the errno value directly + * into pthread_run->error but until then ... + */ +machdep_error: + negu v0, v0 /* Return negative of errno value. */ + j ra + +#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 new file mode 100644 index 00000000000..2d07892a315 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-sparc-netbsd-1.1.S @@ -0,0 +1,40 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#include <sys/syscall.h> + +#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/machdep/syscall-template-sparc-sunos-5.3.S b/lib/libpthread/machdep/syscall-template-sparc-sunos-5.3.S new file mode 100644 index 00000000000..b86541f3049 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-sparc-sunos-5.3.S @@ -0,0 +1,45 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#ifndef lint + .text + .asciz "$Id: syscall-template-sparc-sunos-5.3.S,v 1.1 1998/07/21 13:19:17 peter Exp $"; +#endif + +#define _ASM +#include <sys/syscall.h> + +/* + * 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 concat2(a,b) a ## b +#define concat(a,b) concat2(a,b) +#define SYSval concat(SYS_,SYSCALL_NAME) +#define procname concat(machdep_sys_,SYSCALL_NAME) + + .globl procname + +procname: + mov SYSval, %g1 + ta 0 + bcs,a 2b + sub %r0,%o0,%o0 + retl + nop diff --git a/lib/libpthread/machdep/syscall-template-sparc-sunos4.S b/lib/libpthread/machdep/syscall-template-sparc-sunos4.S new file mode 100644 index 00000000000..2d07892a315 --- /dev/null +++ b/lib/libpthread/machdep/syscall-template-sparc-sunos4.S @@ -0,0 +1,40 @@ +/* ==== syscall.S ============================================================ + * Copyright (c) 1994 Chris Provenzano, proven@mit.edu + * All rights reserved. + * + */ + +#include <sys/syscall.h> + +#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/machdep/ultrix-4.2/__math.h b/lib/libpthread/machdep/ultrix-4.2/__math.h new file mode 100755 index 00000000000..6249d720039 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__math.h @@ -0,0 +1,2 @@ +#define HUGE_VAL 1.8e+308 + diff --git a/lib/libpthread/machdep/ultrix-4.2/__signal.h b/lib/libpthread/machdep/ultrix-4.2/__signal.h new file mode 100755 index 00000000000..68364772a6a --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__signal.h @@ -0,0 +1,66 @@ +#include <ansi_compat.h> + +#define NSIG 32 + +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 /* interrupt */ +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 /* illegal instruction (not reset when caught) */ +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 /* floating point exception */ +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 /* segmentation violation */ +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#define SIGALRM 14 /* alarm clock */ +#define SIGTERM 15 /* software termination signal from kill */ +#define SIGURG 16 /* urgent condition on IO channel */ +#define SIGSTOP 17 /* sendable stop signal not from tty */ +#define SIGTSTP 18 /* stop signal from tty */ +#define SIGCONT 19 /* continue a stopped process */ +#define SIGCHLD 20 /* to parent on child stop or exit */ +#define SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define SIGIO 23 /* input/output possible signal */ +#define SIGXCPU 24 /* exceeded CPU time limit */ +#define SIGXFSZ 25 /* exceeded file size limit */ +#define SIGVTALRM 26 /* virtual time alarm */ +#define SIGPROF 27 /* profiling time alarm */ +#define SIGWINCH 28 /* window size changes */ +#define SIGLOST 29 /* Sys-V rec lock: notify user upon server crash */ +#define SIGUSR1 30 /* User signal 1 (from SysV) */ +#define SIGUSR2 31 /* User signal 2 (from SysV) */ + +/* Add System V signal definitions (DLB001) */ +#define SIGCLD SIGCHLD /* System V name for SIGCHLD */ +#define SIGABRT SIGIOT + +typedef long sig_atomic_t; +typedef unsigned int sigset_t; + +struct sigaction { + void (*sa_handler)(); /* signal handler */ + sigset_t sa_mask; /* signal mask to apply */ + int sa_flags; /* see signal options below */ +}; + +/* Defines for sigprocmask() call. POSIX. + */ +#define SIG_BLOCK 1 /* Add these signals to block mask */ +#define SIG_UNBLOCK 2 /* Remove these signals from block mask */ +#define SIG_SETMASK 3 /* Set block mask to this mask */ + +#define SIG_ERR ((void (*)())(-1)) +#define SIG_DFL ((void (*)())( 0)) +#define SIG_IGN ((void (*)())( 1)) + + +#define __SIGFILLSET 0xffffffff +#define __SIGEMPTYSET 0 +#define __SIGADDSET(s,n) ((*s) |= (1 << ((n) - 1))) +#define __SIGDELSET(s,n) ((*s) &= ~(1 << ((n) - 1))) +#define __SIGISMEMBER(s,n) ((*s) & (1 << ((n) - 1))) + diff --git a/lib/libpthread/machdep/ultrix-4.2/__stdio.h b/lib/libpthread/machdep/ultrix-4.2/__stdio.h new file mode 100755 index 00000000000..3f6aee47de3 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__stdio.h @@ -0,0 +1,7 @@ + +#if ! defined(_SIZE_T_) +#define _SIZE_T_ +typedef pthread_size_t size_t; +#endif + +typedef pthread_fpos_t fpos_t; diff --git a/lib/libpthread/machdep/ultrix-4.2/__stdlib.h b/lib/libpthread/machdep/ultrix-4.2/__stdlib.h new file mode 100755 index 00000000000..e2e52cc41c9 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__stdlib.h @@ -0,0 +1,21 @@ + +#ifndef _SYS___STDLIB_H_ +#define _SYS___STDLIB_H_ + +#include <ansi_compat.h> + +#ifndef _SIZE_T_ +#define _SIZE_T_ +typedef unsigned int size_t; +#endif + +#ifndef _WCHAR_T_ +#define _WCHAR_T_ +typedef unsigned int wchar_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif diff --git a/lib/libpthread/machdep/ultrix-4.2/__string.h b/lib/libpthread/machdep/ultrix-4.2/__string.h new file mode 100755 index 00000000000..03039b5cf73 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__string.h @@ -0,0 +1,17 @@ + +#if ! defined(_SIZE_T_) +#define _SIZE_T_ +typedef pthread_size_t size_t; +#endif + +/* Non-standard Ultrix 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)); +__END_DECLS +#endif + diff --git a/lib/libpthread/machdep/ultrix-4.2/__time.h b/lib/libpthread/machdep/ultrix-4.2/__time.h new file mode 100755 index 00000000000..dd32f138812 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__time.h @@ -0,0 +1,69 @@ +/* + * 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:35 peter Exp $ + */ + +#ifndef _SYS__TIME_H_ +#define _SYS__TIME_H_ + +#include <ansi_compat.h> + +#ifndef _CLOCK_T_ +#define _CLOCK_T_ +typedef int clock_t; +#endif + +#ifndef _TIME_T_ +#define _TIME_T_ +typedef int time_t; +#endif + +#ifndef _SIZE_T_ +#define _SIZE_T_ +typedef unsigned int size_t; +#endif + +#define CLOCKS_PER_SEC 1000000 + +#if !defined(_ANSI_SOURCE) +#define CLK_TCK 60 +#endif /* not ANSI */ + +#endif /* !_SYS__TIME_H_ */ diff --git a/lib/libpthread/machdep/ultrix-4.2/__unistd.h b/lib/libpthread/machdep/ultrix-4.2/__unistd.h new file mode 100755 index 00000000000..c0066df748e --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/__unistd.h @@ -0,0 +1,51 @@ +/*- + * 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:35 peter Exp $ + */ + +#ifndef _SYS___UNISTD_H_ +#define _SYS___UNISTD_H_ + +#include <sys/types.h> + +#ifndef _SSIZE_T_ +#define _SSIZE_T_ +typedef int ssize_t; +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif diff --git a/lib/libpthread/machdep/ultrix-4.2/cdefs.h b/lib/libpthread/machdep/ultrix-4.2/cdefs.h new file mode 100755 index 00000000000..4e1dc1c280d --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/cdefs.h @@ -0,0 +1,66 @@ +/* ==== cdefs.h ============================================================ + * Copyright (c) 1994 by Chris Provenzano, proven@athena.mit.edu + * + * Description : Similar to the BSD cdefs.h file. + * + * 1.00 94/01/26 proven + * -Started coding this file. + */ + +#ifndef _PTHREAD_SYS_CDEFS_H_ +#define _PTHREAD_SYS_CDEFS_H_ + +/* Stuff for compiling */ +#if defined(__GNUC__) +#if defined(__cplusplus) +#define __INLINE static inline +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS }; +#else +#define __INLINE extern inline +#define __CAN_DO_EXTERN_INLINE +#define __BEGIN_DECLS +#define __END_DECLS +#if !defined(__STDC__) +#define const __const +#define inline __inline +#define signed __signed +#define volatile __volatile +#endif +#endif +#else /* !__GNUC__ */ +#define __INLINE static +#define __BEGIN_DECLS +#define __END_DECLS +#endif + +#ifndef __NORETURN +#define __NORETURN +#endif /* __NORETURN not defined. */ + +#ifndef _U_INT32_T_ +#define _U_INT32_T_ +typedef unsigned int u_int32_t; +#endif + +#ifndef _U_INT16_T_ +#define _U_INT16_T_ +typedef unsigned short u_int16_t; +#endif + +#ifndef _INT32_T_ +#define _INT32_T_ +typedef int int32_t; +#endif + +#ifndef _INT16_T_ +#define _INT16_T_ +typedef short int16_t; +#endif + +#ifndef _SSIZE_T_ +#define _SSIZE_T_ +typedef int ssize_t; +#endif + +#endif diff --git a/lib/libpthread/machdep/ultrix-4.2/compat.h b/lib/libpthread/machdep/ultrix-4.2/compat.h new file mode 100755 index 00000000000..8b158986333 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/compat.h @@ -0,0 +1,45 @@ +/* ==== 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:35 peter Exp $ + * + * Description : Basic timers header. + * + * 1.00 94/06/13 proven + * -Started coding this file. + */ + +#ifndef _SYS_COMPAT_H_ +#define _SYS_COMPAT_H_ + +#define omsghdr msghdr + +#endif diff --git a/lib/libpthread/machdep/ultrix-4.2/dirent.h b/lib/libpthread/machdep/ultrix-4.2/dirent.h new file mode 100755 index 00000000000..5f17af345db --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/dirent.h @@ -0,0 +1,61 @@ +/*- + * 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 + +#endif /* !_SYS_DIRENT_H_ */ diff --git a/lib/libpthread/machdep/ultrix-4.2/errno.h b/lib/libpthread/machdep/ultrix-4.2/errno.h new file mode 100755 index 00000000000..b47633a9456 --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/errno.h @@ -0,0 +1,180 @@ +/* + * Copyright (c) 1982, 1986, 1989 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: @(#)errno.h 7.13 (Berkeley) 2/19/91 + * errno.h,v 1.3 1993/05/20 16:22:09 cgd Exp + */ + +#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 EAGAIN 11 /* No more processes */ +#define ENOMEM 12 /* Cannot allocate memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +/* 15 Non POSIX */ +/* 16 Non POSIX */ +#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 */ +/* 26 Non POSIX */ +#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 */ +/* 35 Non POSIX */ +/* 36 Non POSIX */ +/* 37 Non POSIX */ +/* 38 Non POSIX */ +/* 39 Non POSIX */ +/* 40 Non POSIX */ +/* 41 Non POSIX */ +/* 42 Non POSIX */ +/* 43 Non POSIX */ +/* 44 Non POSIX */ +/* 45 Non POSIX */ +/* 46 Non POSIX */ +/* 47 Non POSIX */ +/* 48 Non POSIX */ +/* 49 Non POSIX */ +/* 50 Non POSIX */ +/* 51 Non POSIX */ +/* 52 Non POSIX */ +/* 53 Non POSIX */ +/* 54 Non POSIX */ +/* 55 Non POSIX */ +/* 56 Non POSIX */ +/* 57 Non POSIX */ +/* 58 Non POSIX */ +/* 59 Non POSIX */ +/* 60 Non POSIX */ +/* 61 Non POSIX */ +/* 62 Non POSIX */ +#define ENAMETOOLONG 63 /* File name too long */ +/* 64 Non POSIX */ +/* 65 Non POSIX */ +#define ENOTEMPTY 66 /* Directory not empty */ +/* 67 Non POSIX */ +/* 68 Non POSIX */ +/* 69 Non POSIX */ +/* 70 Non POSIX */ +/* 71 Non POSIX */ +/* 72 Non POSIX */ +/* 73 Non POSIX */ +/* 74 Non POSIX */ +#define ENOLCK 75 /* No locks available */ +#define ENOSYS 76 /* Function not implemented */ + +#ifndef _POSIX_SOURCE +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device busy */ +#define ETXTBSY 26 /* Text file busy */ + +/* non-blocking and interrupt i/o */ +#define EWOULDBLOCK 35 /* Operation would block */ +#define EDEADLK EWOULDBLOCK /* Resource deadlock avoided */ +#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 on socket */ +#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 /* Connection timed out */ +#define ECONNREFUSED 61 /* Connection refused */ + +#define ELOOP 62 /* Too many levels of symbolic links */ + +#define EHOSTDOWN 64 /* Host is down */ +#define EHOSTUNREACH 65 /* No route to host */ + +/* quotas & mush */ +#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 */ + +/* IPC errors */ +#define ENOMSG 72 /* RPC struct is bad */ +#define EIDRM 73 /* RPC version wrong */ + +/* Alignment error of some type (i.e., cluster, page, block ...) */ +#define EALIGN 74 /* RPC prog. not avail */ +#endif /* _POSIX_SOURCE */ + +#endif /* _SYS_ERRNO_H_ */ diff --git a/lib/libpthread/machdep/ultrix-4.2/time.h b/lib/libpthread/machdep/ultrix-4.2/time.h new file mode 100755 index 00000000000..b29f9181e6d --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/time.h @@ -0,0 +1,83 @@ +/* + * 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:36 peter Exp $ + */ + +#ifndef _SYS_TIME_H_ +#define _SYS_TIME_H_ + +#include <time.h> +#include <sys/cdefs.h> + +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* microseconds */ +}; + +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* dst correction */ +}; +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ + + +struct itimerval { + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +/* + * Functions + */ +__BEGIN_DECLS + +int gettimeofday __P_((struct timeval *, struct timezone *)); + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/ultrix-4.2/timers.h b/lib/libpthread/machdep/ultrix-4.2/timers.h new file mode 100755 index 00000000000..3b931f555ec --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/timers.h @@ -0,0 +1,68 @@ +/* ==== 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:36 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 <sys/types.h> +#include <time.h> + +struct timespec { + time_t tv_sec; + long tv_nsec; +}; + +#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ + (ts)->tv_sec = (tv)->tv_sec; \ + (ts)->tv_nsec = (tv)->tv_usec * 1000; \ +} +#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ + (tv)->tv_sec = (ts)->tv_sec; \ + (tv)->tv_usec = (ts)->tv_nsec / 1000; \ +} + +/* + * New functions + */ + +__BEGIN_DECLS + +__END_DECLS + +#endif diff --git a/lib/libpthread/machdep/ultrix-4.2/wait.h b/lib/libpthread/machdep/ultrix-4.2/wait.h new file mode 100755 index 00000000000..8114f7e461d --- /dev/null +++ b/lib/libpthread/machdep/ultrix-4.2/wait.h @@ -0,0 +1,121 @@ + +#ifndef _SYS_WAIT_H_ +#define _SYS_WAIT_H_ + +#include <ansi_compat.h> +#include <sys/cdefs.h> + +#if !defined(_POSIX_SOURCE) +union wait { +#else +union __wait { +#endif /* !defined(_POSIX_SOURCE) */ +#ifdef __vax + int w_status; /* used in syscall */ +#endif /* __vax */ +#ifdef __mips__ + unsigned int w_status; /* used in syscall */ +#endif /* __mips */ + /* + * Terminated process status. + */ + struct { +#ifdef __vax + unsigned short w_Termsig:7; /* termination signal */ + unsigned short w_Coredump:1; /* core dump indicator */ + unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ +#endif /* __vax */ +#ifdef __mips__ +#ifdef __MIPSEL__ + unsigned int w_Termsig:7; /* termination signal */ + unsigned int w_Coredump:1; /* core dump indicator */ + unsigned int w_Retcode:8; /* exit code if w_termsig==0 */ + unsigned int w_Filler:16; /* pad to word boundary */ +#endif /* __MIPSEL */ +#ifdef __MIPSEB__ + unsigned int w_Filler:16; /* pad to word boundary */ + unsigned int w_Retcode:8; /* exit code if w_termsig==0 */ + unsigned int w_Coredump:1; /* core dump indicator */ + unsigned int w_Termsig:7; /* termination signal */ +#endif /* __MIPSEB */ +#endif /* __mips */ + } w_T; + /* + * Stopped process status. Returned + * only for traced children unless requested + * with the WUNTRACED option bit. + */ + struct { +#ifdef __vax + unsigned short w_Stopval:8; /* == W_STOPPED if stopped */ + unsigned short w_Stopsig:8; /* signal that stopped us */ +#endif /* __vax */ +#ifdef __mips__ +#ifdef __MIPSEL__ + unsigned int w_Stopval:8; /* == W_STOPPED if stopped */ + unsigned int w_Stopsig:8; /* signal that stopped us */ + unsigned int w_Filler:16; /* pad to word boundary */ +#endif /* __MIPSEL */ +#ifdef __MIPSEB__ + unsigned int w_Filler:16; /* pad to word boundary */ + unsigned int w_Stopsig:8; /* signal that stopped us */ + unsigned int w_Stopval:8; /* == W_STOPPED if stopped */ +#endif /* __MIPSEB */ +#endif /* __mips */ + } w_S; +}; + +#if !defined(_POSIX_SOURCE) +#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 0177 /* value of s.stopval if process is stopped */ +#endif /* !defined(_POSIX_SOURCE) */ + +#ifdef WSTOPPED +#define _WSTOPPED WSTOPPED +#else +#define _WSTOPPED 0177 +#endif + +/* + * Option bits for the second argument of wait3. 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 */ + +/* + * Must cast as union wait * because POSIX defines the input to these macros + * as int. + */ + +#ifdef _POSIX_SOURCE +#define WIFSTOPPED(x) (((union __wait *)&(x))->w_S.w_Stopval == _WSTOPPED) +#define WIFSIGNALED(x) (((union __wait *)&(x))->w_S.w_Stopval != _WSTOPPED && ((union __wait *)&(x))->w_T.w_Termsig != 0) +#define WIFEXITED(x) (((union __wait *)&(x))->w_S.w_Stopval != _WSTOPPED && ((union __wait *)&(x))->w_T.w_Termsig == 0) +#define WEXITSTATUS(x) (((union __wait *)&(x))->w_T.w_Retcode) +#define WTERMSIG(x) (((union __wait *)&(x))->w_T.w_Termsig) +#define WSTOPSIG(x) (((union __wait *)&(x))->w_S.w_Stopsig) +#endif /* _POSIX_SOURCE */ + +#if !defined(_POSIX_SOURCE) +#define WIFSTOPPED(x) (((union wait *)&(x))->w_stopval == WSTOPPED) +#define WIFSIGNALED(x) (((union wait *)&(x))->w_stopval != WSTOPPED && ((union wait *)&(x))->w_termsig != 0) +#define WIFEXITED(x) (((union wait *)&(x))->w_stopval != WSTOPPED && ((union wait *)&(x))->w_termsig == 0) +#define WEXITSTATUS(x) (((union wait *)&(x))->w_retcode) +#define WTERMSIG(x) (((union wait *)&(x))->w_termsig) +#define WSTOPSIG(x) (((union wait *)&(x))->w_stopsig) +#endif /* !defined(_POSIX_SOURCE) */ + +pid_t wait __P_((int *)); +pid_t waitpid __P_((pid_t, int *, int)); + +#endif /* _SYS_WAIT_H_ */ diff --git a/lib/libpthread/machdep/unistd-i386-freebsd-1.1.h b/lib/libpthread/machdep/unistd-i386-freebsd-1.1.h new file mode 100644 index 00000000000..033e70de5e5 --- /dev/null +++ b/lib/libpthread/machdep/unistd-i386-freebsd-1.1.h @@ -0,0 +1,178 @@ +/*- + * Copyright (c) 1991 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. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <sys/unistd.h> + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +#ifndef NULL +#define NULL 0 /* null pointer constant */ +#endif + +typedef int ssize_t; /* count of bytes or error indication */ + +__BEGIN_DECLS +void _exit __P_((int)); +int access __P_((const char *, int)); +u_int alarm __P_((u_int)); +int chdir __P_((const char *)); +int chown __P_((const char *, uid_t, gid_t)); +int close __P_((int)); +char *cuserid __P_((char *)); +int dup __P_((int)); +int dup2 __P_((int, int)); +int execl __P_((const char *, const char *, ...)); +int execle __P_((const char *, const char *, ...)); +int execlp __P_((const char *, const char *, ...)); +int execv __P_((const char *, char * const *)); +int execve __P_((const char *, char * const *, char * const *)); +int execvp __P_((const char *, char * const *)); +pid_t fork __P_((void)); +long fpathconf __P_((int, int)); /* not yet */ +char *getcwd __P_((char *, size_t)); +gid_t getegid __P_((void)); +uid_t geteuid __P_((void)); +gid_t getgid __P_((void)); +int getgroups __P_((int, int *)); /* XXX (gid_t *) */ +char *getlogin __P_((void)); +pid_t getpgrp __P_((void)); +pid_t getpid __P_((void)); +pid_t getppid __P_((void)); +uid_t getuid __P_((void)); +int isatty __P_((int)); +int link __P_((const char *, const char *)); +off_t lseek __P_((int, off_t, int)); +long pathconf __P_((const char *, int)); /* not yet */ +int pause __P_((void)); +int pipe __P_((int *)); +ssize_t read __P_((int, void *, size_t)); +int rmdir __P_((const char *)); +int setgid __P_((gid_t)); +int setpgid __P_((pid_t, pid_t)); +pid_t setsid __P_((void)); +int setuid __P_((uid_t)); +u_int sleep __P_((u_int)); +long sysconf __P_((int)); /* not yet */ +pid_t tcgetpgrp __P_((int)); +int tcsetpgrp __P_((int, pid_t)); +char *ttyname __P_((int)); +int unlink __P_((const char *)); +ssize_t write __P_((int, const void *, size_t)); + +#ifndef _POSIX_SOURCE + +/* structure timeval required for select() */ +#include <sys/time.h> + +int acct __P_((const char *)); +int async_daemon __P_((void)); +char *brk __P_((const char *)); +int chflags __P_((const char *, long)); +int chroot __P_((const char *)); +char *crypt __P_((const char *, const char *)); +int des_cipher __P_((const char *, char *, long, int)); +int des_setkey __P_((const char *key)); +int encrypt __P_((char *, int)); +void endusershell __P_((void)); +int exect __P_((const char *, char * const *, char * const *)); +int fchdir __P_((int)); +int fchflags __P_((int, long)); +int fchown __P_((int, uid_t, gid_t)); +int fsync __P_((int)); +int ftruncate __P_((int, off_t)); +int getdtablesize __P_((void)); +long gethostid __P_((void)); +int gethostname __P_((char *, int)); +mode_t getmode __P_((const void *, mode_t)); +int getpagesize __P_((void)); +char *getpass __P_((const char *)); +char *getusershell __P_((void)); +char *getwd __P_((char *)); /* obsoleted by getcwd() */ +int initgroups __P_((const char *, int)); +int mknod __P_((const char *, mode_t, dev_t)); +int mkstemp __P_((char *)); +char *mktemp __P_((char *)); +int nfssvc __P_((int)); +int nice __P_((int)); +void psignal __P_((u_int, const char *)); +extern char *sys_siglist[]; +int profil __P_((char *, int, int, int)); +int rcmd __P_((char **, int, const char *, + const char *, const char *, int *)); +char *re_comp __P_((const char *)); +int re_exec __P_((const char *)); +int readlink __P_((const char *, char *, int)); +int reboot __P_((int)); +int revoke __P_((const char *)); +int rresvport __P_((int *)); +int ruserok __P_((const char *, int, const char *, const char *)); +char *sbrk __P_((int)); +int select __P_((int, fd_set *, fd_set *, fd_set *, struct timeval *)); +int setegid __P_((gid_t)); +int seteuid __P_((uid_t)); +int setgroups __P_((int, const int *)); +void sethostid __P_((long)); +int sethostname __P_((const char *, int)); +int setkey __P_((const char *)); +int setlogin __P_((const char *)); +void *setmode __P_((const char *)); +int setpgrp __P_((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */ +int setregid __P_((int, int)); +int setreuid __P_((int, int)); +int setrgid __P_((gid_t)); +int setruid __P_((uid_t)); +void setusershell __P_((void)); +int swapon __P_((const char *)); +int symlink __P_((const char *, const char *)); +void sync __P_((void)); +int syscall __P_((int, ...)); +int truncate __P_((const char *, off_t)); +int ttyslot __P_((void)); +u_int ualarm __P_((u_int, u_int)); +void usleep __P_((u_int)); +void *valloc __P_((size_t)); /* obsoleted by malloc() */ +int vfork __P_((void)); + +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !_UNISTD_H_ */ diff --git a/lib/libpthread/machdep/unistd-i386-linux-1.0.h b/lib/libpthread/machdep/unistd-i386-linux-1.0.h new file mode 100644 index 00000000000..e7a3c5de1e4 --- /dev/null +++ b/lib/libpthread/machdep/unistd-i386-linux-1.0.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 1991 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. + * + * @(#)unistd.h 5.13 (Berkeley) 6/17/91 + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include <features.h> + +/* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988. */ +#define _POSIX_VERSION 199009L +#define _POSIX2_C_BIND 1 +#define _POSIX2_C_DEV 1 +#define _POSIX2_SW_DEV 1 + +#define __need_size_t + +#include <posix_opt.h> +#include <sys/types.h> +#include <stddef.h> + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +#include <pthread/unistd.h> + +#endif /* !_UNISTD_H_ */ diff --git a/lib/libpthread/machdep/unistd-sparc-sunos-4.1.3.h b/lib/libpthread/machdep/unistd-sparc-sunos-4.1.3.h new file mode 100644 index 00000000000..2fb0d137707 --- /dev/null +++ b/lib/libpthread/machdep/unistd-sparc-sunos-4.1.3.h @@ -0,0 +1,215 @@ +/*- + * Copyright (c) 1991 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: @(#)unistd.h 5.13 (Berkeley) 6/17/91 + * $Id: unistd-sparc-sunos-4.1.3.h,v 1.1 1998/07/21 13:19:18 peter Exp $ + */ + +#ifndef _UNISTD_H_ +#define _UNISTD_H_ + +#include <sys/cdefs.h> +#include <sys/types.h> + +#define _NO_STDIO_SIZE_T + +#define _SC_ARG_MAX 1 /* space for argv & envp */ +#define _SC_CHILD_MAX 2 /* maximum children per process??? */ +#define _SC_CLK_TCK 3 /* clock ticks/sec */ +#define _SC_NGROUPS_MAX 4 /* number of groups if multple supp. */ +#define _SC_OPEN_MAX 5 /* max open files per process */ +#define _SC_JOB_CONTROL 6 /* do we have job control */ +#define _SC_SAVED_IDS 7 /* do we have saved uid/gids */ +#define _SC_VERSION 8 /* POSIX version supported */ + +#define _POSIX_JOB_CONTROL 1 +#define _POSIX_SAVED_IDS 1 +#define _POSIX_VERSION 198808 + +#define _PC_LINK_MAX 1 /* max links to file/dir */ +#define _PC_MAX_CANON 2 /* max line length */ +#define _PC_MAX_INPUT 3 /* max "packet" to a tty device */ +#define _PC_NAME_MAX 4 /* max pathname component length */ +#define _PC_PATH_MAX 5 /* max pathname length */ +#define _PC_PIPE_BUF 6 /* size of a pipe */ +#define _PC_CHOWN_RESTRICTED 7 /* can we give away files */ +#define _PC_NO_TRUNC 8 /* trunc or error on >NAME_MAX */ +#define _PC_VDISABLE 9 /* best char to shut off tty c_cc */ +#define _PC_LAST 9 /* highest value of any _PC_* */ + + +#define STDIN_FILENO 0 /* standard input file descriptor */ +#define STDOUT_FILENO 1 /* standard output file descriptor */ +#define STDERR_FILENO 2 /* standard error file descriptor */ + +#ifndef NULL +#define NULL 0 /* null pointer constant */ +#endif + +typedef int ssize_t; + +__BEGIN_DECLS +void _exit __P_((int)); +int access __P_((const char *, int)); +unsigned alarm __P_((unsigned)); +int chdir __P_((const char *)); +int chown __P_((const char *, uid_t, gid_t)); +int close __P_((int)); +size_t confstr __P_((int, char *, size_t)); +char *cuserid __P_((char *)); +int dup __P_((int)); +int dup2 __P_((int, int)); +int execl __P_((const char *, const char *, ...)); +int execle __P_((const char *, const char *, ...)); +int execlp __P_((const char *, const char *, ...)); +int execv __P_((const char *, char * const *)); +int execve __P_((const char *, char * const *, char * const *)); +int execvp __P_((const char *, char * const *)); +pid_t fork __P_((void)); +long fpathconf __P_((int, int)); /* not yet */ +char *getcwd __P_((char *, size_t)); +gid_t getegid __P_((void)); +uid_t geteuid __P_((void)); +gid_t getgid __P_((void)); +int getgroups __P_((int, int *)); /* XXX (gid_t *) */ +char *getlogin __P_((void)); +pid_t getpgrp __P_((void)); +pid_t getpid __P_((void)); +pid_t getppid __P_((void)); +uid_t getuid __P_((void)); +int isatty __P_((int)); +int link __P_((const char *, const char *)); +off_t lseek __P_((int, off_t, int)); +long pathconf __P_((const char *, int)); /* not yet */ +int pause __P_((void)); +int pipe __P_((int *)); +ssize_t read __P_((int, void *, size_t)); +int rmdir __P_((const char *)); +int setgid __P_((gid_t)); +int setpgid __P_((pid_t, pid_t)); +pid_t setsid __P_((void)); +int setuid __P_((uid_t)); +unsigned sleep __P_((unsigned)); +long sysconf __P_((int)); /* not yet */ +pid_t tcgetpgrp __P_((int)); +int tcsetpgrp __P_((int, pid_t)); +char *ttyname __P_((int)); +int unlink __P_((const char *)); +ssize_t write __P_((int, const void *, size_t)); + +#ifndef _POSIX_SOURCE + +/* structure timeval required for select() */ +#include <sys/time.h> + +int acct __P_((const char *)); +int async_daemon __P_((void)); +char *brk __P_((const char *)); +int chflags __P_((const char *, long)); +int chroot __P_((const char *)); +char *crypt __P_((const char *, const char *)); +int des_cipher __P_((const char *, char *, long, int)); +int des_setkey __P_((const char *key)); +int encrypt __P_((char *, int)); +void endusershell __P_((void)); +int exect __P_((const char *, char * const *, char * const *)); +int fchdir __P_((int)); +int fchflags __P_((int, long)); +int fchown __P_((int, uid_t, gid_t)); +int fsync __P_((int)); +int ftruncate __P_((int, off_t)); +int getdomainname __P_((char *, int)); +int getdtablesize __P_((void)); +long gethostid __P_((void)); +int gethostname __P_((char *, int)); +mode_t getmode __P_((const void *, mode_t)); +int getpagesize __P_((void)); +char *getpass __P_((const char *)); +char *getusershell __P_((void)); +char *getwd __P_((char *)); /* obsoleted by getcwd() */ +int initgroups __P_((const char *, int)); +int mknod __P_((const char *, mode_t, dev_t)); +int mkstemp __P_((char *)); +char *mktemp __P_((char *)); +int nfssvc __P_((int)); +int nice __P_((int)); +void psignal __P_((u_int, const char *)); +extern const char *const sys_siglist[]; +int profil __P_((char *, int, int, int)); +int rcmd __P_((char **, int, const char *, + const char *, const char *, int *)); +char *re_comp __P_((const char *)); +int re_exec __P_((const char *)); +int readlink __P_((const char *, char *, int)); +int reboot __P_((int)); +int revoke __P_((const char *)); +int rresvport __P_((int *)); +int ruserok __P_((const char *, int, const char *, const char *)); +char *sbrk __P_((int)); +int select __P_((int, fd_set *, fd_set *, fd_set *, struct timeval *)); +int setdomainname __P_((const char *, int)); +int setegid __P_((gid_t)); +int seteuid __P_((uid_t)); +int setgroups __P_((int, const int *)); +void sethostid __P_((long)); +int sethostname __P_((const char *, int)); +int setkey __P_((const char *)); +int setlogin __P_((const char *)); +void *setmode __P_((const char *)); +int setpgrp __P_((pid_t pid, pid_t pgrp)); /* obsoleted by setpgid() */ +int setregid __P_((int, int)); +int setreuid __P_((int, int)); +int setrgid __P_((gid_t)); +int setruid __P_((uid_t)); +void setusershell __P_((void)); +int swapon __P_((const char *)); +int symlink __P_((const char *, const char *)); +void sync __P_((void)); +int syscall __P_((int, ...)); +int truncate __P_((const char *, off_t)); +int ttyslot __P_((void)); +u_int ualarm __P_((u_int, u_int)); +void usleep __P_((u_int)); +void *valloc __P_((size_t)); /* obsoleted by malloc() */ +pid_t vfork __P_((void)); + +int getopt __P_((int, char * const *, const char *)); +extern char *optarg; /* getopt(3) external variables */ +extern int opterr; +extern int optind; +extern int optopt; +int getsubopt __P_((char **, char * const *, char **)); +extern char *suboptarg; /* getsubopt(3) external variable */ +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !_UNISTD_H_ */ diff --git a/lib/libpthread/net/GNUmakefile.inc b/lib/libpthread/net/GNUmakefile.inc new file mode 100644 index 00000000000..c21e3be1328 --- /dev/null +++ b/lib/libpthread/net/GNUmakefile.inc @@ -0,0 +1,14 @@ +# from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 +# $Id: GNUmakefile.inc,v 1.1 1998/07/21 13:19:44 peter Exp $ + +# gen sources +VPATH:= ${VPATH}:${srcdir}/net + +SRCS:= gethostbyaddr.c gethostbyname.c gethostent.c getnetbyaddr.c \ + getnetbyname.c getnetent.c getproto.c getprotoent.c getprotoname.c \ + getservbyname.c getservbyport.c getservent.c herror.c inet_addr.c \ + inet_lnaof.c inet_makeaddr.c inet_netof.c inet_network.c inet_ntoa.c \ + net_internal.c proto_internal.c res_comp.c res_init.c res_internal.c \ + res_mkquery.c res_query.c res_querydomain.c res_search.c res_send.c \ + res_debug.c serv_internal.c $(SRCS) + diff --git a/lib/libpthread/net/Makefile.inc b/lib/libpthread/net/Makefile.inc new file mode 100644 index 00000000000..c89732ac048 --- /dev/null +++ b/lib/libpthread/net/Makefile.inc @@ -0,0 +1,14 @@ +# from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91 +# $Id: Makefile.inc,v 1.1 1998/07/21 13:19:44 peter Exp $ + +# gen sources +.PATH: ${srcdir}/net + +SRCS+= gethostbyaddr.c gethostbyname.c gethostent.c getnetbyaddr.c \ + getnetbyname.c getnetent.c getproto.c getprotoent.c getprotoname.c \ + getservbyname.c getservbyport.c getservent.c herror.c inet_addr.c \ + inet_lnaof.c inet_makeaddr.c inet_netof.c inet_network.c inet_ntoa.c \ + net_internal.c proto_internal.c res_comp.c res_init.c res_internal.c \ + res_mkquery.c res_query.c res_querydomain.c res_search.c res_send.c \ + serv_internal.c + diff --git a/lib/libpthread/net/gethostbyaddr.c b/lib/libpthread/net/gethostbyaddr.c new file mode 100644 index 00000000000..c996137138e --- /dev/null +++ b/lib/libpthread/net/gethostbyaddr.c @@ -0,0 +1,161 @@ +/* + * Copyright (c) 1985, 1988 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)gethostbyaddr.c 6.45 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: gethostbyaddr.c,v 1.1 1998/07/21 13:19:44 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + + +#include <pthread.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <netdb.h> +#include <netinet/in.h> +#include <resolv.h> +#include <netinet/in.h> +#include <errno.h> +#include <sys/socket.h> +#include "res_internal.h" + +static struct hostent *file_find_addr(const char *addr, int len, int type, + struct hostent *result, char *buf, + int bufsize, int *errval); + +struct hostent *gethostbyaddr(const char *addr, int len, int type) +{ + struct res_data *data = _res_init(); + + if (!data) + return NULL; + if (!data->buf) { + data->buf = malloc(sizeof(struct hostent) + HOST_BUFSIZE); + if (!data->buf) { + errno = 0; + data->errval = NO_RECOVERY; + return NULL; + } + } + return gethostbyaddr_r(addr, len, type, (struct hostent *) data->buf, + data->buf + sizeof(struct hostent), HOST_BUFSIZE, + &data->errval); +} + +struct hostent *gethostbyaddr_r(const char *addr, int len, int type, + struct hostent *result, char *buf, int bufsize, + int *errval) +{ + struct res_data *data; + querybuf qbuf; + char lookups[MAXDNSLUS], addrbuf[MAXDNAME], *abuf; + struct hostent *hp; + int n, i; + + /* Default failure condition is not a range error and not recoverable. */ + errno = 0; + *errval = NO_RECOVERY; + + data = _res_init(); + if (!data) + return NULL; + + if (type != AF_INET) + return NULL; + sprintf(addrbuf, "%u.%u.%u.%u.in-addr.arpa", + (unsigned)addr[3] & 0xff, (unsigned)addr[2] & 0xff, + (unsigned)addr[1] & 0xff, (unsigned)addr[0] & 0xff); + + memcpy(lookups, data->state.lookups, sizeof(lookups)); + if (*lookups == 0) + strncpy(lookups, "bf", sizeof(lookups)); + + hp = NULL; + for (i = 0; i < MAXDNSLUS && hp == NULL && lookups[i]; i++) { + switch (lookups[i]) { + case 'b': + + /* Allocate space for a one-item list of addresses. */ + abuf = SP(SP(buf, char *, 2), struct in_addr, 1); + if (abuf > buf + bufsize) { + errno = ERANGE; + return NULL; + } + + /* Perform and parse the query. */ + n = res_query(addrbuf, C_IN, T_PTR, (char *)&qbuf, sizeof(qbuf)); + if (n < 0) + break; + hp = _res_parse_answer(&qbuf, n, 1, result, abuf, + bufsize - (abuf - buf), errval); + if (hp == NULL) + break; + + /* Fill in our own address list. */ + result->h_addrtype = type; + result->h_length = len; + result->h_addr_list = (char **) ALIGN(buf, char *); + result->h_addr_list[0] = ALIGN(&result->h_addr_list[2], + struct in_addr); + result->h_addr_list[1] = NULL; + break; + + case 'f': + hp = file_find_addr(addr, len, type, result, buf, bufsize, errval); + break; + } + } + + return hp; +} + +static struct hostent *file_find_addr(const char *addr, int len, int type, + struct hostent *result, char *buf, + int bufsize, int *errval) +{ + FILE *fp = NULL; + + pthread_mutex_lock(&host_iterate_lock); + sethostent(0); + while ((result = gethostent_r(result, buf, bufsize, errval)) != NULL) { + /* Check the entry against the given address. */ + if (result->h_addrtype == type && + memcmp(result->h_addr, addr, len) == 0) + break; + } + pthread_mutex_unlock(&host_iterate_lock); + if (!result && errno != ERANGE) + *errval = HOST_NOT_FOUND; + return result; +} + diff --git a/lib/libpthread/net/gethostbyname.c b/lib/libpthread/net/gethostbyname.c new file mode 100644 index 00000000000..2a5e898134c --- /dev/null +++ b/lib/libpthread/net/gethostbyname.c @@ -0,0 +1,167 @@ +/* + * Copyright (c) 1985, 1988 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)gethostbyname.c 6.45 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: gethostbyname.c,v 1.1 1998/07/21 13:19:44 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <netdb.h> +#include <netinet/in.h> +#include <sys/socket.h> +#include <resolv.h> +#include "res_internal.h" + +static struct hostent *fake_hostent(const char *hostname, struct in_addr addr, + struct hostent *result, char *buf, + int bufsize, int *errval); +static struct hostent *file_find_name(const char *name, struct hostent *result, + char *buf, int bufsize, int *errval); + +struct hostent *gethostbyname(const char *hostname) +{ + struct res_data *data = _res_init(); + + if (!data) + return NULL; + if (!data->buf) { + data->buf = malloc(sizeof(struct hostent) + HOST_BUFSIZE); + if (!data->buf) { + errno = 0; + data->errval = NO_RECOVERY; + return NULL; + } + } + return gethostbyname_r(hostname, (struct hostent *) data->buf, + data->buf + sizeof(struct hostent), HOST_BUFSIZE, + &data->errval); +} + +struct hostent *gethostbyname_r(const char *hostname, struct hostent *result, + char *buf, int bufsize, int *errval) +{ + struct in_addr addr; + querybuf qbuf; + const char *p; + int n; + + /* Default failure condition is not a range error and not recoverable. */ + errno = 0; + *errval = NO_RECOVERY; + + /* Check for all-numeric hostname with no trailing dot. */ + if (isdigit(hostname[0])) { + p = hostname; + while (*p && (isdigit(*p) || *p == '.')) + p++; + if (!*p && p[-1] != '.') { + /* Looks like an IP address; convert it. */ + if (inet_aton(hostname, &addr) == -1) { + *errval = HOST_NOT_FOUND; + return NULL; + } + return fake_hostent(hostname, addr, result, buf, bufsize, errval); + } + } + + /* Do the search. */ + n = res_search(hostname, C_IN, T_A, qbuf.buf, sizeof(qbuf)); + if (n >= 0) + return _res_parse_answer(&qbuf, n, 0, result, buf, bufsize, errval); + else if (errno == ECONNREFUSED) + return file_find_name(hostname, result, buf, bufsize, errval); + else + return NULL; +} + +static struct hostent *fake_hostent(const char *hostname, struct in_addr addr, + struct hostent *result, char *buf, + int bufsize, int *errval) +{ + int len = strlen(hostname); + char *name, *addr_ptr; + + if (SP(SP(SP(buf, char, len + 1), addr, 1), char *, 3) > buf + bufsize) { + errno = ERANGE; + return NULL; + } + + /* Copy faked name and address into buffer. */ + strcpy(buf, hostname); + name = buf; + buf = ALIGN(buf + len + 1, addr); + *((struct in_addr *) buf) = addr; + addr_ptr = buf; + buf = ALIGN(buf + sizeof(addr), char *); + ((char **) buf)[0] = addr_ptr; + ((char **) buf)[1] = NULL; + ((char **) buf)[2] = NULL; + + result->h_name = name; + result->h_aliases = ((char **) buf) + 2; + result->h_addrtype = AF_INET; + result->h_length = sizeof(addr); + result->h_addr_list = (char **) buf; + + return result; +} + +static struct hostent *file_find_name(const char *name, struct hostent *result, + char *buf, int bufsize, int *errval) +{ + char **alias; + FILE *fp = NULL; + + pthread_mutex_lock(&host_iterate_lock); + sethostent(0); + while ((result = gethostent_r(result, buf, bufsize, errval)) != NULL) { + /* Check the entry's name and aliases against the given name. */ + if (strcasecmp(result->h_name, name) == 0) + break; + for (alias = result->h_aliases; *alias; alias++) { + if (strcasecmp(*alias, name) == 0) + goto end; /* Josip Gracin */ + } + } +end: + pthread_mutex_unlock(&host_iterate_lock); + if (!result && errno != ERANGE) + *errval = HOST_NOT_FOUND; + return result; +} + diff --git a/lib/libpthread/net/gethostent.c b/lib/libpthread/net/gethostent.c new file mode 100644 index 00000000000..feb065129dd --- /dev/null +++ b/lib/libpthread/net/gethostent.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)gethostent.c 5.8 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: gethostent.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include "res_internal.h" + +static pthread_mutex_t res_file_lock = PTHREAD_MUTEX_INITIALIZER; +static int res_file_stayopen; +static FILE *res_file; + +void sethostent(int stayopen) +{ + pthread_mutex_lock(&res_file_lock); + res_file_stayopen |= stayopen; + if (res_file) + rewind(res_file); + else + res_file = fopen(_PATH_HOSTS, "r"); + pthread_mutex_unlock(&res_file_lock); +} + +void endhostent() +{ + pthread_mutex_lock(&res_file_lock); + if (res_file) + fclose(res_file); + pthread_mutex_unlock(&res_file_lock); +} + +struct hostent *gethostent() +{ + struct res_data *data = _res_init(); + + if (!data) + return NULL; + if (!data->buf) { + data->buf = malloc(sizeof(struct hostent) + HOST_BUFSIZE); + if (!data->buf) { + data->errval = NO_RECOVERY; + return NULL; + } + } + return gethostent_r((struct hostent *) data->buf, + data->buf + sizeof(struct hostent), HOST_BUFSIZE, + &data->errval); +} + +struct hostent *gethostent_r(struct hostent *result, char *buf, int bufsize, + int *errval) +{ + char *p, **alias; + struct in_addr *addr; + int l; + + errno = 0; + pthread_mutex_lock(&res_file_lock); + if (res_file == NULL && (res_file = fopen(_PATH_HOSTS, "r")) == NULL) { + pthread_mutex_unlock(&res_file_lock); + return NULL; + } + while (fgets(buf, bufsize, res_file)) { + if (*buf == '#') + continue; + p = strpbrk(buf, "#\n"); + if (p == NULL) + continue; + l = strlen(buf) + 1; + *p = '\0'; + p = strpbrk(buf, " \t"); + if (p == NULL) + continue; + *p++ = '\0'; + + /* THIS STUFF IS INTERNET SPECIFIC */ + if (SP(SP(SP(buf, char, l), *addr, 1), char *, 3) > buf + bufsize) { + errno = ERANGE; + break; + } + addr = (struct in_addr *) ALIGN(buf + l, struct in_addr); + if (inet_aton(buf, addr) == 0) + continue; + result->h_length = sizeof(*addr); + result->h_addrtype = AF_INET; + result->h_addr_list = (char **) ALIGN(addr + sizeof(*addr), char *); + result->h_addr_list[0] = (char *) addr; + result->h_addr_list[1] = NULL; + result->h_aliases = result->h_addr_list + 2; + while (*p == ' ' || *p == '\t') + p++; + result->h_name = p; + alias = result->h_aliases; + p = strpbrk(p, " \t"); + if (p != NULL) + *p++ = '\0'; + while (p && *p) { + if (*p == ' ' || *p == '\t') { + p++; + continue; + } + if ((char *) &alias[2] > buf + bufsize) { + errno = ERANGE; + break; + } + *alias++ = p; + p = strpbrk(p, " \t"); + if (p != NULL) + *p++ = '\0'; + } + if (p && *p) + break; + *alias = NULL; + pthread_mutex_unlock(&res_file_lock); + return result; + } + + pthread_mutex_unlock(&res_file_lock); + *errval = (errno == ERANGE) ? NO_RECOVERY : 0; + return NULL; +} + diff --git a/lib/libpthread/net/getnetbyaddr.c b/lib/libpthread/net/getnetbyaddr.c new file mode 100644 index 00000000000..d836d3938d7 --- /dev/null +++ b/lib/libpthread/net/getnetbyaddr.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getnetbyaddr.c 5.7 (Berkeley) 6/1/90";*/ +static char *rcsid = "$Id: getnetbyaddr.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <stdio.h> +#include <netdb.h> +#include "net_internal.h" + +struct netent *getnetbyaddr(long net, int type) +{ + char *buf = _net_buf(); + + if (!buf) + return NULL; + return getnetbyaddr_r(net, type, (struct netent *) buf, + buf + sizeof(struct netent), NET_BUFSIZE); +} + +struct netent *getnetbyaddr_r(long net, int type, struct netent *result, + char *buf, int bufsize) +{ + pthread_mutex_lock(&net_iterate_lock); + setnetent(0); + while ((result = getnetent_r(result, buf, bufsize)) != NULL) { + if (result->n_addrtype == type && result->n_net == net) + break; + } + pthread_mutex_unlock(&net_iterate_lock); + return result; +} + diff --git a/lib/libpthread/net/getnetbyname.c b/lib/libpthread/net/getnetbyname.c new file mode 100644 index 00000000000..41a05ad7422 --- /dev/null +++ b/lib/libpthread/net/getnetbyname.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getnetbyname.c 5.7 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getnetbyname.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <netdb.h> +#include <string.h> +#include "net_internal.h" + +struct netent *getnetbyname(const char *name) +{ + char *buf = _net_buf(); + + if (!buf) + return NULL; + return getnetbyname_r(name, (struct netent *) buf, + buf + sizeof(struct netent), NET_BUFSIZE); +} + +struct netent *getnetbyname_r(const char *name, struct netent *result, + char *buf, int bufsize) +{ + char **alias; + + pthread_mutex_lock(&net_iterate_lock); + setnetent(0); + while ((result = getnetent_r(result, buf, bufsize)) != NULL) { + /* Check the entry's name and aliases against the given name. */ + if (strcmp(result->n_name, name) == 0) + break; + for (alias = result->n_aliases; *alias != 0; alias++) { + if (strcmp(*alias, name) == 0) + break; + } + } + pthread_mutex_unlock(&net_iterate_lock); + return result; +} + diff --git a/lib/libpthread/net/getnetent.c b/lib/libpthread/net/getnetent.c new file mode 100644 index 00000000000..192cc03ce39 --- /dev/null +++ b/lib/libpthread/net/getnetent.c @@ -0,0 +1,145 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getnetent.c 5.8 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getnetent.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <netdb.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include "net_internal.h" + +static pthread_mutex_t net_file_lock = PTHREAD_MUTEX_INITIALIZER; +static int net_file_stayopen; +static FILE *net_file; + +void setnetent(int stayopen) +{ + pthread_mutex_lock(&net_file_lock); + net_file_stayopen |= stayopen; + if (net_file) + rewind(net_file); + else + net_file = fopen(_PATH_NETWORKS, "r"); + pthread_mutex_unlock(&net_file_lock); +} + +void endnetent() +{ + pthread_mutex_lock(&net_file_lock); + if (net_file) + fclose(net_file); + pthread_mutex_unlock(&net_file_lock); +} + +struct netent *getnetent() +{ + char *buf = _net_buf(); + + return getnetent_r((struct netent *) buf, buf + sizeof(struct netent), + NET_BUFSIZE); +} + +struct netent *getnetent_r(struct netent *result, char *buf, int bufsize) +{ + char *p, *q, **alias; + int l; + + errno = 0; + pthread_mutex_lock(&net_file_lock); + if (net_file == NULL && (net_file = fopen(_PATH_NETWORKS, "r")) == NULL) { + pthread_mutex_unlock(&net_file_lock); + return NULL; + } + while (fgets(buf, bufsize, net_file)) { + if (*buf == '#') + continue; + p = strpbrk(buf, "#\n"); + if (p == NULL) + continue; + *p = '\0'; + l = strlen(buf) + 1; + result->n_name = buf; + p = strpbrk(buf, " \t"); + if (p == NULL) + continue; + *p++ = '\0'; + while (*p == ' ' || *p == '\t') + p++; + q = strpbrk(p, " \t"); + if (q != NULL) + *q++ = '\0'; + if (SP(SP(buf, char, l), char *, 1) > buf + bufsize) { + errno = ERANGE; + break; + } + result->n_net = inet_network(p); + result->n_addrtype = AF_INET; + result->n_aliases = (char **) ALIGN(buf + l, char *); + alias = result->n_aliases; + if (q != NULL) { + p = q; + while (p && *p) { + if (*p == ' ' || *p == '\t') { + p++; + continue; + } + if ((char *) &alias[2] > buf + bufsize) { + errno = ERANGE; + break; + } + *alias++ = p; + p = strpbrk(p, " \t"); + if (p != NULL) + *p++ = '\0'; + } + if (p && *p) + break; + } + *alias = NULL; + pthread_mutex_unlock(&net_file_lock); + return result; + } + + pthread_mutex_unlock(&net_file_lock); + return NULL; +} + diff --git a/lib/libpthread/net/getproto.c b/lib/libpthread/net/getproto.c new file mode 100644 index 00000000000..a4366fc7b61 --- /dev/null +++ b/lib/libpthread/net/getproto.c @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getproto.c 5.6 (Berkeley) 6/1/90";*/ +static char *rcsid = "$Id: getproto.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <stdio.h> +#include <netdb.h> +#include "proto_internal.h" + +struct protoent *getprotobynumber(int proto) +{ + char *buf = _proto_buf(); + + if (!buf) + return NULL; + return getprotobynumber_r(proto, (struct protoent *) buf, + buf + sizeof(struct protoent), PROTO_BUFSIZE); +} + +struct protoent *getprotobynumber_r(int proto, struct protoent *result, + char *buf, int bufsize) +{ + pthread_mutex_lock(&proto_iterate_lock); + setprotoent(0); + while ((result = getprotoent_r(result, buf, bufsize)) != NULL) { + if (result->p_proto == proto) + break; + } + pthread_mutex_unlock(&proto_iterate_lock); + return result; +} + diff --git a/lib/libpthread/net/getprotoent.c b/lib/libpthread/net/getprotoent.c new file mode 100644 index 00000000000..be8d13d4f12 --- /dev/null +++ b/lib/libpthread/net/getprotoent.c @@ -0,0 +1,143 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getprotoent.c 5.8 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getprotoent.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include "proto_internal.h" + +static pthread_mutex_t proto_file_lock = PTHREAD_MUTEX_INITIALIZER; +static int proto_file_stayopen; +static FILE *proto_file; + +void setprotoent(int stayopen) +{ + pthread_mutex_lock(&proto_file_lock); + proto_file_stayopen |= stayopen; + if (proto_file) + rewind(proto_file); + else + proto_file = fopen(_PATH_PROTOCOLS, "r"); + pthread_mutex_unlock(&proto_file_lock); +} + +void endprotoent() +{ + pthread_mutex_lock(&proto_file_lock); + if (proto_file) + fclose(proto_file); + pthread_mutex_unlock(&proto_file_lock); +} + +struct protoent *getprotoent() +{ + char *buf = _proto_buf(); + + return getprotoent_r((struct protoent *) buf, + buf + sizeof(struct protoent), PROTO_BUFSIZE); +} + +struct protoent *getprotoent_r(struct protoent *result, char *buf, int bufsize) +{ + char *p, *q, **alias; + int l; + + errno = 0; + pthread_mutex_lock(&proto_file_lock); + if (proto_file == NULL && !(proto_file = fopen(_PATH_PROTOCOLS, "r"))) { + pthread_mutex_unlock(&proto_file_lock); + return NULL; + } + while (fgets(buf, bufsize, proto_file)) { + if (*buf == '#') + continue; + p = strpbrk(buf, "#\n"); + if (p == NULL) + continue; + *p = '\0'; + l = strlen(buf) + 1; + result->p_name = buf; + p = strpbrk(buf, " \t"); + if (p == NULL) + continue; + *p++ = '\0'; + while (*p == ' ' || *p == '\t') + p++; + q = strpbrk(p, " \t"); + if (q != NULL) + *q++ = '\0'; + if (SP(SP(buf, char, l), char *, 1) > buf + bufsize) { + errno = ERANGE; + break; + } + result->p_proto = atoi(p); + result->p_aliases = (char **) ALIGN(buf + l, char *); + alias = result->p_aliases; + if (q != NULL) { + p = q; + while (p && *p) { + if (*p == ' ' || *p == '\t') { + p++; + continue; + } + if ((char *) &alias[2] > buf + bufsize) { + errno = ERANGE; + break; + } + *alias++ = p; + p = strpbrk(p, " \t"); + if (p != NULL) + *p++ = '\0'; + } + if (p && *p) + break; + } + *alias = NULL; + pthread_mutex_unlock(&proto_file_lock); + return result; + } + + pthread_mutex_unlock(&proto_file_lock); + return NULL; +} + diff --git a/lib/libpthread/net/getprotoname.c b/lib/libpthread/net/getprotoname.c new file mode 100644 index 00000000000..b31704453ee --- /dev/null +++ b/lib/libpthread/net/getprotoname.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getprotoname.c 5.7 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getprotoname.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <netdb.h> +#include <string.h> +#include "proto_internal.h" + +struct protoent *getprotobyname(const char *name) +{ + char *buf = _proto_buf(); + + if (!buf) + return NULL; + return getprotobyname_r(name, (struct protoent *) buf, + buf + sizeof(struct protoent), PROTO_BUFSIZE); +} + +struct protoent *getprotobyname_r(const char *name, struct protoent *result, + char *buf, int bufsize) +{ + char **alias; + + pthread_mutex_lock(&proto_iterate_lock); + setprotoent(0); + while ((result = getprotoent_r(result, buf, bufsize)) != NULL) { + /* Check the entry's name and aliases against the given name. */ + if (strcmp(result->p_name, name) == 0) + break; + for (alias = result->p_aliases; *alias != 0; alias++) { + if (strcmp(*alias, name) == 0) + break; + } + } + pthread_mutex_unlock(&proto_iterate_lock); + return result; +} + diff --git a/lib/libpthread/net/getservbyname.c b/lib/libpthread/net/getservbyname.c new file mode 100644 index 00000000000..7fc81aec97a --- /dev/null +++ b/lib/libpthread/net/getservbyname.c @@ -0,0 +1,76 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getservbyname.c 5.7 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getservbyname.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <netdb.h> +#include <string.h> +#include "serv_internal.h" + +struct servent *getservbyname(const char *name, const char *proto) +{ + char *buf = _serv_buf(); + + if (!buf) + return NULL; + return getservbyname_r(name, proto, (struct servent *) buf, + buf + sizeof(struct servent), SERV_BUFSIZE); +} + +struct servent *getservbyname_r(const char *name, const char *proto, + struct servent *result, char *buf, int bufsize) +{ + char **alias; + + pthread_mutex_lock(&serv_iterate_lock); + setservent(0); + while ((result = getservent_r(result, buf, bufsize)) != NULL) { + /* Check the entry's name and aliases against the given name. */ + if (strcmp(result->s_name, name) != 0) { + for (alias = result->s_aliases; *alias != NULL; alias++) { + if (strcmp(*alias, name) == 0) + break; + } + if (*alias == NULL) + continue; + } + if (proto == NULL || strcmp(result->s_proto, proto) == 0) + break; + } + pthread_mutex_unlock(&serv_iterate_lock); + return result; +} + diff --git a/lib/libpthread/net/getservbyport.c b/lib/libpthread/net/getservbyport.c new file mode 100644 index 00000000000..da16b55070e --- /dev/null +++ b/lib/libpthread/net/getservbyport.c @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getservbyport.c 5.7 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getservbyport.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <stdio.h> +#include <netdb.h> +#include <string.h> +#include "serv_internal.h" + +struct servent *getservbyport(int port, const char *proto) +{ + char *buf = _serv_buf(); + + if (!buf) + return NULL; + return getservbyport_r(port, proto, (struct servent *) buf, + buf + sizeof(struct servent), SERV_BUFSIZE); +} + +struct servent *getservbyport_r(int port, const char *proto, + struct servent *result, char *buf, int bufsize) +{ + pthread_mutex_lock(&serv_iterate_lock); + setservent(0); + while ((result = getservent_r(result, buf, bufsize)) != NULL) { + if (result->s_port != port) + continue; + if (proto == NULL || strcmp(result->s_proto, proto) == 0) + break; + } + pthread_mutex_unlock(&serv_iterate_lock); + return result; +} + diff --git a/lib/libpthread/net/getservent.c b/lib/libpthread/net/getservent.c new file mode 100644 index 00000000000..a3990ef535a --- /dev/null +++ b/lib/libpthread/net/getservent.c @@ -0,0 +1,146 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)getservent.c 5.9 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: getservent.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <netdb.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <errno.h> +#include "serv_internal.h" + +static pthread_mutex_t serv_file_lock = PTHREAD_MUTEX_INITIALIZER; +static int serv_file_stayopen=0; +static FILE *serv_file=NULL; + +void setservent(int stayopen) +{ + pthread_mutex_lock(&serv_file_lock); + serv_file_stayopen |= stayopen; + if (serv_file) + rewind(serv_file); + else + serv_file = fopen(_PATH_SERVICES, "r"); + pthread_mutex_unlock(&serv_file_lock); +} + +void endservent() +{ + pthread_mutex_lock(&serv_file_lock); + if (serv_file) + { + fclose(serv_file); + serv_file=NULL; + } + pthread_mutex_unlock(&serv_file_lock); +} + +struct servent *getservent() +{ + char *buf = _serv_buf(); + + return getservent_r((struct servent *) buf, buf + sizeof(struct servent), + SERV_BUFSIZE); +} + +struct servent *getservent_r(struct servent *result, char *buf, int bufsize) +{ + char *p, *q, **alias; + int l; + + errno = 0; + pthread_mutex_lock(&serv_file_lock); + if (serv_file == NULL && !(serv_file = fopen(_PATH_SERVICES, "r"))) { + pthread_mutex_unlock(&serv_file_lock); + return NULL; + } + while (fgets(buf, bufsize, serv_file)) { + if (*buf == '#') + continue; + p = strpbrk(buf, "#\n"); + if (p == NULL) + continue; + *p = '\0'; + l = strlen(buf) + 1; + result->s_name = buf; + q = strpbrk(buf, " \t"); + if (q == NULL) + continue; + *q++ = '\0'; + while (*q == ' ' || *q == '\t') + q++; + p = strpbrk(q, ",/"); + if (p == NULL) + continue; + *p++ = '\0'; + if (SP(SP(buf, char, l), char *, 1) > buf + bufsize) { + errno = ERANGE; + break; + } + result->s_port = htons((u_short)atoi(q)); + result->s_proto = p; + result->s_aliases = (char **) ALIGN(buf + l, char *); + alias = result->s_aliases; + p = strpbrk(p, " \t"); + if (p != NULL) + *p++ = '\0'; + while (p && *p) { + if (*p == ' ' || *p == '\t') { + p++; + continue; + } + if ((char *) &alias[2] > buf + bufsize) { + errno = ERANGE; + break; + } + *alias++ = p; + p = strpbrk(p, " \t"); + if (p != NULL) + *p++ = '\0'; + } + *alias = NULL; + pthread_mutex_unlock(&serv_file_lock); + return result; + } + + pthread_mutex_unlock(&serv_file_lock); + return NULL; +} + diff --git a/lib/libpthread/net/herror.c b/lib/libpthread/net/herror.c new file mode 100644 index 00000000000..70c3026dab2 --- /dev/null +++ b/lib/libpthread/net/herror.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1987 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)herror.c 6.6 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: herror.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <stdio.h> +#include <sys/types.h> +#include <sys/uio.h> +#include <netdb.h> +#include <unistd.h> +#include <string.h> +#include <resolv.h> + +char *h_errlist[] = { + "Error 0", + "Unknown host", /* 1 HOST_NOT_FOUND */ + "Host name lookup failure", /* 2 TRY_AGAIN */ + "Unknown server error", /* 3 NO_RECOVERY */ + "No address associated with name", /* 4 NO_ADDRESS */ +}; +int h_nerr = { sizeof(h_errlist)/sizeof(h_errlist[0]) }; + +/* + * herror -- + * print the error indicated by the h_errno value. + */ +void +herror(s) + const char *s; +{ + struct iovec iov[4]; + register struct iovec *v = iov; + int error = h_errno; + + if (s && *s) { + v->iov_base = (char *)s; + v->iov_len = strlen(s); + v++; + v->iov_base = ": "; + v->iov_len = 2; + v++; + } + v->iov_base = ((unsigned int)(error) < h_nerr) ? + h_errlist[error] : "Unknown error"; + v->iov_len = strlen(v->iov_base); + v++; + v->iov_base = "\n"; + v->iov_len = 1; + writev(STDERR_FILENO, iov, (v - iov) + 1); +} + +char * +hstrerror(err) + int err; +{ + return ((unsigned int)(err) < h_nerr) ? h_errlist[err] + : "Unknown resolver error"; +} + diff --git a/lib/libpthread/net/inet_addr.c b/lib/libpthread/net/inet_addr.c new file mode 100644 index 00000000000..9da10ccbcc0 --- /dev/null +++ b/lib/libpthread/net/inet_addr.c @@ -0,0 +1,156 @@ +/* + * Copyright (c) 1983, 1990 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)inet_addr.c 5.10 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: inet_addr.c,v 1.1 1998/07/21 13:19:45 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <ctype.h> + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif +/* + * Ascii internet address interpretation routine. + * The value returned is in network order. + */ +pthread_ipaddr_type +inet_addr(cp) + register const char *cp; +{ + struct in_addr val; + + if (inet_aton(cp, &val)) + return (val.s_addr); + return (INADDR_NONE); +} + +/* + * Check whether "cp" is a valid ascii representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ + +inet_aton(cp, addr) + const register char *cp; + struct in_addr *addr; +{ + pthread_ipaddr_type parts[4], *pp = parts; + pthread_ipaddr_type val, base, n; + register char c; + + for (;;) { + /* + * Collect number up to ``.''. + * Values are specified as for C: + * 0x=hex, 0=octal, other=decimal. + */ + val = 0; base = 10; + if (*cp == '0') { + if (*++cp == 'x' || *cp == 'X') + base = 16, cp++; + else + base = 8; + } + while ((c = *cp) != '\0') { + if (isascii(c) && isdigit(c)) { + val = (val * base) + (c - '0'); + cp++; + continue; + } + if (base == 16 && isascii(c) && isxdigit(c)) { + val = (val << 4) + + (c + 10 - (islower(c) ? 'a' : 'A')); + cp++; + continue; + } + break; + } + if (*cp == '.') { + /* + * Internet format: + * a.b.c.d + * a.b.c (with c treated as 16-bits) + * a.b (with b treated as 24 bits) + */ + if (pp >= parts + 3 || val > 0xff) + return (0); + *pp++ = val, cp++; + } else + break; + } + /* + * Check for trailing characters. + */ + if (*cp && (!isascii(*cp) || !isspace(*cp))) + return (0); + /* + * Concoct the address according to + * the number of parts specified. + */ + n = pp - parts + 1; + switch (n) { + + case 1: /* a -- 32 bits */ + break; + + case 2: /* a.b -- 8.24 bits */ + if (val > 0xffffff) + return (0); + val |= parts[0] << 24; + break; + + case 3: /* a.b.c -- 8.8.16 bits */ + if (val > 0xffff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 4: /* a.b.c.d -- 8.8.8.8 bits */ + if (val > 0xff) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } + if (addr) + addr->s_addr = htonl(val); + return (1); +} + diff --git a/lib/libpthread/net/inet_lnaof.c b/lib/libpthread/net/inet_lnaof.c new file mode 100644 index 00000000000..41c1d6d74ff --- /dev/null +++ b/lib/libpthread/net/inet_lnaof.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)inet_lnaof.c 5.7 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: inet_lnaof.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +/* + * Return the local network address portion of an + * internet address; handles class a/b/c network + * number formats. + */ +pthread_ipaddr_type +inet_lnaof(in) + struct in_addr in; +{ + register pthread_ipaddr_type i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return ((i)&IN_CLASSA_HOST); + else if (IN_CLASSB(i)) + return ((i)&IN_CLASSB_HOST); + else + return ((i)&IN_CLASSC_HOST); +} diff --git a/lib/libpthread/net/inet_makeaddr.c b/lib/libpthread/net/inet_makeaddr.c new file mode 100644 index 00000000000..0c1dcbbeed3 --- /dev/null +++ b/lib/libpthread/net/inet_makeaddr.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)inet_makeaddr.c 5.6 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: inet_makeaddr.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +/* + * Formulate an Internet address from network + host. Used in + * building addresses stored in the ifnet structure. + */ +struct in_addr +inet_makeaddr(net, host) + pthread_ipaddr_type net, host; +{ + pthread_ipaddr_type addr; + + if (net < 128) + addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST); + else if (net < 65536) + addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST); + else if (net < 16777216L) + addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST); + else + addr = net | host; + addr = htonl(addr); + return (*(struct in_addr *)&addr); +} diff --git a/lib/libpthread/net/inet_netof.c b/lib/libpthread/net/inet_netof.c new file mode 100644 index 00000000000..a33185541b0 --- /dev/null +++ b/lib/libpthread/net/inet_netof.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)inet_netof.c 5.7 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: inet_netof.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +/* + * Return the network number from an internet + * address; handles class a/b/c network #'s. + */ +pthread_ipaddr_type +inet_netof(in) + struct in_addr in; +{ + register pthread_ipaddr_type i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT); + else if (IN_CLASSB(i)) + return (((i)&IN_CLASSB_NET) >> IN_CLASSB_NSHIFT); + else + return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT); +} diff --git a/lib/libpthread/net/inet_network.c b/lib/libpthread/net/inet_network.c new file mode 100644 index 00000000000..4f443c2535c --- /dev/null +++ b/lib/libpthread/net/inet_network.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)inet_network.c 5.8 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: inet_network.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <ctype.h> + +#ifndef INADDR_NONE +#define INADDR_NONE 0xffffffff +#endif +/* + * Internet network address interpretation routine. + * The library routines call this routine to interpret + * network numbers. + */ +pthread_ipaddr_type +inet_network(cp) + register const char *cp; +{ + pthread_ipaddr_type parts[4], *pp = parts; + pthread_ipaddr_type val, base, n; + register char c; + register int i; + +again: + val = 0; base = 10; + if (*cp == '0') + base = 8, cp++; + if (*cp == 'x' || *cp == 'X') + base = 16, cp++; + while (c = *cp) { + if (isdigit(c)) { + val = (val * base) + (c - '0'); + cp++; + continue; + } + if (base == 16 && isxdigit(c)) { + val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); + cp++; + continue; + } + break; + } + if (*cp == '.') { + if (pp >= parts + 4) + return (INADDR_NONE); + *pp++ = val, cp++; + goto again; + } + if (*cp && !isspace(*cp)) + return (INADDR_NONE); + *pp++ = val; + n = pp - parts; + if (n > 4) + return (INADDR_NONE); + for (val = 0, i = 0; i < n; i++) { + val <<= 8; + val |= parts[i] & 0xff; + } + return (val); +} diff --git a/lib/libpthread/net/inet_ntoa.c b/lib/libpthread/net/inet_ntoa.c new file mode 100644 index 00000000000..d3c75e9da47 --- /dev/null +++ b/lib/libpthread/net/inet_ntoa.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 1983 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)inet_ntoa.c 5.6 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: inet_ntoa.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +/* + * Convert network-format internet address + * to base 256 d.d.d.d representation. + */ +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +char *inet_ntoa(struct in_addr in) +{ + static pthread_mutex_t inet_ntoa_mutex = PTHREAD_MUTEX_INITIALIZER; + static pthread_key_t inet_ntoa_key = -1; + char *buf, *inet_ntoa_r(); + + if (inet_ntoa_key < 0) { + pthread_mutex_lock(&inet_ntoa_mutex); + if (inet_ntoa_key < 0) { + if (pthread_key_create(&inet_ntoa_key, free) < 0) { + pthread_mutex_unlock(&inet_ntoa_mutex); + return(NULL); + } + } + pthread_mutex_unlock(&inet_ntoa_mutex); + } + if ((buf = pthread_getspecific(inet_ntoa_key)) == NULL) { + if ((buf = (char *) malloc(18)) == NULL) { + return(NULL); + } + pthread_setspecific(inet_ntoa_key, buf); + } + return inet_ntoa_r(in, buf, 18); +} + +char *inet_ntoa_r(struct in_addr in, char *buf, int bufsize) +{ + register char *p; + + p = (char *)∈ +#define UC(b) (((int)b)&0xff) + (void)snprintf(buf, bufsize, + "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); + return (buf); +} + diff --git a/lib/libpthread/net/net_internal.c b/lib/libpthread/net/net_internal.c new file mode 100644 index 00000000000..f3638fad42d --- /dev/null +++ b/lib/libpthread/net/net_internal.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)net_internal.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: net_internal.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include "net_internal.h" + +static void _net_init_global(void); + +pthread_mutex_t net_iterate_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_once_t init_once = PTHREAD_ONCE_INIT; +static pthread_key_t key; +static int init_status; + +/* Performs global initialization. */ +char *_net_buf() +{ + char *buf; + + /* Make sure the global initializations have been done. */ + pthread_once(&init_once, _net_init_global); + + /* Initialize thread-specific data for this thread if it hasn't + * been done already. */ + buf = (char *) pthread_getspecific(key); + if (!buf) { + buf = (char *) malloc(NET_BUFSIZE); + if (buf == NULL) + return NULL; + if (pthread_setspecific(key, buf) < 0) { + free(buf); + return NULL; + } + } + return buf; +} + +static void _net_init_global() +{ + init_status = pthread_key_create(&key, free); +} + diff --git a/lib/libpthread/net/net_internal.h b/lib/libpthread/net/net_internal.h new file mode 100644 index 00000000000..d4a7fc9f216 --- /dev/null +++ b/lib/libpthread/net/net_internal.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)net_internal.h 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: net_internal.h,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef _NET_INTERNAL_H +#define _NET_INTERNAL_H + +#include <pthread.h> +#include <netdb.h> +#include <resolv.h> + +#define NET_BUFSIZE 4096 +#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t))) +#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t)) + +extern pthread_mutex_t net_iterate_lock; + +__BEGIN_DECLS +char *_net_buf(void); +__END_DECLS + +#endif + diff --git a/lib/libpthread/net/proto_internal.c b/lib/libpthread/net/proto_internal.c new file mode 100644 index 00000000000..f25dc4ff6af --- /dev/null +++ b/lib/libpthread/net/proto_internal.c @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)proto_internal.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: proto_internal.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include "proto_internal.h" + +static void _proto_init_global(void); + +pthread_mutex_t proto_iterate_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_once_t init_once = PTHREAD_ONCE_INIT; +static pthread_key_t key; +static int init_status; + +/* Performs global initialization. */ +char *_proto_buf() +{ + char *buf; + + /* Make sure the global initializations have been done. */ + pthread_once(&init_once, _proto_init_global); + + /* Initialize thread-specific data for this thread if it hasn't + * been done already. */ + buf = (char *) pthread_getspecific(key); + if (!buf) { + buf = (char *) malloc(PROTO_BUFSIZE); + if (buf == NULL) + return NULL; + if (pthread_setspecific(key, buf) < 0) { + free(buf); + return NULL; + } + } + return buf; +} + +static void _proto_init_global() +{ + init_status = pthread_key_create(&key, free); +} + diff --git a/lib/libpthread/net/proto_internal.h b/lib/libpthread/net/proto_internal.h new file mode 100644 index 00000000000..916680d533d --- /dev/null +++ b/lib/libpthread/net/proto_internal.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)proto_internal.h 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: proto_internal.h,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef _PROTO_INTERNAL_H +#define _PROTO_INTERNAL_H + +#include <pthread.h> +#include <netdb.h> +#include <resolv.h> + +#define PROTO_BUFSIZE 4096 +#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t))) +#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t)) + +extern pthread_mutex_t proto_iterate_lock; + +__BEGIN_DECLS +char *_proto_buf(void); +__END_DECLS + +#endif + diff --git a/lib/libpthread/net/res_comp.c b/lib/libpthread/net/res_comp.c new file mode 100644 index 00000000000..20cb49131c7 --- /dev/null +++ b/lib/libpthread/net/res_comp.c @@ -0,0 +1,340 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_comp.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: res_comp.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <sys/cdefs.h> +#include <netinet/in.h> +#include <resolv.h> +#include <stdio.h> + +static dn_find(); + +/* + * Expand compressed domain name 'comp_dn' to full domain name. + * 'msg' is a pointer to the begining of the message, + * 'eomorig' points to the first location after the message, + * 'exp_dn' is a pointer to a buffer of size 'length' for the result. + * Return size of compressed name or -1 if there was an error. + */ +dn_expand(msg, eomorig, comp_dn, exp_dn, length) + const u_char *msg, *eomorig, *comp_dn; + u_char *exp_dn; + int length; +{ + register u_char *cp, *dn; + register int n, c; + u_char *eom; + int len = -1, checked = 0; + + dn = exp_dn; + cp = (u_char *)comp_dn; + eom = exp_dn + length; + /* + * fetch next label in domain name + */ + while (n = *cp++) { + /* + * Check for indirection + */ + switch (n & INDIR_MASK) { + case 0: + if (dn != exp_dn) { + if (dn >= eom) + return (-1); + *dn++ = '.'; + } + if (dn+n >= eom) + return (-1); + checked += n + 1; + while (--n >= 0) { + if ((c = *cp++) == '.') { + if (dn + n + 2 >= eom) + return (-1); + *dn++ = '\\'; + } + *dn++ = c; + if (cp >= eomorig) /* out of range */ + return(-1); + } + break; + + case INDIR_MASK: + if (len < 0) + len = cp - comp_dn + 1; + cp = (u_char *)msg + (((n & 0x3f) << 8) | (*cp & 0xff)); + if (cp < msg || cp >= eomorig) /* out of range */ + return(-1); + checked += 2; + /* + * Check for loops in the compressed name; + * if we've looked at the whole message, + * there must be a loop. + */ + if (checked >= eomorig - msg) + return (-1); + break; + + default: + return (-1); /* flag error */ + } + } + *dn = '\0'; + if (len < 0) + len = cp - comp_dn; + return (len); +} + +/* + * Compress domain name 'exp_dn' into 'comp_dn'. + * Return the size of the compressed name or -1. + * 'length' is the size of the array pointed to by 'comp_dn'. + * 'dnptrs' is a list of pointers to previous compressed names. dnptrs[0] + * is a pointer to the beginning of the message. The list ends with NULL. + * 'lastdnptr' is a pointer to the end of the arrary pointed to + * by 'dnptrs'. Side effect is to update the list of pointers for + * labels inserted into the message as we compress the name. + * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr' + * is NULL, we don't update the list. + */ +dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr) + const u_char *exp_dn; + u_char *comp_dn, **dnptrs, **lastdnptr; + int length; +{ + register u_char *cp, *dn; + register int c, l; + u_char **cpp, **lpp, *sp, *eob; + u_char *msg; + + dn = (u_char *)exp_dn; + cp = comp_dn; + eob = cp + length; + if (dnptrs != NULL) { + if ((msg = *dnptrs++) != NULL) { + for (cpp = dnptrs; *cpp != NULL; cpp++) + ; + lpp = cpp; /* end of list to search */ + } + } else + msg = NULL; + for (c = *dn++; c != '\0'; ) { + /* look to see if we can use pointers */ + if (msg != NULL) { + if ((l = dn_find(dn-1, msg, dnptrs, lpp)) >= 0) { + if (cp+1 >= eob) + return (-1); + *cp++ = (l >> 8) | INDIR_MASK; + *cp++ = l % 256; + return (cp - comp_dn); + } + /* not found, save it */ + if (lastdnptr != NULL && cpp < lastdnptr-1) { + *cpp++ = cp; + *cpp = NULL; + } + } + sp = cp++; /* save ptr to length byte */ + do { + if (c == '.') { + c = *dn++; + break; + } + if (c == '\\') { + if ((c = *dn++) == '\0') + break; + } + if (cp >= eob) { + if (msg != NULL) + *lpp = NULL; + return (-1); + } + *cp++ = c; + } while ((c = *dn++) != '\0'); + /* catch trailing '.'s but not '..' */ + if ((l = cp - sp - 1) == 0 && c == '\0') { + cp--; + break; + } + if (l <= 0 || l > MAXLABEL) { + if (msg != NULL) + *lpp = NULL; + return (-1); + } + *sp = l; + } + if (cp >= eob) { + if (msg != NULL) + *lpp = NULL; + return (-1); + } + *cp++ = '\0'; + return (cp - comp_dn); +} + +/* + * Skip over a compressed domain name. Return the size or -1. + */ +__dn_skipname(comp_dn, eom) + const u_char *comp_dn, *eom; +{ + register u_char *cp; + register int n; + + cp = (u_char *)comp_dn; + while (cp < eom && (n = *cp++)) { + /* + * check for indirection + */ + switch (n & INDIR_MASK) { + case 0: /* normal case, n == len */ + cp += n; + continue; + case INDIR_MASK: /* indirection */ + cp++; + break; + default: /* illegal type */ + return (-1); + } + break; + } + if (cp > eom) + return -1; + return (cp - comp_dn); +} + +/* + * Search for expanded name from a list of previously compressed names. + * Return the offset from msg if found or -1. + * dnptrs is the pointer to the first name on the list, + * not the pointer to the start of the message. + */ +static int +dn_find(exp_dn, msg, dnptrs, lastdnptr) + u_char *exp_dn, *msg; + u_char **dnptrs, **lastdnptr; +{ + register u_char *dn, *cp, **cpp; + register int n; + u_char *sp; + + for (cpp = dnptrs; cpp < lastdnptr; cpp++) { + dn = exp_dn; + sp = cp = *cpp; + while (n = *cp++) { + /* + * check for indirection + */ + switch (n & INDIR_MASK) { + case 0: /* normal case, n == len */ + while (--n >= 0) { + if (*dn == '.') + goto next; + if (*dn == '\\') + dn++; + if (*dn++ != *cp++) + goto next; + } + if ((n = *dn++) == '\0' && *cp == '\0') + return (sp - msg); + if (n == '.') + continue; + goto next; + + default: /* illegal type */ + return (-1); + + case INDIR_MASK: /* indirection */ + cp = msg + (((n & 0x3f) << 8) | *cp); + } + } + if (*dn == '\0') + return (sp - msg); + next: ; + } + return (-1); +} + +/* + * Routines to insert/extract short/long's. Must account for byte + * order and non-alignment problems. This code at least has the + * advantage of being portable. + * + * used by sendmail. + */ + +u_short +_getshort(msgp) + register const u_char *msgp; +{ + register u_short u; + + GETSHORT(u, msgp); + return (u); +} + +pthread_ipaddr_type +_getlong(msgp) + const u_char *msgp; +{ + pthread_ipaddr_type u; + + GETLONG(u, msgp); + return (u); +} + +void +#ifdef __STDC__ +__putshort(register u_short s, register u_char *msgp) +#else + __putshort(s, msgp) + register u_short s; + register u_char *msgp; +#endif +{ + PUTSHORT(s, msgp); +} + +void +__putlong(l, msgp) + register pthread_ipaddr_type l; + register u_char *msgp; +{ + PUTLONG(l, msgp); +} + diff --git a/lib/libpthread/net/res_debug.c b/lib/libpthread/net/res_debug.c new file mode 100644 index 00000000000..329b9478c87 --- /dev/null +++ b/lib/libpthread/net/res_debug.c @@ -0,0 +1,749 @@ +/* + * Copyright (c) 1985, 1990, 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. + * + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; +static char rcsid[] = "$Id: res_debug.c,v 1.1 1998/07/21 13:19:46 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <stdio.h> +#include <string.h> +#include <resolv.h> +#include <arpa/inet.h> + +void __fp_query(); +char *__p_class(), *__p_time(), *__p_type(); +char *p_cdname(), *p_fqname(), *p_rr(); +static char *p_option __P_((u_long)); + +char *_res_opcodes[] = { + "QUERY", + "IQUERY", + "CQUERYM", + "CQUERYU", + "4", + "5", + "6", + "7", + "8", + "UPDATEA", + "UPDATED", + "UPDATEDA", + "UPDATEM", + "UPDATEMA", + "ZONEINIT", + "ZONEREF", +}; + +char *_res_resultcodes[] = { + "NOERROR", + "FORMERR", + "SERVFAIL", + "NXDOMAIN", + "NOTIMP", + "REFUSED", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "14", + "NOCHANGE", +}; + +static char retbuf[16]; + +static char * +dewks(wks) + int wks; +{ + switch (wks) { + case 5: return("rje"); + case 7: return("echo"); + case 9: return("discard"); + case 11: return("systat"); + case 13: return("daytime"); + case 15: return("netstat"); + case 17: return("qotd"); + case 19: return("chargen"); + case 20: return("ftp-data"); + case 21: return("ftp"); + case 23: return("telnet"); + case 25: return("smtp"); + case 37: return("time"); + case 39: return("rlp"); + case 42: return("name"); + case 43: return("whois"); + case 53: return("domain"); + case 57: return("apts"); + case 59: return("apfs"); + case 67: return("bootps"); + case 68: return("bootpc"); + case 69: return("tftp"); + case 77: return("rje"); + case 79: return("finger"); + case 87: return("link"); + case 95: return("supdup"); + case 100: return("newacct"); + case 101: return("hostnames"); + case 102: return("iso-tsap"); + case 103: return("x400"); + case 104: return("x400-snd"); + case 105: return("csnet-ns"); + case 109: return("pop-2"); + case 111: return("sunrpc"); + case 113: return("auth"); + case 115: return("sftp"); + case 117: return("uucp-path"); + case 119: return("nntp"); + case 121: return("erpc"); + case 123: return("ntp"); + case 133: return("statsrv"); + case 136: return("profile"); + case 144: return("NeWS"); + case 161: return("snmp"); + case 162: return("snmp-trap"); + case 170: return("print-srv"); + default: (void) sprintf(retbuf, "%d", wks); return(retbuf); + } +} + +static char * +deproto(protonum) + int protonum; +{ + switch (protonum) { + case 1: return("icmp"); + case 2: return("igmp"); + case 3: return("ggp"); + case 5: return("st"); + case 6: return("tcp"); + case 7: return("ucl"); + case 8: return("egp"); + case 9: return("igp"); + case 11: return("nvp-II"); + case 12: return("pup"); + case 16: return("chaos"); + case 17: return("udp"); + default: (void) sprintf(retbuf, "%d", protonum); return(retbuf); + } +} + +static char * +do_rrset(msg, cp, cnt, pflag, file, hs) + int cnt, pflag; + char *cp,*msg, *hs; + FILE *file; +{ + int n; + int sflag; + /* + * Print answer records + */ + sflag = (_res.pfcode & pflag); + if (n = ntohs(cnt)) { + if ((!_res.pfcode) || ((sflag) && (_res.pfcode & RES_PRF_HEAD1))) + fprintf(file, hs); + while (--n >= 0) { + cp = p_rr(cp, msg, file); + if ((cp-msg) > PACKETSZ) + return (NULL); + } + if ((!_res.pfcode) || ((sflag) && (_res.pfcode & RES_PRF_HEAD1))) + putc('\n', file); + } + return(cp); +} + +__p_query(msg) + char *msg; +{ + __fp_query(msg, stdout); +} + +/* + * Print the current options. + * This is intended to be primarily a debugging routine. + */ +void +__fp_resstat(statp, file) + struct __res_state *statp; + FILE *file; +{ + int bit; + + fprintf(file, ";; res options:"); + if (!statp) + statp = &_res; + for (bit = 0; bit < 32; bit++) { /* XXX 32 - bad assumption! */ + if (statp->options & (1<<bit)) + fprintf(file, " %s", p_option(1<<bit)); + } + putc('\n', file); +} + +/* + * Print the contents of a query. + * This is intended to be primarily a debugging routine. + */ +void +__fp_query(msg,file) + char *msg; + FILE *file; +{ + register char *cp; + register HEADER *hp; + register int n; + + /* + * Print header fields. + */ + hp = (HEADER *)msg; + cp = msg + sizeof(HEADER); + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || hp->rcode) { + fprintf(file,";; ->>HEADER<<- opcode: %s, status: %s, id: %d", + _res_opcodes[hp->opcode], + _res_resultcodes[hp->rcode], + ntohs(hp->id)); + putc('\n', file); + } + putc(';', file); + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD2)) { + fprintf(file,"; flags:"); + if (hp->qr) + fprintf(file," qr"); + if (hp->aa) + fprintf(file," aa"); + if (hp->tc) + fprintf(file," tc"); + if (hp->rd) + fprintf(file," rd"); + if (hp->ra) + fprintf(file," ra"); + if (hp->pr) + fprintf(file," pr"); + } + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD1)) { + fprintf(file,"; Ques: %d", ntohs(hp->qdcount)); + fprintf(file,", Ans: %d", ntohs(hp->ancount)); + fprintf(file,", Auth: %d", ntohs(hp->nscount)); + fprintf(file,", Addit: %d", ntohs(hp->arcount)); + } +#if 1 + if ((!_res.pfcode) || (_res.pfcode & + (RES_PRF_HEADX | RES_PRF_HEAD2 | RES_PRF_HEAD1))) { + putc('\n',file); + } +#endif + /* + * Print question records. + */ + if (n = ntohs(hp->qdcount)) { + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES)) + fprintf(file,";; QUESTIONS:\n"); + while (--n >= 0) { + fprintf(file,";;\t"); + cp = p_cdname(cp, msg, file); + if (cp == NULL) + return; + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES)) + fprintf(file, ", type = %s", + __p_type(_getshort(cp))); + cp += sizeof(u_short); + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES)) + fprintf(file, ", class = %s\n", + __p_class(_getshort(cp))); + cp += sizeof(u_short); + putc('\n', file); + } + } + /* + * Print authoritative answer records + */ + cp = do_rrset(msg, cp, hp->ancount, RES_PRF_ANS, file, + ";; ANSWERS:\n"); + if (cp == NULL) + return; + + /* + * print name server records + */ + cp = do_rrset(msg, cp, hp->nscount, RES_PRF_AUTH, file, + ";; AUTHORITY RECORDS:\n"); + if (!cp) + return; + + /* + * print additional records + */ + cp = do_rrset(msg, cp, hp->arcount, RES_PRF_ADD, file, + ";; ADDITIONAL RECORDS:\n"); + if (!cp) + return; +} + +char * +p_cdname(cp, msg, file) + char *cp, *msg; + FILE *file; +{ + char name[MAXDNAME]; + int n; + + if ((n = dn_expand((u_char *)msg, (u_char *)cp + MAXCDNAME, + (u_char *)cp, (u_char *)name, sizeof(name))) < 0) + return (NULL); + if (name[0] == '\0') + putc('.', file); + else + fputs(name, file); + return (cp + n); +} + +char * +p_fqname(cp, msg, file) + char *cp, *msg; + FILE *file; +{ + char name[MAXDNAME]; + int n, len; + + if ((n = dn_expand((u_char *)msg, (u_char *)cp + MAXCDNAME, + (u_char *)cp, (u_char *)name, sizeof(name))) < 0) + return (NULL); + if (name[0] == '\0') { + putc('.', file); + } else { + fputs(name, file); + if (name[strlen(name) - 1] != '.') + putc('.', file); + } + return (cp + n); +} + +/* + * Print resource record fields in human readable form. + * + * Removed calls to non-reentrant routines to simplify varifying + * POSIX thread-safe implementations. (mevans). + */ +char * +p_rr(cp, msg, file) + char *cp, *msg; + FILE *file; +{ + int type, class, dlen, n, c; + struct in_addr inaddr; + char *cp1, *cp2; + u_long tmpttl, t; + int lcnt; + char buf[32]; + + if ((cp = p_fqname(cp, msg, file)) == NULL) + return (NULL); /* compression error */ + type = _getshort(cp); + cp += sizeof(u_short); + class = _getshort(cp); + cp += sizeof(u_short); + tmpttl = _getlong(cp); + cp += sizeof(u_long); + dlen = _getshort(cp); + cp += sizeof(u_short); + cp1 = cp; + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_TTLID)) + fprintf(file, "\t%lu", tmpttl); + if ((!_res.pfcode) || (_res.pfcode & RES_PRF_CLASS)) + fprintf(file, "\t%s", __p_class(class)); + fprintf(file, "\t%s", __p_type(type)); + /* + * Print type specific data, if appropriate + */ + switch (type) { + case T_A: + switch (class) { + case C_IN: + case C_HS: + bcopy(cp, (char *)&inaddr, sizeof(inaddr)); + if (dlen == 4) { + fprintf(file,"\t%s", + inet_ntoa_r(inaddr, buf, sizeof(buf))); + cp += dlen; + } else if (dlen == 7) { + char *address; + u_char protocol; + u_short port; + + address = inet_ntoa_r(inaddr, + buf, sizeof(buf)); + cp += sizeof(inaddr); + protocol = *(u_char*)cp; + cp += sizeof(u_char); + port = _getshort(cp); + cp += sizeof(u_short); + fprintf(file, "\t%s\t; proto %d, port %d", + address, protocol, port); + } + break; + default: + cp += dlen; + } + break; + case T_CNAME: + case T_MB: + case T_MG: + case T_MR: + case T_NS: + case T_PTR: + putc('\t', file); + cp = p_fqname(cp, msg, file); + break; + + case T_HINFO: + if (n = *cp++) { + fprintf(file,"\t%.*s", n, cp); + cp += n; + } + if (n = *cp++) { + fprintf(file,"\t%.*s", n, cp); + cp += n; + } + break; + + case T_SOA: + putc('\t', file); + cp = p_fqname(cp, msg, file); /* origin */ + putc(' ', file); + cp = p_fqname(cp, msg, file); /* mail addr */ + fputs(" (\n", file); + t = _getlong(cp); cp += sizeof(u_long); + fprintf(file,"\t\t\t%lu\t; serial\n", t); + t = _getlong(cp); cp += sizeof(u_long); + fprintf(file,"\t\t\t%lu\t; refresh (%s)\n", t, __p_time(t)); + t = _getlong(cp); cp += sizeof(u_long); + fprintf(file,"\t\t\t%lu\t; retry (%s)\n", t, __p_time(t)); + t = _getlong(cp); cp += sizeof(u_long); + fprintf(file,"\t\t\t%lu\t; expire (%s)\n", t, __p_time(t)); + t = _getlong(cp); cp += sizeof(u_long); + fprintf(file,"\t\t\t%lu )\t; minimum (%s)", t, __p_time(t)); + break; + + case T_MX: + case T_AFSDB: + fprintf(file,"\t%d ", _getshort(cp)); + cp += sizeof(u_short); + cp = p_fqname(cp, msg, file); + break; + + case T_TXT: + (void) fputs("\t\"", file); + cp2 = cp1 + dlen; + while (cp < cp2) { + if (n = (unsigned char) *cp++) { + for (c = n; c > 0 && cp < cp2; c--) + if (*cp == '\n') { + (void) putc('\\', file); + (void) putc(*cp++, file); + } else + (void) putc(*cp++, file); + } + } + putc('"', file); + break; + + case T_MINFO: + case T_RP: + putc('\t', file); + cp = p_fqname(cp, msg, file); + putc(' ', file); + cp = p_fqname(cp, msg, file); + break; + + case T_UINFO: + putc('\t', file); + fputs(cp, file); + cp += dlen; + break; + + case T_UID: + case T_GID: + if (dlen == 4) { + fprintf(file,"\t%u", _getlong(cp)); + cp += sizeof(long); + } + break; + + case T_WKS: + if (dlen < sizeof(u_long) + 1) + break; + bcopy(cp, (char *)&inaddr, sizeof(inaddr)); + cp += sizeof(u_long); + fprintf(file, "\t%s %s ( ", + inet_ntoa_r(inaddr, buf, sizeof(buf)), + deproto((int) *cp)); + cp += sizeof(u_char); + n = 0; + lcnt = 0; + while (cp < cp1 + dlen) { + c = *cp++; + do { + if (c & 0200) { + if (lcnt == 0) { + fputs("\n\t\t\t", file); + lcnt = 5; + } + fputs(dewks(n), file); + putc(' ', file); + lcnt--; + } + c <<= 1; + } while (++n & 07); + } + putc(')', file); + break; + +#ifdef ALLOW_T_UNSPEC + case T_UNSPEC: + { + int NumBytes = 8; + char *DataPtr; + int i; + + if (dlen < NumBytes) NumBytes = dlen; + fprintf(file, "\tFirst %d bytes of hex data:", + NumBytes); + for (i = 0, DataPtr = cp; i < NumBytes; i++, DataPtr++) + fprintf(file, " %x", *DataPtr); + cp += dlen; + } + break; +#endif /* ALLOW_T_UNSPEC */ + + default: + fprintf(file,"\t?%d?", type); + cp += dlen; + } +#if 0 + fprintf(file, "\t; dlen=%d, ttl %s\n", dlen, __p_time(tmpttl)); +#else + putc('\n', file); +#endif + if (cp - cp1 != dlen) { + fprintf(file,";; packet size error (found %d, dlen was %d)\n", + cp - cp1, dlen); + cp = NULL; + } + return (cp); +} + +static char nbuf[40]; + +/* + * Return a string for the type + */ +char * +__p_type(type) + int type; +{ + switch (type) { + case T_A: + return("A"); + case T_NS: /* authoritative server */ + return("NS"); + case T_CNAME: /* canonical name */ + return("CNAME"); + case T_SOA: /* start of authority zone */ + return("SOA"); + case T_MB: /* mailbox domain name */ + return("MB"); + case T_MG: /* mail group member */ + return("MG"); + case T_MR: /* mail rename name */ + return("MR"); + case T_NULL: /* null resource record */ + return("NULL"); + case T_WKS: /* well known service */ + return("WKS"); + case T_PTR: /* domain name pointer */ + return("PTR"); + case T_HINFO: /* host information */ + return("HINFO"); + case T_MINFO: /* mailbox information */ + return("MINFO"); + case T_MX: /* mail routing info */ + return("MX"); + case T_TXT: /* text */ + return("TXT"); + case T_RP: /* responsible person */ + return("RP"); + case T_AFSDB: /* AFS cell database */ + return("AFSDB"); + case T_AXFR: /* zone transfer */ + return("AXFR"); + case T_MAILB: /* mail box */ + return("MAILB"); + case T_MAILA: /* mail address */ + return("MAILA"); + case T_ANY: /* matches any type */ + return("ANY"); + case T_UINFO: + return("UINFO"); + case T_UID: + return("UID"); + case T_GID: + return("GID"); +#ifdef ALLOW_T_UNSPEC + case T_UNSPEC: + return("UNSPEC"); +#endif /* ALLOW_T_UNSPEC */ + + default: + (void)sprintf(nbuf, "%d", type); + return(nbuf); + } +} + +/* + * Return a mnemonic for class + */ +char * +__p_class(class) + int class; +{ + + switch (class) { + case C_IN: /* internet class */ + return("IN"); + case C_HS: /* hesiod class */ + return("HS"); + case C_ANY: /* matches any class */ + return("ANY"); + default: + (void)sprintf(nbuf, "%d", class); + return(nbuf); + } +} + +/* + * Return a mnemonic for an option + */ +static char * +p_option(option) + u_long option; +{ + switch (option) { + case RES_INIT: return "init"; + case RES_DEBUG: return "debug"; + case RES_AAONLY: return "aaonly"; + case RES_USEVC: return "usevc"; + case RES_PRIMARY: return "primry"; + case RES_IGNTC: return "igntc"; + case RES_RECURSE: return "recurs"; + case RES_DEFNAMES: return "defnam"; + case RES_STAYOPEN: return "styopn"; + case RES_DNSRCH: return "dnsrch"; + default: sprintf(nbuf, "?0x%x?", option); return nbuf; + } +} + +/* + * Return a mnemonic for a time to live + */ +char * +__p_time(value) + u_long value; +{ + int secs, mins, hours, days; + register char *p; + + if (value == 0) { + strcpy(nbuf, "0 secs"); + return(nbuf); + } + + secs = value % 60; + value /= 60; + mins = value % 60; + value /= 60; + hours = value % 24; + value /= 24; + days = value; + value = 0; + +#define PLURALIZE(x) x, (x == 1) ? "" : "s" + p = nbuf; + if (days) { + (void)sprintf(p, "%d day%s", PLURALIZE(days)); + while (*++p); + } + if (hours) { + if (days) + *p++ = ' '; + (void)sprintf(p, "%d hour%s", PLURALIZE(hours)); + while (*++p); + } + if (mins) { + if (days || hours) + *p++ = ' '; + (void)sprintf(p, "%d min%s", PLURALIZE(mins)); + while (*++p); + } + if (secs || ! (days || hours || mins)) { + if (days || hours || mins) + *p++ = ' '; + (void)sprintf(p, "%d sec%s", PLURALIZE(secs)); + } + return(nbuf); +} diff --git a/lib/libpthread/net/res_init.c b/lib/libpthread/net/res_init.c new file mode 100644 index 00000000000..73532a9144b --- /dev/null +++ b/lib/libpthread/net/res_init.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_init.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: res_init.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <resolv.h> +#include <netdb.h> +#include "res_internal.h" + +int res_init() +{ + if (_res_init()) { + return 0; + } else { + /* Due to clever tricks in _res_init(), a check for h_errno will + * return NO_RECOVERY even if the next try at initialization + * succeeds, so it's okay that we can't set an error value here. */ + return -1; + } +} + diff --git a/lib/libpthread/net/res_internal.c b/lib/libpthread/net/res_internal.c new file mode 100644 index 00000000000..6f51aec1aa0 --- /dev/null +++ b/lib/libpthread/net/res_internal.c @@ -0,0 +1,576 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_internal.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: res_internal.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <resolv.h> +#include <netdb.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <string.h> +#include <errno.h> +#include "res_internal.h" + +#define DEFAULT_RETRIES 4 + +pthread_mutex_t host_iterate_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_once_t init_once = PTHREAD_ONCE_INIT; +static pthread_key_t key; +static int init_status; + +static void _res_init_global(void); +static void set_options(const char *options, const char *source); +static pthread_ipaddr_type net_mask(struct in_addr in); +static int qcomp(const void *arg1, const void *arg2); + +static struct __res_state start; +/* We want to define _res for partial binary compatibility with libraries. */ +#undef _res +struct __res_state _res = { + RES_TIMEOUT, /* retransmition time interval */ + 4, /* number of times to retransmit */ + RES_DEFAULT, /* options flags */ + 1, /* number of name servers */ +}; + +struct hostent *_res_parse_answer(querybuf *answer, int anslen, int iquery, + struct hostent *result, char *buf, + int bufsize, int *errval) +{ + struct res_data *data = _res_init(); + register HEADER *hp; + register u_char *cp; + register int n; + u_char *eom; + char *aliases[__NETDB_MAXALIASES], *addrs[__NETDB_MAXADDRS]; + char *bp = buf, **ap = aliases, **hap = addrs; + int type, class, ancount, qdcount, getclass = C_ANY, iquery_done = 0; + + eom = answer->buf + anslen; + /* + * find first satisfactory answer + */ + hp = &answer->hdr; + ancount = ntohs(hp->ancount); + qdcount = ntohs(hp->qdcount); + bp = buf; + cp = answer->buf + sizeof(HEADER); + + /* Read in the hostname if this is an address lookup. */ + if (qdcount) { + if (iquery) { + if ((n = dn_expand((u_char *) answer->buf, + (u_char *) eom, (u_char *) cp, (u_char *) bp, + bufsize - (bp - buf))) < 0) { + *errval = NO_RECOVERY; + return ((struct hostent *) NULL); + } + cp += n + QFIXEDSZ; + result->h_name = bp; + bp += strlen(bp) + 1; + } else { + cp += __dn_skipname(cp, eom) + QFIXEDSZ; + } + while (--qdcount > 0) + cp += __dn_skipname(cp, eom) + QFIXEDSZ; + } else if (iquery) { + *errval = (hp->aa) ? HOST_NOT_FOUND : TRY_AGAIN; + return ((struct hostent *) NULL); + } + + /* Read in the answers. */ + *ap = NULL; + *hap = NULL; + while (--ancount >= 0 && cp < eom) { + if ((n = dn_expand((u_char *) answer->buf, (u_char *) eom, + (u_char *) cp, (u_char *) bp, + bufsize - (bp - buf))) < 0) + break; + cp += n; + type = _getshort(cp); + cp += sizeof(u_short); + class = _getshort(cp); + cp += sizeof(u_short) + sizeof(pthread_ipaddr_type); + n = _getshort(cp); + cp += sizeof(u_short); + if (type == T_CNAME) { + cp += n; + if (ap >= aliases + __NETDB_MAXALIASES - 1) + continue; + *ap++ = bp; + bp += strlen(bp) + 1; + continue; + } + if (iquery && type == T_PTR) { + if ((n = dn_expand((u_char *) answer->buf, (u_char *) eom, + (u_char *) cp, (u_char *) bp, + bufsize - (bp - buf))) < 0) + break; + cp += n; + result->h_name = bp; + bp += strlen(bp) + 1; + iquery_done = 1; + break; + } + if (iquery || type != T_A) { +#ifdef DEBUG_RESOLVER + if (data->state.options & RES_DEBUG) + printf("unexpected answer type %d, size %d\n", + type, n); +#endif + cp += n; + continue; + } + if (hap > addrs) { + if (n != result->h_length) { + cp += n; + continue; + } + if (class != getclass) { + cp += n; + continue; + } + } else { + result->h_length = n; + getclass = class; + result->h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC; + if (!iquery) { + result->h_name = bp; + bp += strlen(bp) + 1; + } + } + bp = ALIGN(bp, pthread_ipaddr_type); + if (bp + n >= buf + bufsize) { + errno = ERANGE; + return NULL; + } + memcpy(bp, cp, n); + cp += n; + if (hap >= addrs + __NETDB_MAXADDRS - 1) + continue; + *hap++ = bp; + bp += n; + cp += n; + } + + if (hap > addrs || iquery_done) { + *ap++ = NULL; + *hap++ = NULL; + if (data->state.nsort) + qsort(addrs, hap - addrs, sizeof(struct in_addr), qcomp); + if (SP(bp, char *, (hap - addrs) + (ap - aliases)) > buf + bufsize) { + errno = ERANGE; + return NULL; + } + result->h_addr_list = (char **) ALIGN(bp, char *); + memcpy(result->h_addr_list, addrs, (hap - addrs) * sizeof(char *)); + result->h_aliases = result->h_addr_list + (hap - addrs); + memcpy(result->h_aliases, aliases, (ap - aliases) * sizeof(char *)); + return result; + } else { + *errval = TRY_AGAIN; + return NULL; + } +} + +/* Performs global initialization. */ +struct res_data *_res_init() +{ + struct res_data *data; + + /* Make sure the global initializations have been done. */ + pthread_once(&init_once, _res_init_global); + if (init_status < 0) + return NULL; + + /* Initialize thread-specific data for this thread if it hasn't + * been done already. */ + data = (struct res_data *) pthread_getspecific(key); + if (!data) { + data = (struct res_data *) malloc(sizeof(struct res_data)); + if (data == NULL) + return NULL; + if (pthread_setspecific(key, data) < 0) { + free(data); + return NULL; + } + data->buf = NULL; + data->state = start; + data->errval = NO_RECOVERY; + data->sock = -1; + } + return data; +} + +static void _res_init_global() +{ + int result; + char line[BUFSIZ], buf[BUFSIZ], *domain, *p, *net; + int i, localdomain_set = 0, num_servers = 0, num_sorts = 0; + FILE *fp; + struct in_addr addr; + + /* Assume an error state until we finish. */ + init_status = -1; + + /* Initialize the key for thread-specific data. */ + result = pthread_key_create(&key, free); + if (result < 0) + return; + + /* Initialize starting state. */ + start.retrans = RES_TIMEOUT; + start.retry = DEFAULT_RETRIES; + start.options = RES_DEFAULT; + start.id = 0; + start.nscount = 1; + start.nsaddr.sin_addr.s_addr = INADDR_ANY; + start.nsaddr.sin_family = AF_INET; + start.nsaddr.sin_port = htons(NAMESERVER_PORT); + start.nscount = 1; + start.ndots = 1; + start.pfcode = 0; + strncpy(start.lookups, "f", sizeof(start.lookups)); + + /* Look for a LOCALDOMAIN definition. */ + domain = getenv("LOCALDOMAIN"); + if (domain != NULL) { + strncpy(start.defdname, domain, sizeof(start.defdname)); + domain = start.defdname; + localdomain_set = 1; + + /* Construct a search path from the LOCALDOMAIN value, which is + * a space-separated list of strings. For backwards-compatibility, + * a newline terminates the list. */ + i = 0; + while (*domain && i < MAXDNSRCH) { + start.dnsrch[i] = domain; + while (*domain && !isspace(*domain)) + domain++; + if (!*domain || *domain == '\n') { + *domain = 0; + break; + } + *domain++ = 0; + while (isspace(*domain)) + domain++; + i++; + } + } + + /* Look for a config file and read it in. */ + fp = fopen(_PATH_RESCONF, "r"); + if (fp != NULL) { + strncpy(start.lookups, "bf", sizeof(start.lookups)); + + /* Read in the configuration file. */ + while (fgets(line, sizeof(line), fp)) { + + /* Ignore blank lines and comments. */ + if (*line == ';' || *line == '#' || !*line) + continue; + + if (strncmp(line, "domain", 6) == 0) { + + /* Read in the default domain, and initialize a one- + * element search path. Skip the domain line if we + * already got one from the LOCALDOMAIN environment + * variable. */ + if (localdomain_set) + continue; + + /* Look for the next word in the line. */ + p = line + 6; + while (*p == ' ' || *p == '\t') + p++; + if (!*p || *p == '\n') + continue; + + /* Copy in the domain, and null-terminate it at the + * first tab or newline. */ + strncpy(start.defdname, p, sizeof(start.defdname) - 1); + p = strpbrk(start.defdname, "\t\n"); + if (p) + *p = 0; + + start.dnsrch[0] = start.defdname; + start.dnsrch[1] = NULL; + + } else if (strncmp(line, "lookup", 6) == 0) { + + /* Get a list of lookup types. */ + memset(start.lookups, 0, sizeof(start.lookups)); + + /* Find the next word in the line. */ + p = line + 6; + while (isspace(*p)) + p++; + + i = 0; + while (*p && i < MAXDNSLUS) { + /* Add a lookup type. */ + if (*p == 'y' || *p == 'b' || *p == 'f') + start.lookups[i++] = *p; + + /* Find the next word. */ + while (*p && !isspace(*p)) + p++; + while (isspace(*p)) + p++; + } + + } else if (strncmp(line, "search", 6) == 0) { + + /* Read in a space-separated list of domains to search + * when a name is not fully-qualified. Skip this line + * if the LOCALDOMAIN environment variable was set. */ + if (localdomain_set) + continue; + + /* Look for the next word on the line. */ + p = line + 6; + while (*p == ' ' || *p == '\t') + p++; + if (!*p || *p == '\n') + continue; + + /* Copy the rest of the line into start.defdname. */ + strncpy(start.defdname, p, sizeof(start.defdname) - 1); + domain = start.defdname; + p = strchr(domain, '\n'); + if (*p) + *p = 0; + + /* Construct a search path from the line, which is a + * space-separated list of strings. */ + i = 0; + while (*domain && i < MAXDNSRCH) { + start.dnsrch[i] = domain; + while (*domain && !isspace(*domain)) + domain++; + if (!*domain || *domain == '\n') { + *domain = 0; + break; + } + *domain++ = 0; + while (isspace(*domain)) + domain++; + i++; + } + + } else if (strncmp(line, "nameserver", 10) == 0) { + + /* Add an address to the list of name servers we can + * connect to. */ + + /* Look for the next word in the line. */ + p = line + 10; + while (*p == ' ' || *p == '\t') + p++; + if (*p && *p != '\n' && inet_aton(p, &addr)) { + start.nsaddr_list[num_servers].sin_addr = addr; + start.nsaddr_list[num_servers].sin_family = AF_INET; + start.nsaddr_list[num_servers].sin_port = + htons(NAMESERVER_PORT); + if (++num_servers >= MAXNS) + break; + } + + } else if (strncmp(line, "sortlist", 8) == 0) { + + p = line + 8; + while (num_sorts < MAXRESOLVSORT) { + + /* Find the next word in the line. */ + p = line + 8; + while (*p == ' ' || *p == '\t') + p++; + + /* Read in an IP address and netmask. */ + if (sscanf(p, "%[0-9./]s", buf) != 1) + break; + net = strchr(buf, '/'); + if (net) + *net = 0; + + /* Translate the address into an IP address + * and netmask. */ + if (inet_aton(buf, &addr)) { + start.sort_list[num_sorts].addr = addr; + if (net && inet_aton(net + 1, &addr)) { + start.sort_list[num_sorts].mask = addr.s_addr; + } else { + start.sort_list[num_sorts].mask = + net_mask(start.sort_list[num_sorts].addr); + } + num_sorts++; + } + + /* Skip past this word. */ + if (net) + *net = '/'; + p += strlen(buf); + } + + } + } + fclose(fp); + } + + /* If we don't have a default domain, strip off the first + * component of this machine's domain name, and make a one- + * element search path consisting of the default domain. */ + if (*start.defdname == 0) { + if (gethostname(buf, sizeof(start.defdname) - 1) == 0) { + p = strchr(buf, '.'); + if (p) + strcpy(start.defdname, p + 1); + } + start.dnsrch[0] = start.defdname; + start.dnsrch[1] = NULL; + } + + p = getenv("RES_OPTIONS"); + if (p) + set_options(p, "env"); + + start.options |= RES_INIT; + _res = start; + init_status = 0; +} + +static void set_options(const char *options, const char *source) +{ + const char *p = options; + int i; + + while (*p) { + + /* Skip leading and inner runs of spaces. */ + while (*p == ' ' || *p == '\t') + p++; + + /* Search for and process individual options. */ + if (strncmp(p, "ndots:", 6) == 0) { + i = atoi(p + 6); + start.ndots = (i <= RES_MAXNDOTS) ? i : RES_MAXNDOTS; + } else if (!strncmp(p, "debug", 5)) + start.options |= RES_DEBUG; + else if (!strncmp(p, "usevc", 5)) + start.options |= RES_USEVC; + else if (!strncmp(p, "stayopen", 8)) + start.options |= RES_STAYOPEN; + + /* Skip to next run of spaces */ + while (*p && *p != ' ' && *p != '\t') + p++; + } +} + +static pthread_ipaddr_type net_mask(struct in_addr in) +{ + pthread_ipaddr_type i = ntohl(in.s_addr); + + if (IN_CLASSA(i)) + return htonl(IN_CLASSA_NET); + if (IN_CLASSB(i)) + return htonl(IN_CLASSB_NET); + return htonl(IN_CLASSC_NET); +} + +/* Get the error value for this thread, or NO_RECOVERY if none has been + * successfully set. The screw case to worry about here is if + * __res_init() fails for a resolver routine because it can't allocate + * or set the thread-specific data, and then __res_init() succeeds here. + * Because __res_init() sets errval to NO_RECOVERY after a successful + * initialization, we return NO_RECOVERY in that case, which is correct. */ +int _res_get_error() +{ + struct res_data *data; + + data = _res_init(); + return (data) ? data->errval : NO_RECOVERY; +} + +struct __res_state *_res_status() +{ + struct res_data *data; + + data = _res_init(); + return (data) ? &data->state : NULL; +} + +static int qcomp(const void *arg1, const void *arg2) +{ + const struct in_addr **a1 = (const struct in_addr **) arg1; + const struct in_addr **a2 = (const struct in_addr **) arg2; + struct __res_state *state = _res_status(); + + int pos1, pos2; + + for (pos1 = 0; pos1 < state->nsort; pos1++) { + if (state->sort_list[pos1].addr.s_addr == + ((*a1)->s_addr & state->sort_list[pos1].mask)) + break; + } + for (pos2 = 0; pos2 < state->nsort; pos2++) { + if (state->sort_list[pos2].addr.s_addr == + ((*a2)->s_addr & state->sort_list[pos2].mask)) + break; + } + return pos1 - pos2; +} + +/* + * This routine is for closing the socket if a virtual circuit is used and + * the program wants to close it. We don't use this routine, but libc + * might reference it. + * + * This routine is not expected to be user visible. + */ +void _res_close() +{ + struct res_data *data; + + data = _res_init(); + if (data && data->sock != -1) { + (void) close(data->sock); + data->sock = -1; + } +} diff --git a/lib/libpthread/net/res_internal.h b/lib/libpthread/net/res_internal.h new file mode 100644 index 00000000000..f189471a196 --- /dev/null +++ b/lib/libpthread/net/res_internal.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_internal.h 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: res_internal.h,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef _RES_INTERNAL_H +#define _RES_INTERNAL_H + +#include <pthread.h> +#include <netdb.h> +#include <resolv.h> + +#define HOST_BUFSIZE 4096 +#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t))) +#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t)) + +struct res_data { + char *buf; + struct __res_state state; + int errval; + int sock; +}; + +#if PACKETSZ > 1024 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 1024 +#endif + +typedef union { + HEADER hdr; + unsigned char buf[MAXPACKET]; +} querybuf; + +typedef union { + long al; + char ac; +} align; + +extern pthread_mutex_t host_iterate_lock; + +__BEGIN_DECLS +struct hostent *_res_parse_answer(querybuf *answer, int anslen, int iquery, + struct hostent *result, char *buf, + int buflen, int *errval); +void _res_set_error(int val); +struct res_data *_res_init(void); +__END_DECLS + +#endif + diff --git a/lib/libpthread/net/res_mkquery.c b/lib/libpthread/net/res_mkquery.c new file mode 100644 index 00000000000..6f642fef23a --- /dev/null +++ b/lib/libpthread/net/res_mkquery.c @@ -0,0 +1,212 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_mkquery.c 6.16 (Berkeley) 3/6/91";*/ +static char *rcsid = "$Id: res_mkquery.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <sys/param.h> +#include <sys/cdefs.h> +#include <netinet/in.h> +#include <resolv.h> +#include <stdio.h> +#include <string.h> + +/* + * Form all types of queries. + * Returns the size of the result or -1. + */ +res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) + int op; /* opcode of query */ + const char *dname; /* domain name */ + int class, type; /* class and type of query */ + const char *data; /* resource record data */ + int datalen; /* length of data */ + const char *newrr_in; /* new rr for modify or append */ + char *buf; /* buffer to put query */ + int buflen; /* size of buffer */ +{ + register HEADER *hp; + register char *cp; + register int n; + struct rrec *newrr = (struct rrec *) newrr_in; + char *dnptrs[10], **dpp, **lastdnptr; + struct __res_state *_rs; + + /* + * Initialize header fields. + */ + + _rs = _res_status(); + if (!_rs) + return -1; + if ((buf == NULL) || (buflen < sizeof(HEADER))) + return(-1); + memset(buf, 0, sizeof(HEADER)); + hp = (HEADER *) buf; + hp->id = htons(++_rs->id); + hp->opcode = op; + hp->pr = (_rs->options & RES_PRIMARY) != 0; + hp->rd = (_rs->options & RES_RECURSE) != 0; + hp->rcode = NOERROR; + cp = buf + sizeof(HEADER); + buflen -= sizeof(HEADER); + dpp = dnptrs; + *dpp++ = buf; + *dpp++ = NULL; + lastdnptr = dnptrs + sizeof(dnptrs)/sizeof(dnptrs[0]); + /* + * perform opcode specific processing + */ + switch (op) { + case QUERY: + if ((buflen -= QFIXEDSZ) < 0) + return(-1); + if ((n = dn_comp((u_char *)dname, (u_char *)cp, buflen, + (u_char **)dnptrs, (u_char **)lastdnptr)) < 0) + return (-1); + cp += n; + buflen -= n; + __putshort(type, (u_char *)cp); + cp += sizeof(u_short); + __putshort(class, (u_char *)cp); + cp += sizeof(u_short); + hp->qdcount = htons(1); + if (op == QUERY || data == NULL) + break; + /* + * Make an additional record for completion domain. + */ + buflen -= RRFIXEDSZ; + if ((n = dn_comp((u_char *)data, (u_char *)cp, buflen, + (u_char **)dnptrs, (u_char **)lastdnptr)) < 0) + return (-1); + cp += n; + buflen -= n; + __putshort(T_NULL, (u_char *)cp); + cp += sizeof(u_short); + __putshort(class, (u_char *)cp); + cp += sizeof(u_short); + __putlong(0, (u_char *)cp); + cp += sizeof(pthread_ipaddr_type); + __putshort(0, (u_char *)cp); + cp += sizeof(u_short); + hp->arcount = htons(1); + break; + + case IQUERY: + /* + * Initialize answer section + */ + if (buflen < 1 + RRFIXEDSZ + datalen) + return (-1); + *cp++ = '\0'; /* no domain name */ + __putshort(type, (u_char *)cp); + cp += sizeof(u_short); + __putshort(class, (u_char *)cp); + cp += sizeof(u_short); + __putlong(0, (u_char *)cp); + cp += sizeof(pthread_ipaddr_type); + __putshort(datalen, (u_char *)cp); + cp += sizeof(u_short); + if (datalen) { + memcpy(cp, data, datalen); + cp += datalen; + } + hp->ancount = htons(1); + break; + +#ifdef ALLOW_UPDATES + /* + * For UPDATEM/UPDATEMA, do UPDATED/UPDATEDA followed by UPDATEA + * (Record to be modified is followed by its replacement in msg.) + */ + case UPDATEM: + case UPDATEMA: + + case UPDATED: + /* + * The res code for UPDATED and UPDATEDA is the same; user + * calls them differently: specifies data for UPDATED; server + * ignores data if specified for UPDATEDA. + */ + case UPDATEDA: + buflen -= RRFIXEDSZ + datalen; + if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0) + return (-1); + cp += n; + __putshort(type, cp); + cp += sizeof(u_short); + __putshort(class, cp); + cp += sizeof(u_short); + __putlong(0, cp); + cp += sizeof(pthread_ipaddr_type); + __putshort(datalen, cp); + cp += sizeof(u_short); + if (datalen) { + memcpy(cp, data, datalen); + cp += datalen; + } + if ( (op == UPDATED) || (op == UPDATEDA) ) { + hp->ancount = htons(0); + break; + } + /* Else UPDATEM/UPDATEMA, so drop into code for UPDATEA */ + + case UPDATEA: /* Add new resource record */ + buflen -= RRFIXEDSZ + datalen; + if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0) + return (-1); + cp += n; + __putshort(newrr->r_type, cp); + cp += sizeof(u_short); + __putshort(newrr->r_class, cp); + cp += sizeof(u_short); + __putlong(0, cp); + cp += sizeof(pthread_ipaddr_type); + __putshort(newrr->r_size, cp); + cp += sizeof(u_short); + if (newrr->r_size) { + memcpy(cp, newrr->r_data, newrr->r_size); + cp += newrr->r_size; + } + hp->ancount = htons(0); + break; + +#endif /* ALLOW_UPDATES */ + } + return (cp - buf); +} + diff --git a/lib/libpthread/net/res_query.c b/lib/libpthread/net/res_query.c new file mode 100644 index 00000000000..a00a1c164ac --- /dev/null +++ b/lib/libpthread/net/res_query.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_query.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: res_query.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <resolv.h> +#include <netdb.h> +#include "res_internal.h" + +#if PACKETSZ > 1024 +#define MAXPACKET PACKETSZ +#else +#define MAXPACKET 1024 +#endif + +int res_query(char *name, int class, int type, unsigned char *answer, + int anslen) +{ + struct res_data *data; + char buf[MAXPACKET]; + int result; + HEADER *hp; + + data = _res_init(); + if (!data) + return -1; + + /* Make the query. */ + result = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, buf, + sizeof(buf)); + if (result <= 0) { + data->errval = NO_RECOVERY; + return result; + } + + result = res_send(buf, result, (char *) answer, anslen); + if (result < 0) { + data->errval = TRY_AGAIN; + return result; + } + + hp = (HEADER *) answer; + if (hp->rcode == NOERROR && ntohs(hp->ancount) != 0) + return result; + + /* Translate the error code and return. */ + switch(hp->rcode) { + case NOERROR: + data->errval = NO_DATA; + break; + case SERVFAIL: + data->errval = TRY_AGAIN; + break; + case NXDOMAIN: + data->errval = HOST_NOT_FOUND; + break; + default: + data->errval = NO_RECOVERY; + break; + } + return -1; +} + diff --git a/lib/libpthread/net/res_querydomain.c b/lib/libpthread/net/res_querydomain.c new file mode 100644 index 00000000000..817974d476b --- /dev/null +++ b/lib/libpthread/net/res_querydomain.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_querydomain.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: res_querydomain.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <resolv.h> +#include <string.h> + +/* For backwards compatibility. */ +int res_querydomain(char *name, char *domain, int class, int type, + unsigned char *answer, int anslen) +{ + char buf[2 * MAXDNAME + 2]; + char *longname = buf; + int len; + + if (domain == NULL) { + /* Check for trailing '.'; copy without '.' if present. */ + len = strlen(name); + if (len > 0 && name[len - 1] == '.' && len < sizeof(buf)) { + memcpy(buf, name, len - 1); + buf[len - 1] = '\0'; + } else { + longname = name; + } + } else { + sprintf(buf, "%.*s.%.*s", MAXDNAME, name, MAXDNAME, domain); + } + + return (res_query(longname, class, type, answer, anslen)); +} + diff --git a/lib/libpthread/net/res_search.c b/lib/libpthread/net/res_search.c new file mode 100644 index 00000000000..64cddea20d4 --- /dev/null +++ b/lib/libpthread/net/res_search.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 1985, 1988 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_search.c 6.45 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: res_search.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <resolv.h> +#include <netdb.h> +#include "res_internal.h" + +static char *search_aliases(const char *name, char *buf, int bufsize); + +int res_search(const char *name, int class, int type, unsigned char *answer, + int anslen) +{ + struct res_data *data; + const char *p; + int num_dots, len, result, no_data = 0, error; + char buf[2 * MAXDNAME + 2], *domain, **dptr, *alias; + + data = _res_init(); + if (!data) + return -1; + + /* Count the dots in name, and get a pointer to the end of name. */ + num_dots = 0; + for (p = name; *p; p++) { + if (*p == '.') + num_dots++; + } + len = p - name; + + /* If there aren't any dots, check to see if name is an alias for + * another host. If so, try the resolved alias as a fully-qualified + * name. */ + alias = search_aliases(name, buf, sizeof(buf)); + if (alias != NULL) + return res_query(alias, class, type, answer, anslen); + + /* If there's a trailing dot, try to strip it off and query the name. */ + if (len > 0 && p[-1] == '.') { + if (len > sizeof(buf)) { + /* It's too long; just query the original name. */ + return res_query(name, class, type, answer, anslen); + } else { + /* Copy the name without the trailing dot and query. */ + memcpy(buf, name, len - 1); + buf[len] = 0; + return res_query(buf, class, type, answer, anslen); + } + } + + if (data->state.options & RES_DNSRCH) { + /* If RES_DNSRCH is set, query all the domains until we get a + * definitive answer. */ + for (dptr = data->state.dnsrch; *dptr; dptr++) { + domain = *dptr; + sprintf(buf, "%.*s.%.*s", MAXDNAME, name, MAXDNAME, domain); + result = res_query(buf, class, type, answer, anslen); + if (result > 0) + return result; + if (data->errval == NO_DATA) + no_data = 1; + else if (data->errval != HOST_NOT_FOUND) + break; + } + } else if (num_dots == 0 && data->state.options & RES_DEFNAMES) { + /* If RES_DEFNAMES is set and there is no dot, query the default + * domain. */ + domain = data->state.defdname; + sprintf(buf, "%.*s.%.%s", MAXDNAME, name, MAXDNAME, domain); + result = res_query(buf, class, type, answer, anslen); + if (result > 0) + return result; + if (data->errval == NO_DATA) + no_data = 1; + } + + /* If all the domain queries failed, try the name as fully-qualified. + * Only do this if there is at least one dot in the name. */ + if (num_dots > 0) { + result = res_query(name, class, type, answer, anslen); + if (result > 0) + return result; + } + + if (no_data) + data->errval = NO_DATA; + + return -1; +} + +static char *search_aliases(const char *name, char *buf, int bufsize) +{ + FILE *fp; + char *filename, *p; + int len; + + filename = getenv("HOSTALIASES"); + if (filename == NULL) + return NULL; + + fp = fopen(filename, "r"); + if (fp == NULL) + return NULL; + + len = strlen(name); + while (fgets(buf, bufsize, fp)) { + + /* Get the first word from the buffer. */ + p = buf; + while (*p && !isspace(*p)) + p++; + if (!*p) + break; + + /* Null-terminate the first word and compare it with the name. */ + *p = 0; + if (strcasecmp(buf, name) != 0) + continue; + + p++; + while (isspace(*p)) + p++; + fclose(fp); + return (*p) ? p : NULL; + } + + fclose(fp); + return NULL; +} + diff --git a/lib/libpthread/net/res_send.c b/lib/libpthread/net/res_send.c new file mode 100644 index 00000000000..d2d2ad68413 --- /dev/null +++ b/lib/libpthread/net/res_send.c @@ -0,0 +1,313 @@ +/* + * Copyright (c) 1985, 1988 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)res_send.c 6.45 (Berkeley) 2/24/91";*/ +static char *rcsid = "$Id: res_send.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <stdio.h> +#include <errno.h> +#include <resolv.h> +#include <netdb.h> +#include <time.h> +#include <sys/timers.h> +#include <sys/socket.h> +#include <sys/uio.h> +#include <netinet/in.h> +#include "res_internal.h" + +enum { SEND_GIVE_UP = -1, SEND_TRY_NEXT = -2, SEND_TRY_SAME = -3, + SEND_TIMEOUT = -4, SEND_TRUNCATED = -5 }; + +static int send_datagram(int server, int sock, const char *buf, int buflen, + char *answer, int anslen, int try, + struct res_data *data); +static int send_circuit(int server, const char *buf, int buflen, char *answer, + int anslen, struct res_data *data); +static int close_save_errno(int sock); + +int res_send(const char *buf, int buflen, char *answer, int anslen) +{ + struct res_data *data; + struct sockaddr_in local; + int use_virtual_circuit, result, udp_sock, have_seen_same, terrno = 0; + int try, server; + + data = _res_init(); + if (!data) + return -1; + + try = 0; + server = 0; + + /* Try doing connectionless queries if appropriate. */ + if (!(data->state.options & RES_USEVC) && buflen <= PACKETSZ) { + /* Create and bind a local UDP socket. */ + udp_sock = socket(AF_INET, SOCK_DGRAM, 0); + if (udp_sock < 0) + return -1; + local.sin_family = AF_INET; + local.sin_addr.s_addr = htonl(INADDR_ANY); + local.sin_port = htons(0); + if (bind(udp_sock, (struct sockaddr *) &local, sizeof(local)) < 0) { + close(udp_sock); + return -1; + } + + /* Cycle through the retries and servers, sending off queries and + * waiting for responses. */ + for (; try < data->state.retry; try++) { + for (; server < data->state.nscount; server++) { + result = send_datagram(server, udp_sock, buf, buflen, answer, + anslen, try, data); + if (result == SEND_TIMEOUT) + terrno = ETIMEDOUT; + else if (result != SEND_TRY_NEXT) + break; + } + if (server < data->state.nscount) + break; + } + + close(udp_sock); + if (result < 0) + errno = (terrno == ETIMEDOUT) ? ETIMEDOUT : ECONNREFUSED; + else + errno = 0; + if (result != SEND_TRUNCATED) + return (result >= 0) ? result : -1; + } + + /* Either we have to use the virtual circuit, or the server couldn't + * fit its response in a UDP packet. Cycle through the retries and + * servers, sending off queries and waiting for responses. Allow a + * response of SEND_TRY_SAME to cause an extra retry once. */ + for (; try < data->state.retry; try++) { + for (; server < data->state.nscount; server++) { + result = send_circuit(server, buf, buflen, answer, anslen, data); + terrno = errno; + if (result == SEND_TRY_SAME) { + if (!have_seen_same) + server--; + have_seen_same = 1; + } else if (result != SEND_TRY_NEXT) { + break; + } + } + } + + errno = terrno; + return (result >= 0) ? result : -1; +} + +static int send_datagram(int server, int sock, const char *buf, int buflen, + char *answer, int anslen, int try, + struct res_data *data) +{ + int count, interval; + struct sockaddr_in local_addr; + HEADER *request = (HEADER *) buf, *response = (HEADER *) answer; + struct timespec timeout; + struct timeval current; + struct timezone zone; + +#ifdef DEBUG_RESOLVER + if (_res.options & RES_DEBUG) { + printf("res_send: request:\n"); + __p_query(buf); + } +#endif /* DEBUG_RESOLVER */ + /* Send a packet to the server. */ + count = sendto(sock, buf, buflen, 0, + (struct sockaddr *) &data->state.nsaddr_list[server], + sizeof(struct sockaddr_in)); + + if (count != buflen) { +#ifdef DEBUG_RESOLVER + if (count < 0){ + if (_res.options & RES_DEBUG) + perror("send_datagram:sendto"); + } +#endif /* DEBUG_RESOLVER */ + return SEND_TRY_NEXT; + } + + /* Await a reply with the correct ID. */ + while (1) { + struct sockaddr_in from; + int from_len; + + from_len = sizeof(from); + interval = data->state.retrans << try; + if (try > 0) + interval /= data->state.nscount; + gettimeofday(¤t, &zone); + current.tv_sec += interval; + TIMEVAL_TO_TIMESPEC(¤t, &timeout); + count = recvfrom_timedwait(sock, answer, anslen, 0, + &from, &from_len, &timeout); + if (count < 0) + return SEND_TRY_NEXT; + /* If the ID is wrong, it's from an old query; ignore it. */ + if (response->id == request->id) + break; +#ifdef DEBUG_RESOLVER + if (_res.options & RES_DEBUG) { + printf("res_sendto: count=%d, response:\n", count); + __p_query(answer); + } +#endif /* DEBUG_RESOLVER */ + } + + /* Report a truncated response unless RES_IGNTC is set. This will + * cause the res_send() loop to fall back to TCP. */ + if (response->tc && !(data->state.options & RES_IGNTC)) + return SEND_TRUNCATED; + + return count; +} + +static int send_circuit(int server, const char *buf, int buflen, char *answer, + int anslen, struct res_data *data) +{ + HEADER *response = (HEADER *) answer; + int sock = -1, result, n, response_len, count; + unsigned short len; + struct iovec iov[2]; + char *p, junk[512]; + + /* If data->sock is valid, then it's an open connection to the + * first server. Grab it if it's appropriate; close it if not. */ + if (data->sock) { + if (server == 0) + sock = data->sock; + else + close(data->sock); + data->sock = -1; + } + + /* Initialize our socket if we didn't grab it from data. */ + if (sock == -1) { + sock = socket(AF_INET, SOCK_STREAM, 0); + if (sock < 0) + return SEND_GIVE_UP; + result = connect(sock, + (struct sockaddr *) &data->state.nsaddr_list[server], + sizeof(struct sockaddr_in)); + if (result < 0) { + close_save_errno(sock); + return SEND_TRY_NEXT; + } + } + + /* Send length and message. */ + len = htons((unsigned short) buflen); + iov[0].iov_base = (caddr_t) &len; + iov[0].iov_len = sizeof(len); + iov[1].iov_base = (char *) buf; + iov[1].iov_len = buflen; + if (writev(sock, iov, 2) != sizeof(len) + buflen) { + close_save_errno(sock); + return SEND_TRY_NEXT; + } + + /* Receive length. */ + p = (char *) &len; + n = sizeof(len); + while (n) { + count = read(sock, p, n); + if (count <= 0) { + /* If we got ECONNRESET, the remote server may have restarted, + * and we report SEND_TRY_SAME. (The main loop will only + * allow one of these, so we don't have to worry about looping + * indefinitely.) */ + close_save_errno(sock); + return (errno == ECONNRESET) ? SEND_TRY_SAME : SEND_TRY_NEXT; + } + p += count; + n -= count; + } + len = ntohs(len); + response_len = (len > anslen) ? anslen : len; + len -= response_len; + + /* Receive message. */ + p = answer; + n = response_len; + while (n) { + count = read(sock, p, n); + if (count <= 0) { + close_save_errno(sock); + return SEND_TRY_NEXT; + } + p += count; + n -= count; + } + + /* If the reply is longer than our answer buffer, set the truncated + * bit and flush the rest of the reply, to keep the connection in + * sync. */ + if (len) { + response->tc = 1; + while (len) { + n = (len > sizeof(junk)) ? sizeof(junk) : len; + count = read(sock, junk, n); + if (count <= 0) { + close_save_errno(sock); + return response_len; + } + len -= count; + } + } + + /* If this is the first server, and RES_USEVC and RES_STAYOPEN are + * both set, save the connection. Otherwise, close it. */ + if (server == 0 && (data->state.options & RES_USEVC && + data->state.options & RES_STAYOPEN)) + data->sock = sock; + else + close_save_errno(sock); + + return response_len; +} + +static int close_save_errno(int sock) +{ + int terrno; + + terrno = errno; + close(sock); + errno = terrno; +} diff --git a/lib/libpthread/net/serv_internal.c b/lib/libpthread/net/serv_internal.c new file mode 100644 index 00000000000..305d024259e --- /dev/null +++ b/lib/libpthread/net/serv_internal.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)serv_internal.c 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: serv_internal.c,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include "serv_internal.h" + +#define DEFAULT_RETRIES 4 + +static void _serv_init_global(); + +pthread_mutex_t serv_iterate_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_once_t init_once = PTHREAD_ONCE_INIT; +static pthread_key_t key; +static int init_status; + +/* Performs global initialization. */ +char *_serv_buf() +{ + char *buf; + + /* Make sure the global initializations have been done. */ + pthread_once(&init_once, _serv_init_global); + + /* Initialize thread-specific data for this thread if it hasn't + * been done already. */ + buf = (char *) pthread_getspecific(key); + if (!buf) { + buf = (char *) malloc(sizeof(struct servent) + SERV_BUFSIZE); + if (buf == NULL) + return NULL; + if (pthread_setspecific(key, buf) < 0) { + free(buf); + return NULL; + } + } + return buf; +} + +static void _serv_init_global() +{ + init_status = pthread_key_create(&key, free); +} + diff --git a/lib/libpthread/net/serv_internal.h b/lib/libpthread/net/serv_internal.h new file mode 100644 index 00000000000..781a9120064 --- /dev/null +++ b/lib/libpthread/net/serv_internal.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1985 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +/*static char *sccsid = "from: @(#)serv_internal.h 6.22 (Berkeley) 3/19/91";*/ +static char *rcsid = "$Id: serv_internal.h,v 1.1 1998/07/21 13:19:47 peter Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef _SERV_INTERNAL_H +#define _SERV_INTERNAL_H + +#include <pthread.h> +#include <netdb.h> +#include <resolv.h> + +#define SERV_BUFSIZE 4096 +#define ALIGN(p, t) ((char *)(((((long)(p) - 1) / sizeof(t)) + 1) * sizeof(t))) +#define SP(p, t, n) (ALIGN(p, t) + (n) * sizeof(t)) + +extern pthread_mutex_t serv_iterate_lock; + +__BEGIN_DECLS +char *_serv_buf(void); +__END_DECLS + +#endif + diff --git a/lib/libpthread/pg++ b/lib/libpthread/pg++ new file mode 100644 index 00000000000..0d5f78929ae --- /dev/null +++ b/lib/libpthread/pg++ @@ -0,0 +1,32 @@ +#!/bin/sh + +pthreads_root=/usr/local/pthreads +build_root=/dr1/my/masters/mysql/mit-pthreads +src_root=/dr1/my/masters/mysql/mit-pthreads + +include_dir='-I$pthreads_root/include' +lib_dir='-L$pthreads_root/lib' +libs='-lpthread -lm -lgcc -lpthread' + +# Might be a good idea to also provide a way to override pthreads_root +# so that we can use this script in the build tree, before installation. +if arg="$1" ; then + case $arg in + -notinstalled) + include_dir='-I$build_root/include -I$src_root/include' + lib_dir='-L$build_root/obj' + shift + ;; + esac +fi + +for arg in "$@" ; do + case $arg in + -nostdinc) include_dir= ;; + -nostdlib | -c) libs= ;; + esac +done + +# Include the -L option in any case, just in case the user provided the +# names of some libraries we've built threaded versions of. +eval exec g++ '"$@"' $include_dir $lib_dir $libs diff --git a/lib/libpthread/pgcc b/lib/libpthread/pgcc new file mode 100644 index 00000000000..6eed8a2d0f0 --- /dev/null +++ b/lib/libpthread/pgcc @@ -0,0 +1,32 @@ +#!/bin/sh + +pthreads_root=/usr/local/pthreads +build_root=/dr1/my/masters/mysql/mit-pthreads +src_root=/dr1/my/masters/mysql/mit-pthreads + +include_dir='-I$pthreads_root/include' +lib_dir='-L$pthreads_root/lib' +libs='-lpthread -lm -lgcc -lpthread' + +# Might be a good idea to also provide a way to override pthreads_root +# so that we can use this script in the build tree, before installation. +if arg="$1" ; then + case $arg in + -notinstalled) + include_dir='-I$build_root/include -I$src_root/include' + lib_dir='-L$build_root/obj' + shift + ;; + esac +fi + +for arg in "$@" ; do + case $arg in + -nostdinc) include_dir= ;; + -nostdlib | -c) libs= ;; + esac +done + +# Include the -L option in any case, just in case the user provided the +# names of some libraries we've built threaded versions of. +eval exec gcc '"$@"' $include_dir $lib_dir $libs diff --git a/lib/libpthread/pthreads/GNUmakefile.inc b/lib/libpthread/pthreads/GNUmakefile.inc new file mode 100644 index 00000000000..c8621495bac --- /dev/null +++ b/lib/libpthread/pthreads/GNUmakefile.inc @@ -0,0 +1,46 @@ +# from: @(#)Makefile.inc 5.6 (Berkeley) 6/4/91 + +# pthread sources +VPATH := $(VPATH):${srcdir}/pthreads + +SRCS:= cleanup.c cond.c fd.c fd_kern.c fd_pipe.c fd_sysv.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 stat.c readv.c writev.c condattr.c \ + pthread_cancel.c panic.c $(SRCS) + +ifeq ($(HAVE_SYSCALL_TEMPLATE),yes) +SYSCALL_FILTER_RULE= for s in $(AVAILABLE_SYSCALLS) ; do \ + case " $(SYSCALL_EXCEPTIONS) " in \ + *" "$$s" "*) ;; \ + *) echo $$s ;; \ + esac ; \ + done +STD_SYSCALLS:=$(shell $(SYSCALL_FILTER_RULE)) +STD_SYSCALL_FILES:= $(addprefix S,$(addsuffix .o,$(STD_SYSCALLS))) +EXTRA_OBJS := $(EXTRA_OBJS) syscalls.o +# EXTRA_OBJS := $(EXTRA_OBJS) $(STD_SYSCALL_FILES) + +ifndef SYSCALL_PIC_COMPILE +SYSCALL_PIC_COMPILE=true +endif + +obj/syscalls.o: syscall-template.S + -rm -rf obj/syscalls + mkdir obj/syscalls + for syscall in $(STD_SYSCALLS) ; do \ + echo $$syscall ; \ + $(CC) $(CFLAGS) -DSYSCALL_NAME=$$syscall -c syscall-template.S -o obj/syscalls/S$$syscall.o ; \ + $(SYSCALL_PIC_COMPILE) ; \ + done + x=`pwd` && cd obj/syscalls && ld -r -o ../syscalls.o S*.o && cd $$x + rm -r obj/syscalls +endif + +syscall.o: ${.CURDIR}/pthreads/syscall.S + cpp ${CPPFLAGS} ${.CURDIR}/pthreads/syscall.S > syscall.i + as syscall.i + rm syscall.i + mv a.out syscall.o diff --git a/lib/libpthread/pthreads/_exit.c b/lib/libpthread/pthreads/_exit.c new file mode 100644 index 00000000000..dab873a80a7 --- /dev/null +++ b/lib/libpthread/pthreads/_exit.c @@ -0,0 +1,80 @@ +/* ==== _exit.c ============================================================ + * 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. + * + * Description : The locking functions for stdio. + * + * 1.00 94/09/04 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: _exit.c,v 1.1 1998/07/21 13:19:50 peter Exp $"; +#endif + +#include <pthread.h> +#include <fcntl.h> + +/* ========================================================================== + * _exit() + * + * Change all file descriptors back to their original state, + * before exiting for good. + */ +void _exit(int status) +{ + int fd; + + pthread_sched_prevent(); + + for (fd = 0; fd < dtablesize; fd++) { + if (fd_table[fd] == NULL) { + continue; + } + /* Is it a kernel fd ? */ + if ((!fd_table[fd]->ops) || (fd_table[fd]->ops->use_kfds != 1)) { + continue; + } + switch (fd_table[fd]->type) { + case FD_HALF_DUPLEX: + machdep_sys_fcntl(fd_table[fd]->fd.i, F_SETFL, fd_table[fd]->flags); + fd_table[fd]->type = FD_TEST_HALF_DUPLEX; + break; + case FD_FULL_DUPLEX: + machdep_sys_fcntl(fd_table[fd]->fd.i, F_SETFL, fd_table[fd]->flags); + fd_table[fd]->type = FD_TEST_FULL_DUPLEX; + break; + default: + break; + } + } + machdep_sys_exit(status); +} + diff --git a/lib/libpthread/pthreads/cleanup.c b/lib/libpthread/pthreads/cleanup.c new file mode 100644 index 00000000000..e569697d40e --- /dev/null +++ b/lib/libpthread/pthreads/cleanup.c @@ -0,0 +1,82 @@ +/* ==== cleanup.c ======================================================= + * 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. + * + * Description : Pthread attribute functions. + * + * 1.20 94/02/13 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: cleanup.c,v 1.1 1998/07/21 13:19:50 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> +#include <stdlib.h> + +/* ========================================================================== + * pthread_cleanup_push() + */ +int pthread_cleanup_push(void (*routine)(void *), void *routine_arg) +{ + struct pthread_cleanup *new; + int ret; + + if (new = (struct pthread_cleanup*)malloc(sizeof(struct pthread_cleanup))) { + new->routine = routine; + new->routine_arg = routine_arg; + new->next = pthread_run->cleanup; + + pthread_run->cleanup = new; + ret = OK; + } else { + ret = ENOMEM; + } + return(ret); +} + +/* ========================================================================== + * pthread_cleanup_pop() + */ +void pthread_cleanup_pop(int execute) +{ + struct pthread_cleanup *old; + + if (old = pthread_run->cleanup) { + pthread_run->cleanup = old->next; + if (execute) { + old->routine(old->routine_arg); + } + free(old); + } +} + diff --git a/lib/libpthread/pthreads/condattr.c b/lib/libpthread/pthreads/condattr.c new file mode 100644 index 00000000000..79fd340c96d --- /dev/null +++ b/lib/libpthread/pthreads/condattr.c @@ -0,0 +1,90 @@ +/* ==== condattr.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 : Mutex functions. + * + * 1.00 95/08/22 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: condattr.c,v 1.1 1998/07/21 13:19:52 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> + +/* ========================================================================== + * pthread_condattr_init() + */ +int pthread_condattr_init(pthread_condattr_t *attr) +{ + attr->c_type = COND_TYPE_FAST; + return(OK); +} + +/* ========================================================================== + * pthread_condattr_destroy() + */ +int pthread_condattr_destroy(pthread_condattr_t *attr) +{ + return(OK); +} + +/* ========================================================================== + * pthread_condattr_settype() + */ +int pthread_condattr_settype(pthread_condattr_t *attr, unsigned int type) +{ + switch(type) { + case PTHREAD_CONDTYPE_FAST: + attr->c_type = COND_TYPE_FAST; + break; + case PTHREAD_CONDTYPE_RECURSIVE: + attr->c_type = COND_TYPE_COUNTING_FAST; + break; + case PTHREAD_CONDTYPE_DEBUG: + attr->c_type = COND_TYPE_DEBUG; + break; + default: + return(EINVAL); + } + return(OK); +} + +/* ========================================================================== + * pthread_condattr_gettype() + */ +int pthread_condattr_gettype(pthread_condattr_t *attr, unsigned int * type) +{ + *type = (unsigned int)attr->c_type; + return(OK); +} diff --git a/lib/libpthread/pthreads/dump_state.c b/lib/libpthread/pthreads/dump_state.c new file mode 100644 index 00000000000..6d46ac32c53 --- /dev/null +++ b/lib/libpthread/pthreads/dump_state.c @@ -0,0 +1,88 @@ +/* ==== dump_state.c ============================================================ + * Copyright (c) 1993, 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: dump_state.c,v 1.1 1998/07/21 13:19:52 peter Exp $ + * + * Description : Bogus debugging output routines. + * + * 1.00 95/02/08 snl + * -Started coding this file. + */ + +#include <pthread.h> +#include <stdio.h> + +/* ========================================================================== + * pthread_dump_state() + * + * Totally, totally bogus routine to dump the state of pthreads. + */ + +void +pthread_dump_state() +{ + pthread_t thread; + + for (thread = pthread_link_list; thread; thread = thread->pll) { + printf("Thread %lx", thread); + if (thread == pthread_initial) + printf("*"); + if (thread == pthread_run) + printf("^"); + printf(" "); + switch (thread->state) { + case PS_RUNNING: printf("RUNNING "); break; + case PS_MUTEX_WAIT: printf("MUTEX_WAIT "); break; + case PS_COND_WAIT: printf("COND_WAIT "); break; + case PS_FDLR_WAIT: printf("FDLR_WAIT "); break; + case PS_FDLW_WAIT: printf("FDLW_WAIT "); break; + case PS_FDR_WAIT: printf("FDR_WAIT "); break; + case PS_FDW_WAIT: printf("FDW_WAIT "); break; + case PS_SELECT_WAIT: printf("SELECT "); break; + case PS_SLEEP_WAIT: printf("SLEEP_WAIT "); break; + case PS_WAIT_WAIT: printf("WAIT_WAIT "); break; + case PS_SIGWAIT: printf("SIGWAIT "); break; + case PS_JOIN: printf("JOIN "); break; + case PS_DEAD: printf("DEAD "); break; + default: printf("*UNKNOWN %d* ", thread->state); + break; + } + switch (thread->attr.schedparam_policy) { + case SCHED_RR: printf("RR "); break; + case SCHED_IO: printf("IO "); break; + case SCHED_FIFO: printf("FIFO "); break; + case SCHED_OTHER: printf("OTHER "); break; + default: printf("*UNKNOWN %d* ", + thread->attr.schedparam_policy); + break; + } + } +} diff --git a/lib/libpthread/pthreads/errno.c b/lib/libpthread/pthreads/errno.c new file mode 100644 index 00000000000..edc36c68524 --- /dev/null +++ b/lib/libpthread/pthreads/errno.c @@ -0,0 +1,53 @@ +/* ==== errno.c ============================================================ + * 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. + * + * Description : Return the pointer to the threads errno address. + * + * 1.32 94/05/25 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: errno.c,v 1.1 1998/07/21 13:19:52 peter Exp $"; +#endif + +#include <pthread.h> + +/* ========================================================================== + * __error() + */ +int * __error() +{ + if (!pthread_run->error_p) { + pthread_run->error_p = &pthread_run->error; + } + return(pthread_run->error_p); +} diff --git a/lib/libpthread/pthreads/fd_sysv.c b/lib/libpthread/pthreads/fd_sysv.c new file mode 100644 index 00000000000..896163b57ea --- /dev/null +++ b/lib/libpthread/pthreads/fd_sysv.c @@ -0,0 +1,897 @@ +/* ==== fd_sysv.c ============================================================ + * 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. + * + * Description : Transforms BSD socket calls to SYSV streams. + * + * 1.00 94/11/19 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: fd_sysv.c,v 1.1 1998/07/21 13:19:59 peter Exp $"; +#endif + +#include <pthread.h> +#include <config.h> +#include <fcntl.h> +#include <errno.h> + +#if defined (HAVE_SYSCALL_PUTMSG) && defined (HAVE_SYSCALL_GETMSG) && !defined(HAVE_SYSCALL_SOCKETCALL) && !defined(HAVE_SYSCALL_SOCKET) +#define HAVE_STREAMS 1 + +#include <sys/types.h> +#include <sys/uio.h> +#include <sys/socket.h> +#include <sys/stream.h> +#include <sys/stropts.h> +#include <tiuser.h> +#include <sys/tihdr.h> +#include <netinet/in.h> +#include <sys/timod.h> + +#define STREAM_BUF_SIZE sizeof(union T_primitives) + sizeof(struct sockaddr) + +extern struct pthread_queue fd_wait_read, fd_wait_write; + +/* ========================================================================== + * putmsg_timedwait_basic() + */ +static int putmsg_timedwait_basic(int fd, struct strbuf * ctlptr, + struct strbuf * dataptr, int flags, struct timespec * timeout) +{ + + int ret; + + pthread_run->sighandled=0; /* Added by monty */ + while ((ret = machdep_sys_putmsg(fd_table[fd]->fd.i, + ctlptr, dataptr, flags)) < OK) { + if (!(fd_table[fd]->flags & __FD_NONBLOCK) && + ((ret == -EWOULDBLOCK) || (ret == -EAGAIN))) { + pthread_sched_prevent(); + + /* queue pthread for a FDW_WAIT */ + SET_PF_WAIT_EVENT(pthread_run); + pthread_run->data.fd.fd = fd_table[fd]->fd.i; + pthread_queue_enq(&fd_wait_write, pthread_run); + + if (timeout) { + /* get current time */ + struct timespec current_time; + machdep_gettimeofday(¤t_time); + sleep_schedule(& current_time, timeout); + + pthread_resched_resume(PS_FDW_WAIT); + + /* We're awake */ + pthread_sched_prevent(); + if (sleep_cancel(pthread_run) == NOTOK) { + CLEAR_PF_DONE_EVENT(pthread_run); + pthread_sched_resume(); + SET_ERRNO(ETIMEDOUT); + ret = -ETIMEDOUT; + break; + } + pthread_sched_resume(); + } else { + pthread_resched_resume(PS_FDW_WAIT); + } + CLEAR_PF_DONE_EVENT(pthread_run); + if (pthread_run->sighandled) /* Added by monty */ + { /* We where aborted */ + SET_ERRNO(EINTR); + ret= -EINTR; + break; + } + } else { + SET_ERRNO(-ret); + break; + } + } + return(ret); +} + +/* ========================================================================== + * putmsg_timedwait() + */ +int putmsg_timedwait(int fd, struct strbuf * ctlptr, struct strbuf * dataptr, + int flags, struct timespec * timeout) +{ + int ret; + + if ((ret = fd_lock(fd, FD_WRITE, timeout)) == OK) { + ret = putmsg_timedwait_basic(fd, ctlptr, dataptr, flags, timeout); + fd_unlock(fd, FD_WRITE); + } + return(ret); +} + +/* ========================================================================== + * putmsg() + */ +int putmsg(int fd, struct strbuf * ctlptr, struct strbuf * dataptr, + int flags) +{ + return(putmsg_timedwait(fd, ctlptr, dataptr, flags, NULL)); +} + +/* ========================================================================== + * getmsg_timedwait_basic() + */ +int getmsg_timedwait_basic(int fd, struct strbuf * ctlptr, + struct strbuf * dataptr, int * flags, struct timespec * timeout) +{ + int ret; + + pthread_run->sighandled=0; /* Added by monty */ + while ((ret = machdep_sys_getmsg(fd_table[fd]->fd.i, + ctlptr, dataptr, flags)) < OK) { + if (!(fd_table[fd]->flags & __FD_NONBLOCK) && + ((ret == -EWOULDBLOCK) || (ret == -EAGAIN))) { + pthread_sched_prevent(); + + /* queue pthread for a FDR_WAIT */ + SET_PF_WAIT_EVENT(pthread_run); + pthread_run->data.fd.fd = fd_table[fd]->fd.i; + pthread_queue_enq(&fd_wait_read, pthread_run); + + if (timeout) { + /* get current time */ + struct timespec current_time; + machdep_gettimeofday(¤t_time); + sleep_schedule(& current_time, timeout); + + pthread_resched_resume(PS_FDR_WAIT); + + /* We're awake */ + pthread_sched_prevent(); + if (sleep_cancel(pthread_run) == NOTOK) { + CLEAR_PF_DONE_EVENT(pthread_run); + pthread_sched_resume(); + SET_ERRNO(ETIMEDOUT); + ret = -ETIMEDOUT; + break; + } + pthread_sched_resume(); + } else { + pthread_resched_resume(PS_FDR_WAIT); + } + CLEAR_PF_DONE_EVENT(pthread_run); + if (pthread_run->sighandled) /* Added by monty */ + { /* We where aborted */ + SET_ERRNO(EINTR); + ret= -EINTR; + break; + } + + } else { + SET_ERRNO(-ret); + break; + } + } + return(ret); +} + +/* ========================================================================== + * getmsg_timedwait() + */ +int getmsg_timedwait(int fd, struct strbuf * ctlptr, struct strbuf * dataptr, + int * flags, struct timespec * timeout) +{ + int ret; + + if ((ret = fd_lock(fd, FD_READ, timeout)) == OK) { + ret = getmsg_timedwait_basic(fd, ctlptr, dataptr, flags, timeout); + fd_unlock(fd, FD_READ); + } + return (ret); +} + +/* ========================================================================== + * getmsg() + */ +int getmsg(int fd, struct strbuf * ctlptr, struct strbuf * dataptr, + int * flags) +{ + return(getmsg_timedwait(fd, ctlptr, dataptr, flags, NULL)); +} + +#endif + +/* ========================================================================== + * Here are the berkeley socket functions implemented with stream calls. + * These are not POSIX. + * ======================================================================= */ + +#if (!defined (HAVE_SYSCALL_BIND)) && defined(HAVE_STREAMS) + +/* ========================================================================== + * bind() + */ +int bind(int fd, const struct sockaddr *name, int namelen) +{ + char buf[STREAM_BUF_SIZE]; + union T_primitives * res; + struct T_bind_req * req; + struct T_bind_ack * ack; + struct strbuf strbuf; + int flags, ret; + + if ((ret = fd_lock(fd, FD_RDWR, NULL)) == OK) + { + req = (struct T_bind_req *)buf; + req->PRIM_type = T_BIND_REQ; + req->ADDR_length = namelen; + req->ADDR_offset = sizeof(struct T_bind_req); + req->CONIND_number = 4; + memcpy(buf + sizeof(struct T_bind_req), name, namelen); + + strbuf.len = sizeof(struct T_bind_req) + namelen; + strbuf.maxlen = STREAM_BUF_SIZE; + strbuf.buf = buf; + + if ((ret=putmsg_timedwait_basic(fd, &strbuf, NULL, 0, NULL)) == OK) + { + memset(buf, 0, STREAM_BUF_SIZE); + + strbuf.len = sizeof(struct T_bind_ack) + namelen; + strbuf.maxlen = STREAM_BUF_SIZE; + strbuf.buf = buf; + flags = 0; + + if ((ret = getmsg_timedwait_basic(fd, &strbuf, NULL, + &flags, NULL)) >= OK) + { + res = (union T_primitives *)buf; + + switch(res->type) { + case T_BIND_ACK: + ret = OK; + break; + default: + SET_ERRNO(EPROTO); /* What should this be? */ + ret = NOTOK; + break; + } + } + else + { + SET_ERRNO(-ret); + ret = NOTOK; + } + } + else + { + SET_ERRNO(-ret); + ret = NOTOK; + } + fd_unlock(fd, FD_RDWR); + } + return(ret); +} + +#endif + +#if (!defined (HAVE_SYSCALL_CONNECT)) && defined(HAVE_STREAMS) + +/* ========================================================================== + * connect() + */ +int connect(int fd, const struct sockaddr *name, int namelen) +{ + char buf[STREAM_BUF_SIZE]; + union T_primitives * res; + struct T_conn_req * req; + struct T_conn_con * con; + struct T_ok_ack * ok; + struct strbuf strbuf; + int flags, ret; + + if ((ret = fd_lock(fd, FD_RDWR, NULL)) == OK) + { + req = (struct T_conn_req *)buf; + req->PRIM_type = T_CONN_REQ; + req->DEST_length = namelen; + req->DEST_offset = sizeof(struct T_conn_req); + req->OPT_length = 0; + req->OPT_offset = 0; + memcpy(buf + sizeof(struct T_conn_req), name, namelen); + + strbuf.len = sizeof(struct T_conn_req) + namelen; + strbuf.maxlen = STREAM_BUF_SIZE; + strbuf.buf = buf; + + if ((ret=putmsg_timedwait_basic(fd, &strbuf, NULL, 0, NULL)) != OK) + goto err; + + memset(buf, 0, STREAM_BUF_SIZE); + ok = (struct T_ok_ack *)buf; + + strbuf.maxlen = STREAM_BUF_SIZE; + strbuf.len = STREAM_BUF_SIZE; + strbuf.buf = buf; + flags = 0; + + if ((ret=getmsg_timedwait_basic(fd, &strbuf, NULL, &flags, NULL)) < OK) + goto err; /* Fixed by monty */ + if (ok->PRIM_type != T_OK_ACK) + { + ret= -EPROTO; /* What should this be? */ + goto err; + } + + memset(buf, 0, STREAM_BUF_SIZE); + strbuf.maxlen = STREAM_BUF_SIZE; + strbuf.len = STREAM_BUF_SIZE; + strbuf.buf = buf; + flags = 0; + + if ((ret=getmsg_timedwait_basic(fd, &strbuf, NULL, &flags, NULL) < OK)) + goto err; + + res = (union T_primitives *) buf; + switch(res->type) { + case T_CONN_CON: + ret = OK; + break; + case T_DISCON_IND: + ret= -ECONNREFUSED; + goto err; + default: + ret= -EPROTO; /* What should this be? */ + goto err; + } + fd_unlock(fd, FD_RDWR); + } + return(ret); + + err: + fd_unlock(fd, FD_RDWR); + SET_ERRNO(-ret); /* Proably not needed... */ + return NOTOK; +} + +#endif + +#if (!defined (HAVE_SYSCALL_LISTEN)) && defined(HAVE_STREAMS) + +/* ========================================================================== + * listen() + */ +int listen(int fd, int backlog) +{ + return(OK); +} + +#endif + +#if (!defined (HAVE_SYSCALL_SOCKET)) && defined(HAVE_STREAMS) + +extern ssize_t __fd_kern_write(); +static pthread_ssize_t __fd_sysv_read(); +extern int __fd_kern_close(); +extern int __fd_kern_fcntl(); +extern int __fd_kern_writev(); +extern int __fd_kern_readv(); +extern off_t __fd_kern_lseek(); + +/* Normal file operations */ +static struct fd_ops __fd_sysv_ops = { + __fd_kern_write, __fd_sysv_read, __fd_kern_close, __fd_kern_fcntl, + __fd_kern_writev, __fd_kern_readv, __fd_kern_lseek, 1 +}; + +/* ========================================================================== + * read() + */ +static pthread_ssize_t __fd_sysv_read(union fd_data fd_data, int flags, + void *buf, size_t nbytes, struct timespec * timeout) +{ + struct strbuf dataptr; + int fd = fd_data.i; + int getmsg_flags; + int ret; + + getmsg_flags = 0; + dataptr.len = 0; + dataptr.buf = buf; + dataptr.maxlen = nbytes; + + pthread_run->sighandled=0; /* Added by monty */ + while ((ret = machdep_sys_getmsg(fd, NULL, &dataptr, &getmsg_flags)) < OK) { + if (!(fd_table[fd]->flags & __FD_NONBLOCK) && + ((ret == -EWOULDBLOCK) || (ret == -EAGAIN))) { + pthread_sched_prevent(); + + /* queue pthread for a FDR_WAIT */ + pthread_run->data.fd.fd = fd; + SET_PF_WAIT_EVENT(pthread_run); + pthread_queue_enq(&fd_wait_read, pthread_run); + + if (timeout) { + /* get current time */ + struct timespec current_time; + machdep_gettimeofday(¤t_time); + sleep_schedule(& current_time, timeout); + + pthread_resched_resume(PS_FDR_WAIT); + + /* We're awake */ + pthread_sched_prevent(); + if (sleep_cancel(pthread_run) == NOTOK) { + CLEAR_PF_DONE_EVENT(pthread_run); + pthread_sched_resume(); + SET_ERRNO(ETIMEDOUT); + ret = -ETIMEDOUT; + break; + } + pthread_sched_resume(); + } else { + pthread_resched_resume(PS_FDR_WAIT); + } + CLEAR_PF_DONE_EVENT(pthread_run); + if (pthread_run->sighandled) /* Added by monty */ + { /* We where aborted */ + SET_ERRNO(EINTR); + return(NOTOK); + } + } else { + SET_ERRNO(-ret); + return(NOTOK); + break; + } + } + return(dataptr.len); +} + +/* ========================================================================== + * socket_tcp() + */ +static int socket_tcp(int fd) +{ + int ret; + + if ((ret = machdep_sys_open("/dev/tcp", O_RDWR | O_NONBLOCK, 0)) >= OK) { + /* Should fstat the file to determine what type it is */ + fd_table[fd]->ops = & __fd_sysv_ops; + fd_table[fd]->type = FD_FULL_DUPLEX; + fd_table[fd]->fd.i = ret; + fd_table[fd]->flags = 0; + } + return(ret); +} + +/* ========================================================================== + * socket() + */ +int socket(int af, int type, int protocol) +{ + int fd, fd_kern; + + if ((fd = fd_allocate()) < OK) + return (fd); + + switch(af) { + case AF_INET: + switch(type) { + case SOCK_STREAM: + if ((fd_kern = socket_tcp(fd)) >= OK) + return(fd); + SET_ERRNO(-fd_kern); + break; + case SOCK_DGRAM: + if ((fd_kern = machdep_sys_open("/dev/udp", + O_RDWR | O_NONBLOCK, 0)) >= OK) { + /* Should fstat the file to determine what type it is */ + fd_table[fd]->ops = & __fd_sysv_ops; + fd_table[fd]->type = FD_FULL_DUPLEX; + fd_table[fd]->fd.i = fd_kern; + fd_table[fd]->flags = 0; + return(fd); + } + SET_ERRNO(-fd_kern); + break; + default: + SET_ERRNO(EPROTONOSUPPORT); + break; + } + break; + case AF_UNIX: + case AF_ISO: + case AF_NS: + default: + SET_ERRNO(EPROTONOSUPPORT); + break; + } + fd_table[fd]->count = 0; + return(NOTOK); /* Fixed by monty */ +} + +#endif + +#if (!defined (HAVE_SYSCALL_ACCEPT)) && defined(HAVE_STREAMS) + +/* ========================================================================== + * accept_fd() + */ +static int accept_fd(int fd, struct sockaddr *name, int *namelen, char * buf, + int SEQ_number) +{ + struct T_conn_res * res; + struct strbuf strbuf; + int fd_new, fd_kern; + + /* Get a new table entry */ + if ((fd_new = fd_allocate()) < OK) + return(NOTOK); + + /* Get the new kernel entry */ + if (!((fd_kern = socket_tcp(fd_new)) < OK)) { + res = (struct T_conn_res *)buf; + res->PRIM_type = T_CONN_RES; + /* res->QUEUE_ptr = (queue_t *)&fd_kern; */ + res->OPT_length = 0; + res->OPT_offset = 0; + res->SEQ_number = SEQ_number; + + strbuf.maxlen = sizeof(union T_primitives) +sizeof(struct sockaddr); + strbuf.len = sizeof(struct T_conn_ind) + (*namelen); + strbuf.buf = buf; + + { + struct strfdinsert insert; + + insert.ctlbuf.maxlen = (sizeof(union T_primitives) + + sizeof(struct sockaddr)); + insert.ctlbuf.len = sizeof(struct T_conn_ind); + insert.ctlbuf.buf = buf; + insert.databuf.maxlen = 0; + insert.databuf.len = 0; + insert.databuf.buf = NULL; + insert.flags = 0; + insert.fildes = fd_kern; + insert.offset = 4; + /* Should the following be checked ? */ + machdep_sys_ioctl(fd_table[fd]->fd.i, I_FDINSERT, &insert); + } + + /* if (putmsg_timedwait_basic(fd, &strbuf, NULL, 0, NULL) == OK) { + /* return(fd_new); */ + { + int flags = 0; + int ret; + + /* Should the following be checked ? */ + ret = getmsg_timedwait_basic(fd, &strbuf, NULL, &flags, NULL); + return(fd_new); + + } + machdep_sys_close(fd_kern); + } + fd_table[fd_new]->count = 0; + return(NOTOK); +} + + +/* ========================================================================== + * accept() + */ +int accept(int fd, struct sockaddr *name, int *namelen) +{ + char buf[sizeof(union T_primitives) + sizeof(struct sockaddr)]; + struct T_conn_ind * ind; + struct strbuf strbuf; + int flags, ret; + + if ((ret = fd_lock(fd, FD_RDWR, NULL)) == OK) + { + ind = (struct T_conn_ind *)buf; + ind->PRIM_type = T_CONN_IND; + ind->SRC_length = (*namelen); + ind->SRC_offset = sizeof(struct T_conn_ind); + ind->OPT_length = 0; + ind->OPT_offset = 0; + ind->SEQ_number = 0; + + strbuf.maxlen = sizeof(union T_primitives) + sizeof(struct sockaddr); + strbuf.len = sizeof(struct T_conn_ind) + (*namelen); + strbuf.buf = buf; + flags = 0; + + if ((ret=getmsg_timedwait_basic(fd, &strbuf, NULL, &flags, NULL)) < OK) + { + SET_ERRNO(-ret); + ret= NOTOK; + } + else + ret = accept_fd(fd, name, namelen, buf, ind->SEQ_number); + fd_unlock(fd, FD_RDWR); + } + return(ret); +} + +#endif /* HAVE_SYSCALL_ACCEPT */ + +#if (!defined (HAVE_SYSCALL_SENDTO)) && defined (HAVE_STREAMS) + +/* ========================================================================== + * sendto_timedwait() + */ +ssize_t sendto_timedwait(int fd, const void * msg, size_t len, int flags, + const struct sockaddr *name, int namelen, struct timespec * timeout) +{ + char buf[STREAM_BUF_SIZE]; + struct T_unitdata_req * req; + struct strbuf dataptr; + struct strbuf ctlptr; + ssize_t ret, prio; + + req = (struct T_unitdata_req *)buf; + req->PRIM_type = T_UNITDATA_REQ; + req->DEST_length = namelen; + req->DEST_offset = sizeof(struct T_unitdata_req); + req->OPT_length = 0; + req->OPT_offset = 0; + memcpy(buf + sizeof(struct T_unitdata_req), name, namelen); + + ctlptr.len = sizeof(struct T_unitdata_req) + namelen; + ctlptr.maxlen = STREAM_BUF_SIZE; + ctlptr.buf = buf; + + dataptr.len = len; + dataptr.maxlen = len; + dataptr.buf = (void *)msg; + + if ((ret = putmsg_timedwait(fd, &ctlptr, &dataptr, 0, timeout)) == OK) { + ret = len; + } + return(ret); +} + +/* ========================================================================== + * sendto() + */ +ssize_t sendto(int fd, const void * msg, size_t len, int flags, + const struct sockaddr *to, int to_len) +{ + return(sendto_timedwait(fd, msg, len, flags, to, to_len, NULL)); +} + +#endif + +#if (!defined (HAVE_SYSCALL_SEND)) && defined (HAVE_STREAMS) + +/* ========================================================================== + * send_timedwait() + */ +ssize_t send_timedwait(int fd, const void * msg, size_t len, int flags, + struct timespec * timeout) +{ + char buf[STREAM_BUF_SIZE]; + struct T_unitdata_req * req; + struct strbuf dataptr; + struct strbuf ctlptr; + ssize_t ret, prio; + + req = (struct T_unitdata_req *)buf; + req->PRIM_type = T_UNITDATA_REQ; + req->DEST_length = 0; + req->DEST_offset = 0; + req->OPT_length = 0; + req->OPT_offset = 0; + + ctlptr.len = sizeof(struct T_unitdata_req); + ctlptr.maxlen = STREAM_BUF_SIZE; + ctlptr.buf = buf; + + dataptr.len = len; + dataptr.maxlen = len; + dataptr.buf = (void *)msg; + + if ((ret = putmsg_timedwait(fd, &ctlptr, &dataptr, 0, timeout)) == OK) { + ret = len; + } + return(ret); +} + +/* ========================================================================== + * send() + */ +ssize_t send(int fd, const void * msg, size_t len, int flags) +{ + return(send_timedwait(fd, msg, len, flags, NULL)); +} + +#endif + +#if (!defined (HAVE_SYSCALL_RECVFROM)) && defined(HAVE_STREAMS) + +/* ========================================================================== + * recvfrom_timedwait() + */ +ssize_t recvfrom_timedwait(int fd, void * msg, size_t len, int flags, + struct sockaddr * name, int * namelen, struct timespec * timeout) +{ + char buf[STREAM_BUF_SIZE]; + struct T_unitdata_ind * ind; + struct strbuf dataptr; + struct strbuf ctlptr; + int ret, prio; + + ctlptr.len = 0; + ctlptr.maxlen = STREAM_BUF_SIZE; + ctlptr.buf = buf; + + dataptr.maxlen = len; + dataptr.len = 0; + dataptr.buf = msg; + + prio = 0; + + ret = getmsg_timedwait(fd, &ctlptr, &dataptr, &prio, timeout); + if (ret >= OK) { + if (name != NULL) { + ind = (struct T_unitdata_ind *)buf; + + if (*namelen > ind->SRC_length) + *namelen = ind->SRC_length; + memcpy(name, buf + ind->SRC_offset, *namelen); + } + ret = dataptr.len; + } + + return(ret); +} + +/* ========================================================================== + * recvfrom() + */ +ssize_t recvfrom(int fd, void * buf, size_t len, int flags, + struct sockaddr * from, int * from_len) +{ + return(recvfrom_timedwait(fd, buf, len, flags, from, from_len, NULL)); +} + +#endif + +#if (!defined (HAVE_SYSCALL_RECV)) && defined(HAVE_STREAMS) + +/* ========================================================================== + * recv_timedwait() + */ +ssize_t recv_timedwait(int fd, void * msg, size_t len, int flags, + struct timespec * timeout) +{ + char buf[STREAM_BUF_SIZE]; + struct T_unitdata_ind * ind; + struct strbuf dataptr; + struct strbuf ctlptr; + int ret, prio; + + ctlptr.len = 0; + ctlptr.maxlen = STREAM_BUF_SIZE; + ctlptr.buf = buf; + + dataptr.maxlen = len; + dataptr.len = 0; + dataptr.buf = msg; + + prio = 0; + + ret = getmsg_timedwait(fd, &ctlptr, &dataptr, &prio, timeout); + if (ret >= OK) + ret = dataptr.len; + + return(ret); +} + +/* ========================================================================== + * recv() + */ +ssize_t recv(int fd, void * buf, size_t len, int flags, + struct sockaddr * from, int * from_len) +{ + return(recv_timedwait(fd, buf, len, flags, NULL)); +} + +#endif + +#if (!defined (HAVE_SYSCALL_SETSOCKOPT)) && defined(HAVE_STREAMS) +/* ========================================================================== + * setsockopt() + */ +int setsockopt(int s, int level, int optname, const void *optval, int optlen) +{ + return(0); +} +#endif + +struct foo { /* Used by getsockname and getpeername */ + long a; + int b; + struct sockaddr *name; +}; + +#if (!defined (HAVE_SYSCALL_GETSOCKNAME)) && defined(HAVE_STREAMS) +/* ========================================================================== + * getsockname() + */ + + +int getsockname(int s, struct sockaddr *name, int *namelen) +{ + struct foo foo; + int i; + if (*namelen < sizeof(struct sockaddr)) { + SET_ERRNO(ENOMEM); + return(-1); + } + foo.a = 0x84; + foo.b = 0; + foo.name = name; + i = ioctl(s, TI_GETMYNAME, &foo); + *namelen = foo.b; + return(i); +} +#endif + +#if (!defined (HAVE_SYSCALL_GETPEERNAME)) && defined(HAVE_STREAMS) +/* ========================================================================== + * getpeername() ; Added by Monty + */ + +int getpeername(int s, struct sockaddr *name, int *namelen) +{ + struct foo foo; + int i; + if (*namelen < sizeof(struct sockaddr)) { + SET_ERRNO(ENOMEM); + return(-1); + } + foo.a = 0x84; /* Max length ? */ + foo.b = 0; /* Return length */ + foo.name = name; /* Return buffer */ + i = ioctl(s, TI_GETPEERNAME, &foo); + *namelen = foo.b; + return(i); +} +#endif + + +#if (!defined (HAVE_SYSCALL_SHUTDOWN)) && defined(HAVE_STREAMS) +/* ========================================================================== + * shutdown() + */ + +int shutdown(int s, int how) +{ + return(0); +} +#endif diff --git a/lib/libpthread/pthreads/info.c b/lib/libpthread/pthreads/info.c new file mode 100644 index 00000000000..2b9722ba291 --- /dev/null +++ b/lib/libpthread/pthreads/info.c @@ -0,0 +1,77 @@ +/* hello */ + +#include <stdio.h> +#include <pthread.h> +#include <signal.h> + +static const char *const state_names[] = { +#define __pthread_defstate(S,NAME) NAME, +#include "pthread/state.def" +#undef __pthread_defstate + 0 +}; + +void (*dump_thread_info_fn) (struct pthread *, FILE *); + +static void +dump_thread_info (thread, file) + struct pthread *thread; + FILE *file; +{ + /* machdep */ + /* attr */ + /* signals */ + /* wakeup_time */ + /* join */ + fprintf (file, " thread @%p prio %3d %s", thread, + thread->pthread_priority, state_names[(int) thread->state]); + switch (thread->state) { + case PS_FDLR_WAIT: + fprintf (file, " fd %d[%d]", thread->data.fd.fd, + thread->data.fd.branch); + fprintf (file, " owner %pr/%pw", + fd_table[thread->data.fd.fd]->r_owner, + fd_table[thread->data.fd.fd]->w_owner); + break; + } + /* show where the signal handler gets run */ + if (thread == pthread_run) + fprintf (file, "\t\t[ME!]"); + fprintf (file, "\n"); + if (dump_thread_info_fn) + (*dump_thread_info_fn) (thread, file); +} + +static void +pthread_dump_info_to_file (file) + FILE *file; +{ + pthread_t t; + for (t = pthread_link_list; t; t = t->pll) + dump_thread_info (t, file); +} + +void +pthread_dump_info () +{ + if (ftrylockfile (stderr) != 0) + return; + fprintf (stderr, "process id %ld:\n", (long) getpid ()); + pthread_dump_info_to_file (stderr); + funlockfile (stderr); +} + +#ifdef SIGINFO +static void +sig_handler (sig) + int sig; +{ + pthread_dump_info (); +} + +void +pthread_setup_siginfo () +{ + (void) signal (SIGINFO, sig_handler); +} +#endif diff --git a/lib/libpthread/pthreads/init.cc b/lib/libpthread/pthreads/init.cc new file mode 100644 index 00000000000..24a131a60a5 --- /dev/null +++ b/lib/libpthread/pthreads/init.cc @@ -0,0 +1,9 @@ + +/* + * DO not delete this file. The hack here ensures that pthread_init() gets + * called before main does. This doesn't fix everything. It is still + * possible for a c++ module to reley on constructors that need pthreads. + */ +#include <pthread.h> + +char __pthread_init_hack = 42; diff --git a/lib/libpthread/pthreads/mutexattr.c b/lib/libpthread/pthreads/mutexattr.c new file mode 100644 index 00000000000..db6e561ac8f --- /dev/null +++ b/lib/libpthread/pthreads/mutexattr.c @@ -0,0 +1,90 @@ +/* ==== mutexattr.c =========================================================== + * Copyright (c) 1993, 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. + * + * Description : Mutex functions. + * + * 1.00 93/07/19 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: mutexattr.c,v 1.1 1998/07/21 13:20:09 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> + +/* ========================================================================== + * pthread_mutexattr_init() + */ +int pthread_mutexattr_init(pthread_mutexattr_t *attr) +{ + attr->m_type = MUTEX_TYPE_FAST; + return(OK); +} + +/* ========================================================================== + * pthread_mutexattr_destroy() + */ +int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) +{ + return(OK); +} + +/* ========================================================================== + * pthread_mutexattr_settype() + */ +int pthread_mutexattr_settype(pthread_mutexattr_t *attr, unsigned int type) +{ + switch(type) { + case PTHREAD_MUTEXTYPE_FAST: + attr->m_type = MUTEX_TYPE_FAST; + break; + case PTHREAD_MUTEXTYPE_RECURSIVE: + attr->m_type = MUTEX_TYPE_COUNTING_FAST; + break; + case PTHREAD_MUTEXTYPE_DEBUG: + attr->m_type = MUTEX_TYPE_DEBUG; + break; + default: + return(EINVAL); + } + return(OK); +} + +/* ========================================================================== + * pthread_mutexattr_gettype() + */ +int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, unsigned int * type) +{ + *type = (unsigned int)attr->m_type; + return(OK); +} diff --git a/lib/libpthread/pthreads/panic.c b/lib/libpthread/pthreads/panic.c new file mode 100644 index 00000000000..6b963acd651 --- /dev/null +++ b/lib/libpthread/pthreads/panic.c @@ -0,0 +1,58 @@ +/* ==== panic.c ======================================================= + * Copyright (c) 1996 by Larry V. Streepy, Jr. + * 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 Larry V. Streepy, Jr. + * 4. The name of Larry V. Streepy, Jr. may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY Larry V. Streepy, Jr. ``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 Larry V. Streepy, Jr. 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 : pthread kernel panic + * + * 02 Oct 1996 - Larry V. Streepy, Jr. + * - Initial coding + */ + +#include <pthread.h> +#include <stdio.h> +/*---------------------------------------------------------------------- + * Function: panic_kernel + * Purpose: print a message and panic the pthreads kernel + * Args: file name, line number, and function + * Returns: doesn't + * Notes: + *----------------------------------------------------------------------*/ void +panic_kernel( const char *file, unsigned int line, const char *func ) +{ +#ifdef __GNUC__ + (void) fprintf( stderr, "%s:%u: %s%sPhtreads kernel panic.\n", + file, line, func ? func : "", func ? ": " : "" ); + (void) fflush (stderr); +#else + (void) fprintf( stderr, "%s:%u: Phtreads kernel panic.\n", file, line ); + (void) fflush (stderr); +#endif + abort(); +} diff --git a/lib/libpthread/pthreads/prio_queue.c b/lib/libpthread/pthreads/prio_queue.c new file mode 100644 index 00000000000..b03fa788a58 --- /dev/null +++ b/lib/libpthread/pthreads/prio_queue.c @@ -0,0 +1,176 @@ +/* ==== prio_queue.c ========================================================== + * 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. + * + * Description : Priority Queue functions. + * + * 1.00 94/09/19 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: prio_queue.c,v 1.1 1998/07/21 13:20:09 peter Exp $"; +#endif + +#include <pthread.h> + +/* A thread when it becomes eligeble to run is placed on the run queue. + This requires locking the kernel lock +*/ + +/* ========================================================================== + * pthread_prio_queue_init() + */ +void pthread_prio_queue_init(struct pthread_prio_queue * queue) +{ + int i; + + for (i = 0; i <= PTHREAD_MAX_PRIORITY; i++) { + queue->level[i].first = NULL; + queue->level[i].last = NULL; + } + queue->next = NULL; + queue->data = NULL; +} + +/* ========================================================================== + * pthread_priority_enq() + */ +void pthread_prio_queue_enq(struct pthread_prio_queue * queue, + struct pthread * pthread) +{ + int priority = pthread->pthread_priority; + + if (queue->next) { + if (queue->level[priority].first) { + pthread->next = (queue->level[priority].last)->next; + (queue->level[priority].last)->next = pthread; + queue->level[priority].last = pthread; + return; + } + if (priority != PTHREAD_MAX_PRIORITY) { + int prev_priority; + /* Find first higher priority thread queued on queue */ + for (prev_priority = priority + 1; prev_priority <= + PTHREAD_MAX_PRIORITY; prev_priority++) { + if (queue->level[prev_priority].first) { + pthread->next = (queue->level[prev_priority].last)->next; + (queue->level[prev_priority].last)->next = pthread; + queue->level[priority].first = pthread; + queue->level[priority].last = pthread; + return; + } + } + } + } + queue->level[priority].first = pthread; + queue->level[priority].last = pthread; + pthread->next = queue->next; + queue->next = pthread; +} + +/* ========================================================================== + * pthread_prio_queue_deq() + */ +struct pthread * pthread_prio_queue_deq(struct pthread_prio_queue * queue) +{ + struct pthread * pthread; + int priority; + + if (pthread = queue->next) { + priority = queue->next->pthread_priority; + if (queue->level[priority].first == queue->level[priority].last) { + queue->level[priority].first = NULL; + queue->level[priority].last = NULL; + } else { + queue->level[priority].first = pthread->next; + } + queue->next = pthread->next; + pthread->next = NULL; + } + return(pthread); +} + +/* ========================================================================== + * pthread_prio_queue_remove() + */ +int pthread_prio_queue_remove(struct pthread_prio_queue *queue, + struct pthread *thread) +{ + /* XXX This is slow, should start with thread priority */ + int priority = thread->pthread_priority; + struct pthread **current = &(queue->level[priority].first); + struct pthread *prev = NULL; + + if (thread==*current) { + int current_priority=priority+1; + + if (*current == queue->next){ + pthread_prio_queue_deq(queue); + thread->next = NULL; + return(OK); + } + for (current_priority; current_priority <= PTHREAD_MAX_PRIORITY; + current_priority++) { + if (queue->level[current_priority].last) { + queue->level[current_priority].last->next = (*current)->next; + if ((*current)->next && + (*current)->next->pthread_priority == priority) + queue->level[priority].first = (*current)->next; + else { + queue->level[priority].first = NULL; + queue->level[priority].last = NULL; + } + thread->next = NULL; + return(OK); + } + } + } + + if (*current == NULL) /* Mati Sauks */ + { + return (NOTOK); + } + for (prev=*current,current=&((*current)->next); + *current && ((*current)->pthread_priority == priority); + prev=*current,current=&((*current)->next)) { + if (*current == thread) { + if (*current == queue->level[priority].last) { + queue->level[priority].last = prev; + } + + *current = (*current)->next; + thread->next=NULL; + return(OK); + } + } + return(NOTOK); +} + diff --git a/lib/libpthread/pthreads/process.c b/lib/libpthread/pthreads/process.c new file mode 100644 index 00000000000..56e5d882d77 --- /dev/null +++ b/lib/libpthread/pthreads/process.c @@ -0,0 +1,208 @@ +/* ==== process.c ============================================================ + * 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. + * + * Description : Process functions (fork, exec, ...). + * + * 1.23 94/04/18 proven + * -Started coding this file. + */ + +#include <pthread.h> +#include <sys/types.h> +#include <pthread.h> +#include <stdarg.h> +#include <unistd.h> +#ifdef HAVE_ALLOC_H +#include <alloc.h> +#endif + +extern void *alloca(); + +#ifndef lint +static const char rcsid[] = "$Id: process.c,v 1.1 1998/07/21 13:20:09 peter Exp $"; +#endif + +/* ========================================================================== + * fork() + * + * This function requires a sig_prevent()/sig_check_and_resume() for the + * parent. The child never unlocks. + */ +pid_t fork() +{ + pid_t ret; + + pthread_sched_prevent(); + + fd_kern_fork(); + if (ret = machdep_sys_fork()) { /* Parent or error */ + pthread_sched_resume(); + } else { /* Child */ + machdep_unset_thread_timer(NULL); + machdep_stop_timer(NULL); + fork_lock++; + pthread_kernel_lock--; + } + return(ret); +} + +#ifdef HAVE_VFORK +/* The semantics of vfork probably won't mix well with the pthread + library code. Don't even try. */ +pid_t vfork () +{ + return fork (); +} +#endif + +/* ========================================================================== + * execve() + * + * This function requires a sig_prevent()/sig_check_and_resume() if one + * hasn't been done in the fork routine. Normally machdep_sys_execve() + * should never return. + */ +int execve(const char *name, char * const *argv, char * const *envp) +{ + int ret; + + if (!fork_lock) { + pthread_sched_prevent(); + fd_kern_exec(0); + ret = machdep_sys_execve(name, argv, envp); + pthread_sched_resume(); + } else { + fd_kern_exec(1); + ret = machdep_sys_execve(name, argv, envp); + } + return(ret); +} + +/* Variants of execve. Define them here so that the system versions + don't get used and drag in the system version of execve. */ +#include <sys/stat.h> +#include <string.h> +#include <sys/param.h> +extern char **environ; + +static const char *find (const char *name, char *buf) +{ + char *p1, *p2; + extern char *getenv (); + struct stat sb; + + if (strchr (name, '/')) + return name; + p1 = getenv ("PATH"); + if (p1 == 0) + p1 = "/bin:/usr/bin:"; + while (*p1) { + memset (buf, 0, MAXPATHLEN); + p2 = strchr (p1, ':'); + if (p2 == 0) + p2 = p1 + strlen (p1); + strncpy (buf, p1, p2 - p1); + buf[p2 - p1] = 0; + strcat (buf, "/"); + strcat (buf, name); + if (lstat (buf, &sb) == 0) + return buf; + + if (*p2 == ':') + p2++; + p1 = p2; + } + return name; +} + +int execl (const char *path, const char *arg, ...) +{ +#ifdef SCO_3_5 + return execve (path, (char *const *) &arg, environ); +#else + char ** argv; + va_list ap; + int i; + + va_start(ap, arg); + for (i = 1; va_arg(ap, char *) != NULL; i++); + va_end(ap); + + argv = alloca (i * sizeof (char *)); + + va_start(ap, arg); + argv[0] = (char *) arg; + for (i = 1; (argv[i] = (char *) va_arg(ap, char *)) != NULL; i++); + va_end(ap); + + return execve (path, argv, environ); +#endif +} + +int execlp (const char *name, const char *arg, ...) +{ +#ifdef SCO_3_5 + char buf[MAXPATHLEN]; + return execve (find (name, buf), (char *const *) &arg, environ); +#else + char buf[MAXPATHLEN]; + char ** argv; + va_list ap; + int i; + + va_start(ap, arg); + for (i = 1; va_arg(ap, char *) != NULL; i++); + va_end(ap); + + argv = alloca (i * sizeof (char *)); + + va_start(ap, arg); + argv[0] = (char *) arg; + for (i = 1; (argv[i] = (char *) va_arg(ap, char *)) != NULL; i++); + va_end(ap); + + return execve (find (name, buf), argv, environ); +#endif +} + +int execle (const char *name, const char *arg, ... /* , char *const envp[] */); + +/* This one turns on ptrace-style tracing? */ +int exect (const char *path, char *const argv[], char *const envp[]); + +int execv (const char *path, char *const argv[]) { + return execve (path, argv, environ); +} + +int execvp (const char *name, char *const argv[]) { + char buf[MAXPATHLEN]; + return execve (find (name, buf), argv, environ); +} diff --git a/lib/libpthread/pthreads/pthread_cancel.c b/lib/libpthread/pthreads/pthread_cancel.c new file mode 100644 index 00000000000..4191a269027 --- /dev/null +++ b/lib/libpthread/pthreads/pthread_cancel.c @@ -0,0 +1,258 @@ +/* ==== pthread_cancel.c ==================================================== + * Copyright (c) 1996 by Larry V. Streepy, Jr. + * 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 Larry V. Streepy, Jr. + * 4. The name of Larry V. Streepy, Jr. may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY Larry V. Streepy, Jr. ``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 Larry V. Streepy, Jr. 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 : pthread_cancel operations + * + * 27 Sep 1996 - Larry V. Streepy, Jr. + * - Initial coding + */ +#ifndef lint +static const char rcsid[] = "$Id:"; +#endif +#include <pthread.h> +#include <errno.h> +static void possiblyMakeRunnable( pthread_t pthread ); + +/*---------------------------------------------------------------------- + * Function: pthread_cancel + * Purpose: Allows a thread to request that it or another thread + * terminate execution + * Args: + * thread = thread to mark as cancelled + * Returns: + * int 0 = ok, -1 = some error (see errno) + * Notes: + * The thread is simply marked as CANCELLED, it is up to the cancelled + * thread to decide how to handle it. + *----------------------------------------------------------------------*/ int +pthread_cancel( pthread_t pthread ) +{ + int rtn = 0; /* Assume all ok */ + pthread_sched_prevent(); + /* Ensure they gave us a legal pthread pointer */ + if( ! __pthread_is_valid( pthread ) ) { + rtn = ESRCH; /* No such thread */ + } else if( pthread->state == PS_UNALLOCED || pthread->state == PS_DEAD ) { + /* The standard doesn't call these out as errors, so return 0 */ + rtn = 0; + } else { + SET_PF_CANCELLED(pthread); /* Set the flag */ + /* If the thread is in the right state, then stick it on the + * run queue so it will get a chance to process the cancel. + */ + if( pthread != pthread_run ) { + possiblyMakeRunnable( pthread ); + } + } + pthread_sched_resume(); + if( rtn == 0 ) + pthread_testcancel(); /* See if we cancelled ourself */ + return rtn; +} + +/*---------------------------------------------------------------------- + * Function: pthread_setcancelstate + * Purpose: Set the current thread's cancellability state + * Args: + * state = PTHREAD_CANCEL_DISABLE or PTHREAD_CANCEL_ENABLE + * oldstate= pointer to holder for old state or NULL (*MODIFIED*) + * Returns: + * int 0 = ok + * EINVAL = state is neither of the legal states + * Notes: + * This has to be async-cancel safe, so we prevent scheduling in + * here + *----------------------------------------------------------------------*/ + +int +pthread_setcancelstate( int newstate, int *oldstate ) +{ + int ostate = TEST_PF_CANCEL_STATE(pthread_run); + int rtn = 0; + pthread_sched_prevent(); + if( newstate == PTHREAD_CANCEL_ENABLE || + newstate == PTHREAD_CANCEL_DISABLE ) { + SET_PF_CANCEL_STATE(pthread_run, newstate); + if( oldstate != NULL ) + *oldstate = ostate; + } else { /* Invalid new state */ + rtn = EINVAL; + } + pthread_sched_resume(); + if( rtn == 0 ) { + /* Test to see if we have a pending cancel to handle */ + pthread_testcancel(); + } + return rtn; +} + +/*---------------------------------------------------------------------- + * Function: pthread_setcanceltype + * Purpose: Set the current thread's cancellability type + * Args: + * type = PTHREAD_CANCEL_DEFERRED or PTHREAD_CANCEL_ASYNCHRONOUS + * oldtype = pointer to holder for old type or NULL (*MODIFIED*) + * Returns: + * int 0 = ok + * EINVAL = type is neither of the legal states + * Notes: + * This has to be async-cancel safe, so we prevent scheduling in + * here + *----------------------------------------------------------------------*/ + +int +pthread_setcanceltype( int newtype, int *oldtype ) +{ + int otype = TEST_PF_CANCEL_TYPE(pthread_run); + int rtn = 0; + pthread_sched_prevent(); + if( newtype == PTHREAD_CANCEL_DEFERRED || + newtype == PTHREAD_CANCEL_ASYNCHRONOUS) { + SET_PF_CANCEL_TYPE(pthread_run, newtype); + if( oldtype != NULL ) + *oldtype = otype; + } else { /* Invalid new type */ + rtn = EINVAL; + } + pthread_sched_resume(); + if( rtn == 0 ) { + /* Test to see if we have a pending cancel to handle */ + pthread_testcancel(); + } + return rtn; +} + +/*---------------------------------------------------------------------- + * Function: pthread_testcancel + * Purpose: Requests delivery of a pending cancel to the current thread + * Args: void + * Returns: void + * Notes: + * If the current thread has been cancelled, this function will not + * return and the threads exit processing will be initiated. + *----------------------------------------------------------------------*/ + +void +pthread_testcancel( void ) +{ + if( TEST_PF_CANCEL_STATE(pthread_run) == PTHREAD_CANCEL_DISABLE ) { + return; /* Can't be cancelled */ + } + /* Ensure that we aren't in the process of exiting already */ + if( TEST_PF_RUNNING_TO_CANCEL(pthread_run) ) + return; + + /* See if we have been cancelled */ + if( TEST_PF_CANCELLED(pthread_run) ) { + /* Set this flag to avoid recursively calling pthread_exit */ + SET_PF_RUNNING_TO_CANCEL(pthread_run); + pthread_exit( PTHREAD_CANCELLED ); /* Easy - just call pthread_exit */ + } + return; /* Not cancelled */ +} + +/*---------------------------------------------------------------------- + * Function: pthread_cancel_internal + * Purpose: An internal routine to begin the cancel processing + * Args: freelocks = do we need to free locks before exiting + * Returns: void + * Notes: + * This routine is called from pthread_resched_resume + * prior to a context switch, and after a thread has resumed. + * + * The kernel must *NOT* be locked on entry here + *----------------------------------------------------------------------*/ + +void +pthread_cancel_internal( int freelocks ) +{ + pthread_sched_prevent(); /* gotta stay focused */ + /* Since we can be called from pthread_resched_resume(), our + * state is currently not PS_RUNNING. Since we side stepped + * the actually blocking, we need to be removed from the queue + * and marked as running. + */ + if( pthread_run->state != PS_RUNNING ) { + if( pthread_run->queue == NULL ) { + PANIC(); /* Must be on a queue */ + } + /* We MUST NOT put the thread on the prio_queue here. It + * is already running (although it's state has changed) and if we + * put it on the run queue, it will get resumed after it is dead + * and we end up with a nice panic. + */ + pthread_queue_remove(pthread_run->queue, pthread_run); + pthread_run->state = PS_RUNNING; /* we are running */ + } + /* Set this flag to avoid recursively calling pthread_exit */ + SET_PF_RUNNING_TO_CANCEL(pthread_run); + /* Free up any locks we hold if told to. */ + if( freelocks ) { + fd_unlock_for_cancel(); + } + pthread_sched_resume(); + pthread_exit( PTHREAD_CANCELLED ); /* Easy - just call pthread_exit */ +} + +/*---------------------------------------------------------------------- + * Function: possiblyMakeRunnable + * Purpose: Make a thread runnable so it can be cancelled if state allows + * Args: + * pthread = thread to process + * Returns: + * Notes: + *----------------------------------------------------------------------*/ + +static void +possiblyMakeRunnable( pthread_t pthread ) +{ + if( ! TEST_PTHREAD_IS_CANCELLABLE(pthread) ) + return; /* Not currently cancellable */ + /* If the thread is currently runnable, then we just let things + * take their course when it is next resumed. + */ + if( pthread->state == PS_RUNNING ) + return; /* will happen at context switch */ + /* If the thread is sleeping, the it isn't on a queue. */ + if( pthread->state == PS_SLEEP_WAIT ) { + sleep_cancel( pthread ); /* Remove from sleep list */ + } else { + /* Otherwise, we need to take it off the queue and make it runnable */ + if( pthread->queue == NULL ) { + PANIC(); /* Must be on a queue */ + } + pthread_queue_remove(pthread->queue, pthread); + } + /* And make it runnable */ + pthread_prio_queue_enq(pthread_current_prio_queue, pthread); + pthread->old_state = pthread->state; + pthread->state = PS_RUNNING; +} diff --git a/lib/libpthread/pthreads/pthread_init.c b/lib/libpthread/pthreads/pthread_init.c new file mode 100644 index 00000000000..110029290b5 --- /dev/null +++ b/lib/libpthread/pthreads/pthread_init.c @@ -0,0 +1,135 @@ +/* ==== pthread_init.c ======================================================== + * Copyright (c) 1993, 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. + * + * Description : Pthread_init routine. + * + * 1.00 94/09/20 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: pthread_init.c,v 1.1 1998/07/21 13:20:16 peter Exp $"; +#endif + +#include <pthread.h> +#include <stdlib.h> +#include <string.h> + +/* + * errno is declared here to prevent the linker from pulling in errno + * from the C library (and whatever else is in that file). I also use + * errno as the default location for error numbers for the initial thread + * giving some backwards compatibility. + */ +#ifdef errno +#undef errno +#endif + +#if !defined(M_UNIX) +int errno; +#else +extern int errno; +#endif + +/* ========================================================================== + * pthread_init() + * + * We use features of the C++ linker to make sure this function is called + * before anything else is done in the program. See init.cc. + */ +void pthread_init(void) +{ + struct machdep_pthread machdep_data = MACHDEP_PTHREAD_INIT; + + /* Only call this once */ + if (pthread_initial) { + return; + } + + pthread_pagesize = getpagesize(); + + /* Initialize the first thread */ + if ((pthread_initial = (pthread_t)malloc(sizeof(struct pthread))) && + (pthread_current_prio_queue = (struct pthread_prio_queue *) + malloc(sizeof(struct pthread_prio_queue)))) { + memcpy(&(pthread_initial->machdep_data), &machdep_data, + sizeof(machdep_data)); + memcpy(&pthread_initial->attr, &pthread_attr_default, + sizeof(pthread_attr_t)); + + pthread_initial->pthread_priority = PTHREAD_DEFAULT_PRIORITY; + pthread_initial->state = PS_RUNNING; + + pthread_queue_init(&(pthread_initial->join_queue)); + pthread_initial->specific_data = NULL; + pthread_initial->specific_data_count = 0; + pthread_initial->cleanup = NULL; + pthread_initial->queue = NULL; + pthread_initial->next = NULL; + pthread_initial->flags = 0; + pthread_initial->pll = NULL; + pthread_initial->sll = NULL; + + /* PTHREADS spec says we start with cancellability on and deferred */ + SET_PF_CANCEL_STATE(pthread_initial, PTHREAD_CANCEL_ENABLE); + SET_PF_CANCEL_TYPE(pthread_initial, PTHREAD_CANCEL_DEFERRED); + + + /* Ugly errno hack */ + pthread_initial->error_p = &errno; + pthread_initial->error = 0; + + pthread_prio_queue_init(pthread_current_prio_queue); + pthread_link_list = pthread_initial; + pthread_run = pthread_initial; + + uthread_sigmask = &(pthread_run->sigmask); + + /* XXX can I assume the mask and pending siganl sets are empty. */ + sigemptyset(&(pthread_initial->sigpending)); + sigemptyset(&(pthread_initial->sigmask)); + pthread_initial->sigcount = 0; + + /* Initialize the signal handler. */ + sig_init(); + + /* Initialize the fd table. */ + fd_init(); + + /* Start the scheduler */ + machdep_set_thread_timer(&(pthread_run->machdep_data)); +#ifdef M_UNIX + machdep_sys_init(); +#endif + return; + } + PANIC(); +} diff --git a/lib/libpthread/pthreads/pthread_kill.c b/lib/libpthread/pthreads/pthread_kill.c new file mode 100644 index 00000000000..528874b992c --- /dev/null +++ b/lib/libpthread/pthreads/pthread_kill.c @@ -0,0 +1,93 @@ +/* ==== pthread_kill.c ======================================================= + * 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. + * + * Description : pthread_kill function. + * + * 1.32 94/06/12 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: pthread_kill.c,v 1.1 1998/07/21 13:20:18 peter Exp $"; +#endif + +#include <pthread.h> + +/* Defined in sig.c, a linked list of threads currently + * blocked in sigwait(): */ +extern struct pthread * pthread_sigwait; + + +/* ========================================================================== + * pthread_kill() + */ +int pthread_kill(struct pthread * pthread, int sig) +{ + struct pthread ** pthread_ptr; + + pthread_sched_prevent(); + + /* Check who is the current owner of pthread */ +/* if (pthread->kthread != pthread_run->kthread) { */ + if (0) { + } else { + if (pthread->state == PS_SIGWAIT) { + if(sigismember(pthread->data.sigwait, sig)) { + for (pthread_ptr = &pthread_sigwait; + (*pthread_ptr); + pthread_ptr = &((*pthread_ptr)->next)) { + if ((*pthread_ptr) == pthread) { + + /* Take the thread out of the + * pthread_sigwait linked list: */ + *pthread_ptr=(*pthread_ptr)->next; + + *(int *)(pthread->ret) = sig; + pthread_sched_other_resume(pthread); + return(OK); + } + } + /* A thread should not be in the state PS_SIGWAIT + * without being in the pthread_sigwait linked + * list: */ + PANIC(); + } + } + if (!sigismember(&pthread->sigpending,sig)) /* Added by monty */ + { + sigaddset(&(pthread->sigpending), sig); + pthread->sigcount++; + } + } + + pthread_sched_resume(); + return(OK); +} diff --git a/lib/libpthread/pthreads/readv.c b/lib/libpthread/pthreads/readv.c new file mode 100644 index 00000000000..64ec8704f44 --- /dev/null +++ b/lib/libpthread/pthreads/readv.c @@ -0,0 +1,85 @@ +/* ==== readv.c ============================================================ + * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Implementation of readv(). + * + * 1.00 95/06/19 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: readv.c,v 1.1 1998/07/21 13:20:22 peter Exp $"; +#endif + +#include "config.h" + +#ifndef HAVE_SYSCALL_READV + +#include <errno.h> +#include <unistd.h> +#include <sys/uio.h> +#include <sys/types.h> + +/* ========================================================================== + * machdep_sys_readv() + */ +int machdep_sys_readv(int fd, struct iovec * vector, int count) +{ + size_t bytes, i; + char *buffer; + int ret = 0; + + /* Find the total number of bytes to be read. */ + for (bytes = 0, i = 0; i < count; ++i) + bytes += vector[i].iov_len; + + if (bytes) { + /* + * Allocate a temporary buffer to hold the data. + * Don't use alloca because threads tend to have smaller stacks. + */ + if ((buffer = (char *)malloc(bytes)) == NULL) { + return(-ENOMEM); + } + ret = (int)machdep_sys_read(fd, buffer, bytes); + + /* Copy the data from memory specified by VECTOR to BUFFER */ + for (i = 0, bytes = 0; ret > 0; ret -= vector[i].iov_len) { + memcpy(vector[i].iov_base, buffer + bytes, + ret > vector[i].iov_len ? vector[i].iov_len : ret); + bytes += vector[i].iov_len; + } + free(buffer); + } + return(ret); +} + +#endif diff --git a/lib/libpthread/pthreads/schedparam.c b/lib/libpthread/pthreads/schedparam.c new file mode 100644 index 00000000000..599306c0a74 --- /dev/null +++ b/lib/libpthread/pthreads/schedparam.c @@ -0,0 +1,170 @@ +/* ==== schedparam.c ======================================================= + * 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. + * + * Description : Pthread schedparam functions. + * + * 1.38 94/06/15 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: schedparam.c,v 1.1 1998/07/21 13:20:22 peter Exp $"; +#endif + +#include <pthread.h> +#include <sched.h> +#include <errno.h> + +/* ========================================================================== + * sched_get_priority_max + */ +int sched_get_priority_max(int policy) +{ + return PTHREAD_MAX_PRIORITY; +} + +/* ========================================================================== + * sched_get_priority_min + */ +int sched_get_priority_min(int policy) +{ + return PTHREAD_MIN_PRIORITY; +} + +/* Currently only policy is supported */ +/* ========================================================================== + * pthread_setschedparam() + */ +int pthread_setschedparam(pthread_t pthread, int policy, + struct sched_param * param) +{ + enum schedparam_policy new_policy, old_policy; + int ret = OK; + int prio; + + new_policy = policy; + pthread_sched_prevent(); + old_policy = pthread->attr.schedparam_policy; + + if (param) { + if ((param->sched_priority < PTHREAD_MIN_PRIORITY) || + (param->sched_priority > PTHREAD_MAX_PRIORITY)) { + pthread_sched_resume(); + return(EINVAL); + } + prio = param->sched_priority; + } else { + prio = pthread->pthread_priority; + } + + if (pthread == pthread_run) { + switch(new_policy) { + case SCHED_RR: + pthread->attr.schedparam_policy = new_policy; + switch (old_policy) { + case SCHED_FIFO: + machdep_unset_thread_timer(NULL); + default: + pthread->pthread_priority = prio; + break; + } + break; + case SCHED_FIFO: + pthread->attr.schedparam_policy = new_policy; + switch (old_policy) { + case SCHED_IO: + case SCHED_RR: + if (pthread->pthread_priority < prio) { + pthread->pthread_priority = prio; + pthread_sched_resume(); + pthread_yield(); + return(OK); + } + default: + pthread->pthread_priority = prio; + break; + } + break; + case SCHED_IO: + pthread->attr.schedparam_policy = new_policy; + switch (old_policy) { + case SCHED_FIFO: + machdep_unset_thread_timer(NULL); + default: + pthread->pthread_priority = prio; + break; + } + break; + default: + SET_ERRNO(EINVAL); + ret = EINVAL; + break; + } + } else { + switch(new_policy) { + case SCHED_FIFO: + case SCHED_IO: + case SCHED_RR: + if(pthread_prio_queue_remove(pthread_current_prio_queue,pthread) == OK) { + pthread->attr.schedparam_policy = new_policy; + pthread->pthread_priority = prio; + pthread_sched_other_resume(pthread); + } else { + pthread->attr.schedparam_policy = new_policy; + pthread->pthread_priority = prio; + pthread_sched_resume(); + } + return(OK); + break; + default: + SET_ERRNO(EINVAL); + ret = EINVAL; + break; + } + } + + pthread_sched_resume(); + return(ret); +} + +/* ========================================================================== + * pthread_getschedparam() + */ +int pthread_getschedparam(pthread_t pthread, int * policy, + struct sched_param * param) +{ + *policy = pthread->attr.schedparam_policy; + if (param) { + param->sched_priority = pthread->pthread_priority; + } + return(OK); +} + diff --git a/lib/libpthread/pthreads/select.c b/lib/libpthread/pthreads/select.c new file mode 100644 index 00000000000..2b145d9ed16 --- /dev/null +++ b/lib/libpthread/pthreads/select.c @@ -0,0 +1,255 @@ +/* ==== select.c ============================================================ + * 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. + * + * This code based on code contributed by + * Peter Hofmann <peterh@prz.tu-berlin.d400.de> + * + * Description : Select. + * + * 1.23 94/04/26 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: select.c,v 1.1 1998/07/21 13:20:22 peter Exp $"; +#endif + +#include <string.h> +#include <errno.h> +#include <pthread.h> +#include <sys/types.h> +#include <sys/time.h> + +extern struct pthread_queue fd_wait_select; +static struct timeval zero_timeout = { 0, 0 }; /* Moved by monty */ + +/* ========================================================================== + * select() + */ +int select(int numfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) +{ + fd_set real_exceptfds, real_readfds, real_writefds; /* mapped fd_sets */ + fd_set * real_readfds_p, * real_writefds_p, * real_exceptfds_p; + fd_set read_locks, write_locks, rdwr_locks; + struct timespec timeout_time, current_time; + int i, j, ret = 0, got_all_locks = 1; + struct pthread_select_data data; + + if (numfds > dtablesize) { + numfds = dtablesize; + } + + data.nfds = 0; + FD_ZERO(&data.readfds); + FD_ZERO(&data.writefds); + FD_ZERO(&data.exceptfds); + + /* Do this first */ + if (timeout) { + machdep_gettimeofday(¤t_time); + timeout_time.tv_sec = current_time.tv_sec + timeout->tv_sec; + if ((timeout_time.tv_nsec = current_time.tv_nsec + + (timeout->tv_usec * 1000)) > 1000000000) { + timeout_time.tv_nsec -= 1000000000; + timeout_time.tv_sec++; + } + } + + FD_ZERO(&read_locks); + FD_ZERO(&write_locks); + FD_ZERO(&rdwr_locks); + FD_ZERO(&real_readfds); + FD_ZERO(&real_writefds); + FD_ZERO(&real_exceptfds); + + /* lock readfds */ + if (readfds || writefds || exceptfds) { + for (i = 0; i < numfds; i++) { + if ((readfds && (FD_ISSET(i, readfds))) || + (exceptfds && FD_ISSET(i, exceptfds))) { + if (writefds && FD_ISSET(i ,writefds)) { + if ((ret = fd_lock(i, FD_RDWR, NULL)) != OK) { + got_all_locks = 0; + break; + } + FD_SET(i, &rdwr_locks); + FD_SET(fd_table[i]->fd.i,&real_writefds); + } else { + if ((ret = fd_lock(i, FD_READ, NULL)) != OK) { + got_all_locks = 0; + break; + } + FD_SET(i, &read_locks); + } + if (readfds && FD_ISSET(i,readfds)) { + FD_SET(fd_table[i]->fd.i, &real_readfds); + } + if (exceptfds && FD_ISSET(i,exceptfds)) { + FD_SET(fd_table[i]->fd.i, &real_exceptfds); + } + if (fd_table[i]->fd.i >= data.nfds) { + data.nfds = fd_table[i]->fd.i + 1; + } + } else { + if (writefds && FD_ISSET(i, writefds)) { + if ((ret = fd_lock(i, FD_WRITE, NULL)) != OK) { + got_all_locks = 0; + break; + } + FD_SET(i, &write_locks); + FD_SET(fd_table[i]->fd.i,&real_writefds); + if (fd_table[i]->fd.i >= data.nfds) { + data.nfds = fd_table[i]->fd.i + 1; + } + } + } + } + } + + if (got_all_locks) + { + memcpy(&data.readfds,&real_readfds,sizeof(fd_set)); + memcpy(&data.writefds,&real_writefds,sizeof(fd_set)); + memcpy(&data.exceptfds,&real_exceptfds,sizeof(fd_set)); + + real_readfds_p = (readfds == NULL) ? NULL : &real_readfds; + real_writefds_p = (writefds == NULL) ? NULL : &real_writefds; + real_exceptfds_p = (exceptfds == NULL) ? NULL : &real_exceptfds; + + pthread_run->sighandled=0; + if ((ret = machdep_sys_select(data.nfds, real_readfds_p, + real_writefds_p, real_exceptfds_p, + &zero_timeout)) == OK) { + pthread_sched_prevent(); + + real_exceptfds_p = (exceptfds == NULL) ? NULL : &data.exceptfds; + real_writefds_p = (writefds == NULL) ? NULL : &data.writefds; + real_readfds_p = (readfds == NULL) ? NULL : &data.readfds; + + pthread_queue_enq(&fd_wait_select, pthread_run); + pthread_run->data.select_data = &data; + SET_PF_WAIT_EVENT(pthread_run); + + if (timeout) { + machdep_gettimeofday(¤t_time); + sleep_schedule(¤t_time, &timeout_time); + + SET_PF_AT_CANCEL_POINT(pthread_run); + pthread_resched_resume(PS_SELECT_WAIT); + CLEAR_PF_AT_CANCEL_POINT(pthread_run); + + /* We're awake */ + if (sleep_cancel(pthread_run) == NOTOK) { + ret = OK; + } + else + { + int count = 0; + for (i = 0; i < numfds; i++) + { + if (real_readfds_p && (FD_ISSET(i, real_readfds_p))) + count++; + if (real_writefds_p && (FD_ISSET(i, real_writefds_p))) + count++; + if (real_exceptfds_p && (FD_ISSET(i, real_exceptfds_p))) + count++; + } + ret = count; + } + /* Moving this after the sleep_cancel() seemed + * to fix intermittent crashes during heavy + * socket use. (mevans) + */ + CLEAR_PF_DONE_EVENT(pthread_run); + } else { + int count = 0; + SET_PF_AT_CANCEL_POINT(pthread_run); + pthread_resched_resume(PS_SELECT_WAIT); + CLEAR_PF_AT_CANCEL_POINT(pthread_run); + CLEAR_PF_DONE_EVENT(pthread_run); + for (i = 0; i < numfds; i++) + { + if (real_readfds_p && (FD_ISSET(i, real_readfds_p))) + count++; + if (real_writefds_p && (FD_ISSET(i, real_writefds_p))) + count++; + if (real_exceptfds_p && (FD_ISSET(i, real_exceptfds_p))) + count++; + } + ret = count; + } + if (pthread_run->sighandled) /* Added by monty */ + { /* We where aborted */ + ret= NOTOK; + SET_ERRNO(EINTR); + } + } else if (ret < 0) { + SET_ERRNO(-ret); + ret = NOTOK; + } + } + + /* clean up the locks */ + for (i = 0; i < numfds; i++) + { /* Changed by monty */ + if (FD_ISSET(i,&read_locks)) fd_unlock(i,FD_READ); + if (FD_ISSET(i,&rdwr_locks)) fd_unlock(i,FD_RDWR); + if (FD_ISSET(i,&write_locks)) fd_unlock(i,FD_WRITE); + } + if (ret > 0) { + if (readfds != NULL) { + for (i = 0; i < numfds; i++) { + if (! (FD_ISSET(i,readfds) && + FD_ISSET(fd_table[i]->fd.i,real_readfds_p))) + FD_CLR(i,readfds); + } + } + if (writefds != NULL) { + for (i = 0; i < numfds; i++) + if (! (FD_ISSET(i,writefds) && + FD_ISSET(fd_table[i]->fd.i,real_writefds_p))) + FD_CLR(i,writefds); + } + if (exceptfds != NULL) { + for (i = 0; i < numfds; i++) + if (! (FD_ISSET(i,exceptfds) && + FD_ISSET(fd_table[i]->fd.i,real_exceptfds_p))) + FD_CLR(i,exceptfds); + } + } else { + if (exceptfds != NULL) FD_ZERO(exceptfds); + if (writefds != NULL) FD_ZERO(writefds); + if (readfds != NULL) FD_ZERO(readfds); + } + + return(ret); +} diff --git a/lib/libpthread/pthreads/sig.c b/lib/libpthread/pthreads/sig.c new file mode 100644 index 00000000000..7883665d19c --- /dev/null +++ b/lib/libpthread/pthreads/sig.c @@ -0,0 +1,452 @@ +/* ==== sig.c ======================================================= + * 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. + * + * Description : All the thread signal functions. + * + * 1.32 94/06/12 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: sig.c,v 1.1 1998/07/21 13:20:22 peter Exp $"; +#endif + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <string.h> + +#if defined(M_UNIX) +#define signal(A,B) machdep_sys_signal((A),(B)) +#endif + +extern void sig_handler_real(); + +struct pthread * pthread_sigwait; +static sigset_t pending_signals; + +struct pthread_sigvec { + void (*vector)(); + sigset_t mask; + int flags; +} pthread_sigvec[SIGMAX]; + +/* ========================================================================== + * pthread_sig_register() + * + * Assumes the kernel is locked. + */ +int pthread_sig_register(int sig) +{ + struct pthread ** pthread_ptr, * pthread; + int ret; + + /* + * If we have a siginfo structure and the signal is synchronous then + * only deliver the signal to the current thread. + */ + + /* Check waiting threads for delivery */ + for (pthread_ptr = &pthread_sigwait; (*pthread_ptr); + pthread_ptr = &((*pthread_ptr)->next)) { + if (sigismember((*pthread_ptr)->data.sigwait, sig)) { + pthread=*pthread_ptr; + *pthread_ptr=(*pthread_ptr)->next; + + pthread_prio_queue_enq(pthread_current_prio_queue, pthread); + ret = pthread->pthread_priority; + *(int *)(pthread->ret) = sig; + pthread->state = PS_RUNNING; + + return(ret); + } + } + + /* Check current running thread */ + if (pthread_run) { + if (!sigismember(&pthread_run->sigmask, sig)) { + sigaddset(&pthread_run->sigpending, sig); + pthread_run->sigcount++; + return(0); + } + } + + /* Check any running thread */ + for (pthread = pthread_current_prio_queue->next; + pthread; pthread = pthread->next) { + if (!sigismember(&pthread->sigmask, sig)) { + sigaddset(&pthread->sigpending, sig); + pthread->sigcount++; + return(0); + } + } + + /* Check any thread */ + for (pthread = pthread_link_list; pthread; pthread = pthread->pll) { + if (!sigismember(&pthread->sigmask, sig)) { + sigaddset(&pthread->sigpending, sig); + pthread->sigcount++; + return(0); + } + } + + sigaddset(&pending_signals, sig); + return(0); +} + +/* ========================================================================== + * pthread_sig_default() + */ +void pthread_sig_default(int sig) +{ + sigset_t mask, omask; + + if (pthread_sigvec[sig].vector == SIG_DFL) { + /* Set the signal handler to default before issueing the kill */ + signal(sig, SIG_DFL); + kill(getpid(), sig); + sigemptyset(&mask); + sigaddset(&mask, sig); + machdep_sys_sigprocmask(SIG_UNBLOCK, &mask, &omask); + signal(sig, sig_handler_real); + } +} + +/* ========================================================================== + * pthread_sig_process() + * + * Assumes the kernel is locked. + */ +void pthread_sig_process() +{ + void (*vector)(); + int i, j; + + for (i = 1; i < SIGMAX; i++) { + if (sigismember(&(pthread_run->sigpending), i)) { + if (! sigismember(&(pthread_run->sigmask), i)) { + sigdelset(&(pthread_run->sigpending), i); + pthread_run->sigcount--; + + if (pthread_sigvec[i].vector == SIG_IGN) { + continue; + } + if (pthread_sigvec[i].vector == SIG_DFL) { + pthread_sig_default(i); + continue; + } + + { + sigset_t omask; + + sigemptyset(&omask); + /* Save old mask */ + for (j = 1; j < SIGMAX; j++) { + if (sigismember(&(pthread_run->sigmask), j)) { + if (sigismember(&(pthread_sigvec[i].mask), j)) + sigaddset(&(pthread_run->sigmask), j); + sigaddset(&omask, j); + } + } + /* The signal is masked while handling the signal */ + sigaddset(&(pthread_run->sigmask), i); + + /* + * Allow interrupts during a signal, + * but not a change in the vector + */ + vector = pthread_sigvec[i].vector; + if (--pthread_kernel_lock) { + PANIC(); + } + vector(i); + pthread_run->sighandled=1; /* Mark for select; Monty */ + pthread_kernel_lock++; + + memcpy(&(pthread_run->sigmask), &omask, sizeof(omask)); + } + } + } + } +} + +/* ========================================================================== + * pthread_sigmask() + * + * It is unclear wheather this call should be implemented as an atomic + * operation. The resulting mask could be wrong if in the signal + * handler the thread calls sigprocmask for any signal other than the + * signal the handler is dealing with. + */ +int pthread_sigmask(int how, const sigset_t *set, sigset_t * oset) +{ + int i; + + if (oset) { + sigemptyset(oset); + for (i = 1; i < SIGMAX; i++) { + if (sigismember(&(pthread_run->sigmask), i)) { + sigaddset(oset, i); + } + } + } + + if (set) { + switch(how) { + case SIG_BLOCK: + for (i = 1; i < SIGMAX; i++) { + if (sigismember(set, i)) { + sigaddset(&(pthread_run->sigmask), i); + } + } + break; + case SIG_UNBLOCK: + pthread_sched_prevent(); + for (i = 1; i < SIGMAX; i++) { + if (sigismember(set, i)) { + sigdelset(&(pthread_run->sigmask), i); + if (sigismember(&pending_signals, i)) { + sigaddset(&(pthread_run->sigpending), i); + sigdelset(&pending_signals, i); + pthread_run->sigcount++; + } + } + } + pthread_sched_resume(); + break; + case SIG_SETMASK: + sigfillset(&(pthread_run->sigmask)); + pthread_sched_prevent(); + for (i = 1; i < SIGMAX; i++) { + if (! sigismember(set, i)) { + sigdelset(&(pthread_run->sigmask), i); + if (sigismember(&pending_signals, i)) { + sigaddset(&(pthread_run->sigpending), i); + sigdelset(&pending_signals, i); + pthread_run->sigcount++; + } + } + } + pthread_sched_resume(); + break; + default: + SET_ERRNO(EINVAL); + return(NOTOK); + } + } + return(OK); +} + +int sigprocmask(int how, const sigset_t *set, sigset_t * oset) +{ + return(pthread_sigmask(how, set, oset)); +} + +/* ========================================================================== + * sigwait() + */ +int sigwait(const sigset_t * set, int * sig) +{ + int i; + + /* Check that sig is valid */ + *sig = 0; + + pthread_sched_prevent(); + for (i = 1; i < SIGMAX; i++) { + if (sigismember(set, i)) { + /* Check personal signals */ + if (sigismember(&(pthread_run->sigpending), i)) { + sigdelset(&(pthread_run->sigpending), i); + pthread_sched_resume(); + *sig = i; + return(OK); + } + /* Check kernel signals */ + if (sigismember(&pending_signals, i)) { + sigdelset(&pending_signals, i); + pthread_sched_resume(); + *sig = i; + return(OK); + } + } + } + + /* No pending signals, wait for one */ + pthread_run->next = pthread_sigwait; + pthread_sigwait = pthread_run; + pthread_run->data.sigwait = set; + pthread_run->ret = sig; + + SET_PF_AT_CANCEL_POINT(pthread_run); /* This is a cancel point */ + pthread_resched_resume(PS_SIGWAIT); + CLEAR_PF_AT_CANCEL_POINT(pthread_run); /* No longer at cancel point */ + + return(OK); +} + +/* ========================================================================== + * raise() + */ +int raise(int sig) +{ + return(pthread_kill(pthread_self(), sig)); +} + +/* ========================================================================== + * sigsuspend() + */ +int sigsuspend(const sigset_t * mask) +{ + int ret_sig, ret; + sigset_t nm, om; + + sigfillset(&nm); + for(ret_sig = 1; ret_sig < SIGMAX; ret_sig++) { + if (sigismember(mask, ret_sig)) { + sigdelset(&nm, ret_sig); + } + } + pthread_sigmask(SIG_BLOCK, &nm, &om); + if ((ret = sigwait(&nm, &ret_sig)) == OK) { + sigemptyset(&nm); + sigaddset(&nm, ret_sig); + pthread_kill(pthread_self(), ret_sig); + pthread_sigmask(SIG_UNBLOCK, &nm, NULL); + /* There is a race condition here, it's not worth worring about */ + pthread_sigmask(SIG_BLOCK, &nm, NULL); + SET_ERRNO(EINTR); + ret = NOTOK; + } + pthread_sigmask(SIG_SETMASK, &om, NULL); + return(ret); +} + +/* ========================================================================== + * pthread_signal() + */ +void (*pthread_signal(int sig, void (*dispatch)(int)))() +{ + void (*odispatch)(int); + + odispatch = pthread_sigvec[sig].vector; + if ((sig > 0) && (sig < SIGMAX)) { + pthread_sigvec[sig].vector = dispatch; + sigemptyset(&(pthread_sigvec[sig].mask)); + pthread_sigvec[sig].flags = 0; + } + return(odispatch); +} + +/* ========================================================================== + * pthread_sigprocmask() + */ +int pthread_sigaction(int sig, const struct sigaction * act, + struct sigaction * oact) +{ + if ((sig > 0) && (sig < SIGMAX)) { + if (oact) { + memcpy(&(oact->sa_mask), &(pthread_sigvec[sig].mask), + sizeof(sigset_t)); + oact->sa_handler = pthread_sigvec[sig].vector; + oact->sa_flags = pthread_sigvec[sig].flags; + } + if (act) { + memcpy(&(pthread_sigvec[sig].mask), &(act->sa_mask), + sizeof(sigset_t)); + pthread_sigvec[sig].vector = act->sa_handler; + pthread_sigvec[sig].flags = act->sa_flags; + } + return(OK); + } + SET_ERRNO(EINVAL); + return(NOTOK); +} + +/* + * The following here are stolen from BSD because I get mutiply defined + * symbols between sig.o and posix_sig.o in Sun's libc.a under Sunos 4.1.3. + * The problem is that sigprocmask() is defined in posix_sig.o, in the same + * module that a lot of other sigset-primitives are defined, and we have + * our definition of sigprocmask() here, but use those other primitives. + */ + +#undef sigemptyset +#undef sigfillset +#undef sigaddset +#undef sigdelset +#undef sigismember + +static const sigset_t __sigemptyset = __SIGEMPTYSET; +int sigemptyset(sigset_t *set) +{ + *set = __sigemptyset; + return (0); +} + +static const sigset_t __sigfillset = __SIGFILLSET; +int sigfillset(sigset_t * set) +{ + *set = __sigfillset; + return (0); +} + +#define _MAXIMUM_SIG NSIG + +int sigaddset(sigset_t *set, int signo) +{ + if (signo <= 0 || signo >= _MAXIMUM_SIG) { + errno = EINVAL; + return -1; + } + __SIGADDSET(set, signo); + return (0); +} + +int sigdelset(sigset_t *set, int signo) +{ + if (signo <= 0 || signo >= _MAXIMUM_SIG) { + errno = EINVAL; + return -1; + } + __SIGDELSET(set, signo); + return (0); +} + +int sigismember(const sigset_t *set, int signo) +{ + if (signo <= 0 || signo >= _MAXIMUM_SIG) { + errno = EINVAL; + return -1; + } + return(__SIGISMEMBER(set, signo)); +} + diff --git a/lib/libpthread/pthreads/specific.c b/lib/libpthread/pthreads/specific.c new file mode 100644 index 00000000000..95725bed59b --- /dev/null +++ b/lib/libpthread/pthreads/specific.c @@ -0,0 +1,197 @@ +/* ==== specific.c ======================================================= + * 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. + * + * Description : Pthread thread specific data management. + * + * 1.20 94/03/30 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: specific.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +#endif + +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> + +static struct pthread_key key_table[PTHREAD_DATAKEYS_MAX]; +static pthread_mutex_t key_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* ========================================================================== + * pthread_key_create() + */ +int pthread_key_create(pthread_key_t *key, void (*destructor)(void *)) +{ + pthread_mutex_lock(&key_mutex); + for ((*key) = 0; (*key) < PTHREAD_DATAKEYS_MAX; (*key)++) { + if (key_table[(*key)].count == 0) { + key_table[(*key)].count++; + key_table[(*key)].destructor = destructor; + pthread_mutex_init(&(key_table[(*key)].mutex), NULL); + pthread_mutex_unlock(&key_mutex); + return(OK); + } + } + pthread_mutex_unlock(&key_mutex); + return(EAGAIN); +} + +/* ========================================================================== + * pthread_key_delete() + */ +int pthread_key_delete(pthread_key_t key) +{ + int ret; + + if (key < PTHREAD_DATAKEYS_MAX) { + pthread_mutex_lock(&(key_table[key].mutex)); + switch (key_table[key].count) { + case 1: + pthread_mutex_destroy(&(key_table[key].mutex)); + key_table[key].destructor = NULL; + key_table[key].count = 0; + case 0: + ret = OK; + break; + default: + ret = EBUSY; + } + pthread_mutex_unlock(&(key_table[key].mutex)); + } else { + ret = EINVAL; + } + return(ret); +} + +/* ========================================================================== + * pthread_cleanupspecific() + */ +void pthread_cleanupspecific(void) +{ + void * data; + int key; + int itr; + + pthread_mutex_lock(&key_mutex); + for (itr = 0; itr < _POSIX_THREAD_DESTRUTOR_ITERATIONS; itr++) { + for (key = 0; key < PTHREAD_DATAKEYS_MAX; key++) { + if (pthread_run->specific_data_count) { + if (pthread_run->specific_data[key]) { + data = (void *)pthread_run->specific_data[key]; + pthread_run->specific_data[key] = NULL; + pthread_run->specific_data_count--; + if (key_table[key].destructor) { + pthread_mutex_unlock(&key_mutex); + key_table[key].destructor(data); + pthread_mutex_lock(&key_mutex); + } + key_table[key].count--; + } + } else { + free(pthread_run->specific_data); + pthread_mutex_unlock(&key_mutex); + return; + } + } + } + free(pthread_run->specific_data); + pthread_mutex_unlock(&key_mutex); +} + +static inline const void ** pthread_key_allocate_data(void) +{ + const void ** new_data; + if(new_data = (const void**)malloc(sizeof(void *) * PTHREAD_DATAKEYS_MAX)) { + memset((void *)new_data, 0, sizeof(void *) * PTHREAD_DATAKEYS_MAX); + } + return(new_data); +} + +/* ========================================================================== + * pthread_setspecific() + */ +int pthread_setspecific(pthread_key_t key, const void * value) +{ + int ret; + + if ((pthread_run->specific_data) || + (pthread_run->specific_data = pthread_key_allocate_data())) { + if ((key < PTHREAD_DATAKEYS_MAX) && (key_table)) { + pthread_mutex_lock(&(key_table[key].mutex)); + if (key_table[key].count) { + if (pthread_run->specific_data[key] == NULL) { + if (value != NULL) { + pthread_run->specific_data_count++; + key_table[key].count++; + } + } else { + if (value == NULL) { + pthread_run->specific_data_count--; + key_table[key].count--; + } + } + pthread_run->specific_data[key] = value; + ret = OK; + } else { + ret = EINVAL; + } + pthread_mutex_unlock(&(key_table[key].mutex)); + } else { + ret = EINVAL; + } + } else { + ret = ENOMEM; + } + return(ret); +} + +/* ========================================================================== + * pthread_getspecific() + */ +void * pthread_getspecific(pthread_key_t key) +{ + void *ret; + + if ((pthread_run->specific_data) && (key < PTHREAD_DATAKEYS_MAX) + && (key_table)) { + pthread_mutex_lock(&(key_table[key].mutex)); + if (key_table[key].count) { + ret = (void *)pthread_run->specific_data[key]; + } else { + ret = NULL; + } + pthread_mutex_unlock(&(key_table[key].mutex)); + } else { + ret = NULL; + } + return(ret); +} diff --git a/lib/libpthread/pthreads/stat.c b/lib/libpthread/pthreads/stat.c new file mode 100644 index 00000000000..56e65a48c60 --- /dev/null +++ b/lib/libpthread/pthreads/stat.c @@ -0,0 +1,116 @@ +/* ==== stat.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 : All the syscalls dealing with fds. + * + * 1.00 93/05/27 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: stat.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> + +struct stat; +struct statfs; + +/* ========================================================================== + * fstat() + * + * Might want to indirect this. + */ +int fstat(int fd, struct stat *buf) +{ + int ret; + + if ((ret = fd_lock(fd, FD_READ, NULL)) == OK) { + if ((ret = machdep_sys_fstat(fd_table[fd]->fd.i, buf)) < OK) { + SET_ERRNO(-ret); + ret = NOTOK; + } + fd_unlock(fd, FD_READ); + } + return(ret); +} + +/* ========================================================================== + * stat() + */ +int stat(const char * path, struct stat * buf) +{ + int ret; + + if ((ret = machdep_sys_stat(path, buf)) < OK) { + SET_ERRNO(-ret); + ret = NOTOK; + } + return(ret); + +} + +/* ========================================================================== + * lstat() + */ +int lstat(const char * path, struct stat * buf) +{ + int ret; + + if ((ret = machdep_sys_lstat(path, buf)) < OK) { + SET_ERRNO(-ret); + ret = NOTOK; + } + return(ret); + +} + +#ifdef HAVE_SYSCALL_FSTATFS +/* ========================================================================== + * fstatfs() + * + * Might want to indirect this. + */ +int fstatfs(int fd, struct statfs *buf) +{ + int ret; + + if ((ret = fd_lock(fd, FD_READ, NULL)) == OK) { + if ((ret = machdep_sys_fstatfs(fd_table[fd]->fd.i, buf)) < OK) { + SET_ERRNO(-ret); + ret = NOTOK; + } + fd_unlock(fd, FD_READ); + } + return(ret); +} +#endif diff --git a/lib/libpthread/pthreads/wait.c b/lib/libpthread/pthreads/wait.c new file mode 100644 index 00000000000..7ff26b55847 --- /dev/null +++ b/lib/libpthread/pthreads/wait.c @@ -0,0 +1,159 @@ +/* ==== wait.c ============================================================ + * 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. + * + * Description : All the appropriate wait routines. + * + * 1.38 94/06/13 proven + * -Started coding this file. + * + */ + +#ifndef lint +static const char rcsid[] = "$Id: wait.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +#endif + +#include <pthread.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/time.h> +#include <pthread/posix.h> +#include <sys/compat.h> +#include <sys/wait.h> + +/* This is an UGLY hack to get wait to compile, something better is needed. */ +/* #define _POSIX_SOURCE +#undef _POSIX_SOURCE +*/ + +struct pthread_queue wait_queue = { NULL, NULL, NULL }; +extern void sig_handler_real(); + +/* ========================================================================== + * wait_wakeup() + * + * This routine is called by the interrupt handler which has locked + * the current kthread semaphore. Since only threads owned by the + * current kthread can be queue here, no additional locks are necessary. + */ +int wait_wakeup() +{ + struct pthread *pthread; + int ret = 0; + + if (pthread = pthread_queue_deq(& wait_queue)) { + /* Wakeup all threads, and enqueue them on the run queue */ + do { + pthread->state = PS_RUNNING; + if (pthread->pthread_priority > ret) { + ret = pthread->pthread_priority; + } + pthread_prio_queue_enq(pthread_current_prio_queue, pthread); + } while (pthread = pthread_queue_deq(&wait_queue)); + return(ret); + } + return(NOTOK); +} + +/* ========================================================================== + * For the wait calls, it is important that the current kthread is locked + * before the apropriate wait syscall is preformed. This way we ensure + * that there is never a case where a thread is waiting for a child but + * missed the interrupt for that child. + * Patched by William S. Lear 1997-02-02 + */ + +/* ========================================================================== + * waitpid() + */ +pid_t waitpid(pid_t pid, int *status, int options) +{ + pid_t ret; + + pthread_sched_prevent(); + ret = machdep_sys_waitpid(pid, status, options | WNOHANG); + /* If we are not doing nohang, try again, else return immediately */ + if (!(options & WNOHANG)) { + while (ret == OK) { + /* Enqueue thread on wait queue */ + pthread_queue_enq(&wait_queue, pthread_run); + + /* reschedule unlocks scheduler */ + SET_PF_AT_CANCEL_POINT(pthread_run); /* This is a cancel point */ + pthread_resched_resume(PS_WAIT_WAIT); + CLEAR_PF_AT_CANCEL_POINT(pthread_run); /* No longer at cancel point */ + + pthread_sched_prevent(); + + ret = machdep_sys_waitpid(pid, status, options | WNOHANG); + } + } + pthread_sched_resume(); + return(ret); +} + +/* ========================================================================== + * wait3() + * Patched by Monty 1997-02-02 + */ +pid_t wait3(__WAIT_STATUS status, int options, void * rusage) +{ + semaphore * lock; + pid_t ret; + + pthread_sched_prevent(); + ret = machdep_sys_wait3(status, options | WNOHANG, rusage); + /* If we are not doing nohang, try again, else return immediately */ + if (!(options & WNOHANG)) { + while (ret == OK) { + /* Enqueue thread on wait queue */ + pthread_queue_enq(&wait_queue, pthread_run); + + /* reschedule unlocks scheduler */ + SET_PF_AT_CANCEL_POINT(pthread_run); /* This is a cancel point */ + pthread_resched_resume(PS_WAIT_WAIT); + CLEAR_PF_AT_CANCEL_POINT(pthread_run); /* No longer at cancel point */ + + pthread_sched_prevent(); + + machdep_sys_wait3(status, options | WNOHANG, rusage); + } + } + pthread_sched_resume(); + return(ret); +} + +/* ========================================================================== + * wait() + */ +pid_t wait(__WAIT_STATUS status) +{ + return(waitpid((pid_t)-1, (int *)status, 0)); +} diff --git a/lib/libpthread/pthreads/wrapper.c b/lib/libpthread/pthreads/wrapper.c new file mode 100644 index 00000000000..7e986706046 --- /dev/null +++ b/lib/libpthread/pthreads/wrapper.c @@ -0,0 +1,130 @@ +/* ==== wrapper.c ============================================================ + * 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. + * + * Description : Wrapper functions for syscalls that only need errno redirected + * + * 1.4x 94/07/23 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: wrapper.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +#endif + +#include <pthread.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <pthread/posix.h> + +/* ========================================================================== + * link() + */ +int link(const char * name1, const char * name2) +{ + int ret; + + if ((ret = machdep_sys_link(name1, name2)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * unlink() + */ +int unlink(const char * path) +{ + int ret; + + if ((ret = machdep_sys_unlink(path)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * chdir() + */ +int chdir(const char * path) +{ + int ret; + + if ((ret = machdep_sys_chdir(path)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * chmod() + */ +int chmod(const char * path, mode_t mode) +{ + int ret; + + if ((ret = machdep_sys_chmod(path, mode)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * chown() + */ +int chown(const char * path, uid_t owner, gid_t group) +{ + int ret; + + if ((ret = machdep_sys_chown(path, owner, group)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} + +/* ========================================================================== + * rename() + */ +int rename(const char * name1, const char * name2) +{ + int ret; + + if ((ret = machdep_sys_rename(name1, name2)) < OK) { + SET_ERRNO(-ret); + } + return(ret); + +} diff --git a/lib/libpthread/pthreads/writev.c b/lib/libpthread/pthreads/writev.c new file mode 100644 index 00000000000..9bc3cba870d --- /dev/null +++ b/lib/libpthread/pthreads/writev.c @@ -0,0 +1,89 @@ +/* ==== writev.c ============================================================ + * Copyright (c) 1995 by Chris Provenzano, proven@mit.edu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Chris Provenzano. + * 4. The name of Chris Provenzano may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Description : Implementation of writev(). + * + * 1.00 95/06/19 proven + * -Started coding this file. + */ + +#ifndef lint +static const char rcsid[] = "$Id: writev.c,v 1.1 1998/07/21 13:20:26 peter Exp $"; +#endif + +#include "config.h" + +#ifndef HAVE_SYSCALL_WRITEV + +#include <errno.h> +#include <unistd.h> +#include <sys/uio.h> +#include <sys/types.h> + +/* ========================================================================== + * machdep_sys_writev() + * + * modified from the GNU C Library posix/writev.c + */ +int machdep_sys_writev(int fd, struct iovec * vector, int count) +{ + size_t bytes, i; + char *buffer; + int ret; + + /* Find the total number of bytes to be written. */ + for (bytes = 0, i = 0; i < count; ++i) + bytes += vector[i].iov_len; + + if (bytes) { + /* + * Allocate a temporary buffer to hold the data. + * Don't use alloca because threads tend to have smaller stacks. + */ + if ((buffer = (char *)malloc(bytes)) == NULL) { + return(-ENOMEM); + } + /* Copy the data from memory specified by VECTOR to BUFFER */ + for (ret = 0, i = 0; i < count; ++i) { + memcpy(buffer + ret, vector[i].iov_base, vector[i].iov_len); + ret += vector[i].iov_len; + } + } else { + buffer = NULL; + } + + ret = (int)machdep_sys_write(fd, buffer, bytes); + if (buffer) + free(buffer); + return(ret); +} + +#endif diff --git a/lib/libpthread/scripts/GNUmakefile.inc b/lib/libpthread/scripts/GNUmakefile.inc new file mode 100755 index 00000000000..6309f28ca55 --- /dev/null +++ b/lib/libpthread/scripts/GNUmakefile.inc @@ -0,0 +1,24 @@ +VPATH := $(VPATH):${srcdir}/scripts +SCRIPTS= pgcc pg++ + +abspath := $(shell pwd) + +all-bin: $(SCRIPTS) + +pgcc: pgcc.sh + sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \ + -e 's!BUILD_PREFIX!$(abspath)!g' \ + -e 's!SRC_PREFIX!$(srcdir)!g' \ + -e 's!COMPILER!gcc!g' \ + < $(srcdir)/scripts/pgcc.sh > pgcc.new + chmod a+x pgcc.new + mv -f pgcc.new pgcc + +pg++: pgcc.sh + sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \ + -e 's!BUILD_PREFIX!$(abspath)!g' \ + -e 's!SRC_PREFIX!$(srcdir)!g' \ + -e 's!COMPILER!g++!g' \ + < $(srcdir)/scripts/pgcc.sh > pg++.new + chmod a+x pg++.new + mv -f pg++.new pg++ diff --git a/lib/libpthread/scripts/Makefile.inc b/lib/libpthread/scripts/Makefile.inc new file mode 100644 index 00000000000..441f6b51d29 --- /dev/null +++ b/lib/libpthread/scripts/Makefile.inc @@ -0,0 +1,30 @@ +.PATH : ${srcdir}/scripts +SCRIPTS= pgcc pg++ + +abspath != pwd + +all-bin: $(SCRIPTS) + +# +# Objects go in the obj directory for both BSD and GNU make but these +# scripts get put in the obj dir for BSD and the root dir for GNU. +# +pgcc: pgcc.sh + sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \ + -e 's!BUILD_PREFIX!$(.CURDIR)!g' \ + -e 's!SRC_PREFIX!$(srcdir)!g' \ + -e 's!COMPILER!gcc!g' \ + < $(srcdir)/scripts/pgcc.sh > pgcc.new + chmod a+x pgcc.new + mv -f pgcc.new pgcc + ln -fs obj/pgcc ../pgcc + +pg++: pgcc.sh + sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \ + -e 's!BUILD_PREFIX!$(.CURDIR)!g' \ + -e 's!SRC_PREFIX!$(srcdir)!g' \ + -e 's!COMPILER!g++!g' \ + < $(srcdir)/scripts/pgcc.sh > pg++.new + chmod a+x pg++.new + mv -f pg++.new pg++ + ln -fs obj/pg++ ../pg++ diff --git a/lib/libpthread/scripts/pgcc.sh b/lib/libpthread/scripts/pgcc.sh new file mode 100755 index 00000000000..6bd6cbeccdb --- /dev/null +++ b/lib/libpthread/scripts/pgcc.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +pthreads_root=EXEC_PREFIX +build_root=BUILD_PREFIX +src_root=SRC_PREFIX + +include_dir='-I$pthreads_root/include' +lib_dir='-L$pthreads_root/lib' +libs='-lpthread -lm -lgcc -lpthread' + +# Might be a good idea to also provide a way to override pthreads_root +# so that we can use this script in the build tree, before installation. +if arg="$1" ; then + case $arg in + -notinstalled) + include_dir='-I$build_root/include -I$src_root/include' + lib_dir='-L$build_root/obj' + shift + ;; + esac +fi + +for arg in "$@" ; do + case $arg in + -nostdinc) include_dir= ;; + -nostdlib | -c) libs= ;; + esac +done + +# Include the -L option in any case, just in case the user provided the +# names of some libraries we've built threaded versions of. +eval exec COMPILER '"$@"' $include_dir $lib_dir $libs diff --git a/lib/libpthread/stdio/GNUmakefile.inc b/lib/libpthread/stdio/GNUmakefile.inc new file mode 100755 index 00000000000..ca26f386f72 --- /dev/null +++ b/lib/libpthread/stdio/GNUmakefile.inc @@ -0,0 +1,26 @@ + +# from: @(#)Makefile.inc 5.7 (Berkeley) 6/27/91 +# $Id: GNUmakefile.inc,v 1.1 1998/07/21 13:20:28 peter Exp $ + +# Thread safe stdio sources +VPATH:= ${VPATH}:${srcdir}/stdio + +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 \ + 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 putc.c \ + putchar.c puts.c putw.c refill.c remove.c rewind.c rget.c scanf.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 xprintf.c $(SRCS) + +# tempnam.c tmpnam.c tmpfile.c +# +# SRCS:= sys_errlist.c $(SRCS) +# sys_errlist.c: make_errlist +# (FOO=`pwd`; cd ${srcdir}/stdio/make_errlist; \ +# $(MAKE) CC=$(CC) srcdir=${srcdir} objdir=$${FOO}) +# `pwd`/make_errlist; |