<pre style='margin:0'>
Herby Gillot (herbygillot) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/c811f064de5dab620de65f44effd081ac91c97d4">https://github.com/macports/macports-ports/commit/c811f064de5dab620de65f44effd081ac91c97d4</a></p>
<pre style="white-space: pre; background: #F8F8F8">The following commit(s) were added to refs/heads/master by this push:
<span style='display:block; white-space:pre;color:#404040;'> new c811f064de5 npth: fix for old systems Fixes: https://trac.macports.org/ticket/56185 Fixes: https://trac.macports.org/ticket/61115
</span>c811f064de5 is described below
<span style='display:block; white-space:pre;color:#808000;'>commit c811f064de5dab620de65f44effd081ac91c97d4
</span>Author: barracuda156 <vital.had@gmail.com>
AuthorDate: Wed Jan 18 09:52:48 2023 +0800
<span style='display:block; white-space:pre;color:#404040;'> npth: fix for old systems
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes: https://trac.macports.org/ticket/56185
</span><span style='display:block; white-space:pre;color:#404040;'> Fixes: https://trac.macports.org/ticket/61115
</span>---
devel/npth/Portfile | 17 ++-
devel/npth/files/darwin_compat.c | 247 ++++++++++++++++++++++++++++++++
devel/npth/files/darwin_compat.h | 52 +++++++
devel/npth/files/use-darwin-compat.diff | 21 +++
4 files changed, 335 insertions(+), 2 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/npth/Portfile b/devel/npth/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index b1d5467cccb..81adabf0ba5 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/devel/npth/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/npth/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -4,14 +4,15 @@ PortSystem 1.0
</span>
name npth
version 1.6
<span style='display:block; white-space:pre;background:#e0ffe0;'>+revision 1
</span> categories devel
license LGPL-3+ GPL-2+
maintainers nomaintainer
description The New GNU Portable Threads Library
<span style='display:block; white-space:pre;background:#ffe0e0;'>-long_description This is a library to provide the GNU Pth API and thus a \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- non-preemptive threads implementation.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+long_description This is a library to provide the GNU Pth API \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ and thus a non-preemptive threads implementation.
</span>
homepage https://gnupg.org/related_software/npth/
master_sites gnupg:npth
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -22,6 +23,18 @@ checksums rmd160 25756e8cd7711a9e06b377f41b2f88cdcc76d441 \
</span> sha256 1393abd9adcf0762d34798dc34fdcf4d0d22a8410721e76f1e3afcd1daa4e2d1 \
size 300486
<span style='display:block; white-space:pre;background:#e0ffe0;'>+platform darwin {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${os.major} < 10 || (${os.major} == 10 && ${build_arch} eq "ppc")} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ post-extract {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ copy ${filespath}/darwin_compat.h ${worksrcpath}/src/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ copy ${filespath}/darwin_compat.c ${worksrcpath}/src/
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append use-darwin-compat.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ use_autoreconf yes
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ autoreconf.args -fvi
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> livecheck.type regex
livecheck.url https://gnupg.org/ftp/gcrypt/${name}/
livecheck.regex ${name}-(\\d+\.\\d+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/npth/files/darwin_compat.c b/devel/npth/files/darwin_compat.c
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..86b52f9da09
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/npth/files/darwin_compat.c
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,247 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Source: https://github.com/pktgen/sshfs/blob/master/compat/darwin_compat.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2006-2008 Amit Singh/Google Inc.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2012 Anatol Pomozov
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2011-2013 Benjamin Fleischer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include "darwin_compat.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <assert.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <errno.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <sys/types.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Semaphore implementation based on:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (C) 2000,02 Free Software Foundation, Inc.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * This file is part of the GNU C Library.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Written by Ga<EB>l Le Mignot <address@hidden>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * The GNU C Library is free software; you can redistribute it and/or
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * modify it under the terms of the GNU Library General Public License as
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * published by the Free Software Foundation; either version 2 of the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * License, or (at your option) any later version.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * The GNU C Library is distributed in the hope that it will be useful,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Library General Public License for more details.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * You should have received a copy of the GNU Library General Public
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * License along with the GNU C Library; see the file COPYING.LIB. If not,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Boston, MA 02111-1307, USA.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* Semaphores */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define __SEM_ID_NONE ((int)0x0)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define __SEM_ID_LOCAL ((int)0xcafef00d)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_init.html */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_init(darwin_sem_t *sem, int pshared, unsigned int value)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (pshared) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = ENOSYS;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->id = __SEM_ID_NONE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (pthread_cond_init(&sem->__data.local.count_cond, NULL)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ goto cond_init_fail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (pthread_mutex_init(&sem->__data.local.count_lock, NULL)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ goto mutex_init_fail;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->__data.local.count = value;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->id = __SEM_ID_LOCAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mutex_init_fail:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cond_destroy(&sem->__data.local.count_cond);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cond_init_fail:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_destroy.html */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_destroy(darwin_sem_t *sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int res = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_lock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->id = __SEM_ID_NONE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cond_broadcast(&sem->__data.local.count_cond);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (pthread_cond_destroy(&sem->__data.local.count_cond)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_unlock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (pthread_mutex_destroy(&sem->__data.local.count_lock)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return res;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_getvalue(darwin_sem_t *sem, unsigned int *sval)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int res = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_lock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ *sval = sem->__data.local.count;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_unlock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return res;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_post.html */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_post(darwin_sem_t *sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int res = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_lock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else if (sem->__data.local.count < DARWIN_SEM_VALUE_MAX) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->__data.local.count++;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->__data.local.count == 1) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cond_signal(&sem->__data.local.count_cond);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = ERANGE;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_unlock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return res;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* http://www.opengroup.org/onlinepubs/009695399/functions/sem_timedwait.html */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_timedwait(darwin_sem_t *sem, const struct timespec *abs_timeout)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int res = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (abs_timeout &&
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ (abs_timeout->tv_nsec < 0 || abs_timeout->tv_nsec >= 1000000000)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cleanup_push((void(*)(void*))&pthread_mutex_unlock,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ &sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_lock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!sem->__data.local.count) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = pthread_cond_timedwait(&sem->__data.local.count_cond,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ &sem->__data.local.count_lock,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ abs_timeout);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (res) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ assert(res == ETIMEDOUT);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = ETIMEDOUT;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->__data.local.count--;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cleanup_pop(1);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return res;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_trywait.html */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_trywait(darwin_sem_t *sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int res = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_lock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else if (sem->__data.local.count) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->__data.local.count--;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EAGAIN;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_unlock (&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return res;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* http://www.opengroup.org/onlinepubs/007908799/xsh/sem_wait.html */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ darwin_sem_wait(darwin_sem_t *sem)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int res = 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cleanup_push((void(*)(void*))&pthread_mutex_unlock,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ &sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_lock(&sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!sem->__data.local.count) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cond_wait(&sem->__data.local.count_cond,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ &sem->__data.local.count_lock);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!sem->__data.local.count) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* spurious wakeup, assume it is an interruption */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINTR;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ goto out;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sem->id != __SEM_ID_LOCAL) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ res = -1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ errno = EINVAL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sem->__data.local.count--;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ out:
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cleanup_pop(1);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return res;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/npth/files/darwin_compat.h b/devel/npth/files/darwin_compat.h
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..01f79e26584
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/npth/files/darwin_compat.h
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,52 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Source: https://github.com/pktgen/sshfs/blob/master/compat/darwin_compat.h
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2006-2008 Amit Singh/Google Inc.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ * Copyright (c) 2011-2013 Benjamin Fleischer
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifndef _DARWIN_COMPAT_
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define _DARWIN_COMPAT_
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #include <pthread.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* Semaphores */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct __local_sem_t
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ unsigned int count;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_mutex_t count_lock;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ pthread_cond_t count_cond;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ };
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typedef struct fuse_sem {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int id;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ union {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ struct __local_sem_t local;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } __data;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } darwin_sem_t;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define DARWIN_SEM_VALUE_MAX ((int32_t)32767)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_init(darwin_sem_t *sem, int pshared, unsigned int value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_destroy(darwin_sem_t *sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_getvalue(darwin_sem_t *sem, unsigned int *value);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_post(darwin_sem_t *sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_timedwait(darwin_sem_t *sem, const struct timespec *abs_timeout);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_trywait(darwin_sem_t *sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int darwin_sem_wait(darwin_sem_t *sem);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ /* Caller must not include <semaphore.h> */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ typedef darwin_sem_t sem_t;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_init(s, p, v) darwin_sem_init(s, p, v)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_destroy(s) darwin_sem_destroy(s)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_getvalue(s, v) darwin_sem_getvalue(s, v)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_post(s) darwin_sem_post(s)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_timedwait(s, t) darwin_sem_timedwait(s, t)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_trywait(s) darwin_sem_trywait(s)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define sem_wait(s) darwin_sem_wait(s)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #define SEM_VALUE_MAX DARWIN_SEM_VALUE_MAX
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif /* _DARWIN_COMPAT_ */
</span><span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/npth/files/use-darwin-compat.diff b/devel/npth/files/use-darwin-compat.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..735f46dbe69
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/npth/files/use-darwin-compat.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,21 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/Makefile.am~ 2017-05-16 09:21:06.000000000 +0200
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/Makefile.am 2020-09-02 10:32:49.000000000 +0200
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -31,6 +31,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ libnpth_la_SOURCES = npth.h npth.c npth-sigev.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++libnpth_la_SOURCES += darwin_compat.h darwin_compat.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # AM_CPPFLAGS =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # AM_CFLAGS =
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- src/npth.c~ 2018-07-16 09:15:59.000000000 +0200
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ src/npth.c 2020-09-02 10:33:58.000000000 +0200
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -63,7 +63,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return 0;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-# include <semaphore.h>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++# include "darwin_compat.h"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef HAVE_UNISTD_H
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # include <unistd.h>
</span></pre><pre style='margin:0'>
</pre>