diff --git a/add-test-cases.patch b/add-test-cases.patch index fc8f882ca2e25cd644092b9dc9db90ef9b03d364..0a1019f813bb7445cfef08480f97e60f5a71c5ca 100644 --- a/add-test-cases.patch +++ b/add-test-cases.patch @@ -33,19 +33,19 @@ index 8092a3c..f37e798 100644 ## Process this file with automake to produce Makefile.in --TESTS = t-mutex t-thread -+TESTS = t-mutex t-thread t-condlock t-rwlock t-signal t-socket +-TESTS = t-mutex t-thread t-cond ++TESTS = t-mutex t-thread t-cond t-condlock t-rwlock t-signal t-socket + XFAIL_TESTS = - # We explicitly require POSIX.1-2001 so that pthread_rwlock_t is - # available when build with c99. + if HAVE_W32_SYSTEM @@ -31,6 +31,7 @@ AM_CPPFLAGS = -I../src -D_POSIX_C_SOURCE=200112L - AM_LDFLAGS = - LDADD = ../src/libnpth.la $(LIBSOCKET) $(LIB_CLOCK_GETTIME) + XFAIL_TESTS += t-fork + else TESTS += t-fork +TESTS += t-fork-enhance endif + endif - noinst_HEADERS = t-support.h diff --git a/tests/t-condlock.c b/tests/t-condlock.c new file mode 100644 index 0000000..ff7597b diff --git a/backport-0001-w32-Use-cast-by-uintptr_t-for-thread-ID.patch b/backport-0001-w32-Use-cast-by-uintptr_t-for-thread-ID.patch deleted file mode 100755 index e02e454313268b639ef2d81f3cd6835f97c33ba7..0000000000000000000000000000000000000000 --- a/backport-0001-w32-Use-cast-by-uintptr_t-for-thread-ID.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 377c1b91e67af25613ccb72ee26449661cea8d8e Mon Sep 17 00:00:00 2001 -From: NIIBE Yutaka -Date: Thu, 8 Nov 2018 13:26:41 +0900 -Subject: [PATCH 12/18] w32: Use cast by uintptr_t for thread ID. - -* w32/npth.c (npth_init): Cast with uintptr_t. -(npth_setname_np, npth_create, npth_self): Likewise. - --- - -In w32/npth.h, npth_t is unsigned long int type, which is 32-bit -for both of 32-bit machine and 64-bit machine. - -We use TlsSetValue, TlsGetValue and CreateThread API to handle -thread ID, which uses void * type, which is 64-bit on 64-bit -machine. - -Because the size is different on 64-bit machine, here, we use explicit -cast to integer type which has enough size to have pointer. - -Signed-off-by: NIIBE Yutaka ---- - w32/npth.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/w32/npth.c b/w32/npth.c -index 6ea6d19..41213c0 100644 ---- a/w32/npth.c -+++ b/w32/npth.c -@@ -351,7 +351,7 @@ npth_init (void) - thread = thread_table[thread_id]; - thread->handle = handle; - -- if (! TlsSetValue(tls_index, (LPVOID) thread_id)) -+ if (! TlsSetValue(tls_index, (LPVOID)(uintptr_t) thread_id)) - return map_error (GetLastError()); - - LEAVE(); -@@ -449,11 +449,11 @@ npth_setname_np (npth_t target_thread, const char *name) - static DWORD - thread_start (void *arg) - { -- npth_t thread_id = (npth_t) arg; -+ npth_t thread_id = (npth_t)(uintptr_t) arg; - npth_impl_t thread; - void *result; - -- if (! TlsSetValue(tls_index, (LPVOID) thread_id)) -+ if (! TlsSetValue(tls_index, (LPVOID)(uintptr_t) thread_id)) - /* FIXME: There is not much we can do here. */ - ; - -@@ -519,7 +519,7 @@ npth_create (npth_t *newthread, const npth_attr_t *user_attr, - - handle = CreateThread (NULL, 0, - (LPTHREAD_START_ROUTINE)thread_start, -- (void *) thread_id, CREATE_SUSPENDED, -+ (void *)(uintptr_t) thread_id, CREATE_SUSPENDED, - NULL); - if (handle == NULL) - { -@@ -556,7 +556,7 @@ npth_self (void) - if (thread_id == 0 && GetLastError() != ERROR_SUCCESS) - /* FIXME: Log the error. */ - ; -- return (npth_t) thread_id; -+ return (npth_t)(uintptr_t) thread_id; - } - - --- -1.8.3.1 - diff --git a/backport-0002-posix-Add-npth_poll-npth_ppoll.patch b/backport-0002-posix-Add-npth_poll-npth_ppoll.patch deleted file mode 100644 index 953d62938c6554c07b285563c356a6f0b96d4770..0000000000000000000000000000000000000000 --- a/backport-0002-posix-Add-npth_poll-npth_ppoll.patch +++ /dev/null @@ -1,157 +0,0 @@ -From b5ecd8d2c6fdb988f6139c5157c124ebea293bd7 Mon Sep 17 00:00:00 2001 -From: NIIBE Yutaka -Date: Wed, 22 Dec 2021 09:52:44 +0900 -Subject: [PATCH 1/2] posix: Add npth_poll/npth_ppoll. - -* configure.ac: Add checks for poll.h and ppoll. - --- - -GnuPG-bug-id: 5748 -Signed-off-by: NIIBE Yutaka -Signed-off-by: EulerOSWander <314264452@qq.com> ---- - - configure.ac | 6 ++--- - src/npth.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - src/npth.h.in | 5 +++++ - 3 files changed, 78 insertions(+), 3 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 3d76661..cf8bb0e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -18,7 +18,7 @@ - - # Process this file with autoconf to produce a configure script. - --AC_PREREQ([2.67]) -+AC_PREREQ([2.69]) - min_automake_version="1.14" - - # To build a release you need to create a tag with the version number -@@ -198,7 +198,7 @@ AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP", - # - # fixme: For what do we need the sys/socket test? - AC_CHECK_HEADERS([sys/socket.h sys/select.h unistd.h sys/time.h time.h \ -- signal.h]) -+ signal.h poll.h]) - INSERT_SYS_SELECT_H= - if test x"$ac_cv_header_sys_select_h" = xyes; then - INSERT_SYS_SELECT_H="include " -@@ -277,7 +277,7 @@ if test "$have_w32_system" = no; then - fi - fi - --AC_CHECK_FUNCS([select pselect gettimeofday]) -+AC_CHECK_FUNCS([select pselect gettimeofday ppoll]) - - npth_LIBSOCKET - config_libs="$config_libs $LIBSOCKET" -diff --git a/src/npth.c b/src/npth.c -index 45ca7ee..22314a6 100644 ---- a/src/npth.c -+++ b/src/npth.c -@@ -71,6 +71,9 @@ sem_wait (sem_t *sem) - #ifndef HAVE_PSELECT - # include - #endif -+#ifdef HAVE_POLL_H -+#include -+#endif - - #include "npth.h" - -@@ -675,6 +678,73 @@ npth_pselect(int nfd, fd_set *rfds, fd_set *wfds, fd_set *efds, - } - - -+int -+npth_poll (struct pollfd *fds, unsigned long nfds, int timeout) -+{ -+ int res; -+ -+ ENTER(); -+#ifdef HAVE_POLL_H -+ res = poll (fds, (nfds_t)nfds, timeout); -+#endif -+ LEAVE(); -+ return res; -+} -+ -+ -+int -+npth_ppoll (struct pollfd *fds, unsigned long nfds, -+ const struct timespec *timeout, const sigset_t *sigmask) -+{ -+ int res; -+ -+ ENTER(); -+#ifdef HAVE_POLL_H -+#ifdef HAVE_PPOLL -+ res = ppoll (fds, (nfds_t)nfds, timeout, sigmask); -+#else /*!HAVE_PPOLL*/ -+ { -+# ifdef __GNUC__ -+# warning Using a non race free ppoll emulation. -+# endif -+ -+ int t; -+ -+ if (!timeout) -+ t = -1; -+ else if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) -+ t = timeout->tv_sec * 1000 + (timeout->tv_nsec + 999999) / 1000000; -+ else -+ { -+ errno = EINVAL; -+ res = -1; -+ goto leave; -+ } -+ -+ if (sigmask) -+ { -+ int save_errno; -+ sigset_t savemask; -+ -+ pthread_sigmask (SIG_SETMASK, sigmask, &savemask); -+ res = poll (fds, (nfds_t)nfds, timeout); -+ save_errno = errno; -+ pthread_sigmask (SIG_SETMASK, &savemask, NULL); -+ errno = save_errno; -+ } -+ else -+ res = poll (fds, (nfds_t)nfds, timeout); -+ -+ leave: -+ ; -+ } -+#endif -+#endif -+ LEAVE(); -+ return res; -+} -+ -+ - ssize_t - npth_read(int fd, void *buf, size_t nbytes) - { -diff --git a/src/npth.h.in b/src/npth.h.in -index 39dcf32..db57935 100644 ---- a/src/npth.h.in -+++ b/src/npth.h.in -@@ -345,6 +345,11 @@ ssize_t npth_write(int fd, const void *buf, size_t nbytes); - int npth_recvmsg (int fd, struct msghdr *msg, int flags); - int npth_sendmsg (int fd, const struct msghdr *msg, int flags); - -+struct pollfd; -+int npth_poll (struct pollfd *fds, unsigned long nfds, int timeout); -+int npth_ppoll (struct pollfd *fds, unsigned long nfds, -+ const struct timespec *timeout, const sigset_t *sigmask); -+ - /* For anything not covered here, you can enter/leave manually at your - own risk. */ - void npth_unprotect (void); --- -1.8.3.1 - diff --git a/npth-1.6.tar.bz2 b/npth-1.6.tar.bz2 deleted file mode 100644 index 3fbe48b63d0320ae84c49aca9f64bed594ed8ea6..0000000000000000000000000000000000000000 Binary files a/npth-1.6.tar.bz2 and /dev/null differ diff --git a/npth-1.8.tar.bz2 b/npth-1.8.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..7096b7506a22b73b5a92864a33e12b984c0a11e1 Binary files /dev/null and b/npth-1.8.tar.bz2 differ diff --git a/npth.spec b/npth.spec index 2488d53149fe58e650d75ed001d51c501b892810..8da8b0761f2843fe3cfecd35cf08b5b2916d26a6 100644 --- a/npth.spec +++ b/npth.spec @@ -1,16 +1,14 @@ Name: npth -Version: 1.6 -Release: 7 +Version: 1.8 +Release: 1 Summary: The New GNU Portable Threads library -License: LGPLv2+ -URL: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=npth.git +License: LGPL-2.1-or-later +URL: https://gnupg.org/software/npth/index.html Source: https://gnupg.org/ftp/gcrypt/npth/%{name}-%{version}.tar.bz2 +Patch0: add-test-cases.patch -Patch6000: backport-0001-w32-Use-cast-by-uintptr_t-for-thread-ID.patch -Patch6001: add-test-cases.patch -Patch6002: backport-0002-posix-Add-npth_poll-npth_ppoll.patch - -BuildRequires: make gcc automake +BuildRequires: make gcc +BuildRequires: autoconf automake libtool %description The NPth package contains a very portable POSIX/ANSI-C based @@ -32,23 +30,17 @@ developing applications that use %{name}. %prep %autosetup -n %{name}-%{version} -p1 -aclocal -automake - %build +autoreconf -fi %configure --disable-static %make_build %install -%make_install - -find %{buildroot} -name '*.la' -delete -print +%make_install +%{?delete_la} %check -make check - -%post -%ldconfig_scriptlets +%make_build check %files %license COPYING.LIB @@ -56,12 +48,15 @@ make check %files devel %doc AUTHORS ChangeLog NEWS README -%{_bindir}/%{name}-config %{_libdir}/lib%{name}.so +%{_libdir}/pkgconfig/*.pc %{_includedir}/%{name}.h %{_datadir}/aclocal/%{name}.m4 %changelog +* Fri Nov 29 2024 Funda Wang - 1.8-1 +- update to 1.8 + * Sat Jan 28 2023 licihua - 1.6-7 - DESC: modify the patchs location diff --git a/npth.yaml b/npth.yaml index c4af8022aab18907d820a27e40c78a61bd01fdf4..568e751aaeb1a604c9185f2006a8e7c0200d8029 100644 --- a/npth.yaml +++ b/npth.yaml @@ -1,4 +1,4 @@ version_control: git src_repo: http://dev.gnupg.org/source/npth.git tag_prefix: ^npth- -seperator: . +separator: .