nbdkit/0004-common-include-test-once.c-Skip-test-on-macOS-which-.patch
Richard W.M. Jones ca4b55ce0a Further rebase along 1.44 branch.
- New nbdkit-count-filter.
- Remove nbdkit-cacheextents-filter.
- file: trim: Don't try BLKDISCARD if earlier FALLOC_FL_PUNCH_HOLE worked

related: RHEL-101180
2025-07-09 16:32:21 +01:00

64 lines
1.5 KiB
Diff

From 48869f1c0b6e4c318b680f6f672a9f90dfe31bff Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 8 Jul 2025 21:39:04 +0100
Subject: [PATCH] common/include/test-once.c: Skip test on macOS which lacks
pthread_barrier_t
See:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap02.html
(cherry picked from commit 8271f9244f1521c716460820d8162e7641018674)
---
common/include/test-once.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/common/include/test-once.c b/common/include/test-once.c
index d7dd5c42..512b1a20 100644
--- a/common/include/test-once.c
+++ b/common/include/test-once.c
@@ -34,29 +34,29 @@
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <pthread.h>
-#ifndef HAVE_STDATOMIC_H
+#if !defined(HAVE_STDATOMIC_H) || !defined(_POSIX_BARRIERS)
-/* Skip the test if no <stdatomic.h> */
+/* Skip the test if no <stdatomic.h> or pthread_barrier_t */
int
main (void)
{
- printf ("SKIP: no <stdatomic.h> on this platform\n");
+ fprintf (stderr,
+ "SKIP: no <stdatomic.h> or pthread_barrier_t on this platform\n");
exit (77);
}
-#else /* HAVE_STDATOMIC_H */
+#else
#include <stdatomic.h>
#include <errno.h>
-#include <unistd.h>
#undef NDEBUG /* Keep test strong even for nbdkit built without assertions */
#include <assert.h>
-#include <pthread.h>
-
#include "once.h"
#define NR_THREADS 8
@@ -123,4 +123,4 @@ main (void)
exit (EXIT_SUCCESS);
}
-#endif /* HAVE_STDATOMIC_H */
+#endif
--
2.47.1