summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bench/ioq.c2
-rw-r--r--src/list.h31
-rw-r--r--tests/posix/exec_return.out18
-rw-r--r--tests/posix/exec_return.sh1
4 files changed, 32 insertions, 20 deletions
diff --git a/bench/ioq.c b/bench/ioq.c
index b3fbfbf..5db585a 100644
--- a/bench/ioq.c
+++ b/bench/ioq.c
@@ -223,7 +223,7 @@ int main(int argc, char *argv[]) {
}
if (threads <= 0) {
- threads = xsysconf(_SC_NPROCESSORS_ONLN);
+ threads = nproc();
if (threads > 8) {
threads = 8;
}
diff --git a/src/list.h b/src/list.h
index 15c37a8..276c610 100644
--- a/src/list.h
+++ b/src/list.h
@@ -82,11 +82,9 @@
#ifndef BFS_LIST_H
#define BFS_LIST_H
-#include "bfs.h"
#include "diag.h"
#include <stddef.h>
-#include <stdint.h>
#include <string.h>
/**
@@ -374,24 +372,19 @@
#define SLIST_REMOVE_(list, cursor, ...) \
SLIST_REMOVE__((list), (cursor), LIST_NEXT_(__VA_ARGS__))
-// Scratch variables for the type-safe SLIST_REMOVE() implementation.
-// Not a pointer type due to https://github.com/llvm/llvm-project/issues/109718.
-_maybe_unused
-static thread_local uintptr_t slist_prev_, slist_next_;
-
-/** Suppress -Wunused-value. */
-_maybe_unused
-static inline void *slist_cast_(uintptr_t ptr) {
- return (void *)ptr;
-}
-
#define SLIST_REMOVE__(list, cursor, next) \
- (slist_prev_ = (uintptr_t)(void *)*cursor, \
- slist_next_ = (uintptr_t)(void *)(*cursor)->next, \
- (*cursor)->next = NULL, \
- *cursor = (void *)slist_next_, \
- list->tail = *cursor ? list->tail : cursor, \
- slist_cast_(slist_prev_))
+ (list->tail = (*cursor)->next ? list->tail : cursor, \
+ slist_remove_(*cursor, cursor, &(*cursor)->next, sizeof(*cursor)))
+
+// Helper for SLIST_REMOVE()
+static inline void *slist_remove_(void *ret, void *cursor, void *next, size_t size) {
+ // ret = *cursor;
+ // *cursor = ret->next;
+ memcpy(cursor, next, size);
+ // ret->next = NULL;
+ memset(next, 0, size);
+ return ret;
+}
/**
* Pop the head off a singly-linked list.
diff --git a/tests/posix/exec_return.out b/tests/posix/exec_return.out
new file mode 100644
index 0000000..600c93a
--- /dev/null
+++ b/tests/posix/exec_return.out
@@ -0,0 +1,18 @@
+basic
+basic/a
+basic/b
+basic/c/d
+basic/e
+basic/e/f
+basic/g
+basic/g/h
+basic/i
+basic/j
+basic/j/foo
+basic/k
+basic/k/foo
+basic/k/foo/bar
+basic/l
+basic/l/foo
+basic/l/foo/bar
+basic/l/foo/bar/baz
diff --git a/tests/posix/exec_return.sh b/tests/posix/exec_return.sh
new file mode 100644
index 0000000..cfa0f5d
--- /dev/null
+++ b/tests/posix/exec_return.sh
@@ -0,0 +1 @@
+bfs_diff basic -exec test {} = basic/c \; -o -print