npth.git
4 years agoRelease 1.2 npth-1.2
Werner Koch [Sat, 11 Apr 2015 11:58:48 +0000 (13:58 +0200)]
Release 1.2

4 years agow32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.
Werner Koch [Tue, 3 Feb 2015 14:17:49 +0000 (15:17 +0100)]
w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.

* w32/Makefile.am: Remove non-Windows stuff.
(extra_ltoptions): New.
(libnpth_la_LDFLAGS): Use it.
--

Since gcc 4.8 there is a regression in that plain C programs may link
to libgcc_s.a which has a dependency on libgcc_s_sjlj.dll.  This is
for example triggered by using long long arithmetic on a 32 bit
Windows (e.g symbol __udivdi3).

4 years agoSwitch to automake 1.14.
Werner Koch [Wed, 28 Jan 2015 09:10:47 +0000 (10:10 +0100)]
Switch to automake 1.14.

* Makefile.am (AUTOMAKE_OPTIONS): Move to ...
* configure.ac (AM_INIT_AUTOMAKE): here.  Add serial-tests.
* build-aux/compile: Add.
* build-aux/config.guess, build-aux/config.sub: Update.
* build-aux/depcomp: Update.
* build-aux/missing: Update.

4 years agoDon't get fooled by leave_npth changing ERRNO.
Werner Koch [Thu, 18 Dec 2014 15:54:51 +0000 (16:54 +0100)]
Don't get fooled by leave_npth changing ERRNO.

* src/npth.c: Save ERRNO.
--
GnuPG-bug-id: 1773

Note that there is no need to do that in enter_pth because the specs
for sem_post don't identify EINTR as a possible return value.

4 years agoPost release updates.
Werner Koch [Fri, 31 Oct 2014 06:54:54 +0000 (07:54 +0100)]
Post release updates.

--

4 years agoRelease 1.1. npth-1.1
Werner Koch [Fri, 31 Oct 2014 06:49:44 +0000 (07:49 +0100)]
Release 1.1.

* configure.ac: Set LT version to C0/A0/R4.

4 years agoAllow use on systems which return ENOSYS for sem_init.
Werner Koch [Wed, 29 Oct 2014 11:25:20 +0000 (12:25 +0100)]
Allow use on systems which return ENOSYS for sem_init.

* src/npth.c: Include some more headers.
(sceptre_buffer): New.
(sceptre): Change to a pointer and init to sceptre_buffer.
(enter_npth, leave_npth): Adjust.
(try_sem_open): New.
(npth_init): Check for ENOSYS and use sem_open.
--

This is for example the case on OS X and some AIX versions Thanks to
Patrick Brunschwig for finding this problem and suggesting a solution.

4 years agoPost release updates
Werner Koch [Thu, 18 Sep 2014 06:11:00 +0000 (08:11 +0200)]
Post release updates

--

4 years agoRelease 1.0 npth-1.0
Werner Koch [Thu, 18 Sep 2014 06:06:58 +0000 (08:06 +0200)]
Release 1.0

* configure.ac: Set LT version to C0/A0/R2.

4 years agow32: Remove a debug message.
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
w32: Remove a debug message.

--

4 years agow32: Fix segv in npth_eselect.
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
w32: Fix segv in npth_eselect.

* w32/npth.c (npth_eselect): Obvious fix.

4 years agow32: Change an npth_eselect arg to unsigned.
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
w32: Change an npth_eselect arg to unsigned.

* w32/npth.c (npth_eselect): Change arg EVENTS_SET to unsigned int.
--

We use an unsigned int instead of a signed int for the bit vector for
clarity.

4 years agow32: Let npth_eselect return 0 for timeout. Fix replacement error codes.
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
w32: Let npth_eselect return 0 for timeout. Fix replacement error codes.

* w32/npth.c (npth_eselect): Remove debug output.  Return 0 for timeout.
* w32/npth.h (ETIMEDOUT, EOPNOTSUPP):  Change to more correct values.

5 years agow32: Make npth_eselect actually work.
Werner Koch [Wed, 19 Feb 2014 19:56:20 +0000 (20:56 +0100)]
w32: Make npth_eselect actually work.

* w32/npth.c (npth_eselect): Rewrite.
--

It never worked because the result FDSETs were first cleared and then
used to see which fd to check after the WFMO.  The new way better
resembles the way a select is expected to work under Windows (ignoring
the first arg) and will also work if this library is used by
application which have been build with a different FD_SETSIZE.

5 years agow32: Avoid calling FD_ISSET with a NULL fdset.
Werner Koch [Wed, 19 Feb 2014 13:09:20 +0000 (14:09 +0100)]
w32: Avoid calling FD_ISSET with a NULL fdset.

* w32/npth.c (npth_eselect): Check fdset before callig FD_foo.

5 years agoUse the generic autogen.sh script.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Use the generic autogen.sh script.

* autogen.rc: New.
* Makefile.am (EXTRA_DIST): Add it.
* autogen.sh: Update from GnuPG.

5 years agoMove helper scripts to build-aux.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Move helper scripts to build-aux.

* config.guess, config.sub, depcomp, install-sh
* ltmain.sh, missing: Move to build-aux/.
* configure.ac (AC_CONFIG_AUX_DIR): New.
(AM_SILENT_RULES): New.

5 years agoFix creation of w32 npth-config tool.
Werner Koch [Thu, 9 Jan 2014 16:41:16 +0000 (17:41 +0100)]
Fix creation of w32 npth-config tool.

* src/npth-config.in: Move to ../.
* src/npth.m4: Move to ../.
* w32/npth-config.in: Remove.
* w32/npth.m4: Remove.
* Makefile.am (EXTRA_DIST): Add npth-config.in and npth.m4.
(bin_SCRIPTS): new.
(m4datadir, m4data_DATA): New.
* configure.ac (AC_CONFIG_FILES): Adjust accordingly.

5 years agoAdd configure option --enable-silent-rules.
Werner Koch [Thu, 9 Jan 2014 14:13:48 +0000 (15:13 +0100)]
Add configure option --enable-silent-rules.

* configure.ac: Add AM_SILENT_RULES.

5 years agoautogen.sh: Change preferences of w32 toolchains
Werner Koch [Thu, 9 Jan 2014 14:10:47 +0000 (15:10 +0100)]
autogen.sh: Change preferences of w32 toolchains

--

5 years agoUpdate libtool to support Android.
Werner Koch [Thu, 9 Jan 2014 14:06:32 +0000 (15:06 +0100)]
Update libtool to support Android.

* m4/libtool.m4: Add "linux*android*" case.  Taken from the
libgpg-error.
--

This is the libgpg-error commit

  commit bf0d67dbfa4161e529781d6dfbfcce7126c3bf22
  Author: David 'Digit' Turner <digit@google.com>
  Date:   Tue Oct 22 14:26:53 2013 +0200

5 years agoUpdate config.{guess.sub} to a decent version (2013-11-29)
Werner Koch [Thu, 9 Jan 2014 14:03:15 +0000 (15:03 +0100)]
Update config.{guess.sub} to a decent version (2013-11-29)

5 years agoAdd hack to have different names for 64 bit Windows DLLs.
Werner Koch [Mon, 17 Jun 2013 14:11:23 +0000 (16:11 +0200)]
Add hack to have different names for 64 bit Windows DLLs.

* ltmain.sh: Prefix the SO number for W64 with a "6".
--

We need to stick to libtool 2.4.2 anyway, thus we take the easy way
and hack libtool instead of adding "-release 6" to the Makefile.  This
also avoids an extra dash before the 6 and thus yields a prettier name
than the one produced by the -release option.  The header files and
def files are supposed to be identical for w32 and w64 thus we don't
need to do any special code for them.

Having a different namespace for 64 bit DLLs is such a good idea that
I hope this or a similar feature will be provided by future libtool
versions.

5 years agoFix libtool 2.4.2 to correctly detect .def files.
Werner Koch [Thu, 18 Apr 2013 12:40:43 +0000 (14:40 +0200)]
Fix libtool 2.4.2 to correctly detect .def files.

* ltmain.sh (sed_uncomment_deffile): New.
(orig_export_symbols): Uncomment def file before testing for EXPORTS.
* m4/libtool.m4: Do the same for the generated code.
--

The old code was not correct in that it only looked at the first line
and puts an EXPORTS keyword in front if missing.  Binutils 2.22
accepted a duplicated EXPORTS keyword but at least 2.23.2 is more
stringent and bails out without this fix.

There is no need to send this upstream.  Upstream's git master has a
lot of changes including a similar fix for this problems.  There are
no signs that a libtool 2.4.3 will be released to fix this problem and
thus we need to stick to our copy of 2.4.2 along with this patch.

Signed-off-by: Werner Koch <wk@gnupg.org>
5 years agoUpdate libtool to Debian's 2.4.2.
Werner Koch [Thu, 9 Jan 2014 13:51:46 +0000 (14:51 +0100)]
Update libtool to Debian's 2.4.2.

5 years agow32: Fix build problems with current compilers.
Werner Koch [Thu, 9 Jan 2014 13:39:25 +0000 (14:39 +0100)]
w32: Fix build problems with current compilers.

* configure.ac (NTELIBS): ac_subst for W32.
* w32/npth.h (struct timespec): Do not define for current mingw-w64
versions.

5 years agoConditionalize use of pthread_atfork.
NIIBE Yutaka [Tue, 10 Dec 2013 00:00:37 +0000 (09:00 +0900)]
Conditionalize use of pthread_atfork.

* configure.ac: Add checking pthread_atfork.

* src/npth-sigev.c (npth_sigev_fini): Call pthread_atfork only when
it's available.

--

GnuPG-bug-id: 1576

5 years agoRestore sigmask at fork.
NIIBE Yutaka [Wed, 3 Jul 2013 08:06:49 +0000 (17:06 +0900)]
Restore sigmask at fork.

* src/npth-sigev.c (restore_sigmask_for_child_process): New.
(npth_sigev_fini): Register restore_sigmask_for_child_process.

6 years agoBuild fix for NetBSD.
Ben Kibbey [Tue, 20 Nov 2012 04:04:07 +0000 (23:04 -0500)]
Build fix for NetBSD.

* src/npth.c (npth_setname_np): conditional check for __NetBSD__ and
adapt correct parameters.
--

Not sure how far back pthread_setname_np() goes on NetBSD. This
function has funny parameters on NetBSD and I *think* this is the
correct
fix (http://www.daemon-systems.org/man/pthread_setname_np.3.html). Fixes
the build anyway.

6 years agoImprove parsing of the GIT revision number.
Werner Koch [Fri, 16 Nov 2012 12:42:44 +0000 (13:42 +0100)]
Improve parsing of the GIT revision number.

* configure.ac (git_revision): Use git rev-parse.

6 years agoFix non-portable use of chmod in autogen.sh.
Werner Koch [Fri, 16 Nov 2012 12:41:49 +0000 (13:41 +0100)]
Fix non-portable use of chmod in autogen.sh.

* autogen.sh: Remove option -c from chmod.

6 years agoMake local variables configure hack more robust
Werner Koch [Wed, 26 Sep 2012 14:38:49 +0000 (16:38 +0200)]
Make local variables configure hack more robust

* configure.ac (emacs_local_vars_begin): Use extra m4 quoting so that
newer Emscasen won't take it up as Local Variables for this file.

6 years agoPost release version bump
Werner Koch [Wed, 8 Aug 2012 04:51:04 +0000 (06:51 +0200)]
Post release version bump

--

6 years agoRelease 0.91 npth-0.91
Werner Koch [Wed, 8 Aug 2012 04:44:18 +0000 (06:44 +0200)]
Release 0.91

* configure.ac: Bump LT version to C0/A0/R2.

7 years agoReally fix the version number parsing.
Werner Koch [Tue, 15 May 2012 15:03:07 +0000 (17:03 +0200)]
Really fix the version number parsing.

* src/npth.m4 (_AM_PATH_NPTH_CONFIG, _AM_PATH_NPTH_CONFIG]: Fix last
fix.  Print detected version number.  Print warning for non-matching
host.
--

Repeat with me:  Before-breakfast-hacking is a bad habit.

7 years agoFix version number parsing in npth.m4.
Werner Koch [Tue, 15 May 2012 07:05:08 +0000 (09:05 +0200)]
Fix version number parsing in npth.m4.

* src/npth.m4: Adjust for n.m style version numbers.

7 years agoProvide gettimeofday fallback for clock_gettime.
Werner Koch [Thu, 10 May 2012 18:28:23 +0000 (20:28 +0200)]
Provide gettimeofday fallback for clock_gettime.

* configure.ac (AC_CHECK_FUNCS): Check for gettimeofday.
* src/npth.c (npth_clock_gettime): Use gettimeofday if clock_gettime
is not available.
--

This should fix the MacOS problem.

7 years agoReturn an error if npth_rwlock_timedwrlock is not supported.
Werner Koch [Thu, 10 May 2012 17:00:35 +0000 (19:00 +0200)]
Return an error if npth_rwlock_timedwrlock is not supported.

* src/npth.c (npth_rwlock_timedwrlock): Return ENOSYS if there is no
way to build it.

7 years agoAvoid compiler warning for debug variable.
Werner Koch [Thu, 10 May 2012 16:59:17 +0000 (18:59 +0200)]
Avoid compiler warning for debug variable.

* src/npth.c (main_thread): Flag as volatile.

7 years agoInclude required headers into pth.h.
Werner Koch [Thu, 10 May 2012 16:47:00 +0000 (18:47 +0200)]
Include required headers into pth.h.

* src/npth.h.in: Include sys/time.h and signal.h.  Include time.h only
if available.
* configure.ac (INSERT_SYS_TIME_H, INSERT_TIME_H, INSERT_SIGNAL_H):
Detect header files and ac_subst snippets.
--

sys/time.h is required for struct timeval and signal.h for sigset_t.
Without that them the regression test fails on IRIX.  Conditional
inclusion of these files might not bee required, but it should not
harm, either.

7 years agoRemove obsolete debug stuff.
Werner Koch [Thu, 10 May 2012 15:03:48 +0000 (17:03 +0200)]
Remove obsolete debug stuff.

* src/npth.c (enter_npth, leave_npth): Remove argument and debug
stuff.
(ENTER, LEAVE): Adjust macros accordingly.
--

The debug calls used c99 style varmarco arguments which is not good
for pre-c99 systems.  The debug stuff is not anymore needed, standard
system trace utilities are better suited for this task.

7 years agoAdd a basic create and join thread test case.
Werner Koch [Thu, 10 May 2012 14:55:48 +0000 (16:55 +0200)]
Add a basic create and join thread test case.

* tests/t-thread.c: New
* tests/t-support.h (opt_verbose):  New.
(fail_msg, info_msg): New.

7 years agoMake npth_setname_np actually work.
Werner Koch [Thu, 10 May 2012 13:31:37 +0000 (15:31 +0200)]
Make npth_setname_np actually work.

* src/npth.c (npth_setname_np): Fix typo in name and test macro.

7 years agoCheck for -lsocket et al.
Werner Koch [Thu, 10 May 2012 07:17:55 +0000 (09:17 +0200)]
Check for -lsocket et al.

* m4/libsocket.m4: New.  Stripped down from gnulib's socketlib.m4.
* tests/Makefile.am (LDADD): Add LIBSOCKET.
* configure.ac (NETLIBS): Remove because it is not used.
(npth_LIBSOCKET): Call.

7 years agoAdd a pselect emulation.
Werner Koch [Wed, 9 May 2012 18:44:12 +0000 (20:44 +0200)]
Add a pselect emulation.

* src/npth.c [!HAVE_PSELECT]: Include signal.h
(npth_pselect) [!HAVE_PSELECT]: Implement a crude pselect emulation
* configure.ac (AC_CHECK_FUNCS): Test for pselect.
--

This is a better than nothing emulation.  OpenBSD applications who
care about race conditions will probably use their own signal detection
via pipe.  This can be implemented on top of this emulation.

7 years agoCleanup the debug code.
Werner Koch [Wed, 9 May 2012 15:10:29 +0000 (17:10 +0200)]
Cleanup the debug code.

Debugging was only used for initial testing and there is no interface
to enable it at runtime.  This change make the code a little bit
cleaner.

7 years agoTake care of possible surprising sem_init implementations.
Werner Koch [Wed, 9 May 2012 15:08:30 +0000 (17:08 +0200)]
Take care of possible surprising sem_init implementations.

* src/npth.c (npth_init): Return an error only for POSIX.1-2008.
--

Although, I doubt that there is a sem_init version which does not
return 0 on success, it is better to avoid such surprises.  Most
callers will not test for the error return anyway.

7 years agoComment cleanups.
Werner Koch [Wed, 9 May 2012 14:25:36 +0000 (16:25 +0200)]
Comment cleanups.

--

7 years agoMake the t-mutex test more robust.
Werner Koch [Wed, 9 May 2012 13:21:34 +0000 (15:21 +0200)]
Make the t-mutex test more robust.

* tests/t-support.h: Simplify.
* tests/t-mutex.c: Include t-support.h.
(main): Check each call and explicitly return 0.

7 years agoLet npth_init actually return an error.
Werner Koch [Wed, 9 May 2012 13:13:10 +0000 (15:13 +0200)]
Let npth_init actually return an error.

* src/npth.c (npth_init): Return ERRNO.

7 years agoProvide a replacement for socklen_t.
Werner Koch [Wed, 9 May 2012 13:01:22 +0000 (15:01 +0200)]
Provide a replacement for socklen_t.

* m4/socklen.m4, m4/sys_socket_h.m4: New.
* configure.ac (INSERT_SOCKLEN_T): New.
* src/npth.h.in (INSERT_SOCKLEN_T): New substitution.
(npth_connect, npth_accept): Use _npth_socklen_t.
--

For example SGI IRIX 6.5 MIPS R10000 does not provide socklen_t.  We
provide the usual fallback to int as figured out by a gnulib test.
Note that _npth_socklen_t is internal to nPth and shall not be used by
applications.

7 years agoDo not use ___FUNCTION__.
Werner Koch [Wed, 9 May 2012 12:31:39 +0000 (14:31 +0200)]
Do not use ___FUNCTION__.

* src/npth.c: Define replacement for __func__.
(ENTER, LEAVE): Use __func__.

7 years agoTweak for building with c99.
Werner Koch [Wed, 9 May 2012 12:05:41 +0000 (14:05 +0200)]
Tweak for building with c99.

* tests/Makefile.am (AM_CPPFLAGS): Add -D_POSIX_C_SOURCE=200112L.

7 years agoAdd unistd.h is available.
Werner Koch [Wed, 9 May 2012 09:09:38 +0000 (11:09 +0200)]
Add unistd.h is available.

* configure.ac (AC_CHECK_HEADERS): Test for unistd.h.
* src/npth.c [HAVE_UNISTD_H]: Include unistd.h.

7 years agoImplement git magic to create beta version numbers.
Werner Koch [Fri, 4 May 2012 13:24:39 +0000 (15:24 +0200)]
Implement git magic to create beta version numbers.

* configure.ac (BUILD_FILEVERSION): Move after detection of W32.
--
Also update the version number for the next release.

7 years agoRelease 0.90. npth-0.90
Werner Koch [Fri, 4 May 2012 12:14:05 +0000 (14:14 +0200)]
Release 0.90.

* configure.ac: Bump LT version to C0/A0/R1.

7 years agoSupport Android API level earlier than 9.
Marcus Brinkmann [Fri, 9 Mar 2012 18:00:21 +0000 (19:00 +0100)]
Support Android API level earlier than 9.

* src/npth.h [__ANDROID__]: Include <android/api-level.h>
(_NPTH_NO_RWLOCK) [__ANDROID__ && __ANDROID_API__ < 9]: Define.
(npth_rwlockattr_t, npth_rwlockattr_init, npth_rwlockattr_destroy,
npth_rwlockattr_gettype_np, npth_rwlockattr_settype_np,
NPTH_RWLOCK_PREFER_READER_NP, NPTH_RWLOCK_PREFER_WRITER_NP,
NPTH_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, NPTH_RWLOCK_DEFAULT_NP,
NPTH_RWLOCK_INITIALIZER, NPTH_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP,
NPTH_MUTEX_INITIALIZER, npth_rwlock_t, npth_rwlock_init,
npth_rwlock_destroy, npth_rwlock_tryrdlock, npth_rwlock_rdlock,
npth_rwlock_trywrlock, npth_rwlock_timedrdlock, npth_rwlock_wrlock,
npth_rwlock_rdlock, npth_rwlock_timedwrlock, npth_rwlock_unlock
(_NPTH_NO_RWLOCK): Alternative implementation based on mutex.

7 years agoRemove npth_yield.
Marcus Brinkmann [Tue, 28 Feb 2012 16:24:19 +0000 (17:24 +0100)]
Remove npth_yield.

* src/npth.h.in (npth_yield): Macro removed (should have been a
function anyway).
* w32/npth.c (npth_yield): Remove function.
* w32/npth.h (npth_yield): Remove prototype.
* w32/npth.def (npth_yield): Remove symbol export.

7 years agoMake rwlock try and timed functions optional.
Marcus Brinkmann [Tue, 28 Feb 2012 15:52:07 +0000 (16:52 +0100)]
Make rwlock try and timed functions optional.

* configure.ac: Check for pthread_rwlock_rdlock, pthread_rwlock_wrlock,
pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock,
pthread_rwlock_tryrdlock, pthread_rwlock_trywrlock.
* src/npth.c (trylock_func_t): New type.
(busy_wait_for): New function.
(npth_mutex_timedlock) [!HAVE_PTHREAD_MUTEX_TIMEDLOCK]: Reimplement
in terms of busy_wait_for.
(npth_rwlock_rdlock, npth_rwlock_timedrdlock)
[!HAVE_PTHREAD_RWLOCK_TRYRDLOCK]: Skip trylock.
(npth_rwlock_wrlock, npth_rwlock_timedwrlock)
[!HAVE_PTHREAD_RWLOCK_TRYWRLOCK]: Skip trylock call.
(npth_rwlock_timedrdlock) [!HAVE_PTHREAD_RWLOCK_TIMEDRDLOCK]:
Use busy_wait_for.
(npth_rwlock_timedwrlock) [!HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK]:
Use busy_wait_for.

7 years agoAdd generated files src/npth.h and w32/npth-config.
Marcus Brinkmann [Tue, 28 Feb 2012 13:44:37 +0000 (14:44 +0100)]
Add generated files src/npth.h and w32/npth-config.

7 years agoFix include path for non-w32 builds.
Marcus Brinkmann [Wed, 8 Feb 2012 13:39:42 +0000 (14:39 +0100)]
Fix include path for non-w32 builds.

* tests/Makefile.am (AM_CPPFLAGS) [!HAVE_W32_SYSTEM]:
Locate header in build dir, not src.

7 years agoImplement npth_mutex_timedlock for inferior systems.
Marcus Brinkmann [Tue, 31 Jan 2012 14:33:55 +0000 (15:33 +0100)]
Implement npth_mutex_timedlock for inferior systems.

* configure.ac: Check for pthread_mutex_timedlock.
* src/npth.c (BUSY_WAIT_INTERVAL): New macro.
(npth_mutex_timedlock): If pthread_mutex_timedlock is missing,
use a poke-the-stick-at-it strategy.

7 years agoInclude sys/select.h if needed.
Werner Koch [Fri, 27 Jan 2012 18:55:22 +0000 (19:55 +0100)]
Include sys/select.h if needed.

* src/npth.h: Rename to npth.h.in.  Include sys/select.h if
available. Add usual read-only comments.
* configure.ac: Create npth.h.
(INSERT_SYS_SELECT_N): New
(emacs_local_vars_read_only): New vars to support read-only switching.

7 years agoUpdate config.guess and config.sub.
Werner Koch [Fri, 27 Jan 2012 14:20:08 +0000 (15:20 +0100)]
Update config.guess and config.sub.

* config.guess, config.sub: Update to version 2012-01-01.
* autogen.sh: Fix typo.

7 years agoEncapsulate clock_gettime.
Werner Koch [Fri, 27 Jan 2012 14:16:25 +0000 (15:16 +0100)]
Encapsulate clock_gettime.

* src/Makefile.am (libnpth_la_LDFLAGS): Remove -pthread and -lrt.
* src/npth.h (npth_clock_gettime): Turn macro into a function.
* src/npth.c (npth_clock_gettime): New.
* src/libnpth.vers: Add npth_clock_gettime.

7 years agoImprove pthread library detection.
Werner Koch [Fri, 27 Jan 2012 14:12:47 +0000 (15:12 +0100)]
Improve pthread library detection.

* configure.ac: Reorder some code.  Improve pthread test to take libc
in account.  Generate NPTH_CONFIG_LIBS from tests.
* src/npth-config.in: Use NPTH_CONFIG_LIBS.
* w32/npth-config.in: Ditto.
* tests/Makefile.am (AM_CPPFLAGS, AM_LDFLAGS): Don not pass -pthread.

7 years agoRemove unused include files from npth.h.
Werner Koch [Thu, 26 Jan 2012 16:27:37 +0000 (17:27 +0100)]
Remove unused include files from npth.h.

* src/npth.h: Remove unused poll.h and errno.h includes.

7 years agoMake npth_{s,g}etname_np portable.
Werner Koch [Thu, 26 Jan 2012 16:01:28 +0000 (17:01 +0100)]
Make npth_{s,g}etname_np portable.

These functions are usually used for debugging.  On systems where
they are not easy to support they will now simply return ENOSYS.
* configure.ac: Check for pthread_setname_np and pthread_getname_np.
* src/libnpth.vers: Add npth_setname_np and npth_getname_np.
* src/npth.c (npth_setname_np, npth_getname_np): New.
* src/npth.h (npth_setname_np, npth_getname_np): Turn macros into
functions.

7 years agoCheck for the non-portable pthread_tryjoin_np.
Werner Koch [Thu, 26 Jan 2012 10:15:16 +0000 (11:15 +0100)]
Check for the non-portable pthread_tryjoin_np.

* configure.ac: Check for pthread_tryjoin_np.  Also rework the pthread
test to update LIBS
* src/npth.c (npth_join) [HAVE_PTHREAD_TRYJOIN_NP]: Use
pthread_tryjoin_np only if available.

7 years agoFix thread startup.
Marcus Brinkmann [Wed, 25 Jan 2012 15:23:34 +0000 (16:23 +0100)]
Fix thread startup.

* src/npth.c (npth_create): Fix startup data use.

7 years agoInclude stdlib.h for malloc prototypes.
Werner Koch [Wed, 25 Jan 2012 10:50:02 +0000 (11:50 +0100)]
Include stdlib.h for malloc prototypes.

* src/npth.c: Include stdlib.h.

7 years agoRequire gitlog-to-changelog to be installed.
Werner Koch [Tue, 24 Jan 2012 17:53:42 +0000 (18:53 +0100)]
Require gitlog-to-changelog to be installed.

* Makefile.am (gen-ChangeLog): Do no use included gitlog-to-changelog.
Use options --append-dot and --tear-off.
* build-aux/gitlog-to-changelog: Remove from repo.

7 years agoAllow manually unprotect/protect calls.
Marcus Brinkmann [Mon, 23 Jan 2012 22:53:05 +0000 (23:53 +0100)]
Allow manually unprotect/protect calls.

* src/libnpth.vers (npth_unprotect, npth_protect): New symbols.
* src/npth.c (npth_unprotect, npth_protect): New functions.
* src/npth.h (npth_unprotect, npth_protect): New declaration.
* w32/npth.def (npth_unprotect, npth_protect): New exports.
* w32/npth.c (npth_unprotect, npth_protect): New functions.
* w32/npth.h (npth_unprotect, npth_protect): New declaration.

7 years agoAllow no extra events in npth_eselect.
Marcus Brinkmann [Thu, 19 Jan 2012 20:50:59 +0000 (21:50 +0100)]
Allow no extra events in npth_eselect.

* w32/npth.c (npth_eselect): Allow events to be NULL.

7 years agoImplement ability to wait on sockets and events.
Marcus Brinkmann [Thu, 19 Jan 2012 20:13:53 +0000 (21:13 +0100)]
Implement ability to wait on sockets and events.

* w32/npth.c (npth_eselect): New function.
* w32/npth.h (npth_eselect): New declaration.
* w32/npth.def (npth_eselect): New export.

7 years agoRemove libnpth.vers dependency.
Marcus Brinkmann [Thu, 19 Jan 2012 20:12:32 +0000 (21:12 +0100)]
Remove libnpth.vers dependency.

* w32/Makefile.am (libnpth_la_DEPENDENCIES): Remove libnpth.vers.

7 years agoRelease mutex temporarily on instant timeout in npth_cond_timedwait.
Marcus Brinkmann [Thu, 19 Jan 2012 16:31:59 +0000 (17:31 +0100)]
Release mutex temporarily on instant timeout in npth_cond_timedwait.

* w32/npth.c (npth_cond_timedwait): Release mutex temporarily even on
instant timeout.

7 years agoRemove obsolete file.
Marcus Brinkmann [Fri, 13 Jan 2012 00:53:25 +0000 (01:53 +0100)]
Remove obsolete file.

* src/Makefile.am (EXTRA_DIST): Remove npth.def
* src/npth.def: Removed.

7 years agoInitial support for w32.
Marcus Brinkmann [Fri, 13 Jan 2012 00:37:07 +0000 (01:37 +0100)]
Initial support for w32.

* Makefile.am [HAVE_W32_SYSTEM]: Build from w32 directory.
* configure.ac: Don't check for pthread on windows.  Add winsock
library on windows.  Add w32 subdirectory to config files.
* w32/npth.h, w32/npth.c, w32/Makefile.am, w32/npth.def,
w32/npth-config.in, w32/npth.m4: New files.
* tests/Makefile.am: Allow building on w32.

7 years agoAdd missing function npth_system.
Marcus Brinkmann [Fri, 13 Jan 2012 00:27:26 +0000 (01:27 +0100)]
Add missing function npth_system.

* src/npth.c (npth_system): New function.

7 years agoRemove duplicated macro.
Marcus Brinkmann [Wed, 11 Jan 2012 21:35:26 +0000 (22:35 +0100)]
Remove duplicated macro.

* npth.h (PTHREAD_RWLOCK_INITIALIZER): Remove.

7 years agoAdd some missing interfaces.
Marcus Brinkmann [Wed, 11 Jan 2012 21:15:48 +0000 (22:15 +0100)]
Add some missing interfaces.

* npth.h (npth_key_delete, NPTH_ERRORCHECK_MUTEX_INITIALIZER_NP,
npth_rwlockattr_t, npth_rwlockattr_init, npth_rwlockattr_destroy,
npth_rwlockattr_gettype_np, npth_rwlockattr_settype_np,
NPTH_RWLOCK_PREFER_READER_NP, NPTH_RWLOCK_PREFER_WRITER_NP,
NPTH_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, NPTH_RWLOCK_DEFAULT_NP,
NPTH_RWLOCK_INITIALIZER, NPTH_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP):
New macros.
(NPTH_RWLOCK_INIT): Rename to ...
(NPTH_RWLOCK_INITIALIZER): ... this.

7 years agoFix exclusion logic at thread creation and allow main thread to exit.
Marcus Brinkmann [Fri, 6 Jan 2012 13:03:13 +0000 (14:03 +0100)]
Fix exclusion logic at thread creation and allow main thread to exit.

* libnpth.vers (npth_create, npth_exit): New.
* npth.def (npth_create, npth_exit): Likewise.
* npth.h (npth_create): Change from macro to declaration.
(npth_exit): New declaration.
* npth.c (startup_s): New struct.
(thread_startup, npth_create, npth_exit): New functions.

7 years agoCreate the ChangeLog from the git commit log.
Werner Koch [Tue, 6 Dec 2011 10:37:19 +0000 (11:37 +0100)]
Create the ChangeLog from the git commit log.

* autogen.sh: Install git commit log checker.
* build-aux/git-hooks/commit-msg: New.  Repo only.
* build-aux/git-log-fix: New.  Repo only.
* build-aux/git-log-footer: New.  Repo only.
* build-aux/gitlog-to-changelog: New.  Repo only.
* HACKING: New.
* Makefile.am (gen-Changelog): New rule.
(dist-hook):  Depend on gen-Changelog.
(EXTRA_DIST): Add HACKING.
* ChangeLog: New stub file.

7 years agoMerge branch 'master' of git+ssh://playfair.gnupg.org/git/npth
Marcus Brinkmann [Mon, 7 Nov 2011 16:38:23 +0000 (17:38 +0100)]
Merge branch 'master' of git+ssh://playfair.gnupg.org/git/npth

Conflicts:
ChangeLog

7 years agoLoop over sem_wait until EINTR.
Marcus Brinkmann [Mon, 7 Nov 2011 16:37:52 +0000 (17:37 +0100)]
Loop over sem_wait until EINTR.

7 years agoStraighten out some interface issues.
Marcus Brinkmann [Wed, 26 Oct 2011 19:51:49 +0000 (21:51 +0200)]
Straighten out some interface issues.

7 years agoHave attributes for mutex, rwlock and cond like in pthread.
Marcus Brinkmann [Fri, 7 Oct 2011 19:58:02 +0000 (21:58 +0200)]
Have attributes for mutex, rwlock and cond like in pthread.

7 years agoDelete generated file.
Marcus Brinkmann [Fri, 7 Oct 2011 19:36:26 +0000 (21:36 +0200)]
Delete generated file.

7 years agoMade make distcheck work.
Werner Koch [Thu, 6 Oct 2011 16:47:29 +0000 (18:47 +0200)]
Made make distcheck work.

7 years agoInitial commit.
Marcus Brinkmann [Thu, 6 Oct 2011 15:00:06 +0000 (17:00 +0200)]
Initial commit.

8 years agoStarted nPth project.
Werner Koch [Wed, 23 Feb 2011 18:06:32 +0000 (19:06 +0100)]
Started nPth project.