├── AUTHORS ├── COMPILING.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── LICENSE.txt ├── Makefile ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── README.sxw ├── README.txt ├── USAGE.txt ├── client ├── Makefile.am ├── Makefile.in ├── Makefile_standalone ├── command.c ├── config.c ├── io.c ├── main.c ├── network.c ├── network_v4.c ├── network_v6.c ├── protocol.c ├── ring.c └── transcript.c ├── common ├── Makefile.am ├── Makefile.in ├── common.c ├── common_win32.c ├── error.c └── md5.c ├── config.guess ├── config.sub ├── configure ├── configure.in ├── depcomp ├── include ├── Makefile.am ├── Makefile.in ├── md5.h ├── tsunami-client.h ├── tsunami-cvs-buildnr.h ├── tsunami-server.h └── tsunami.h ├── install-sh ├── missing ├── mk5server ├── COMPILING.txt ├── Makefile.am ├── config.c ├── io.c ├── log.c ├── main.c ├── mk5api.c ├── mk5api.h ├── network.c ├── protocol.c ├── registration.h ├── transcript.c ├── tstamp.c ├── xlrapi.h └── xlrtypes.h ├── mkinstalldirs ├── recompile.sh ├── rtclient ├── Makefile.am ├── Makefile.in ├── command.c ├── config.c ├── io.c ├── main.c ├── network.c ├── network_v4.c ├── network_v6.c ├── protocol.c ├── ring.c ├── transcript.c ├── vsib_ioctl.h ├── vsibctl.c └── vsibctl.h ├── rtserver ├── Makefile.am ├── Makefile.in ├── config.c ├── io.c ├── log.c ├── main.c ├── network.c ├── parse_evn_filename.c ├── parse_evn_filename.h ├── parsecheck.sh ├── protocol.c ├── registration.h ├── transcript.c ├── tstamp.c ├── vsib_ioctl.h ├── vsibctl.c └── vsibctl.h ├── semaphoreExamples ├── sema ├── sema.c ├── semabinit ├── semabinit.c ├── semb └── semb.c ├── server ├── Makefile.am ├── Makefile.in ├── Makefile_standalone ├── config.c ├── io.c ├── log.c ├── main.c ├── network.c ├── protocol.c └── transcript.c ├── util ├── Makefile.am ├── Makefile.in ├── MhDrudge.sh ├── bskp.c ├── dump.c ├── fusereadtest.c ├── insertsorttest.c ├── iperf-tester.sh ├── makeRecexpt-tsunami.sh ├── makeRecexpt-tsunami.txt ├── makeRecexpt.sh ├── readtest.c ├── recexpt-tsunami ├── recexpt-tsunami.head ├── recexpt-tsunami.tail ├── recexpt.head ├── recexpt.tail ├── recpass ├── recpass-tsunami ├── tsuc2plot.sh ├── tsucmatlabplot.m ├── tsunami-testload.sh └── writetest.c └── win32compat ├── pthreadVC2.lib ├── pthreads-compile.txt ├── pthreads-w32-2-7-0-release ├── ANNOUNCE ├── BUGS ├── Bmakefile ├── CONTRIBUTORS ├── COPYING ├── COPYING.LIB ├── ChangeLog ├── FAQ ├── GNUmakefile ├── MAINTAINERS ├── Makefile ├── NEWS ├── Nmakefile ├── Nmakefile.tests ├── PROGRESS ├── README ├── README.Borland ├── README.CV ├── README.NONPORTABLE ├── README.Watcom ├── README.WinCE ├── TODO ├── WinCE-PORT ├── attr.c ├── barrier.c ├── builddmc.bat ├── cancel.c ├── cleanup.c ├── condvar.c ├── config.h ├── create.c ├── dll.c ├── errno.c ├── exit.c ├── fork.c ├── global.c ├── implement.h ├── manual │ ├── ChangeLog │ ├── PortabilityIssues.html │ ├── index.html │ ├── pthreadCancelableWait.html │ ├── pthread_attr_init.html │ ├── pthread_attr_setstackaddr.html │ ├── pthread_attr_setstacksize.html │ ├── pthread_barrier_init.html │ ├── pthread_barrier_wait.html │ ├── pthread_barrierattr_init.html │ ├── pthread_barrierattr_setpshared.html │ ├── pthread_cancel.html │ ├── pthread_cleanup_push.html │ ├── pthread_cond_init.html │ ├── pthread_condattr_init.html │ ├── pthread_condattr_setpshared.html │ ├── pthread_create.html │ ├── pthread_delay_np.html │ ├── pthread_detach.html │ ├── pthread_equal.html │ ├── pthread_exit.html │ ├── pthread_getw32threadhandle_np.html │ ├── pthread_join.html │ ├── pthread_key_create.html │ ├── pthread_kill.html │ ├── pthread_mutex_init.html │ ├── pthread_mutexattr_init.html │ ├── pthread_mutexattr_setpshared.html │ ├── pthread_num_processors_np.html │ ├── pthread_once.html │ ├── pthread_rwlock_init.html │ ├── pthread_rwlock_rdlock.html │ ├── pthread_rwlock_timedrdlock.html │ ├── pthread_rwlock_timedwrlock.html │ ├── pthread_rwlock_unlock.html │ ├── pthread_rwlock_wrlock.html │ ├── pthread_rwlockattr_init.html │ ├── pthread_rwlockattr_setpshared.html │ ├── pthread_self.html │ ├── pthread_setcancelstate.html │ ├── pthread_setcanceltype.html │ ├── pthread_setconcurrency.html │ ├── pthread_setschedparam.html │ ├── pthread_spin_init.html │ ├── pthread_spin_lock.html │ ├── pthread_spin_unlock.html │ ├── pthread_timechange_handler_np.html │ ├── pthread_win32_attach_detach_np.html │ ├── pthread_win32_test_features_np.html │ ├── sched_get_priority_max.html │ ├── sched_getscheduler.html │ ├── sched_setscheduler.html │ ├── sched_yield.html │ └── sem_init.html ├── misc.c ├── mutex.c ├── need_errno.h ├── nonportable.c ├── private.c ├── pthread.c ├── pthread.dsp ├── pthread.dsw ├── pthread.h ├── pthread_attr_destroy.c ├── pthread_attr_getdetachstate.c ├── pthread_attr_getinheritsched.c ├── pthread_attr_getschedparam.c ├── pthread_attr_getschedpolicy.c ├── pthread_attr_getscope.c ├── pthread_attr_getstackaddr.c ├── pthread_attr_getstacksize.c ├── pthread_attr_init.c ├── pthread_attr_setdetachstate.c ├── pthread_attr_setinheritsched.c ├── pthread_attr_setschedparam.c ├── pthread_attr_setschedpolicy.c ├── pthread_attr_setscope.c ├── pthread_attr_setstackaddr.c ├── pthread_attr_setstacksize.c ├── pthread_barrier_destroy.c ├── pthread_barrier_init.c ├── pthread_barrier_wait.c ├── pthread_barrierattr_destroy.c ├── pthread_barrierattr_getpshared.c ├── pthread_barrierattr_init.c ├── pthread_barrierattr_setpshared.c ├── pthread_cancel.c ├── pthread_cond_destroy.c ├── pthread_cond_init.c ├── pthread_cond_signal.c ├── pthread_cond_wait.c ├── pthread_condattr_destroy.c ├── pthread_condattr_getpshared.c ├── pthread_condattr_init.c ├── pthread_condattr_setpshared.c ├── pthread_delay_np.c ├── pthread_detach.c ├── pthread_equal.c ├── pthread_exit.c ├── pthread_getconcurrency.c ├── pthread_getschedparam.c ├── pthread_getspecific.c ├── pthread_getw32threadhandle_np.c ├── pthread_join.c ├── pthread_key_create.c ├── pthread_key_delete.c ├── pthread_kill.c ├── pthread_mutex_destroy.c ├── pthread_mutex_init.c ├── pthread_mutex_lock.c ├── pthread_mutex_timedlock.c ├── pthread_mutex_trylock.c ├── pthread_mutex_unlock.c ├── pthread_mutexattr_destroy.c ├── pthread_mutexattr_getkind_np.c ├── pthread_mutexattr_getpshared.c ├── pthread_mutexattr_gettype.c ├── pthread_mutexattr_init.c ├── pthread_mutexattr_setkind_np.c ├── pthread_mutexattr_setpshared.c ├── pthread_mutexattr_settype.c ├── pthread_num_processors_np.c ├── pthread_once.c ├── pthread_rwlock_destroy.c ├── pthread_rwlock_init.c ├── pthread_rwlock_rdlock.c ├── pthread_rwlock_timedrdlock.c ├── pthread_rwlock_timedwrlock.c ├── pthread_rwlock_tryrdlock.c ├── pthread_rwlock_trywrlock.c ├── pthread_rwlock_unlock.c ├── pthread_rwlock_wrlock.c ├── pthread_rwlockattr_destroy.c ├── pthread_rwlockattr_getpshared.c ├── pthread_rwlockattr_init.c ├── pthread_rwlockattr_setpshared.c ├── pthread_self.c ├── pthread_setcancelstate.c ├── pthread_setcanceltype.c ├── pthread_setconcurrency.c ├── pthread_setschedparam.c ├── pthread_setspecific.c ├── pthread_spin_destroy.c ├── pthread_spin_init.c ├── pthread_spin_lock.c ├── pthread_spin_trylock.c ├── pthread_spin_unlock.c ├── pthread_testcancel.c ├── pthread_timechange_handler_np.c ├── pthread_win32_attach_detach_np.c ├── ptw32_InterlockedCompareExchange.c ├── ptw32_MCS_lock.c ├── ptw32_callUserDestroyRoutines.c ├── ptw32_calloc.c ├── ptw32_cond_check_need_init.c ├── ptw32_getprocessors.c ├── ptw32_is_attr.c ├── ptw32_mutex_check_need_init.c ├── ptw32_new.c ├── ptw32_processInitialize.c ├── ptw32_processTerminate.c ├── ptw32_relmillisecs.c ├── ptw32_reuse.c ├── ptw32_rwlock_cancelwrwait.c ├── ptw32_rwlock_check_need_init.c ├── ptw32_semwait.c ├── ptw32_spinlock_check_need_init.c ├── ptw32_threadDestroy.c ├── ptw32_threadStart.c ├── ptw32_throw.c ├── ptw32_timespec.c ├── ptw32_tkAssocCreate.c ├── ptw32_tkAssocDestroy.c ├── rwlock.c ├── sched.c ├── sched.h ├── sched_get_priority_max.c ├── sched_get_priority_min.c ├── sched_getscheduler.c ├── sched_setscheduler.c ├── sched_yield.c ├── sem_close.c ├── sem_destroy.c ├── sem_getvalue.c ├── sem_init.c ├── sem_open.c ├── sem_post.c ├── sem_post_multiple.c ├── sem_timedwait.c ├── sem_trywait.c ├── sem_unlink.c ├── sem_wait.c ├── semaphore.c ├── semaphore.h ├── signal.c ├── spin.c ├── sync.c ├── tests │ ├── Bmakefile │ ├── ChangeLog │ ├── Debug.dsp │ ├── Debug.dsw │ ├── Debug.plg │ ├── Debug.txt │ ├── GNUmakefile │ ├── Makefile │ ├── README │ ├── README.BENCHTESTS │ ├── SIZES.GC │ ├── SIZES.GCE │ ├── SIZES.VC │ ├── SIZES.VCE │ ├── SIZES.VSE │ ├── Wmakefile │ ├── barrier1.c │ ├── barrier2.c │ ├── barrier3.c │ ├── barrier4.c │ ├── barrier5.c │ ├── benchlib.c │ ├── benchtest.h │ ├── benchtest1.c │ ├── benchtest2.c │ ├── benchtest3.c │ ├── benchtest4.c │ ├── benchtest5.c │ ├── cancel1.c │ ├── cancel2.c │ ├── cancel3.c │ ├── cancel4.c │ ├── cancel5.c │ ├── cancel6a.c │ ├── cancel6d.c │ ├── cancel7.c │ ├── cancel8.c │ ├── cancel9.c │ ├── cleanup0.c │ ├── cleanup1.c │ ├── cleanup2.c │ ├── cleanup3.c │ ├── condvar1.c │ ├── condvar1_1.c │ ├── condvar1_2.c │ ├── condvar2.c │ ├── condvar2_1.c │ ├── condvar3.c │ ├── condvar3_1.c │ ├── condvar3_2.c │ ├── condvar3_3.c │ ├── condvar4.c │ ├── condvar5.c │ ├── condvar6.c │ ├── condvar7.c │ ├── condvar8.c │ ├── condvar9.c │ ├── context1.c │ ├── count1.c │ ├── create1.c │ ├── create2.c │ ├── create3.c │ ├── delay1.c │ ├── delay2.c │ ├── detach1.c │ ├── equal1.c │ ├── errno1.c │ ├── exception1.c │ ├── exception2.c │ ├── exception3.c │ ├── exit1.c │ ├── exit2.c │ ├── exit3.c │ ├── exit4.c │ ├── exit5.c │ ├── eyal1.c │ ├── inherit1.c │ ├── join0.c │ ├── join1.c │ ├── join2.c │ ├── join3.c │ ├── kill1.c │ ├── loadfree.c │ ├── mutex1.c │ ├── mutex1e.c │ ├── mutex1n.c │ ├── mutex1r.c │ ├── mutex2.c │ ├── mutex2e.c │ ├── mutex2r.c │ ├── mutex3.c │ ├── mutex3e.c │ ├── mutex3r.c │ ├── mutex4.c │ ├── mutex5.c │ ├── mutex6.c │ ├── mutex6e.c │ ├── mutex6es.c │ ├── mutex6n.c │ ├── mutex6r.c │ ├── mutex6rs.c │ ├── mutex6s.c │ ├── mutex7.c │ ├── mutex7e.c │ ├── mutex7n.c │ ├── mutex7r.c │ ├── mutex8.c │ ├── mutex8e.c │ ├── mutex8n.c │ ├── mutex8r.c │ ├── once1.c │ ├── once2.c │ ├── once3.c │ ├── once4.c │ ├── priority1.c │ ├── priority2.c │ ├── reuse1.c │ ├── reuse2.c │ ├── rwlock1.c │ ├── rwlock2.c │ ├── rwlock2_t.c │ ├── rwlock3.c │ ├── rwlock3_t.c │ ├── rwlock4.c │ ├── rwlock4_t.c │ ├── rwlock5.c │ ├── rwlock5_t.c │ ├── rwlock6.c │ ├── rwlock6_t.c │ ├── rwlock6_t2.c │ ├── rwlock7.c │ ├── rwlock8.c │ ├── self1.c │ ├── self2.c │ ├── semaphore1.c │ ├── semaphore2.c │ ├── semaphore3.c │ ├── semaphore4.c │ ├── semaphore4t.c │ ├── sizes.c │ ├── spin1.c │ ├── spin2.c │ ├── spin3.c │ ├── spin4.c │ ├── stress1.c │ ├── test.h │ ├── tryentercs.c │ ├── tryentercs2.c │ ├── tsd1.c │ ├── tsd2.c │ ├── valid1.c │ └── valid2.c ├── tsd.c ├── version.rc └── w32_CancelableWait.c └── sys ├── socket.h ├── time.h ├── types.h └── ws2tcpip.h /AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | ... 3 | 4 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | 2 | GPL 3 | 4 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | make install 2 | 3 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/LICENSE.txt -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | # this makefile will be overwritten on the first 'make' run 3 | 4 | all: 5 | sh ./recompile.sh 6 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.3 2007/06/04 12:17:21 jwagnerhki Exp $ 11 | # 12 | 13 | SUBDIRS = include common client server util rtserver rtclient 14 | # SUBDIRS = include common client server util rtserver rtclient mk5server 15 | 16 | # For some reason, we have to list depcomp explicitly, even though 17 | # it's an automake-generated file. :-( 18 | 19 | EXTRA_DIST = LICENSE README.txt depcomp 20 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | none 2 | 3 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | see README.txt 2 | 3 | 4 | -------------------------------------------------------------------------------- /README.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/README.sxw -------------------------------------------------------------------------------- /client/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.3 2008/07/19 19:47:08 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include 14 | 15 | common_lib = $(top_builddir)/common/libtsunami_common.a 16 | 17 | bin_PROGRAMS = tsunami 18 | 19 | tsunami_SOURCES = \ 20 | client.h \ 21 | command.c \ 22 | config.c \ 23 | io.c \ 24 | main.c \ 25 | network.c \ 26 | protocol.c \ 27 | ring.c \ 28 | transcript.c 29 | tsunami_LDADD = $(common_lib) -lpthread 30 | tsunami_DEPENDENCIES = $(common_lib) 31 | # AM_CFLAGS = -DRETX_REQBLOCK_SORTING # too slow 32 | -------------------------------------------------------------------------------- /client/Makefile_standalone: -------------------------------------------------------------------------------- 1 | 2 | SRC = command.c config.c io.c main.c network.c network_v4.c network_v6.c protocol.c ring.c transcript.c \ 3 | ../common/common.c ../common/error.c ../common/md5.c 4 | 5 | CFLAGS = -Wall -O3 -I../common/ -I../include/ -pthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 6 | 7 | tsunami: $(SRC) 8 | $(CC) $(CFLAGS) $(SRC) -o tsunami 9 | -------------------------------------------------------------------------------- /client/io.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/client/io.c -------------------------------------------------------------------------------- /client/network_v4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/client/network_v4.c -------------------------------------------------------------------------------- /client/network_v6.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/client/network_v6.c -------------------------------------------------------------------------------- /common/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.2 2007/08/27 13:37:04 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include 14 | 15 | lib_LIBRARIES = libtsunami_common.a 16 | libtsunami_common_a_SOURCES= md5.c common.c error.c 17 | 18 | # Uncomment this on Playstation3 or other big endian platforms 19 | # before running 'configure': 20 | # AM_CFLAGS = -DARCH_IS_BIG_ENDIAN 21 | -------------------------------------------------------------------------------- /common/common.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/common/common.c -------------------------------------------------------------------------------- /common/common_win32.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/common/common_win32.c -------------------------------------------------------------------------------- /common/error.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/common/error.c -------------------------------------------------------------------------------- /common/md5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/common/md5.c -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.1.1.1 2006/07/20 09:21:19 jwagnerhki Exp $ 11 | # 12 | 13 | include_HEADERS = md5.h tsunami.h 14 | -------------------------------------------------------------------------------- /include/md5.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/include/md5.h -------------------------------------------------------------------------------- /include/tsunami-client.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/include/tsunami-client.h -------------------------------------------------------------------------------- /include/tsunami-cvs-buildnr.h: -------------------------------------------------------------------------------- 1 | /*======================================================================== 2 | * cvs-buildnr.h -- Global definition of CVS Check-in Number 3 | * 4 | * This file needs to be manually edited (yuck...) every time before you 5 | * commit something to the CVS. 6 | * 7 | * The commit/build number in this file will be printed out by the 8 | * tsunami applications on start. That allows people to better control 9 | * which CVS build version they are using since the number is the same 10 | * on all machines after a 'cvs update' or checkout. 11 | * 12 | ========================================================================*/ 13 | 14 | #ifndef __CVS_BUILDNR_H 15 | #define __CVS_BUILDNR_H 16 | 17 | // Build number format: 18 | // v[ongoing version] [devel/final] cvsbuild [incrementing number] 19 | 20 | #define TSUNAMI_CVS_BUILDNR "v1.1 devel cvsbuild 42" 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /include/tsunami.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/include/tsunami.h -------------------------------------------------------------------------------- /mk5server/COMPILING.txt: -------------------------------------------------------------------------------- 1 | 2 | In Makefile.am, "mk5tsunamid_CC = g++" is not supported by automake. 3 | StreamStor library libssapi.a requires g++ version 3.x instead of gcc. 4 | 5 | To compile mk5server: 6 | ./configure 7 | cd common 8 | edit Makefile : change "CC = gcc" into "CC = g++" 9 | make 10 | cd ../mk5server 11 | edit Makefile : change "CC = gcc" into "CC = g++" 12 | make 13 | 14 | (for quick libssapi.a link check: g++ mk5api.c ../common/libtsunami_common.a -lm ../common/libssapi.a -lpthread) 15 | 16 | -------------------------------------------------------------------------------- /mk5server/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.4 2007/05/31 12:50:26 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include -L$(top_builddir)/common 14 | 15 | common_lib = -lm $(top_builddir)/common/libtsunami_common.a -lm $(top_builddir)/common/libssapi.a -lpthread 16 | 17 | bin_PROGRAMS = mk5tsunamid 18 | 19 | mk5tsunamid_SOURCES = \ 20 | config.c \ 21 | io.c \ 22 | log.c \ 23 | main.c \ 24 | network.c \ 25 | protocol.c \ 26 | transcript.c \ 27 | mk5api.c \ 28 | server.h 29 | mk5tsunamid_LDADD = $(common_lib) 30 | mk5tsunamid_DEPENDENCIES = $(common_lib) 31 | mk5tsunamid_LDFLAGS = -L$(top_builddir)/common 32 | mk5tsunamid_CFLAGS = -DMK5SERVER 33 | mk5tsunamid_CXXFLAGS = -DMK5SERVER 34 | 35 | # libssapi.a requires g++ instead of gcc, version 3.x or 2.x 36 | # mk5tsunamid_CC = g++ -- this is not supported by automake 37 | # Instead, edit final Makefile directly and set "CC = g++" manually. 38 | -------------------------------------------------------------------------------- /mk5server/config.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/config.c -------------------------------------------------------------------------------- /mk5server/io.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/io.c -------------------------------------------------------------------------------- /mk5server/log.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/log.c -------------------------------------------------------------------------------- /mk5server/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/main.c -------------------------------------------------------------------------------- /mk5server/mk5api.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/mk5api.c -------------------------------------------------------------------------------- /mk5server/mk5api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/mk5api.h -------------------------------------------------------------------------------- /mk5server/network.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/network.c -------------------------------------------------------------------------------- /mk5server/registration.h: -------------------------------------------------------------------------------- 1 | /* registration.h -- helps in registering RCS ids of each file */ 2 | /* $Id: registration.h,v 1.1 2007/05/31 09:32:07 jwagnerhki Exp $ */ 3 | /* Copyright (C) 1995 Ari Mujunen. (amn@nfra.nl, Ari.Mujunen@hut.fi) */ 4 | 5 | /* This is free software; you can redistribute it and/or modify */ 6 | /* it under the terms of the GNU General Public License. */ 7 | /* See the file 'COPYING' for details. */ 8 | 9 | /* 10 | * $Log: registration.h,v $ 11 | * Revision 1.1 2007/05/31 09:32:07 jwagnerhki 12 | * removed some signedness warnings, added Mark5 server devel start code 13 | * 14 | * Revision 1.1.1.1 2006/07/20 09:21:20 jwagnerhki 15 | * reimport 16 | * 17 | * Revision 1.1 2006/07/10 12:37:21 jwagnerhki 18 | * added to trunk 19 | * 20 | * Revision 1.6 2002/12/18 07:31:03 amn 21 | * Upped revision. 22 | * 23 | * Revision 1.2 2002/12/18 07:31:02 amn 24 | * intermediate 25 | * 26 | * Revision 1.1 2002/12/18 07:23:46 amn 27 | * Recovered from /home disk crash by re-creating 'common' module in CVS. 28 | * 29 | * Revision 1.5 2002/11/03 10:42:22 amn 30 | * Removing "unused" warnings for gcc-295 and gcc-300. 31 | * 32 | * Revision 1.4 1998/05/29 05:51:14 amn 33 | * Comment leader of log lines changed. 34 | * 35 | * Revision 1.3 1997/03/10 08:59:31 amn 36 | * Had to make use of 'rcsid_##file' more complicated as GCC 2.7.2 37 | * had acquired new talents in recognizing dummy uses of variables. 38 | * 39 | * Revision 1.2 1995/03/20 15:01:04 amn 40 | * Changed from C++-style comments to ordinary C comments 41 | * to make this file usable from both C and C++. 42 | * 43 | * Revision 1.1 1995/02/11 19:54:27 amn 44 | * Initial revision 45 | * 46 | */ 47 | 48 | 49 | #ifndef _registration_h 50 | #define _registration_h 1 51 | 52 | /* By embedding static variables containing the RCS special strings */ 53 | /* in the format "$Id xxx$", the resulting object code and executables */ 54 | /* can be examined with the command 'ident'. This macro takes care */ 55 | /* of both defining the static variable and using it, so we don't */ 56 | /* get extra warnings of unused variables in GCC. */ 57 | 58 | #define RCSID(file, id) \ 59 | static char rcsid_##file[] __attribute__ ((unused)) = id; 60 | /* static void *use_rcsid_##file = (&use_rcsid_##file, (void *)&rcsid_##file) */ 61 | 62 | RCSID(registration_h, "$Id: registration.h,v 1.1 2007/05/31 09:32:07 jwagnerhki Exp $"); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /mk5server/transcript.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/transcript.c -------------------------------------------------------------------------------- /mk5server/tstamp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/mk5server/tstamp.c -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | # Author: Noah Friedman 4 | # Created: 1993-05-16 5 | # Public domain 6 | 7 | errstatus=0 8 | dirmode="" 9 | 10 | usage="\ 11 | Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." 12 | 13 | # process command line arguments 14 | while test $# -gt 0 ; do 15 | case "${1}" in 16 | -h | --help | --h* ) # -h for help 17 | echo "${usage}" 1>&2; exit 0 ;; 18 | -m ) # -m PERM arg 19 | shift 20 | test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } 21 | dirmode="${1}" 22 | shift ;; 23 | -- ) shift; break ;; # stop option processing 24 | -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option 25 | * ) break ;; # first non-opt arg 26 | esac 27 | done 28 | 29 | for file 30 | do 31 | if test -d "$file"; then 32 | shift 33 | else 34 | break 35 | fi 36 | done 37 | 38 | case $# in 39 | 0) exit 0 ;; 40 | esac 41 | 42 | case $dirmode in 43 | '') 44 | if mkdir -p -- . 2>/dev/null; then 45 | echo "mkdir -p -- $*" 46 | exec mkdir -p -- "$@" 47 | fi ;; 48 | *) 49 | if mkdir -m "$dirmode" -p -- . 2>/dev/null; then 50 | echo "mkdir -m $dirmode -p -- $*" 51 | exec mkdir -m "$dirmode" -p -- "$@" 52 | fi ;; 53 | esac 54 | 55 | for file 56 | do 57 | set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 58 | shift 59 | 60 | pathcomp= 61 | for d 62 | do 63 | pathcomp="$pathcomp$d" 64 | case "$pathcomp" in 65 | -* ) pathcomp=./$pathcomp ;; 66 | esac 67 | 68 | if test ! -d "$pathcomp"; then 69 | echo "mkdir $pathcomp" 70 | 71 | mkdir "$pathcomp" || lasterr=$? 72 | 73 | if test ! -d "$pathcomp"; then 74 | errstatus=$lasterr 75 | else 76 | if test ! -z "$dirmode"; then 77 | echo "chmod $dirmode $pathcomp" 78 | 79 | lasterr="" 80 | chmod "$dirmode" "$pathcomp" || lasterr=$? 81 | 82 | if test ! -z "$lasterr"; then 83 | errstatus=$lasterr 84 | fi 85 | fi 86 | fi 87 | fi 88 | 89 | pathcomp="$pathcomp/" 90 | done 91 | done 92 | 93 | exit $errstatus 94 | 95 | # Local Variables: 96 | # mode: shell-script 97 | # sh-indentation: 3 98 | # End: 99 | # mkinstalldirs ends here 100 | -------------------------------------------------------------------------------- /recompile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm -f configure 4 | rm -f Makefile 5 | rm -f Makefile.in 6 | rm -f */Makefile 7 | rm -f */Makefile.in 8 | rm -rf */.deps 9 | rm -rf autom4te.cache 10 | 11 | echo "Running aclocal..." 12 | aclocal 13 | echo "Running automake..." 14 | automake 15 | echo "Running autoconf..." 16 | autoconf 17 | ./configure 18 | make clean 19 | make 20 | 21 | echo 22 | echo "You can do a 'sudo make install' to install binaries into /usr/bin" 23 | echo 24 | 25 | 26 | -------------------------------------------------------------------------------- /rtclient/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.5 2008/07/19 19:47:08 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include 14 | 15 | common_lib = $(top_builddir)/common/libtsunami_common.a 16 | 17 | bin_PROGRAMS = rttsunami 18 | 19 | rttsunami_SOURCES = \ 20 | client.h \ 21 | command.c \ 22 | config.c \ 23 | io.c \ 24 | main.c \ 25 | network.c \ 26 | protocol.c \ 27 | ring.c \ 28 | vsibctl.c \ 29 | transcript.c 30 | rttsunami_LDADD = $(common_lib) -lpthread 31 | rttsunami_DEPENDENCIES = $(common_lib) 32 | AM_CFLAGS = -DVSIB_REALTIME # -DRETX_REQBLOCK_SORTING too slow 33 | -------------------------------------------------------------------------------- /rtclient/io.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtclient/io.c -------------------------------------------------------------------------------- /rtclient/network_v4.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtclient/network_v4.c -------------------------------------------------------------------------------- /rtclient/network_v6.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtclient/network_v6.c -------------------------------------------------------------------------------- /rtclient/vsibctl.h: -------------------------------------------------------------------------------- 1 | /*======================================================================== 2 | * vsibctl.h -- VSIB mode settings 3 | * 4 | * This contains extern declarations for VSIB mode setting variables. 5 | * 6 | *========================================================================*/ 7 | 8 | #ifndef __VSIBCTL_H 9 | #define __VSIBCTL_H 10 | 11 | /*------------------------------------------------------------------------ 12 | * External variables 13 | *------------------------------------------------------------------------*/ 14 | 15 | // From vsibctl.c : 16 | extern int vsib_mode; 17 | extern int vsib_mode_gigabit; 18 | extern int vsib_mode_embed_1pps_markers; 19 | extern int vsib_mode_skip_samples; 20 | 21 | #endif 22 | 23 | /*======================================================================== 24 | * $Log: vsibctl.h,v $ 25 | * Revision 1.1 2006/10/19 07:44:06 jwagnerhki 26 | * added VSIB config extern vars 27 | * 28 | */ 29 | -------------------------------------------------------------------------------- /rtserver/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.6 2008/05/22 17:48:37 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include 14 | 15 | common_lib = $(top_builddir)/common/libtsunami_common.a 16 | 17 | bin_PROGRAMS = rttsunamid 18 | 19 | rttsunamid_SOURCES = \ 20 | config.c \ 21 | io.c \ 22 | log.c \ 23 | main.c \ 24 | network.c \ 25 | protocol.c \ 26 | transcript.c \ 27 | vsibctl.c \ 28 | parse_evn_filename.c \ 29 | server.h 30 | rttsunamid_LDADD = $(common_lib) -lm 31 | rttsunamid_DEPENDENCIES = $(common_lib) 32 | AM_CFLAGS = -DVSIB_REALTIME 33 | -------------------------------------------------------------------------------- /rtserver/config.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtserver/config.c -------------------------------------------------------------------------------- /rtserver/io.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtserver/io.c -------------------------------------------------------------------------------- /rtserver/log.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtserver/log.c -------------------------------------------------------------------------------- /rtserver/network.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtserver/network.c -------------------------------------------------------------------------------- /rtserver/parse_evn_filename.h: -------------------------------------------------------------------------------- 1 | #ifndef PARSE_EVN_FILENAME 2 | #define PARSE_EVN_FILENAME 3 | 4 | #include 5 | #include 6 | 7 | struct evn_filename { 8 | char *exp_name; 9 | char *station_code; 10 | char *scan_name; 11 | char *data_start_time_ascii; 12 | double data_start_time; /* system tick seconds time_t (integer) or with fractional seconds (double) */ 13 | char **auxinfo; /* pointer to (array of pointers to aux info elements) */ 14 | int nr_auxinfo; 15 | char *file_type; 16 | char valid; 17 | }; 18 | 19 | struct evn_filename *parse_evn_filename(char *filename); 20 | 21 | char *get_aux_entry(char *key, char **auxinfo, int nr_auxinfo); 22 | 23 | #endif 24 | 25 | /* 26 | * $Log: parse_evn_filename.h,v $ 27 | * Revision 1.3 2007/02/12 13:41:21 jwagnerhki 28 | * mktime() post-fix now parsing really to utc, added 'dl' same as 'flen', added some EVN formats, added parse validity flag 29 | * 30 | * Revision 1.2 2006/10/25 12:14:07 jwagnerhki 31 | * added cvs log line 32 | * 33 | */ 34 | 35 | 36 | -------------------------------------------------------------------------------- /rtserver/parsecheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | rm parsetest 4 | gcc parse_evn_filename.c -DUNIT_TEST -o parsetest -lm 5 | 6 | echo "To successfully pass validation:" 7 | echo " - DEBUG: ... fixed_mktime()=... matches 'expected' value" 8 | echo " - ef->data_start_time equals fixed_mktime() result, OR" 9 | echo " - ef->data_start_time equals 0.0 when start time is " 10 | echo " in the past" 11 | echo " - system time zone does not alter fixed_mktime() result" 12 | echo " - valid or invalid file name is reported" 13 | echo 14 | 15 | ./parsetest gre53_Ef_scan035_154d12h43m10s.vsi 16 | echo " expect: 1180874590 (in 2007)" 17 | echo 18 | ./parsetest gre53_Ef_scan035_154124310.vsi 19 | echo " expect: 1180874590 (in 2007)" 20 | echo 21 | ./parsetest R1262_On_037-1240b_2007037124050_flen=5408000000.evn 22 | echo " expect: 1170765650" 23 | echo 24 | ./parsetest R1262_On_037-1240b_2007037_dl=5408000000.vsi 25 | echo " expect: 1170720000" 26 | echo 27 | ./parsetest R1262_On_037-1240b_2007y037d_dl=5408000000.vsi 28 | echo " expect: 1170720000" 29 | echo 30 | ./parsetest R1262_On_037-1240b_2007y037d12h6m1s_dl=5408000000.vsi 31 | echo " expect: 1170763561" 32 | echo 33 | ./parsetest gre53_Ef_scan035_2006-11-21T08:45:00_dl=14400000.vsi 34 | echo " expect: 1164098700" 35 | echo 36 | ./parsetest dummy_Mh_scan01_134330_dl=1500.vsi 37 | TMPSTR=`date -u --date "13:43:30" +%s` 38 | echo " expect: $TMPSTR (per 'date -u --date '13:43:30' +%s')" 39 | echo 40 | ./parsetest dummy_Mh_scan01_124500.00_dl=1500.vsi 41 | TMPSTR=`date -u --date "12:45:00" +%s` 42 | echo " expect: $TMPSTR (fractional parse not working yet)" 43 | echo 44 | 45 | 46 | -------------------------------------------------------------------------------- /rtserver/registration.h: -------------------------------------------------------------------------------- 1 | /* registration.h -- helps in registering RCS ids of each file */ 2 | /* $Id: registration.h,v 1.1.1.1 2006/07/20 09:21:20 jwagnerhki Exp $ */ 3 | /* Copyright (C) 1995 Ari Mujunen. (amn@nfra.nl, Ari.Mujunen@hut.fi) */ 4 | 5 | /* This is free software; you can redistribute it and/or modify */ 6 | /* it under the terms of the GNU General Public License. */ 7 | /* See the file 'COPYING' for details. */ 8 | 9 | /* 10 | * $Log: registration.h,v $ 11 | * Revision 1.1.1.1 2006/07/20 09:21:20 jwagnerhki 12 | * reimport 13 | * 14 | * Revision 1.1 2006/07/10 12:37:21 jwagnerhki 15 | * added to trunk 16 | * 17 | * Revision 1.6 2002/12/18 07:31:03 amn 18 | * Upped revision. 19 | * 20 | * Revision 1.2 2002/12/18 07:31:02 amn 21 | * intermediate 22 | * 23 | * Revision 1.1 2002/12/18 07:23:46 amn 24 | * Recovered from /home disk crash by re-creating 'common' module in CVS. 25 | * 26 | * Revision 1.5 2002/11/03 10:42:22 amn 27 | * Removing "unused" warnings for gcc-295 and gcc-300. 28 | * 29 | * Revision 1.4 1998/05/29 05:51:14 amn 30 | * Comment leader of log lines changed. 31 | * 32 | * Revision 1.3 1997/03/10 08:59:31 amn 33 | * Had to make use of 'rcsid_##file' more complicated as GCC 2.7.2 34 | * had acquired new talents in recognizing dummy uses of variables. 35 | * 36 | * Revision 1.2 1995/03/20 15:01:04 amn 37 | * Changed from C++-style comments to ordinary C comments 38 | * to make this file usable from both C and C++. 39 | * 40 | * Revision 1.1 1995/02/11 19:54:27 amn 41 | * Initial revision 42 | * 43 | */ 44 | 45 | 46 | #ifndef _registration_h 47 | #define _registration_h 1 48 | 49 | /* By embedding static variables containing the RCS special strings */ 50 | /* in the format "$Id xxx$", the resulting object code and executables */ 51 | /* can be examined with the command 'ident'. This macro takes care */ 52 | /* of both defining the static variable and using it, so we don't */ 53 | /* get extra warnings of unused variables in GCC. */ 54 | 55 | #define RCSID(file, id) \ 56 | static char rcsid_##file[] __attribute__ ((unused)) = id; 57 | /* static void *use_rcsid_##file = (&use_rcsid_##file, (void *)&rcsid_##file) */ 58 | 59 | RCSID(registration_h, "$Id: registration.h,v 1.1.1.1 2006/07/20 09:21:20 jwagnerhki Exp $"); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /rtserver/transcript.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtserver/transcript.c -------------------------------------------------------------------------------- /rtserver/tstamp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/rtserver/tstamp.c -------------------------------------------------------------------------------- /rtserver/vsibctl.h: -------------------------------------------------------------------------------- 1 | /*======================================================================== 2 | * vsibctl.h -- VSIB mode settings 3 | * 4 | * This contains extern declarations for VSIB mode setting variables. 5 | * 6 | *========================================================================*/ 7 | 8 | #ifndef __VSIBCTL_H 9 | #define __VSIBCTL_H 10 | 11 | /*------------------------------------------------------------------------ 12 | * External variables 13 | *------------------------------------------------------------------------*/ 14 | 15 | // From vsibctl.c : 16 | extern int vsib_mode; 17 | extern int vsib_mode_gigabit; 18 | extern int vsib_mode_embed_1pps_markers; 19 | extern int vsib_mode_skip_samples; 20 | 21 | #endif 22 | 23 | /*======================================================================== 24 | * $Log: vsibctl.h,v $ 25 | * Revision 1.1 2006/10/19 07:44:06 jwagnerhki 26 | * added VSIB config extern vars 27 | * 28 | */ 29 | -------------------------------------------------------------------------------- /semaphoreExamples/sema: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/semaphoreExamples/sema -------------------------------------------------------------------------------- /semaphoreExamples/sema.c: -------------------------------------------------------------------------------- 1 | /* Semaphore example program a (sema.c) */ 2 | /* We have two programs, sema and semb. Semb may be initiated at any 3 | time, but will be forced to wait until sema is executed. Sema and 4 | semb do not have to be executed by the same user! */ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #define KEY (1492) 12 | /* This is the external name by which the semaphore is known to any 13 | program that wishes to access it. */ 14 | 15 | void main() 16 | { 17 | int id; /* Internal identifier of the semaphore. */ 18 | struct sembuf operations[1]; 19 | /* An "array" of one operation to perform on the semaphore. */ 20 | 21 | int retval; /* Return value from semop() */ 22 | 23 | /* Get the index for the semaphore with external name KEY. */ 24 | id = semget(KEY, 1, 0666); 25 | if(id < 0) 26 | /* Semaphore does not exist. */ 27 | { 28 | fprintf(stderr, "Program sema cannot find semaphore, exiting.\n"); 29 | exit(0); 30 | } 31 | 32 | /* Do a semaphore V-operation. */ 33 | printf("Program sema about to do a V-operation. \n"); 34 | 35 | /* Set up the sembuf structure. */ 36 | /* Which semaphore in the semaphore array : */ 37 | operations[0].sem_num = 0; 38 | /* Which operation? Add 1 to semaphore value : */ 39 | operations[0].sem_op = 1; 40 | /* Set the flag so we will wait : */ 41 | operations[0].sem_flg = 0; 42 | 43 | /* So do the operation! */ 44 | retval = semop(id, operations, 1); 45 | 46 | if(retval == 0) 47 | { 48 | printf("Successful V-operation by program sema.\n"); 49 | } 50 | else 51 | { 52 | printf("sema: V-operation did not succeed.\n"); 53 | perror("REASON"); 54 | } 55 | } 56 | 57 | /* Think carefully about what the V-operation does. If sema is executed 58 | twice, then semb can execute twice. */ 59 | 60 | -------------------------------------------------------------------------------- /semaphoreExamples/semabinit: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/semaphoreExamples/semabinit -------------------------------------------------------------------------------- /semaphoreExamples/semabinit.c: -------------------------------------------------------------------------------- 1 | /* semabinit.c - initialize a semaphore for use by programs sema and semb */ 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | /* The semaphore key is an arbitrary long integer which serves as an 9 | external identifier by which the semaphore is known to any program 10 | that wishes to use it. */ 11 | 12 | #define KEY (1492) 13 | 14 | void main() 15 | { 16 | int id; /* Number by which the semaphore is known within a program */ 17 | 18 | /* The next thing is an argument to the semctl() function. Semctl() 19 | does various things to the semaphore depending on which arguments 20 | are passed. We will use it to make sure that the value of the 21 | semaphore is initially 0. */ 22 | 23 | union semun { 24 | int val; 25 | struct semid_ds *buf; 26 | ushort * array; 27 | } argument; 28 | 29 | argument.val = 0; 30 | 31 | /* Create the semaphore with external key KEY if it doesn't already 32 | exists. Give permissions to the world. */ 33 | 34 | id = semget(KEY, 1, 0666 | IPC_CREAT); 35 | 36 | /* Always check system returns. */ 37 | 38 | if(id < 0) 39 | { 40 | fprintf(stderr, "Unable to obtain semaphore.\n"); 41 | exit(0); 42 | } 43 | 44 | /* What we actually get is an array of semaphores. The second 45 | argument to semget() was the array dimension - in our case 46 | 1. */ 47 | 48 | /* Set the value of the number 0 semaphore in semaphore array 49 | # id to the value 0. */ 50 | 51 | if( semctl(id, 0, SETVAL, argument) < 0) 52 | { 53 | fprintf( stderr, "Cannot set semaphore value.\n"); 54 | } 55 | else 56 | { 57 | fprintf(stderr, "Semaphore %d initialized.\n", KEY); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /semaphoreExamples/semb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/semaphoreExamples/semb -------------------------------------------------------------------------------- /semaphoreExamples/semb.c: -------------------------------------------------------------------------------- 1 | /* Semaphore example program b (semb.c) */ 2 | /* We have two programs, sema and semb. Semb may be initiated at any 3 | time, but will be forced to wait until sema is executed. Sema and 4 | semb do not have to be executed by the same user! */ 5 | 6 | /* HOW TO TEST: 7 | Execute semb & 8 | The & is important - otherwise you would have have to move to 9 | a different terminal to execute sema. 10 | 11 | Then execute sema. 12 | */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #define KEY (1492) 20 | /* This is the external name by which the semaphore is known to any 21 | program that wishes to access it. */ 22 | 23 | void main() 24 | { 25 | int id; /* Internal identifier of the semaphore. */ 26 | struct sembuf operations[1]; 27 | /* An "array" of one operation to perform on the semaphore. */ 28 | 29 | int retval; /* Return value from semop() */ 30 | 31 | /* Get the index for the semaphore with external name KEY. */ 32 | id = semget(KEY, 1, 0666); 33 | if(id < 0) 34 | /* Semaphore does not exist. */ 35 | { 36 | fprintf(stderr, "Program semb cannot find semaphore, exiting.\n"); 37 | exit(0); 38 | } 39 | 40 | /* Do a semaphore P-operation. */ 41 | printf("Program semb about to do a P-operation. \n"); 42 | printf("Process id is %d\n", getpid()); 43 | 44 | /* Set up the sembuf structure. */ 45 | /* Which semaphore in the semaphore array : */ 46 | operations[0].sem_num = 0; 47 | /* Which operation? Subtract 1 from semaphore value : */ 48 | operations[0].sem_op = -1; 49 | /* Set the flag so we will wait : */ 50 | operations[0].sem_flg = 0; 51 | 52 | /* So do the operation! */ 53 | retval = semop(id, operations, 1); 54 | 55 | if(retval == 0) 56 | { 57 | printf("Successful P-operation by program semb.\n"); 58 | printf("Process id is %d\n", getpid()); 59 | } 60 | else 61 | { 62 | printf("semb: P-operation did not succeed.\n"); 63 | } 64 | } 65 | 66 | /* Think carefully about what the V-operation does. If sema is executed 67 | twice, then semb can execute twice. */ 68 | -------------------------------------------------------------------------------- /server/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.1.1.1 2006/07/20 09:21:20 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include 14 | 15 | common_lib = $(top_builddir)/common/libtsunami_common.a 16 | 17 | bin_PROGRAMS = tsunamid 18 | 19 | tsunamid_SOURCES = \ 20 | config.c \ 21 | io.c \ 22 | log.c \ 23 | main.c \ 24 | network.c \ 25 | protocol.c \ 26 | transcript.c \ 27 | server.h 28 | tsunamid_LDADD = $(common_lib) 29 | tsunamid_DEPENDENCIES = $(common_lib) 30 | -------------------------------------------------------------------------------- /server/Makefile_standalone: -------------------------------------------------------------------------------- 1 | 2 | SRC = config.c io.c log.c main.c network.c protocol.c transcript.c \ 3 | ../common/common.c ../common/error.c ../common/md5.c 4 | 5 | CFLAGS = -Wall -O3 -I../common/ -I../include/ -pthread -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE 6 | 7 | tsunamid: $(SRC) 8 | $(CC) $(CFLAGS) $(SRC) -o tsunamid 9 | -------------------------------------------------------------------------------- /server/config.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/server/config.c -------------------------------------------------------------------------------- /server/io.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/server/io.c -------------------------------------------------------------------------------- /server/log.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/server/log.c -------------------------------------------------------------------------------- /server/network.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/server/network.c -------------------------------------------------------------------------------- /util/Makefile.am: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # 3 | # Copyright (c) 2001-2002 The Trustees of Indiana University. 4 | # All rights reserved. 5 | # 6 | # This file is part of the Tsunami software package. For license 7 | # information, see the LICENSE file in the top level directory of the 8 | # Tsunami source distribution. 9 | # 10 | # $Id: Makefile.am,v 1.2 2007/10/05 05:57:31 jwagnerhki Exp $ 11 | # 12 | 13 | INCLUDES = -I$(top_srcdir)/include 14 | 15 | common_lib = $(top_builddir)/util/libtsunami_common.a 16 | 17 | bin_PROGRAMS = readtest writetest fusereadtest 18 | readtest_SOURCES = readtest.c 19 | #readtest_LDADD = $(common_lib) 20 | #readtest_DEPENDENCIES = $(common_lib) 21 | 22 | writetest_SOURCES = writetest.c 23 | #writetest_LDADD = $(common_lib) 24 | #writetest_DEPENDENCIES = $(common_lib) 25 | 26 | fusereadtest_SOURCES = fusereadtest.c 27 | -------------------------------------------------------------------------------- /util/MhDrudge.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "$1" == "" ]; then 4 | echo -e "Usage: MhDrudge.sh experimentname" 5 | echo -e " Calls drudg to create .snp and .prc" 6 | echo -e " out of 'experimentname'.skd\n" 7 | exit 8 | fi 9 | 10 | # -- purge 11 | basef=${1%.skd} 12 | skdf="${basef}.skd" 13 | prcf="/usr2/proc/${basef}mh.prc" 14 | snpf="/usr2/sched/${basef}mh.snp" 15 | if [ -e $prcf ]; then 16 | echo -n "Proc $prcf exists (y to delete): " 17 | read action 18 | if [ $action == "y" ]; then 19 | rm -f $prcf 20 | else 21 | exit 1 22 | fi 23 | fi 24 | if [ -e $snpf ]; then 25 | echo -n "Snap $snpf exists (y to delete): " 26 | read action 27 | if [ $action == "y" ]; then 28 | rm -f $snpf 29 | else 30 | exit 1 31 | fi 32 | fi 33 | 34 | # -- drudg the files 35 | # Mh\n 36 | # 11\n -- equipment type 37 | # 8 10 0 0\n -- VLBA4 Mark5A n/c n/c 38 | # 12\n \n -- make .prc, use default TPI setting 39 | # 3\n -- make .snp 40 | # ( 5\n -- print summary ) 41 | # 0\n -- exit 42 | keystr="Mh\n11\n8 10 0 0\n12\n \n3\n0\n"; 43 | echo -e $keystr | drudg $skdf 44 | sleep 2 45 | 46 | # -- create PC-EVN scripts 47 | ./makeRecexpt.sh $snpf ${basef} Mh 48 | ./makeRecexpt-tsunami.sh $snpf ${basef} Mh 49 | 50 | # TODO: add Gerhards samplerate detect for ./recpass 51 | 52 | # -- summary 53 | echo 54 | echo "Done drudg'ing and created recexpt scripts" 55 | echo "Start experiment in fieldsystem with: " 56 | echo "> proc=${basef}mh" 57 | echo "> setupsx (assuming geo-VLBI...)" 58 | echo "> schedule=${basef}mh" 59 | echo "Start recexpt scripts on client PC." 60 | echo 61 | 62 | # scp "recexptsunami_${basef}*" jwagner@kurp:/home/jwagner/public_html/expscripts 63 | # http://www.metsahovi.fi/~jwagner/expscripts/ 64 | -------------------------------------------------------------------------------- /util/bskp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * BSKP - byte skip : hard coded byte skipping, reads stdin, writes to stdout 3 | * outputs first three bytes from every 4 byte pair 4 | */ 5 | 6 | #include 7 | 8 | // Compile: 9 | // gcc bskp.c -o bskp 10 | 11 | int main(void) { 12 | int c = 0, i; 13 | 14 | while (c!=EOF) { 15 | for (i=0; i<3 && c!=EOF; i++) { // read+write 3 16 | c = getc(stdin); 17 | putc(c, stdout); 18 | } 19 | c = getc(stdin); // read+skip 1 20 | } 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /util/dump.c: -------------------------------------------------------------------------------- 1 | /* 3-out-of-4 Tsunami mode dumping tool */ 2 | 3 | // Compile: 4 | // gcc dump.c -o dump 5 | #include 6 | 7 | int main(void) 8 | { 9 | int c; 10 | int i=0, j=0; 11 | int addr = 0; 12 | 13 | printf("%04X: ", addr); 14 | while ( EOF!=(c=getc(stdin)) ) { 15 | printf("%02X ", c); 16 | i++; addr++; 17 | if(i>=3) { 18 | j++; 19 | if (j>=4) { j=0; printf("\n%04X: ", addr); } 20 | else { printf(" "); } 21 | i = 0; 22 | } 23 | } 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /util/fusereadtest.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define DIFX_RECEIVE_RING_LENGTH 4 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | struct timeval t_start, t_isopen, t_closed; 13 | double tdelta, tsleeps; 14 | unsigned long randsleep; 15 | static u_char *block; 16 | int i, j; 17 | 18 | FILE* file; 19 | u_int32_t readbytes; 20 | u_int64_t totalread; 21 | 22 | if (argc <= 1) { 23 | printf("Usage: ./fusereadtest filename [readsize in bytes]\n\n"); 24 | return 0; 25 | } 26 | 27 | if (sizeof(off_t) != 8) { 28 | printf("Warning: Not compiled with 64-bit Large File Support, results can be unreliable\n"); 29 | } 30 | 31 | if (argc > 2) { 32 | readbytes = atoi(argv[2]); 33 | } else { 34 | readbytes = 1250*512*2*sizeof(float); // DiFX blockspersend=1250, 512pt FFT, complex 35 | } 36 | block = (u_char *) malloc(readbytes); 37 | 38 | gettimeofday(&t_start, NULL); 39 | srand(*((unsigned int*)&t_start)); 40 | file = fopen(argv[1], "r"); 41 | 42 | totalread = 0; 43 | tsleeps = 0.0; 44 | 45 | gettimeofday(&t_isopen, NULL); 46 | while (1) { 47 | j = rand() / (RAND_MAX/DIFX_RECEIVE_RING_LENGTH); 48 | for (i = 0; i < j; i++) { 49 | totalread += fread(block, 1, readbytes, file); 50 | } 51 | if (feof(file)) 52 | break; 53 | randsleep = (10000LL * 100LL * rand())/ RAND_MAX; // 10ms * 1..100 as usecs 54 | tsleeps += 1e-6 * randsleep; 55 | usleep(randsleep); 56 | } 57 | fclose(file); 58 | 59 | gettimeofday(&t_closed, NULL); 60 | tdelta = (t_closed.tv_sec - t_start.tv_sec) + 1e-6 * (t_closed.tv_usec - t_start.tv_usec); 61 | 62 | printf("Start = %lu.%06lu\n", (unsigned long)t_start.tv_sec, (unsigned long)t_start.tv_usec); 63 | printf("Opened = %lu.%06lu\n", (unsigned long)t_isopen.tv_sec, (unsigned long)t_isopen.tv_usec); 64 | printf("Finished = %lu.%06lu\n", (unsigned long)t_closed.tv_sec, (unsigned long)t_closed.tv_usec); 65 | printf("Delta = %0.3lf sec\n", tdelta); 66 | printf("Sleeps = %0.3lf sec\n", tsleeps); 67 | printf("Speed = %0.3lf Mbps\n", totalread * 8.0 / (tdelta * 1024 * 1024)); 68 | 69 | return 0; 70 | } 71 | 72 | -------------------------------------------------------------------------------- /util/insertsorttest.c: -------------------------------------------------------------------------------- 1 | // gcc insertsorttest.c -o insertsorttest 2 | 3 | int insTab[8192]; 4 | int maxidx; 5 | 6 | void dumpTab() { 7 | int i = 0; 8 | printf(" maxidx=%d ", maxidx); 9 | while(i $OUTFILE 30 | done 31 | done 32 | fi 33 | -------------------------------------------------------------------------------- /util/readtest.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/util/readtest.c -------------------------------------------------------------------------------- /util/recexpt-tsunami: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # RECEXPT-TSUNAMI -- records given scans from a 4 | # remote real-time Tsunami server 5 | # 6 | # Very simple manual script for quick testing. You may 7 | # prefer the 'makeTsunami-recexpt.sh' autogenerator for 8 | # real observations. 9 | # 10 | #---------------------------------------------------------- 11 | # !! Edit before use: ./recpass-tsunami, and data below: !! 12 | 13 | SID=Mh 14 | EXPT=R1255 15 | 16 | SCANS=( 17 | # scanName_yyyy-mm-ddThh:mm:ss secs 18 | scan01_2006-12-19T10:58:00 60 19 | scan02_2006-12-19T11:00:00 220 20 | scan03_2006-12-19T11:15:00 300 21 | ) 22 | 23 | #---------------------------------------------------------- 24 | 25 | USC="_" 26 | for idx in $(seq 0 $((${#SCANS[@]} / 2 - 1))) 27 | do 28 | idx2=$(($idx * 2)) 29 | echo "./recpass-tsunami "$EXPT$USC$SID$USC${SCANS[$idx2]}" ${SCANS[$(($idx2 + 1 ))]}" 30 | ./recpass-tsunami "$EXPT$USC$SID$USC${SCANS[$idx2]}" ${SCANS[$(($idx2 + 1 ))]} 31 | done 32 | -------------------------------------------------------------------------------- /util/recexpt-tsunami.head: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # RECEXPT-TSUNAMI -- records given scans from a 4 | # remote real-time Tsunami server 5 | # 6 | # Autogenerated using 'makeRecexpt-tsunami.sh'. 7 | # All times are UTC. 8 | # 9 | #---------------------------------------------------------- 10 | 11 | HEADROOM=15 # pre-connect to server how many seconds before next scan 12 | SKIPOLDSCANS=1 # set to 1 to skip over old scans, or to 0 to start transfer immediately 13 | 14 | USC="_" # underscore... 15 | 16 | SCANS=( 17 | # name[scanName_yyyy-mm-ddThh:mm:ss] year[yyyy] dayofyear[dd] start[hh:mm:ss] duration[secs] 18 | -------------------------------------------------------------------------------- /util/recexpt-tsunami.tail: -------------------------------------------------------------------------------- 1 | 2 | #---------------------------------------------------------- 3 | 4 | cliPID=0 # previous client process ID 5 | 6 | for idx in $(seq 0 $((${#SCANS[@]} / 5 - 1))) 7 | do 8 | 9 | # -- get the data from the array 10 | idx1=$(($idx * 5)) 11 | idx2=$(($idx1 + 1)) 12 | idx3=$(($idx1 + 2)) 13 | idx4=$(($idx1 + 3)) 14 | idx5=$(($idx1 + 4)) 15 | scanName=${SCANS[$idx1]} 16 | scanYear=${SCANS[$idx2]} 17 | scanDay=${SCANS[$idx3]} 18 | scanStart=${SCANS[$idx4]} 19 | scanDuration=${SCANS[$idx5]} 20 | 21 | 22 | # -- wait until start of next scan 23 | # using HEADROOM startup safety margin 24 | 25 | # sysSecs2start=`date --utc --date "01/01/$scanYear $scanStart + $((scanDay - 1)) days" +%s` 26 | sysSecs2start=`date --utc --date "01/01/$scanYear + $((scanDay - 1)) days $scanStart " +%s` 27 | sysSecsNow=`date --utc +%s` 28 | waitTime=$((sysSecs2start - sysSecsNow - HEADROOM)) 29 | if ((waitTime>0)); then 30 | echo "$0: waiting $waitTime s from now `date --utc +%Y-%m-%dT%H:%M:%S` to start the next scan ${scanName} (len ${scanDuration}s)" 31 | sleep $waitTime; 32 | else 33 | # -- a past scan, decide what to do 34 | if ((SKIPOLDSCANS>0)); then 35 | echo "$0 ERROR: start time in the past (now `date --utc +%Y-%m-%dT%H:%M:%S`), skipping scan ${scanName}" 36 | continue 37 | else 38 | echo "$0 WARNING: start time in the past (now `date --utc +%Y-%m-%dT%H:%M:%S`), beginning scan ${scanName} anyway" 39 | fi 40 | fi 41 | 42 | 43 | # -- check and kill old client if still running (it shouldn't be running, unless the transfer went somehow wrong 44 | # or the HEADROOM setting is larger than the scheduled idle time between scans) 45 | 46 | if ((cliPID>0)); then 47 | if ((`ps -p $cliPID | wc -l` > 1)); then 48 | echo "$0 WARNING: old ./recpass-tsunami still running, now killing it before next scan" 49 | kill -HUP $cliPID 50 | fi 51 | fi 52 | 53 | 54 | # -- start scan download script in the background, and 55 | # go to sleep for the expected duration of the scan 56 | 57 | echo "$0 : time is `date --utc +%Y-%m-%dT%H:%M:%S`" # for debug/check... 58 | echo "$0: invoking ./recpass-tsunami '$EXPT$USC$SID$USC${scanName}' $scanDuration & into background" 59 | # tmStart=`date --utc +%s` 60 | 61 | ./recpass-tsunami "$EXPT$USC$SID$USC${scanName}" $scanDuration & 62 | cliPID=$! 63 | 64 | echo "$0: sleeping..." 65 | sleep $scanDuration 66 | 67 | done 68 | 69 | fg 70 | 71 | -------------------------------------------------------------------------------- /util/recexpt.head: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # RECEXPT -- records given scans to disk 4 | # 5 | # Autogenerated using 'makeRecexpt.sh'. 6 | # All times are UTC. 7 | # 8 | #---------------------------------------------------------- 9 | 10 | SKIPOLDSCANS=1 # set to 1 to skip over old scans, or to 0 to start transfer immediately 11 | 12 | USC="_" # underscore... 13 | 14 | SCANS=( 15 | # name[scanName_yyyy-mm-ddThh:mm:ss] year[yyyy] dayofyear[dd] start[hh:mm:ss] duration[secs] 16 | -------------------------------------------------------------------------------- /util/recexpt.tail: -------------------------------------------------------------------------------- 1 | 2 | #---------------------------------------------------------- 3 | 4 | for idx in $(seq 0 $((${#SCANS[@]} / 5 - 1))) 5 | do 6 | 7 | # -- get the data from the array 8 | idx1=$(($idx * 5)) 9 | idx2=$(($idx1 + 1)) 10 | idx3=$(($idx1 + 2)) 11 | idx4=$(($idx1 + 3)) 12 | idx5=$(($idx1 + 4)) 13 | scanName=${SCANS[$idx1]} 14 | scanYear=${SCANS[$idx2]} 15 | scanDay=${SCANS[$idx3]} 16 | scanStart=${SCANS[$idx4]} 17 | scanDuration=${SCANS[$idx5]} 18 | 19 | sfilename="$EXPT$USC$SID$USC${scanName}" 20 | echo -e "\n\nNext scan in list: ${sfilename}\n" 21 | dstart2 "${sfilename}.evn" 22 | 23 | if (($? > 0)); then 24 | # -- a past scan, decide what to do 25 | if ((SKIPOLDSCANS>0)); then 26 | echo "Skipping old scan - start time was in the past, now it is `date --utc +%Y-%m-%dT%H:%M:%S`" 27 | continue 28 | else 29 | echo "Not skipping old scan - start time was in the past, now it is `date --utc +%Y-%m-%dT%H:%M:%S`" 30 | fi 31 | fi 32 | 33 | ./recpass "${sfilename}" $scanDuration 34 | 35 | done 36 | -------------------------------------------------------------------------------- /util/recpass: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # RECPASS -- records one contiguous time slice to disk 4 | # 5 | # ./recpass scanName recordTimeInSecs 6 | # 7 | # Assumes: 'wr' program is in /usr/bin/ 8 | # 9 | #---------------------------------------------------------- 10 | # Defaults if not specified from command line: 11 | # recording time is 220s / 3min40s 12 | #---------------------------------------------------------- 13 | # !! Edit these before use: !! 14 | # - raiddir : RAID mount point and scan directory 15 | # - FRAMESPERBLOCK : correct frame rate of experiment 16 | #---------------------------------------------------------- 17 | 18 | # Where to place recorded files: 19 | raiddir=/raid/t 20 | 21 | # Recording rate specifed as frame rate: 22 | # 800 frames/blocks/s at 512Mbit/s. 23 | # 400 frames/blocks/s at 256Mbit/s. 24 | # 200 frames/blocks/s at 128Mbit/s. 25 | # One frame/block at 32 tracks is 90000 bytes with parity, 80000 without. 26 | FRAMESPERBLOCK=200 27 | 28 | if [ "$1" == "" ]; then 29 | echo " ./recpass scanname [seconds] " 30 | exit 31 | fi 32 | 33 | # Default to 220 seconds, 3min40s. 34 | if [ "$2" == "" ]; then 35 | SECS=220 36 | echo "defaulting to 220sec" 37 | else 38 | SECS=$2 39 | fi 40 | 41 | mkdir -p $raiddir 42 | filenm=$1 43 | 44 | TOTALBLKS=$(( $SECS * $FRAMESPERBLOCK )) 45 | 46 | # wr: blocksize totalblocks mode skip embed giga ndirs { path%d blks } 47 | # -- 48 | # mode 0 for 32-bit; skip 0 samples, do not embed 1pps, no gigabit mode 49 | # split into smaller files (at 512Mbit/s: 8000 blks ~360MB == 10sec) 50 | # ./wr 80000 $TOTALBLKS 0 0 0 0 1 $dir/%06d 8000 < /dev/vsib 51 | # or just one big file: 52 | 53 | echo "./wr 80000 ${TOTALBLKS} 0 0 0 0 1 ${raiddir}/${filenm}.evn ${TOTALBLKS} < /dev/vsib" 54 | ./wr 80000 $TOTALBLKS 0 0 0 0 1 $raiddir/$filenm.evn $TOTALBLKS < /dev/vsib 55 | -------------------------------------------------------------------------------- /util/recpass-tsunami: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # RECPASS-TSUNAMI -- remote-records one contiguous time slice to disk 4 | # 5 | # ./recpass-tsunami scanName recordTimeInSecs 6 | # 7 | #---------------------------------------------------------- 8 | # !! Edit these before use: !! 9 | 10 | # -- Remote real-time Tsunami server (IP or Hostname) and password (default: kitten) 11 | TSUNAMISERVER="your.server.org" 12 | PASSPHRASE="kitten" 13 | 14 | # -- Remote directory where to backup files to (blank: no backup) 15 | REMOTEDIR= 16 | # REMOTEDIR="./" 17 | 18 | # -- Local root directory where to place downloaded files 19 | ROOTDIR=/raid/t/ 20 | 21 | # -- Recording data rate in bits/sec (check schedule or .prc file for this) 22 | # RATE=128000000 23 | RATE=256000000 24 | # RATE=512000000 25 | 26 | # -- Full path to the 'tsunami' client application directory 27 | TSCLIPATH=`which tsunami` 28 | # TSCLIPATH=/home/oper/cvs/tsunami-udp/client/tsunami 29 | 30 | #---------------------------------------------------------- 31 | 32 | # -- Params check (should be improved with regexp...) 33 | if [ "$1" == "" ] || [ "$2" == "" ]; then 34 | echo "Syntax: ./recpass-tsunami Expt_StationID_scanName_UTCDateTime recordingsecs" 35 | echo " ./recpass-tsunami R1255_Mh_scan01_2006-12-19T11:00:00 60" 36 | exit 37 | fi 38 | 39 | FILE=$1 40 | SECS=$2 41 | 42 | # -- Start the tsunami transfer 43 | pushd $ROOTDIR > /dev/null 44 | RECLEN=$(( $SECS * $RATE / 8 )) 45 | # FLEN="_flen=" # up to and including Tsunami v1.1 b41 46 | FLEN="_dl" # since Tsunami v1.1 b42 and later 47 | TSCMD=" \ 48 | set passphrase $PASSPHRASE \ 49 | connect $TSUNAMISERVER \ 50 | set transcript yes \ 51 | get $REMOTEDIR$FILE$FLEN$RECLEN.evn \ 52 | close \ 53 | quit " 54 | echo -e "\n$0: $TSCLIPATH $TSCMD \n" 55 | $TSCLIPATH $TSCMD 56 | popd > /dev/null 57 | -------------------------------------------------------------------------------- /util/tsuc2plot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" == "" ]; then 4 | echo 5 | echo " ./tsuc2gnuplot tsunamiClientTranscript.tsuc " 6 | echo 7 | echo "Takes a Tsunami client side transcript file, extracts " 8 | echo "the data into a temp file, and plots the rates vs time" 9 | echo "of the transfer using Octave." 10 | echo 11 | exit 12 | fi 13 | 14 | # -- find data portion of the log 15 | linenrs=$(grep -n -e "START" -e "STOP" $1 | cut -f1 -d: | head -2) 16 | read lbegin lend << HERE 17 | $(echo $linenrs) 18 | HERE 19 | lbegin=$(($lbegin + 1)) 20 | lend=$(($lend - 1)) 21 | 22 | # -- extract data and reformat the presentation a bit for Matlab/Octave/GNUplot 23 | TMPF=`mktemp /tmp/tsuc2gpData.XXXXXXXXXX` || exit 1 24 | SEDF=`mktemp /tmp/tsuc2gpSed.XXXXXXXXXX` || exit 1 25 | echo -e " s/Mbps//g \n s/M//g \n s/G//g \n s/:/ /g \n s/\%//g" > $SEDF 26 | sed -n "$lbegin,${lend}p" $1 | sed -f $SEDF > $TMPF 27 | rm $SEDF 28 | 29 | # example data: 30 | # 000000.357 550 0.00 403.7 0.0 550 0.0 403.6 0.0 0 0 457214 0 0 31 | # interval, packets, retransmitted MB, receive rate Mbit/s, loss %, ... 32 | 33 | OCTF=`mktemp /tmp/tsuc2gpPlot.XXXXXXXXXX` || exit 1 34 | echo "load '${TMPF}';" > $OCTF 35 | echo "xsecs = tsuc2gpData(:,3) + 60*(tsuc2gpData(:,2) + 60*tsuc2gpData(:,1));" >> $OCTF 36 | echo "figure(1), hold on, grid on, title('$1')" >> $OCTF 37 | echo "plot(xsecs, tsuc2gpData(:,6), ';receive rate;')" >> $OCTF 38 | echo "plot(xsecs, tsuc2gpData(:,5), ';loss rate;')" >> $OCTF 39 | echo "plot(xsecs, tsuc2gpData(:,10), ';cumulative rate;')" >> $OCTF 40 | echo "xlabel('seconds'), ylabel('Mbit/s')" >> $OCTF 41 | echo "disp('Any key to close the plot...')" >> $OCTF 42 | echo "pause" >> $OCTF 43 | octave $OCTF 44 | 45 | rm $OCTF 46 | rm $TMPF 47 | -------------------------------------------------------------------------------- /util/tsucmatlabplot.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/util/tsucmatlabplot.m -------------------------------------------------------------------------------- /util/tsunami-testload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Testing of realtime Tsunami transfer, default semi-lossy mode 15s window 4 | 5 | RTSERVER=didius.metsahovi.fi # server with real-time Tsunami server, default passwd 6 | RTRATE=200 # server side Mbit/s (VSI rate) 7 | RTLEN=$((RTRATE * 1000000 * 60 * 3 / 8)) # 3 minutes of data 8 | RAIDROOT=/raid/s 9 | TSBIN=`which tsunami` 10 | 11 | while true; do 12 | 13 | timestr=`date -u --date "now + 20 seconds" +"%Y%j%H%M%S"` # YYYYdddhhhmmss + 50s 14 | usc="_" 15 | dlfile=dummy${usc}mh${usc}scan01${usc}${timestr}${usc}dl=${RTLEN}.vsi 16 | 17 | echo $dlfile 18 | pushd ${RAIDROOT} 19 | $TSBIN connect ${RTSERVER} \ 20 | set rate 500m \ 21 | set transcript yes \ 22 | set lossless no \ 23 | set losswindow 15000 \ 24 | get $dlfile \ 25 | close \ 26 | quit 27 | # rm $dlfile 28 | popd 29 | 30 | sleep 10 31 | 32 | done 33 | -------------------------------------------------------------------------------- /util/writetest.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/util/writetest.c -------------------------------------------------------------------------------- /win32compat/pthreadVC2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/res0nat0r/tsunami-udp/d1760468756189765ea8e92730ab91edc43e1626/win32compat/pthreadVC2.lib -------------------------------------------------------------------------------- /win32compat/pthreads-compile.txt: -------------------------------------------------------------------------------- 1 | 2 | How to compile a new static lib (pthreadVC2.lib) in VC6 from cmd.exe command line: 3 | 4 | VCVARS32.BAT 5 | nmake clean VC-static 6 | 7 | Should work just the same for VC7.1 and VC 2005 (Express) etc. 8 | 9 | NOTE: VCVARS32.BAT is part of Visual Studio. For VC6 it 10 | is usually found in C:\Program Files\Microsoft Visual Studio\VC98\Bin\ 11 | 12 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/MAINTAINERS: -------------------------------------------------------------------------------- 1 | CVS Repository maintainers 2 | 3 | Ross Johnson rpj@ise.canberra.edu.au 4 | Ben Elliston bje@cygnus.com 5 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/Nmakefile: -------------------------------------------------------------------------------- 1 | /* 2 | * nmake file for uwin pthread library 3 | */ 4 | 5 | VERSION = - 6 | CCFLAGS = -V -g $(CC.DLL) 7 | HAVE_CONFIG_H == 1 8 | _MT == 1 9 | _timeb == timeb 10 | _ftime == ftime 11 | _errno == _ast_errno 12 | 13 | $(INCLUDEDIR) :INSTALLDIR: pthread.h sched.h 14 | 15 | pthread $(VERSION) :LIBRARY: attr.c barrier.c cancel.c cleanup.c condvar.c \ 16 | create.c dll.c exit.c fork.c global.c misc.c mutex.c private.c \ 17 | rwlock.c sched.c semaphore.c spin.c sync.c tsd.c nonportable.c 18 | 19 | :: ANNOUNCE CONTRIBUTORS COPYING.LIB ChangeLog FAQ GNUmakefile MAINTAINERS \ 20 | Makefile Makefile.in Makefile.vc NEWS PROGRESS README README.WinCE \ 21 | TODO WinCE-PORT install-sh errno.c tests tests.mk acconfig.h \ 22 | config.guess config.h.in config.sub configure configure.in signal.c \ 23 | README.CV README.NONPORTABLE pthread.dsp pthread.dsw 24 | 25 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/PROGRESS: -------------------------------------------------------------------------------- 1 | Please see the ANNOUNCE file "Level of Standards Conformance" 2 | or the web page: 3 | 4 | http://sources.redhat.com/pthreads-win32/conformance.html 5 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/README.WinCE: -------------------------------------------------------------------------------- 1 | WinCE port 2 | ---------- 3 | (See the file WinCE-PORT for a detailed explanation.) 4 | 5 | Make sure you define "WINCE" amongst your compiler flags (eg. -DWINCE). 6 | The config.h file will define all the necessary defines for you. 7 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/TODO: -------------------------------------------------------------------------------- 1 | Things that aren't done yet 2 | --------------------------- 3 | 4 | 1. Implement PTHREAD_PROCESS_SHARED for semaphores, mutexes, 5 | condition variables, read/write locks, barriers. 6 | 7 | 8 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/attr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * attr.c 3 | * 4 | * Description: 5 | * This translation unit agregates operations on thread attribute objects. 6 | * It is used for inline optimisation. 7 | * 8 | * The included modules are used separately when static executable sizes 9 | * must be minimised. 10 | * 11 | * -------------------------------------------------------------------------- 12 | * 13 | * Pthreads-win32 - POSIX Threads Library for Win32 14 | * Copyright(C) 1998 John E. Bossom 15 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 16 | * 17 | * Contact Email: rpj@callisto.canberra.edu.au 18 | * 19 | * The current list of contributors is contained 20 | * in the file CONTRIBUTORS included with the source 21 | * code distribution. The list can also be seen at the 22 | * following World Wide Web location: 23 | * http://sources.redhat.com/pthreads-win32/contributors.html 24 | * 25 | * This library is free software; you can redistribute it and/or 26 | * modify it under the terms of the GNU Lesser General Public 27 | * License as published by the Free Software Foundation; either 28 | * version 2 of the License, or (at your option) any later version. 29 | * 30 | * This library is distributed in the hope that it will be useful, 31 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 32 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 33 | * Lesser General Public License for more details. 34 | * 35 | * You should have received a copy of the GNU Lesser General Public 36 | * License along with this library in the file COPYING.LIB; 37 | * if not, write to the Free Software Foundation, Inc., 38 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 39 | */ 40 | 41 | #include "pthread.h" 42 | #include "implement.h" 43 | 44 | #include "pthread_attr_init.c" 45 | #include "pthread_attr_destroy.c" 46 | #include "pthread_attr_getdetachstate.c" 47 | #include "pthread_attr_setdetachstate.c" 48 | #include "pthread_attr_getstackaddr.c" 49 | #include "pthread_attr_setstackaddr.c" 50 | #include "pthread_attr_getstacksize.c" 51 | #include "pthread_attr_setstacksize.c" 52 | #include "pthread_attr_getscope.c" 53 | #include "pthread_attr_setscope.c" 54 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/barrier.c: -------------------------------------------------------------------------------- 1 | /* 2 | * barrier.c 3 | * 4 | * Description: 5 | * This translation unit implements barrier primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_barrier_init.c" 42 | #include "pthread_barrier_destroy.c" 43 | #include "pthread_barrier_wait.c" 44 | #include "pthread_barrierattr_init.c" 45 | #include "pthread_barrierattr_destroy.c" 46 | #include "pthread_barrierattr_getpshared.c" 47 | #include "pthread_barrierattr_setpshared.c" 48 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/builddmc.bat: -------------------------------------------------------------------------------- 1 | ; Build the pthreads library with the Digital Mars Compiler 2 | ; 3 | set DMCDIR=c:\dm 4 | 5 | ; RELEASE 6 | %DMCDIR%\bin\dmc -D_WIN32_WINNT -D_MT -DHAVE_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/NODEBUG -L/SU:WINDOWS 7 | 8 | ; DEBUG 9 | %DMCDIR%\bin\dmc -g -D_WIN32_WINNT -D_MT -DHAVE_CONFIG_H -I.;c:\dm\include -o+all -WD pthread.c user32.lib+kernel32.lib+wsock32.lib -L/impl -L/SU:WINDOWS 10 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/cancel.c: -------------------------------------------------------------------------------- 1 | /* 2 | * cancel.c 3 | * 4 | * Description: 5 | * POSIX thread functions related to thread cancellation. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_setcancelstate.c" 42 | #include "pthread_setcanceltype.c" 43 | #include "pthread_testcancel.c" 44 | #include "pthread_cancel.c" 45 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/condvar.c: -------------------------------------------------------------------------------- 1 | /* 2 | * condvar.c 3 | * 4 | * Description: 5 | * This translation unit implements condition variables and their primitives. 6 | * 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | * 37 | */ 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | #include "ptw32_cond_check_need_init.c" 43 | #include "pthread_condattr_init.c" 44 | #include "pthread_condattr_destroy.c" 45 | #include "pthread_condattr_getpshared.c" 46 | #include "pthread_condattr_setpshared.c" 47 | #include "pthread_cond_init.c" 48 | #include "pthread_cond_destroy.c" 49 | #include "pthread_cond_wait.c" 50 | #include "pthread_cond_signal.c" 51 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/exit.c: -------------------------------------------------------------------------------- 1 | /* 2 | * exit.c 3 | * 4 | * Description: 5 | * This translation unit implements routines associated with exiting from 6 | * a thread. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | #ifndef _UWIN 41 | # include 42 | #endif 43 | 44 | #include "pthread_exit.c" 45 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/fork.c: -------------------------------------------------------------------------------- 1 | /* 2 | * fork.c 3 | * 4 | * Description: 5 | * Implementation of fork() for POSIX threads. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/manual/ChangeLog: -------------------------------------------------------------------------------- 1 | 2005-05-06 Ross Johnson 2 | 3 | * PortabilityIssues.html: Was nonPortableIssues.html. 4 | * index.html: Updated; add table of contents at top. 5 | * *.html: Add Pthreads-win32 header info; add link back to the 6 | index page 'index.html'. 7 | 8 | 2005-05-06 Ross Johnson 9 | 10 | * index.html: New. 11 | * nonPortableIssues.html: New. 12 | * pthread_attr_init.html: New. 13 | * pthread_attr_setstackaddr.html: New. 14 | * pthread_attr_setstacksize.html: New. 15 | * pthread_barrierattr_init.html: New. 16 | * pthread_barrierattr_setpshared.html: New. 17 | * pthread_barrier_init.html: New. 18 | * pthread_barrier_wait.html: New. 19 | * pthreadCancelableWait.html: New. 20 | * pthread_cancel.html: New. 21 | * pthread_cleanup_push.html: New. 22 | * pthread_condattr_init.html: New. 23 | * pthread_condattr_setpshared.html: New. 24 | * pthread_cond_init.html: New. 25 | * pthread_create.html: New. 26 | * pthread_delay_np.html: New. 27 | * pthread_detach.html: New. 28 | * pthread_equal.html: New. 29 | * pthread_exit.html: New. 30 | * pthread_getw32threadhandle_np.html: New. 31 | * pthread_join.html: New. 32 | * pthread_key_create.html: New. 33 | * pthread_kill.html: New. 34 | * pthread_mutexattr_init.html: New. 35 | * pthread_mutexattr_setpshared.html: New. 36 | * pthread_mutex_init.html: New. 37 | * pthread_num_processors_np.html: New. 38 | * pthread_once.html: New. 39 | * pthread_rwlockattr_init.html: New. 40 | * pthread_rwlockattr_setpshared.html: New. 41 | * pthread_rwlock_init.html: New. 42 | * pthread_rwlock_rdlock.html: New. 43 | * pthread_rwlock_timedrdlock.html: New. 44 | * pthread_rwlock_timedwrlock.html: New. 45 | * pthread_rwlock_unlock.html: New. 46 | * pthread_rwlock_wrlock.html: New. 47 | * pthread_self.html: New. 48 | * pthread_setcancelstate.html: New. 49 | * pthread_setcanceltype.html: New. 50 | * pthread_setconcurrency.html: New. 51 | * pthread_setschedparam.html: New. 52 | * pthread_spin_init.html: New. 53 | * pthread_spin_lock.html: New. 54 | * pthread_spin_unlock.html: New. 55 | * pthread_timechange_handler_np.html: New. 56 | * pthread_win32_attach_detach_np.html: New. 57 | * pthread_win32_test_features_np.html: New. 58 | * sched_get_priority_max.html: New. 59 | * sched_getscheduler.html: New. 60 | * sched_setscheduler.html: New. 61 | * sched_yield.html: New. 62 | * sem_init.html: New. 63 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/manual/pthread_equal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PTHREAD_EQUAL(3) manual page 7 | 8 | 9 | Table of Contents

10 | 11 |

12 |

Name

13 | pthread_equal - compare two thread identifiers 14 |

15 |

Synopsis

16 | #include <pthread.h> 17 | 18 |

int pthread_equal(pthread_t thread1, pthread_t thread2); 19 |

20 |

Description

21 | pthread_equal 22 | determines if two thread identifiers refer to the same thread. 23 |

24 |

Return Value

25 | A 26 | non-zero value is returned if thread1 and thread2 refer to the same thread. 27 | Otherwise, 0 is returned. 28 |

29 |

Author

30 | Xavier Leroy <Xavier.Leroy@inria.fr> 31 |

32 |

See Also

33 | pthread_self(3) 34 | . 35 |

36 | 37 |


38 | Table of Contents

39 |

47 | 48 | 49 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/manual/pthread_exit.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PTHREAD_EXIT(3) manual page 7 | 8 | 9 | Table of Contents

10 | 11 |

12 |

Name

13 | pthread_exit - terminate the calling thread 14 |

15 |

Synopsis

16 | #include <pthread.h> 17 | 18 |

void pthread_exit(void *retval); 19 |

20 |

Description

21 | pthread_exit terminates the 22 | execution of the calling thread. All cleanup handlers that have been set 23 | for the calling thread with pthread_cleanup_push(3) 24 | are executed in reverse 25 | order (the most recently pushed handler is executed first). Finalization 26 | functions for thread-specific data are then called for all keys that have 27 | non- NULL values associated with them in the calling thread (see pthread_key_create(3) 28 | ). 29 | Finally, execution of the calling thread is stopped. 30 |

The retval argument 31 | is the return value of the thread. It can be consulted from another thread 32 | using pthread_join(3) 33 | . 34 |

35 |

Return Value

36 | The pthread_exit function never returns. 37 | 38 |

39 |

Author

40 | Xavier Leroy <Xavier.Leroy@inria.fr> 41 |

42 |

See Also

43 | pthread_create(3) 44 | , pthread_join(3) 45 | . 46 |

47 | 48 |


49 | Table of Contents

50 |

58 | 59 | 60 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * misc.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_kill.c" 42 | #include "pthread_once.c" 43 | #include "pthread_self.c" 44 | #include "pthread_equal.c" 45 | #include "pthread_setconcurrency.c" 46 | #include "pthread_getconcurrency.c" 47 | #include "ptw32_new.c" 48 | #include "ptw32_calloc.c" 49 | #include "ptw32_reuse.c" 50 | #include "w32_CancelableWait.c" 51 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/mutex.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex.c 3 | * 4 | * Description: 5 | * This translation unit implements mutual exclusion (mutex) primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #ifndef _UWIN 38 | # include 39 | #endif 40 | #ifndef NEED_FTIME 41 | #include 42 | #endif 43 | #include "pthread.h" 44 | #include "implement.h" 45 | 46 | 47 | #include "ptw32_mutex_check_need_init.c" 48 | #include "pthread_mutex_init.c" 49 | #include "pthread_mutex_destroy.c" 50 | #include "pthread_mutexattr_init.c" 51 | #include "pthread_mutexattr_destroy.c" 52 | #include "pthread_mutexattr_getpshared.c" 53 | #include "pthread_mutexattr_setpshared.c" 54 | #include "pthread_mutexattr_settype.c" 55 | #include "pthread_mutexattr_gettype.c" 56 | #include "pthread_mutex_lock.c" 57 | #include "pthread_mutex_timedlock.c" 58 | #include "pthread_mutex_unlock.c" 59 | #include "pthread_mutex_trylock.c" 60 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/nonportable.c: -------------------------------------------------------------------------------- 1 | /* 2 | * nonportable.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | #include "pthread_mutexattr_setkind_np.c" 41 | #include "pthread_mutexattr_getkind_np.c" 42 | #include "pthread_getw32threadhandle_np.c" 43 | #include "pthread_delay_np.c" 44 | #include "pthread_num_processors_np.c" 45 | #include "pthread_win32_attach_detach_np.c" 46 | #include "pthread_timechange_handler_np.c" 47 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/private.c: -------------------------------------------------------------------------------- 1 | /* 2 | * private.c 3 | * 4 | * Description: 5 | * This translation unit implements routines which are private to 6 | * the implementation and may be used throughout it. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | /* Must be first to define HAVE_INLINABLE_INTERLOCKED_CMPXCHG */ 42 | #include "ptw32_InterlockedCompareExchange.c" 43 | 44 | #include "ptw32_MCS_lock.c" 45 | #include "ptw32_is_attr.c" 46 | #include "ptw32_processInitialize.c" 47 | #include "ptw32_processTerminate.c" 48 | #include "ptw32_threadStart.c" 49 | #include "ptw32_threadDestroy.c" 50 | #include "ptw32_tkAssocCreate.c" 51 | #include "ptw32_tkAssocDestroy.c" 52 | #include "ptw32_callUserDestroyRoutines.c" 53 | #include "ptw32_semwait.c" 54 | #include "ptw32_timespec.c" 55 | #include "ptw32_relmillisecs.c" 56 | #include "ptw32_throw.c" 57 | #include "ptw32_getprocessors.c" 58 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread.c 3 | * 4 | * Description: 5 | * This translation unit agregates pthreads-win32 translation units. 6 | * It is used for inline optimisation of the library, 7 | * maximising for speed at the expense of size. 8 | * 9 | * -------------------------------------------------------------------------- 10 | * 11 | * Pthreads-win32 - POSIX Threads Library for Win32 12 | * Copyright(C) 1998 John E. Bossom 13 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 14 | * 15 | * Contact Email: rpj@callisto.canberra.edu.au 16 | * 17 | * The current list of contributors is contained 18 | * in the file CONTRIBUTORS included with the source 19 | * code distribution. The list can also be seen at the 20 | * following World Wide Web location: 21 | * http://sources.redhat.com/pthreads-win32/contributors.html 22 | * 23 | * This library is free software; you can redistribute it and/or 24 | * modify it under the terms of the GNU Lesser General Public 25 | * License as published by the Free Software Foundation; either 26 | * version 2 of the License, or (at your option) any later version. 27 | * 28 | * This library is distributed in the hope that it will be useful, 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 31 | * Lesser General Public License for more details. 32 | * 33 | * You should have received a copy of the GNU Lesser General Public 34 | * License along with this library in the file COPYING.LIB; 35 | * if not, write to the Free Software Foundation, Inc., 36 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 37 | */ 38 | 39 | #include "pthread.h" 40 | #include "implement.h" 41 | 42 | /* The following are ordered for inlining */ 43 | 44 | #include "private.c" 45 | #include "attr.c" 46 | #include "barrier.c" 47 | #include "cancel.c" 48 | #include "cleanup.c" 49 | #include "condvar.c" 50 | #include "create.c" 51 | #include "dll.c" 52 | #include "errno.c" 53 | #include "exit.c" 54 | #include "fork.c" 55 | #include "global.c" 56 | #include "misc.c" 57 | #include "mutex.c" 58 | #include "nonportable.c" 59 | #include "rwlock.c" 60 | #include "sched.c" 61 | #include "semaphore.c" 62 | #include "signal.c" 63 | #include "spin.c" 64 | #include "sync.c" 65 | #include "tsd.c" 66 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "pthread"=.\pthread.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_getinheritsched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getinheritsched.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_getinheritsched (pthread_attr_t * attr, int *inheritsched) 43 | { 44 | if (ptw32_is_attr (attr) != 0 || inheritsched == NULL) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | *inheritsched = (*attr)->inheritsched; 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_getschedparam.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getschedparam.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_getschedparam (const pthread_attr_t * attr, 43 | struct sched_param *param) 44 | { 45 | if (ptw32_is_attr (attr) != 0 || param == NULL) 46 | { 47 | return EINVAL; 48 | } 49 | 50 | memcpy (param, &(*attr)->param, sizeof (*param)); 51 | return 0; 52 | } 53 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_getschedpolicy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getschedpolicy.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_getschedpolicy (pthread_attr_t * attr, int *policy) 43 | { 44 | if (ptw32_is_attr (attr) != 0 || policy == NULL) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | /* 50 | * Validate the policy arg. 51 | * Check that a policy constant wasn't passed rather than &policy. 52 | */ 53 | if (policy <= (int *) SCHED_MAX) 54 | { 55 | return EINVAL; 56 | } 57 | 58 | *policy = SCHED_OTHER; 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_getscope.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_getscope.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* ignore warning "unreferenced formal parameter" */ 41 | #ifdef _MSC_VER 42 | #pragma warning( disable : 4100 ) 43 | #endif 44 | 45 | int 46 | pthread_attr_getscope (const pthread_attr_t * attr, int *contentionscope) 47 | { 48 | #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING 49 | *contentionscope = (*attr)->contentionscope; 50 | return 0; 51 | #else 52 | return ENOSYS; 53 | #endif 54 | } 55 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_setinheritsched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setinheritsched.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_setinheritsched (pthread_attr_t * attr, int inheritsched) 43 | { 44 | if (ptw32_is_attr (attr) != 0) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | if (PTHREAD_INHERIT_SCHED != inheritsched 50 | && PTHREAD_EXPLICIT_SCHED != inheritsched) 51 | { 52 | return EINVAL; 53 | } 54 | 55 | (*attr)->inheritsched = inheritsched; 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_setschedparam.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setschedparam.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_setschedparam (pthread_attr_t * attr, 43 | const struct sched_param *param) 44 | { 45 | int priority; 46 | 47 | if (ptw32_is_attr (attr) != 0 || param == NULL) 48 | { 49 | return EINVAL; 50 | } 51 | 52 | priority = param->sched_priority; 53 | 54 | /* Validate priority level. */ 55 | if (priority < sched_get_priority_min (SCHED_OTHER) || 56 | priority > sched_get_priority_max (SCHED_OTHER)) 57 | { 58 | return EINVAL; 59 | } 60 | 61 | memcpy (&(*attr)->param, param, sizeof (*param)); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_setschedpolicy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setschedpolicy.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | pthread_attr_setschedpolicy (pthread_attr_t * attr, int policy) 43 | { 44 | if (ptw32_is_attr (attr) != 0) 45 | { 46 | return EINVAL; 47 | } 48 | 49 | if (policy != SCHED_OTHER) 50 | { 51 | return ENOTSUP; 52 | } 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_attr_setscope.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_attr_setscope.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* ignore warning "unreferenced formal parameter" */ 41 | #ifdef _MSC_VER 42 | #pragma warning( disable : 4100 ) 43 | #endif 44 | 45 | int 46 | pthread_attr_setscope (pthread_attr_t * attr, int contentionscope) 47 | { 48 | #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING 49 | switch (contentionscope) 50 | { 51 | case PTHREAD_SCOPE_SYSTEM: 52 | (*attr)->contentionscope = contentionscope; 53 | return 0; 54 | case PTHREAD_SCOPE_PROCESS: 55 | return ENOTSUP; 56 | default: 57 | return EINVAL; 58 | } 59 | #else 60 | return ENOSYS; 61 | #endif 62 | } 63 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_barrier_destroy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_barrier_destroy.c 3 | * 4 | * Description: 5 | * This translation unit implements barrier primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_barrier_destroy (pthread_barrier_t * barrier) 43 | { 44 | int result = 0; 45 | pthread_barrier_t b; 46 | 47 | if (barrier == NULL || *barrier == (pthread_barrier_t) PTW32_OBJECT_INVALID) 48 | { 49 | return EINVAL; 50 | } 51 | 52 | b = *barrier; 53 | *barrier = NULL; 54 | 55 | if (0 == (result = sem_destroy (&(b->semBarrierBreeched[0])))) 56 | { 57 | if (0 == (result = sem_destroy (&(b->semBarrierBreeched[1])))) 58 | { 59 | (void) free (b); 60 | return 0; 61 | } 62 | (void) sem_init (&(b->semBarrierBreeched[0]), b->pshared, 0); 63 | } 64 | 65 | *barrier = b; 66 | return (result); 67 | } 68 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_getconcurrency.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_getconcurrency.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_getconcurrency (void) 43 | { 44 | return ptw32_concurrency; 45 | } 46 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_getw32threadhandle_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_getw32threadhandle_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* 41 | * pthread_getw32threadhandle_np() 42 | * 43 | * Returns the win32 thread handle that the POSIX 44 | * thread "thread" is running as. 45 | * 46 | * Applications can use the win32 handle to set 47 | * win32 specific attributes of the thread. 48 | */ 49 | HANDLE 50 | pthread_getw32threadhandle_np (pthread_t thread) 51 | { 52 | return ((ptw32_thread_t *)thread.p)->threadH; 53 | } 54 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_mutexattr_getkind_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_getkind_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | pthread_mutexattr_getkind_np (pthread_mutexattr_t * attr, int *kind) 42 | { 43 | return pthread_mutexattr_gettype (attr, kind); 44 | } 45 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_mutexattr_gettype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_gettype.c 3 | * 4 | * Description: 5 | * This translation unit implements mutual exclusion (mutex) primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind) 43 | { 44 | int result = 0; 45 | 46 | if (attr != NULL && *attr != NULL && kind != NULL) 47 | { 48 | *kind = (*attr)->kind; 49 | } 50 | else 51 | { 52 | result = EINVAL; 53 | } 54 | 55 | return (result); 56 | } 57 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_mutexattr_setkind_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_mutexattr_setkind_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | pthread_mutexattr_setkind_np (pthread_mutexattr_t * attr, int kind) 42 | { 43 | return pthread_mutexattr_settype (attr, kind); 44 | } 45 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_num_processors_np.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_num_processors_np.c 3 | * 4 | * Description: 5 | * This translation unit implements non-portable thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | /* 41 | * pthread_num_processors_np() 42 | * 43 | * Get the number of CPUs available to the process. 44 | */ 45 | int 46 | pthread_num_processors_np (void) 47 | { 48 | int count; 49 | 50 | if (ptw32_getprocessors (&count) != 0) 51 | { 52 | count = 1; 53 | } 54 | 55 | return (count); 56 | } 57 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/pthread_setconcurrency.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pthread_setconcurrency.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | int 42 | pthread_setconcurrency (int level) 43 | { 44 | if (level < 0) 45 | { 46 | return EINVAL; 47 | } 48 | else 49 | { 50 | ptw32_concurrency = level; 51 | return 0; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/ptw32_calloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_calloc.c 3 | * 4 | * Description: 5 | * This translation unit implements miscellaneous thread functions. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #ifdef NEED_CALLOC 42 | void * 43 | ptw32_calloc (size_t n, size_t s) 44 | { 45 | unsigned int m = n * s; 46 | void *p; 47 | 48 | p = malloc (m); 49 | if (p == NULL) 50 | return NULL; 51 | 52 | memset (p, 0, m); 53 | 54 | return p; 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/ptw32_is_attr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_is_attr.c 3 | * 4 | * Description: 5 | * This translation unit implements operations on thread attribute objects. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | int 41 | ptw32_is_attr (const pthread_attr_t * attr) 42 | { 43 | /* Return 0 if the attr object is valid, non-zero otherwise. */ 44 | 45 | return (attr == NULL || 46 | *attr == NULL || (*attr)->valid != PTW32_ATTR_VALID); 47 | } 48 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/ptw32_rwlock_cancelwrwait.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ptw32_rwlock_cancelwrwait.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | void 41 | ptw32_rwlock_cancelwrwait (void *arg) 42 | { 43 | pthread_rwlock_t rwl = (pthread_rwlock_t) arg; 44 | 45 | rwl->nSharedAccessCount = -rwl->nCompletedSharedAccessCount; 46 | rwl->nCompletedSharedAccessCount = 0; 47 | 48 | (void) pthread_mutex_unlock (&(rwl->mtxSharedAccessCompleted)); 49 | (void) pthread_mutex_unlock (&(rwl->mtxExclusiveAccess)); 50 | } 51 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/rwlock.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rwlock.c 3 | * 4 | * Description: 5 | * This translation unit implements read/write lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "ptw32_rwlock_check_need_init.c" 38 | #include "ptw32_rwlock_cancelwrwait.c" 39 | #include "pthread_rwlock_init.c" 40 | #include "pthread_rwlock_destroy.c" 41 | #include "pthread_rwlockattr_init.c" 42 | #include "pthread_rwlockattr_destroy.c" 43 | #include "pthread_rwlockattr_getpshared.c" 44 | #include "pthread_rwlockattr_setpshared.c" 45 | #include "pthread_rwlock_rdlock.c" 46 | #include "pthread_rwlock_timedrdlock.c" 47 | #include "pthread_rwlock_wrlock.c" 48 | #include "pthread_rwlock_timedwrlock.c" 49 | #include "pthread_rwlock_unlock.c" 50 | #include "pthread_rwlock_tryrdlock.c" 51 | #include "pthread_rwlock_trywrlock.c" 52 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/sched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | #include "pthread_attr_setschedpolicy.c" 42 | #include "pthread_attr_getschedpolicy.c" 43 | #include "pthread_attr_setschedparam.c" 44 | #include "pthread_attr_getschedparam.c" 45 | #include "pthread_attr_setinheritsched.c" 46 | #include "pthread_attr_getinheritsched.c" 47 | #include "pthread_setschedparam.c" 48 | #include "pthread_getschedparam.c" 49 | #include "sched_get_priority_max.c" 50 | #include "sched_get_priority_min.c" 51 | #include "sched_setscheduler.c" 52 | #include "sched_getscheduler.c" 53 | #include "sched_yield.c" 54 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/sched_getscheduler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sched_getscheduler.c 3 | * 4 | * Description: 5 | * POSIX thread functions that deal with thread scheduling. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | #include "sched.h" 40 | 41 | int 42 | sched_getscheduler (pid_t pid) 43 | { 44 | /* 45 | * Win32 only has one policy which we call SCHED_OTHER. 46 | * However, we try to provide other valid side-effects 47 | * such as EPERM and ESRCH errors. 48 | */ 49 | if (0 != pid) 50 | { 51 | int selfPid = (int) GetCurrentProcessId (); 52 | 53 | if (pid != selfPid) 54 | { 55 | HANDLE h = 56 | OpenProcess (PROCESS_QUERY_INFORMATION, PTW32_FALSE, (DWORD) pid); 57 | 58 | if (NULL == h) 59 | { 60 | errno = 61 | (GetLastError () == 62 | (0xFF & ERROR_ACCESS_DENIED)) ? EPERM : ESRCH; 63 | return -1; 64 | } 65 | } 66 | } 67 | 68 | return SCHED_OTHER; 69 | } 70 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/sem_close.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: sem_close.c 5 | * 6 | * Purpose: 7 | * Semaphores aren't actually part of the PThreads standard. 8 | * They are defined by the POSIX Standard: 9 | * 10 | * POSIX 1003.1b-1993 (POSIX.1b) 11 | * 12 | * ------------------------------------------------------------- 13 | * 14 | * -------------------------------------------------------------------------- 15 | * 16 | * Pthreads-win32 - POSIX Threads Library for Win32 17 | * Copyright(C) 1998 John E. Bossom 18 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 19 | * 20 | * Contact Email: rpj@callisto.canberra.edu.au 21 | * 22 | * The current list of contributors is contained 23 | * in the file CONTRIBUTORS included with the source 24 | * code distribution. The list can also be seen at the 25 | * following World Wide Web location: 26 | * http://sources.redhat.com/pthreads-win32/contributors.html 27 | * 28 | * This library is free software; you can redistribute it and/or 29 | * modify it under the terms of the GNU Lesser General Public 30 | * License as published by the Free Software Foundation; either 31 | * version 2 of the License, or (at your option) any later version. 32 | * 33 | * This library is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | * Lesser General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU Lesser General Public 39 | * License along with this library in the file COPYING.LIB; 40 | * if not, write to the Free Software Foundation, Inc., 41 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 42 | */ 43 | 44 | #include "pthread.h" 45 | #include "semaphore.h" 46 | #include "implement.h" 47 | 48 | /* ignore warning "unreferenced formal parameter" */ 49 | #ifdef _MSC_VER 50 | #pragma warning( disable : 4100 ) 51 | #endif 52 | 53 | int 54 | sem_close (sem_t * sem) 55 | { 56 | errno = ENOSYS; 57 | return -1; 58 | } /* sem_close */ 59 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/sem_open.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: sem_open.c 5 | * 6 | * Purpose: 7 | * Semaphores aren't actually part of the PThreads standard. 8 | * They are defined by the POSIX Standard: 9 | * 10 | * POSIX 1003.1b-1993 (POSIX.1b) 11 | * 12 | * ------------------------------------------------------------- 13 | * 14 | * -------------------------------------------------------------------------- 15 | * 16 | * Pthreads-win32 - POSIX Threads Library for Win32 17 | * Copyright(C) 1998 John E. Bossom 18 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 19 | * 20 | * Contact Email: rpj@callisto.canberra.edu.au 21 | * 22 | * The current list of contributors is contained 23 | * in the file CONTRIBUTORS included with the source 24 | * code distribution. The list can also be seen at the 25 | * following World Wide Web location: 26 | * http://sources.redhat.com/pthreads-win32/contributors.html 27 | * 28 | * This library is free software; you can redistribute it and/or 29 | * modify it under the terms of the GNU Lesser General Public 30 | * License as published by the Free Software Foundation; either 31 | * version 2 of the License, or (at your option) any later version. 32 | * 33 | * This library is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | * Lesser General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU Lesser General Public 39 | * License along with this library in the file COPYING.LIB; 40 | * if not, write to the Free Software Foundation, Inc., 41 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 42 | */ 43 | 44 | #include "pthread.h" 45 | #include "semaphore.h" 46 | #include "implement.h" 47 | 48 | /* ignore warning "unreferenced formal parameter" */ 49 | #ifdef _MSC_VER 50 | #pragma warning( disable : 4100 ) 51 | #endif 52 | 53 | int 54 | sem_open (const char *name, int oflag, mode_t mode, unsigned int value) 55 | { 56 | errno = ENOSYS; 57 | return -1; 58 | } /* sem_open */ 59 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/sem_unlink.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ------------------------------------------------------------- 3 | * 4 | * Module: sem_unlink.c 5 | * 6 | * Purpose: 7 | * Semaphores aren't actually part of the PThreads standard. 8 | * They are defined by the POSIX Standard: 9 | * 10 | * POSIX 1003.1b-1993 (POSIX.1b) 11 | * 12 | * ------------------------------------------------------------- 13 | * 14 | * -------------------------------------------------------------------------- 15 | * 16 | * Pthreads-win32 - POSIX Threads Library for Win32 17 | * Copyright(C) 1998 John E. Bossom 18 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 19 | * 20 | * Contact Email: rpj@callisto.canberra.edu.au 21 | * 22 | * The current list of contributors is contained 23 | * in the file CONTRIBUTORS included with the source 24 | * code distribution. The list can also be seen at the 25 | * following World Wide Web location: 26 | * http://sources.redhat.com/pthreads-win32/contributors.html 27 | * 28 | * This library is free software; you can redistribute it and/or 29 | * modify it under the terms of the GNU Lesser General Public 30 | * License as published by the Free Software Foundation; either 31 | * version 2 of the License, or (at your option) any later version. 32 | * 33 | * This library is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 | * Lesser General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU Lesser General Public 39 | * License along with this library in the file COPYING.LIB; 40 | * if not, write to the Free Software Foundation, Inc., 41 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 42 | */ 43 | 44 | #include "pthread.h" 45 | #include "semaphore.h" 46 | #include "implement.h" 47 | 48 | /* ignore warning "unreferenced formal parameter" */ 49 | #ifdef _MSC_VER 50 | #pragma warning( disable : 4100 ) 51 | #endif 52 | 53 | int 54 | sem_unlink (const char *name) 55 | { 56 | errno = ENOSYS; 57 | return -1; 58 | } /* sem_unlink */ 59 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/spin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spin.c 3 | * 4 | * Description: 5 | * This translation unit implements spin lock primitives. 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "ptw32_spinlock_check_need_init.c" 42 | #include "pthread_spin_init.c" 43 | #include "pthread_spin_destroy.c" 44 | #include "pthread_spin_lock.c" 45 | #include "pthread_spin_unlock.c" 46 | #include "pthread_spin_trylock.c" 47 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/sync.c: -------------------------------------------------------------------------------- 1 | /* 2 | * sync.c 3 | * 4 | * Description: 5 | * This translation unit implements functions related to thread 6 | * synchronisation. 7 | * 8 | * -------------------------------------------------------------------------- 9 | * 10 | * Pthreads-win32 - POSIX Threads Library for Win32 11 | * Copyright(C) 1998 John E. Bossom 12 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 13 | * 14 | * Contact Email: rpj@callisto.canberra.edu.au 15 | * 16 | * The current list of contributors is contained 17 | * in the file CONTRIBUTORS included with the source 18 | * code distribution. The list can also be seen at the 19 | * following World Wide Web location: 20 | * http://sources.redhat.com/pthreads-win32/contributors.html 21 | * 22 | * This library is free software; you can redistribute it and/or 23 | * modify it under the terms of the GNU Lesser General Public 24 | * License as published by the Free Software Foundation; either 25 | * version 2 of the License, or (at your option) any later version. 26 | * 27 | * This library is distributed in the hope that it will be useful, 28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 30 | * Lesser General Public License for more details. 31 | * 32 | * You should have received a copy of the GNU Lesser General Public 33 | * License along with this library in the file COPYING.LIB; 34 | * if not, write to the Free Software Foundation, Inc., 35 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 36 | */ 37 | 38 | #include "pthread.h" 39 | #include "implement.h" 40 | 41 | 42 | #include "pthread_detach.c" 43 | #include "pthread_join.c" 44 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/Debug.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "Debug"=.\Debug.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/Debug.plg: -------------------------------------------------------------------------------- 1 | 2 | 3 |
 4 | 

Build Log

5 |

6 | --------------------Configuration: Debug - Win32 Debug-------------------- 7 |

8 |

Command Lines

9 | Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9.tmp" with contents 10 | [ 11 | /nologo /MDd /W3 /WX /Gm /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "CLEANUP_C" /FR"Debug/" /Fp"Debug/Debug.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 12 | "E:\PTHREADS\pthreads.2\tests\semaphore1.c" 13 | ] 14 | Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSP9.tmp" 15 | Creating temporary file "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPA.tmp" with contents 16 | [ 17 | kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib pthreadVC2d.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/Debug.pdb" /debug /machine:I386 /out:"Debug/Debug.exe" /pdbtype:sept /libpath:".." 18 | .\Debug\semaphore1.obj 19 | ] 20 | Creating command line "link.exe @C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\RSPA.tmp" 21 |

Output Window

22 | Compiling... 23 | semaphore1.c 24 | Linking... 25 | 26 | 27 | 28 |

Results

29 | Debug.exe - 0 error(s), 0 warning(s) 30 |
31 | 32 | 33 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/Debug.txt: -------------------------------------------------------------------------------- 1 | This project is used to debug individual test case programs. 2 | 3 | To build and debug a test case: 4 | - add the .c file to this project; 5 | - remove any .c files from other test cases from this project. 6 | - build and debug as usual. -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/README: -------------------------------------------------------------------------------- 1 | Running test cases in this directory 2 | ------------------------------------ 3 | 4 | These make scripts expect to be able to copy the dll, library 5 | and header files from this directory's parent directory, 6 | which should be the pthreads-win32 source directory. 7 | 8 | MS VC nmake 9 | ------------- 10 | 11 | Run the target corresponding to the DLL version being tested: 12 | 13 | nmake clean VC 14 | 15 | or: 16 | 17 | nmake clean VS 18 | 19 | 20 | GNU GCC make 21 | ------------ 22 | 23 | Run "make clean" and then "make". See the "Known bugs" section 24 | in ..\README. 25 | 26 | 27 | Writing Test Cases 28 | ------------------ 29 | 30 | Tests written in this test suite should behave in the following manner: 31 | 32 | * If a test fails, leave main() with a result of 1. 33 | 34 | * If a test succeeds, leave main() with a result of 0. 35 | 36 | * No diagnostic output should appear when the test is succeeding. 37 | Diagnostic output may be emitted if something in the test 38 | fails, to help determine the cause of the test failure. 39 | 40 | Notes: 41 | ------ 42 | 43 | Many test cases use knowledge of implementation internals which are supposed 44 | to be opaque to portable applications. 45 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/README.BENCHTESTS: -------------------------------------------------------------------------------- 1 | 2 | ------------ 3 | Benchmarking 4 | ------------ 5 | There is a set a benchmarking programs in the 6 | "tests" directory. These should be runnable using the 7 | following command-lines corresponding to each of the possible 8 | library builds: 9 | 10 | MSVC: 11 | nmake clean VC-bench 12 | nmake clean VCE-bench 13 | nmake clean VSE-bench 14 | 15 | Mingw32: 16 | make clean GC-bench 17 | make clean GCE-bench 18 | 19 | UWIN: 20 | The benchtests are run as part of the testsuite. 21 | 22 | 23 | Mutex benchtests 24 | ---------------- 25 | 26 | benchtest1 - Lock plus unlock on an unlocked mutex. 27 | benchtest2 - Lock plus unlock on a locked mutex. 28 | benchtest3 - Trylock on a locked mutex. 29 | benchtest4 - Trylock plus unlock on an unlocked mutex. 30 | 31 | 32 | Each test times up to three alternate synchronisation 33 | implementations as a reference, and then times each of 34 | the four mutex types provided by the library. Each is 35 | described below: 36 | 37 | Simple Critical Section 38 | - uses a simple Win32 critical section. There is no 39 | additional overhead for this case as there is in the 40 | remaining cases. 41 | 42 | POSIX mutex implemented using a Critical Section 43 | - The old implementation which uses runtime adaptation 44 | depending on the Windows variant being run on. When 45 | the pthreads DLL was run on WinNT or higher then 46 | POSIX mutexes would use Win32 Critical Sections. 47 | 48 | POSIX mutex implemented using a Win32 Mutex 49 | - The old implementation which uses runtime adaptation 50 | depending on the Windows variant being run on. When 51 | the pthreads DLL was run on Win9x then POSIX mutexes 52 | would use Win32 Mutexes (because TryEnterCriticalSection 53 | is not implemented on Win9x). 54 | 55 | PTHREAD_MUTEX_DEFAULT 56 | PTHREAD_MUTEX_NORMAL 57 | PTHREAD_MUTEX_ERRORCHECK 58 | PTHREAD_MUTEX_RECURSIVE 59 | - The current implementation supports these mutex types. 60 | The underlying basis of POSIX mutexes is now the same 61 | irrespective of the Windows variant, and should therefore 62 | have consistent performance. 63 | 64 | 65 | Semaphore benchtests 66 | -------------------- 67 | 68 | benchtest5 - Timing for various uncontended cases. 69 | 70 | 71 | In all benchtests, the operation is repeated a large 72 | number of times and an average is calculated. Loop 73 | overhead is measured and subtracted from all test times. 74 | 75 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/SIZES.GC: -------------------------------------------------------------------------------- 1 | Sizes of pthreads-win32 structs 2 | ------------------------------- 3 | pthread_t_ 124 4 | pthread_attr_t_ 28 5 | sem_t_ 4 6 | pthread_mutex_t_ 44 7 | pthread_mutexattr_t_ 8 8 | pthread_spinlock_t_ 8 9 | pthread_barrier_t_ 24 10 | pthread_barrierattr_t_ 4 11 | pthread_key_t_ 16 12 | pthread_cond_t_ 32 13 | pthread_condattr_t_ 4 14 | pthread_rwlock_t_ 28 15 | pthread_rwlockattr_t_ 4 16 | pthread_once_t_ 8 17 | ptw32_cleanup_t 12 18 | sched_param 4 19 | ------------------------------- 20 | 21 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/SIZES.GCE: -------------------------------------------------------------------------------- 1 | Sizes of pthreads-win32 structs 2 | ------------------------------- 3 | pthread_t_ 60 4 | pthread_attr_t_ 28 5 | sem_t_ 4 6 | pthread_mutex_t_ 44 7 | pthread_mutexattr_t_ 8 8 | pthread_spinlock_t_ 8 9 | pthread_barrier_t_ 24 10 | pthread_barrierattr_t_ 4 11 | pthread_key_t_ 16 12 | pthread_cond_t_ 32 13 | pthread_condattr_t_ 4 14 | pthread_rwlock_t_ 28 15 | pthread_rwlockattr_t_ 4 16 | pthread_once_t_ 8 17 | ptw32_cleanup_t 12 18 | sched_param 4 19 | ------------------------------- 20 | 21 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/SIZES.VC: -------------------------------------------------------------------------------- 1 | Sizes of pthreads-win32 structs 2 | ------------------------------- 3 | pthread_t_ 124 4 | pthread_attr_t_ 28 5 | sem_t_ 4 6 | pthread_mutex_t_ 44 7 | pthread_mutexattr_t_ 8 8 | pthread_spinlock_t_ 8 9 | pthread_barrier_t_ 24 10 | pthread_barrierattr_t_ 4 11 | pthread_key_t_ 16 12 | pthread_cond_t_ 32 13 | pthread_condattr_t_ 4 14 | pthread_rwlock_t_ 28 15 | pthread_rwlockattr_t_ 4 16 | pthread_once_t_ 8 17 | ptw32_cleanup_t 12 18 | sched_param 4 19 | ------------------------------- 20 | 21 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/SIZES.VCE: -------------------------------------------------------------------------------- 1 | Sizes of pthreads-win32 structs 2 | ------------------------------- 3 | pthread_t_ 68 4 | pthread_attr_t_ 28 5 | sem_t_ 4 6 | pthread_mutex_t_ 44 7 | pthread_mutexattr_t_ 8 8 | pthread_spinlock_t_ 8 9 | pthread_barrier_t_ 24 10 | pthread_barrierattr_t_ 4 11 | pthread_key_t_ 16 12 | pthread_cond_t_ 32 13 | pthread_condattr_t_ 4 14 | pthread_rwlock_t_ 28 15 | pthread_rwlockattr_t_ 4 16 | pthread_once_t_ 8 17 | ptw32_cleanup_t 12 18 | sched_param 4 19 | ------------------------------- 20 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/SIZES.VSE: -------------------------------------------------------------------------------- 1 | Sizes of pthreads-win32 structs 2 | ------------------------------- 3 | pthread_t_ 68 4 | pthread_attr_t_ 28 5 | sem_t_ 4 6 | pthread_mutex_t_ 44 7 | pthread_mutexattr_t_ 8 8 | pthread_spinlock_t_ 8 9 | pthread_barrier_t_ 24 10 | pthread_barrierattr_t_ 4 11 | pthread_key_t_ 16 12 | pthread_cond_t_ 32 13 | pthread_condattr_t_ 4 14 | pthread_rwlock_t_ 28 15 | pthread_rwlockattr_t_ 4 16 | pthread_once_t_ 8 17 | ptw32_cleanup_t 12 18 | sched_param 4 19 | ------------------------------- 20 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/barrier1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * barrier1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Create a barrier object and then destroy it. 37 | * 38 | */ 39 | 40 | #include "test.h" 41 | 42 | pthread_barrier_t barrier = NULL; 43 | 44 | int 45 | main() 46 | { 47 | assert(barrier == NULL); 48 | 49 | assert(pthread_barrier_init(&barrier, NULL, 1) == 0); 50 | 51 | assert(barrier != NULL); 52 | 53 | assert(pthread_barrier_destroy(&barrier) == 0); 54 | 55 | assert(barrier == NULL); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/barrier2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * barrier2.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a single barrier object, wait on it, 37 | * and then destroy it. 38 | * 39 | */ 40 | 41 | #include "test.h" 42 | 43 | pthread_barrier_t barrier = NULL; 44 | 45 | int 46 | main() 47 | { 48 | assert(pthread_barrier_init(&barrier, NULL, 1) == 0); 49 | 50 | assert(pthread_barrier_wait(&barrier) == PTHREAD_BARRIER_SERIAL_THREAD); 51 | 52 | assert(pthread_barrier_destroy(&barrier) == 0); 53 | 54 | return 0; 55 | } 56 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/create1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * create1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Description: 37 | * Create a thread and check that it ran. 38 | * 39 | * Depends on API functions: None. 40 | */ 41 | 42 | #include "test.h" 43 | 44 | static int washere = 0; 45 | 46 | void * func(void * arg) 47 | { 48 | washere = 1; 49 | return 0; 50 | } 51 | 52 | int 53 | main() 54 | { 55 | pthread_t t; 56 | 57 | assert(pthread_create(&t, NULL, func, NULL) == 0); 58 | 59 | /* A dirty hack, but we cannot rely on pthread_join in this 60 | primitive test. */ 61 | Sleep(2000); 62 | 63 | assert(washere == 1); 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/delay1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * delay1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on API functions: 37 | * pthread_delay_np 38 | */ 39 | 40 | #include "test.h" 41 | 42 | int 43 | main(int argc, char * argv[]) 44 | { 45 | struct timespec interval = {1L, 500000000L}; 46 | 47 | assert(pthread_delay_np(&interval) == 0); 48 | 49 | return 0; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/equal1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test for pthread_equal. 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on functions: pthread_create(). 37 | */ 38 | 39 | #include "test.h" 40 | 41 | void * func(void * arg) 42 | { 43 | Sleep(2000); 44 | return 0; 45 | } 46 | 47 | int 48 | main() 49 | { 50 | pthread_t t1, t2; 51 | 52 | assert(pthread_create(&t1, NULL, func, (void *) 1) == 0); 53 | 54 | assert(pthread_create(&t2, NULL, func, (void *) 2) == 0); 55 | 56 | assert(pthread_equal(t1, t2) == 0); 57 | 58 | assert(pthread_equal(t1,t1) != 0); 59 | 60 | /* This is a hack. We don't want to rely on pthread_join 61 | yet if we can help it. */ 62 | Sleep(4000); 63 | 64 | /* Success. */ 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/exit1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test for pthread_exit(). 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on API functions: None. 37 | */ 38 | 39 | #include "test.h" 40 | 41 | int 42 | main(int argc, char * argv[]) 43 | { 44 | /* A simple test first. */ 45 | pthread_exit((void *) 0); 46 | 47 | /* Not reached */ 48 | assert(0); 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/exit2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test for pthread_exit(). 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on API functions: 37 | * pthread_create() 38 | * pthread_exit() 39 | */ 40 | 41 | #include "test.h" 42 | 43 | void * 44 | func(void * arg) 45 | { 46 | pthread_exit(arg); 47 | 48 | /* Never reached. */ 49 | assert(0); 50 | 51 | return NULL; 52 | } 53 | 54 | int 55 | main(int argc, char * argv[]) 56 | { 57 | pthread_t t; 58 | 59 | assert(pthread_create(&t, NULL, func, (void *) NULL) == 0); 60 | 61 | Sleep(1000); 62 | 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/exit3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test for pthread_exit(). 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on API functions: pthread_create(). 37 | */ 38 | 39 | #include "test.h" 40 | 41 | void * 42 | func(void * arg) 43 | { 44 | pthread_exit(arg); 45 | 46 | /* Never reached. */ 47 | assert(0); 48 | 49 | return NULL; 50 | } 51 | 52 | int 53 | main(int argc, char * argv[]) 54 | { 55 | pthread_t id[4]; 56 | int i; 57 | 58 | /* Create a few threads and then exit. */ 59 | for (i = 0; i < 4; i++) 60 | { 61 | assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); 62 | } 63 | 64 | Sleep(1000); 65 | 66 | /* Success. */ 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/join0.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test for pthread_join(). 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on API functions: pthread_create(), pthread_exit(). 37 | */ 38 | 39 | #include "test.h" 40 | 41 | void * 42 | func(void * arg) 43 | { 44 | Sleep(2000); 45 | 46 | pthread_exit(arg); 47 | 48 | /* Never reached. */ 49 | exit(1); 50 | } 51 | 52 | int 53 | main(int argc, char * argv[]) 54 | { 55 | pthread_t id; 56 | int result; 57 | 58 | /* Create a single thread and wait for it to exit. */ 59 | assert(pthread_create(&id, NULL, func, (void *) 123) == 0); 60 | 61 | assert(pthread_join(id, (void **) &result) == 0); 62 | 63 | assert(result == 123); 64 | 65 | /* Success. */ 66 | return 0; 67 | } 68 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/join2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Test for pthread_join() returning return value from threads. 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Depends on API functions: pthread_create(). 37 | */ 38 | 39 | #include "test.h" 40 | 41 | void * 42 | func(void * arg) 43 | { 44 | Sleep(1000); 45 | return arg; 46 | } 47 | 48 | int 49 | main(int argc, char * argv[]) 50 | { 51 | pthread_t id[4]; 52 | int i; 53 | int result; 54 | 55 | /* Create a few threads and then exit. */ 56 | for (i = 0; i < 4; i++) 57 | { 58 | assert(pthread_create(&id[i], NULL, func, (void *) i) == 0); 59 | } 60 | 61 | for (i = 0; i < 4; i++) 62 | { 63 | assert(pthread_join(id[i], (void **) &result) == 0); 64 | assert(result == i); 65 | } 66 | 67 | /* Success. */ 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/mutex1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Create a simple mutex object, lock it, and then unlock it again. 37 | * This is the simplest test of the pthread mutex family that we can do. 38 | * 39 | * Depends on API functions: 40 | * pthread_mutex_init() 41 | * pthread_mutex_lock() 42 | * pthread_mutex_unlock() 43 | * pthread_mutex_destroy() 44 | */ 45 | 46 | #include "test.h" 47 | 48 | pthread_mutex_t mutex = NULL; 49 | 50 | int 51 | main() 52 | { 53 | assert(mutex == NULL); 54 | 55 | assert(pthread_mutex_init(&mutex, NULL) == 0); 56 | 57 | assert(mutex != NULL); 58 | 59 | assert(pthread_mutex_lock(&mutex) == 0); 60 | 61 | assert(pthread_mutex_unlock(&mutex) == 0); 62 | 63 | assert(pthread_mutex_destroy(&mutex) == 0); 64 | 65 | assert(mutex == NULL); 66 | 67 | return 0; 68 | } 69 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/mutex2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex2.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a static mutex object, lock it, 37 | * and then unlock it again. 38 | * 39 | * Depends on API functions: 40 | * pthread_mutex_lock() 41 | * pthread_mutex_unlock() 42 | */ 43 | 44 | #include "test.h" 45 | 46 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; 47 | 48 | int 49 | main() 50 | { 51 | assert(mutex == PTHREAD_MUTEX_INITIALIZER); 52 | 53 | assert(pthread_mutex_lock(&mutex) == 0); 54 | 55 | assert(mutex != PTHREAD_MUTEX_INITIALIZER); 56 | 57 | assert(mutex != NULL); 58 | 59 | assert(pthread_mutex_unlock(&mutex) == 0); 60 | 61 | assert(pthread_mutex_destroy(&mutex) == 0); 62 | 63 | assert(mutex == NULL); 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/mutex2e.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex2e.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a static mutex object, lock it, 37 | * and then unlock it again. 38 | * 39 | * Depends on API functions: 40 | * pthread_mutex_lock() 41 | * pthread_mutex_unlock() 42 | */ 43 | 44 | #include "test.h" 45 | 46 | pthread_mutex_t mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER; 47 | 48 | int 49 | main() 50 | { 51 | assert(mutex == PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); 52 | 53 | assert(pthread_mutex_lock(&mutex) == 0); 54 | 55 | assert(mutex != PTHREAD_ERRORCHECK_MUTEX_INITIALIZER); 56 | 57 | assert(mutex != NULL); 58 | 59 | assert(pthread_mutex_unlock(&mutex) == 0); 60 | 61 | assert(pthread_mutex_destroy(&mutex) == 0); 62 | 63 | assert(mutex == NULL); 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/mutex2r.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex2r.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a static mutex object, lock it, 37 | * and then unlock it again. 38 | * 39 | * Depends on API functions: 40 | * pthread_mutex_lock() 41 | * pthread_mutex_unlock() 42 | */ 43 | 44 | #include "test.h" 45 | 46 | pthread_mutex_t mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; 47 | 48 | int 49 | main() 50 | { 51 | assert(mutex == PTHREAD_RECURSIVE_MUTEX_INITIALIZER); 52 | 53 | assert(pthread_mutex_lock(&mutex) == 0); 54 | 55 | assert(mutex != PTHREAD_RECURSIVE_MUTEX_INITIALIZER); 56 | 57 | assert(mutex != NULL); 58 | 59 | assert(pthread_mutex_unlock(&mutex) == 0); 60 | 61 | assert(pthread_mutex_destroy(&mutex) == 0); 62 | 63 | assert(mutex == NULL); 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/mutex3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex3.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a static mutex object, lock it, trylock it, 37 | * and then unlock it again. 38 | * 39 | * Depends on API functions: 40 | * pthread_mutex_lock() 41 | * pthread_mutex_trylock() 42 | * pthread_mutex_unlock() 43 | */ 44 | 45 | #include "test.h" 46 | 47 | pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; 48 | 49 | static int washere = 0; 50 | 51 | void * func(void * arg) 52 | { 53 | assert(pthread_mutex_trylock(&mutex1) == EBUSY); 54 | 55 | washere = 1; 56 | 57 | return 0; 58 | } 59 | 60 | int 61 | main() 62 | { 63 | pthread_t t; 64 | 65 | assert(pthread_mutex_lock(&mutex1) == 0); 66 | 67 | assert(pthread_create(&t, NULL, func, NULL) == 0); 68 | assert(pthread_join(t, NULL) == 0); 69 | 70 | assert(pthread_mutex_unlock(&mutex1) == 0); 71 | 72 | assert(washere == 1); 73 | 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/mutex8.c: -------------------------------------------------------------------------------- 1 | /* 2 | * mutex8.c 3 | * 4 | * 5 | * Pthreads-win32 - POSIX Threads Library for Win32 6 | * Copyright (C) 1998 Ben Elliston and Ross Johnson 7 | * Copyright (C) 1999,2000,2001 Ross Johnson 8 | * 9 | * Contact Email: rpj@ise.canberra.edu.au 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * -------------------------------------------------------------------------- 26 | * 27 | * Test the default (type not set) mutex type exercising timedlock. 28 | * Thread locks mutex, another thread timedlocks the mutex. 29 | * Timed thread should timeout. 30 | * 31 | * Depends on API functions: 32 | * pthread_mutex_lock() 33 | * pthread_mutex_timedlock() 34 | * pthread_mutex_unlock() 35 | */ 36 | 37 | #include "test.h" 38 | #include 39 | 40 | static int lockCount = 0; 41 | 42 | static pthread_mutex_t mutex; 43 | 44 | void * locker(void * arg) 45 | { 46 | struct timespec abstime = { 0, 0 }; 47 | struct _timeb currSysTime; 48 | const DWORD NANOSEC_PER_MILLISEC = 1000000; 49 | 50 | _ftime(&currSysTime); 51 | 52 | abstime.tv_sec = currSysTime.time; 53 | abstime.tv_nsec = NANOSEC_PER_MILLISEC * currSysTime.millitm; 54 | 55 | abstime.tv_sec += 1; 56 | 57 | assert(pthread_mutex_timedlock(&mutex, &abstime) == ETIMEDOUT); 58 | 59 | lockCount++; 60 | 61 | return 0; 62 | } 63 | 64 | int 65 | main() 66 | { 67 | pthread_t t; 68 | 69 | assert(pthread_mutex_init(&mutex, NULL) == 0); 70 | 71 | assert(pthread_mutex_lock(&mutex) == 0); 72 | 73 | assert(pthread_create(&t, NULL, locker, NULL) == 0); 74 | 75 | Sleep(2000); 76 | 77 | assert(lockCount == 1); 78 | 79 | assert(pthread_mutex_unlock(&mutex) == 0); 80 | 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/once1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * once1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Create a static pthread_once and test that it calls myfunc once. 37 | * 38 | * Depends on API functions: 39 | * pthread_once() 40 | * pthread_create() 41 | */ 42 | 43 | #include "test.h" 44 | 45 | pthread_once_t once = PTHREAD_ONCE_INIT; 46 | 47 | static int washere = 0; 48 | 49 | void 50 | myfunc(void) 51 | { 52 | washere++; 53 | } 54 | 55 | void * 56 | mythread(void * arg) 57 | { 58 | assert(pthread_once(&once, myfunc) == 0); 59 | 60 | return 0; 61 | } 62 | 63 | int 64 | main() 65 | { 66 | pthread_t t1, t2; 67 | 68 | assert(pthread_create(&t1, NULL, mythread, NULL) == 0); 69 | 70 | assert(pthread_create(&t2, NULL, mythread, NULL) == 0); 71 | 72 | Sleep(2000); 73 | 74 | assert(washere == 1); 75 | 76 | return 0; 77 | } 78 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/rwlock1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rwlock1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Create a simple rwlock object and then destroy it. 37 | * 38 | * Depends on API functions: 39 | * pthread_rwlock_init() 40 | * pthread_rwlock_destroy() 41 | */ 42 | 43 | #include "test.h" 44 | 45 | pthread_rwlock_t rwlock = NULL; 46 | 47 | int 48 | main() 49 | { 50 | assert(rwlock == NULL); 51 | 52 | assert(pthread_rwlock_init(&rwlock, NULL) == 0); 53 | 54 | assert(rwlock != NULL); 55 | 56 | assert(pthread_rwlock_destroy(&rwlock) == 0); 57 | 58 | assert(rwlock == NULL); 59 | 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/rwlock2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rwlock2.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a static rwlock object, lock it, 37 | * and then unlock it again. 38 | * 39 | * Depends on API functions: 40 | * pthread_rwlock_rdlock() 41 | * pthread_rwlock_unlock() 42 | */ 43 | 44 | #include "test.h" 45 | 46 | pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; 47 | 48 | int 49 | main() 50 | { 51 | assert(rwlock == PTHREAD_RWLOCK_INITIALIZER); 52 | 53 | assert(pthread_rwlock_rdlock(&rwlock) == 0); 54 | 55 | assert(rwlock != PTHREAD_RWLOCK_INITIALIZER); 56 | 57 | assert(rwlock != NULL); 58 | 59 | assert(pthread_rwlock_unlock(&rwlock) == 0); 60 | 61 | assert(pthread_rwlock_destroy(&rwlock) == 0); 62 | 63 | assert(rwlock == NULL); 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/self1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * self1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Test for pthread_self(). 37 | * 38 | * Depends on API functions: 39 | * pthread_self() 40 | * 41 | * Implicitly depends on: 42 | * pthread_getspecific() 43 | * pthread_setspecific() 44 | */ 45 | 46 | #include "test.h" 47 | 48 | int 49 | main(int argc, char * argv[]) 50 | { 51 | /* 52 | * This should always succeed unless the system has no 53 | * resources (memory) left. 54 | */ 55 | pthread_t self; 56 | 57 | #ifdef PTW32_STATIC_LIB 58 | pthread_win32_process_attach_np(); 59 | #endif 60 | 61 | self = pthread_self(); 62 | 63 | assert(self.p != NULL); 64 | 65 | #ifdef PTW32_STATIC_LIB 66 | pthread_win32_process_detach_np(); 67 | #endif 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/self2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * self2.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Test for pthread_self(). 37 | * 38 | * Depends on API functions: 39 | * pthread_create() 40 | * pthread_self() 41 | * 42 | * Implicitly depends on: 43 | * pthread_getspecific() 44 | * pthread_setspecific() 45 | */ 46 | 47 | #include "test.h" 48 | #include 49 | 50 | static pthread_t me; 51 | 52 | void * 53 | entry(void * arg) 54 | { 55 | me = pthread_self(); 56 | 57 | return arg; 58 | } 59 | 60 | int 61 | main() 62 | { 63 | pthread_t t; 64 | 65 | assert(pthread_create(&t, NULL, entry, NULL) == 0); 66 | 67 | Sleep(100); 68 | 69 | assert(pthread_equal(t, me) != 0); 70 | 71 | /* Success. */ 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/sizes.c: -------------------------------------------------------------------------------- 1 | #define _WIN32_WINNT 0x400 2 | 3 | #include "test.h" 4 | #include "../implement.h" 5 | 6 | int 7 | main() 8 | { 9 | printf("Sizes of pthreads-win32 structs\n"); 10 | printf("-------------------------------\n"); 11 | printf("%30s %4d\n", "pthread_t", sizeof(pthread_t)); 12 | printf("%30s %4d\n", "ptw32_thread_t", sizeof(ptw32_thread_t)); 13 | printf("%30s %4d\n", "pthread_attr_t_", sizeof(struct pthread_attr_t_)); 14 | printf("%30s %4d\n", "sem_t_", sizeof(struct sem_t_)); 15 | printf("%30s %4d\n", "pthread_mutex_t_", sizeof(struct pthread_mutex_t_)); 16 | printf("%30s %4d\n", "pthread_mutexattr_t_", sizeof(struct pthread_mutexattr_t_)); 17 | printf("%30s %4d\n", "pthread_spinlock_t_", sizeof(struct pthread_spinlock_t_)); 18 | printf("%30s %4d\n", "pthread_barrier_t_", sizeof(struct pthread_barrier_t_)); 19 | printf("%30s %4d\n", "pthread_barrierattr_t_", sizeof(struct pthread_barrierattr_t_)); 20 | printf("%30s %4d\n", "pthread_key_t_", sizeof(struct pthread_key_t_)); 21 | printf("%30s %4d\n", "pthread_cond_t_", sizeof(struct pthread_cond_t_)); 22 | printf("%30s %4d\n", "pthread_condattr_t_", sizeof(struct pthread_condattr_t_)); 23 | printf("%30s %4d\n", "pthread_rwlock_t_", sizeof(struct pthread_rwlock_t_)); 24 | printf("%30s %4d\n", "pthread_rwlockattr_t_", sizeof(struct pthread_rwlockattr_t_)); 25 | printf("%30s %4d\n", "pthread_once_t_", sizeof(struct pthread_once_t_)); 26 | printf("%30s %4d\n", "ptw32_cleanup_t", sizeof(struct ptw32_cleanup_t)); 27 | printf("%30s %4d\n", "ptw32_mcs_node_t_", sizeof(struct ptw32_mcs_node_t_)); 28 | printf("%30s %4d\n", "sched_param", sizeof(struct sched_param)); 29 | printf("-------------------------------\n"); 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/spin1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spin1.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Create a simple spinlock object, lock it, and then unlock it again. 37 | * This is the simplest test of the pthread mutex family that we can do. 38 | * 39 | */ 40 | 41 | #include "test.h" 42 | 43 | pthread_spinlock_t lock; 44 | 45 | int 46 | main() 47 | { 48 | assert(pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE) == 0); 49 | 50 | assert(pthread_spin_lock(&lock) == 0); 51 | 52 | assert(pthread_spin_unlock(&lock) == 0); 53 | 54 | assert(pthread_spin_destroy(&lock) == 0); 55 | 56 | assert(pthread_spin_lock(&lock) == EINVAL); 57 | 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tests/spin2.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spin2.c 3 | * 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Pthreads-win32 - POSIX Threads Library for Win32 8 | * Copyright(C) 1998 John E. Bossom 9 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 10 | * 11 | * Contact Email: rpj@callisto.canberra.edu.au 12 | * 13 | * The current list of contributors is contained 14 | * in the file CONTRIBUTORS included with the source 15 | * code distribution. The list can also be seen at the 16 | * following World Wide Web location: 17 | * http://sources.redhat.com/pthreads-win32/contributors.html 18 | * 19 | * This library is free software; you can redistribute it and/or 20 | * modify it under the terms of the GNU Lesser General Public 21 | * License as published by the Free Software Foundation; either 22 | * version 2 of the License, or (at your option) any later version. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library in the file COPYING.LIB; 31 | * if not, write to the Free Software Foundation, Inc., 32 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 33 | * 34 | * -------------------------------------------------------------------------- 35 | * 36 | * Declare a spinlock object, lock it, trylock it, 37 | * and then unlock it again. 38 | * 39 | */ 40 | 41 | #include "test.h" 42 | 43 | pthread_spinlock_t lock = NULL; 44 | 45 | static int washere = 0; 46 | 47 | void * func(void * arg) 48 | { 49 | assert(pthread_spin_trylock(&lock) == EBUSY); 50 | 51 | washere = 1; 52 | 53 | return 0; 54 | } 55 | 56 | int 57 | main() 58 | { 59 | pthread_t t; 60 | 61 | assert(pthread_spin_init(&lock, PTHREAD_PROCESS_PRIVATE) == 0); 62 | 63 | assert(pthread_spin_lock(&lock) == 0); 64 | 65 | assert(pthread_create(&t, NULL, func, NULL) == 0); 66 | assert(pthread_join(t, NULL) == 0); 67 | 68 | assert(pthread_spin_unlock(&lock) == 0); 69 | 70 | assert(pthread_spin_destroy(&lock) == 0); 71 | 72 | assert(washere == 1); 73 | 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /win32compat/pthreads-w32-2-7-0-release/tsd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tsd.c 3 | * 4 | * Description: 5 | * POSIX thread functions which implement thread-specific data (TSD). 6 | * 7 | * -------------------------------------------------------------------------- 8 | * 9 | * Pthreads-win32 - POSIX Threads Library for Win32 10 | * Copyright(C) 1998 John E. Bossom 11 | * Copyright(C) 1999,2005 Pthreads-win32 contributors 12 | * 13 | * Contact Email: rpj@callisto.canberra.edu.au 14 | * 15 | * The current list of contributors is contained 16 | * in the file CONTRIBUTORS included with the source 17 | * code distribution. The list can also be seen at the 18 | * following World Wide Web location: 19 | * http://sources.redhat.com/pthreads-win32/contributors.html 20 | * 21 | * This library is free software; you can redistribute it and/or 22 | * modify it under the terms of the GNU Lesser General Public 23 | * License as published by the Free Software Foundation; either 24 | * version 2 of the License, or (at your option) any later version. 25 | * 26 | * This library is distributed in the hope that it will be useful, 27 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 28 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 29 | * Lesser General Public License for more details. 30 | * 31 | * You should have received a copy of the GNU Lesser General Public 32 | * License along with this library in the file COPYING.LIB; 33 | * if not, write to the Free Software Foundation, Inc., 34 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 35 | */ 36 | 37 | #include "pthread.h" 38 | #include "implement.h" 39 | 40 | 41 | #include "pthread_key_create.c" 42 | #include "pthread_key_delete.c" 43 | #include "pthread_setspecific.c" 44 | #include "pthread_getspecific.c" 45 | -------------------------------------------------------------------------------- /win32compat/sys/socket.h: -------------------------------------------------------------------------------- 1 | #ifndef __SOCKET_H 2 | #define __SOCKET_H 3 | 4 | #include 5 | #include 6 | 7 | #endif -------------------------------------------------------------------------------- /win32compat/sys/time.h: -------------------------------------------------------------------------------- 1 | #ifndef __TIME_H 2 | #define __TIME_H 3 | 4 | typedef long time_t; 5 | 6 | #endif -------------------------------------------------------------------------------- /win32compat/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef __TYPES_H 2 | #define __TYPES_H 3 | 4 | /* 7.18.1.1 Exact-width integer types */ 5 | #ifdef _MSC_VER 6 | typedef signed __int8 int8_t; 7 | typedef unsigned __int8 u_int8_t; 8 | typedef unsigned __int8 u_char; 9 | typedef __int16 int16_t; 10 | typedef unsigned __int16 u_int16_t; 11 | typedef __int32 int32_t; 12 | typedef unsigned __int32 u_int32_t; 13 | typedef __int64 int64_t; 14 | typedef unsigned __int64 u_int64_t; 15 | #else 16 | typedef signed char int8_t; 17 | typedef unsigned char u_int8_t; 18 | typedef unsigned char u_char; 19 | typedef short int16_t; 20 | typedef unsigned short u_int16_t; 21 | typedef int int32_t; 22 | typedef unsigned int u_int32_t; 23 | typedef long long int64_t; 24 | typedef unsigned int64_t u_int64_t; 25 | #endif 26 | 27 | typedef long time_t; 28 | typedef long _ssize_t; 29 | typedef _ssize_t ssize_t; 30 | typedef u_int64_t off64_t; 31 | typedef u_int64_t fpos64_t; 32 | 33 | #endif --------------------------------------------------------------------------------