aboutsummaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
Diffstat (limited to 'support')
-rw-r--r--support/Makefile36
-rw-r--r--support/blob_repeat.c16
-rw-r--r--support/blob_repeat.h2
-rw-r--r--support/bundled/README5
-rw-r--r--support/bundled/linux/COPYING20
-rw-r--r--support/bundled/linux/LICENSES/exceptions/Linux-syscall-note24
-rw-r--r--support/bundled/linux/LICENSES/preferred/GPL-2.0359
-rw-r--r--support/bundled/linux/include/uapi/linux/fuse.h1189
-rw-r--r--support/capture_subprocess.h13
-rw-r--r--support/check.c2
-rw-r--r--support/check.h5
-rw-r--r--support/check_addrinfo.c2
-rw-r--r--support/check_dns_packet.c2
-rw-r--r--support/check_hostent.c2
-rw-r--r--support/check_netent.c2
-rw-r--r--support/check_nss.h2
-rw-r--r--support/delayed_exit.c2
-rw-r--r--support/descriptors.h2
-rw-r--r--support/dtotimespec-time64.c2
-rw-r--r--support/dtotimespec.c2
-rw-r--r--support/echo-container.c2
-rw-r--r--support/file_contents.h63
-rw-r--r--support/format_nss.h2
-rw-r--r--support/fuse.h217
-rw-r--r--support/ignore_stderr.c2
-rw-r--r--support/links-dso-program-c.c20
-rw-r--r--support/namespace.h4
-rw-r--r--support/next_to_fault.c46
-rw-r--r--support/next_to_fault.h7
-rw-r--r--support/oom_error.c2
-rw-r--r--support/process_state.h9
-rw-r--r--support/readdir.h85
-rw-r--r--support/resolv_response_context_duplicate.c2
-rw-r--r--support/resolv_response_context_free.c2
-rw-r--r--support/resolv_test.c2
-rw-r--r--support/resolv_test.h2
-rw-r--r--support/run_diff.h2
-rw-r--r--support/set_fortify_handler.c2
-rw-r--r--support/shell-container.c6
-rw-r--r--support/subprocess.h2
-rw-r--r--support/support-open-dev-null-range.c2
-rw-r--r--support/support.h4
-rw-r--r--support/support_become_root.c2
-rw-r--r--support/support_can_chroot.c2
-rw-r--r--support/support_capture_subprocess.c168
-rw-r--r--support/support_capture_subprocess_check.c2
-rw-r--r--support/support_check_stat_fd.c (renamed from support/xlstat.c)11
-rw-r--r--support/support_check_stat_path.c (renamed from support/support-xstat.c)13
-rw-r--r--support/support_chroot.c4
-rw-r--r--support/support_compare_file_bytes.c42
-rw-r--r--support/support_compare_file_string.c28
-rw-r--r--support/support_copy_file.c2
-rw-r--r--support/support_copy_file_range.c2
-rw-r--r--support/support_create_timer.c2
-rw-r--r--support/support_descriptor_supports_holes.c2
-rw-r--r--support/support_descriptors.c2
-rw-r--r--support/support_enter_mount_namespace.c2
-rw-r--r--support/support_enter_network_namespace.c2
-rw-r--r--support/support_format_address_family.c2
-rw-r--r--support/support_format_addrinfo.c3
-rw-r--r--support/support_format_dns_packet.c2
-rw-r--r--support/support_format_herrno.c2
-rw-r--r--support/support_format_hostent.c2
-rw-r--r--support/support_format_netent.c2
-rw-r--r--support/support_fuse.c706
-rw-r--r--support/support_isolate_in_subprocess.c2
-rw-r--r--support/support_mutex_pi_monotonic.c2
-rw-r--r--support/support_need_proc.c2
-rw-r--r--support/support_open_and_compare_file_bytes.c (renamed from support/support-xstat-time64.c)25
-rw-r--r--support/support_open_and_compare_file_string.c32
-rw-r--r--support/support_openpty.c4
-rw-r--r--support/support_path_support_time64.c2
-rw-r--r--support/support_paths.c2
-rw-r--r--support/support_process_state.c8
-rw-r--r--support/support_ptrace.c2
-rw-r--r--support/support_quote_blob.c2
-rw-r--r--support/support_quote_blob_main.c2
-rw-r--r--support/support_quote_blob_wide.c2
-rw-r--r--support/support_quote_string.c2
-rw-r--r--support/support_readdir.c318
-rw-r--r--support/support_readdir_check.c30
-rw-r--r--support/support_readdir_r_check.c (renamed from support/xlstat-time64.c)25
-rw-r--r--support/support_record_failure.c12
-rw-r--r--support/support_run_diff.c2
-rw-r--r--support/support_select_modifies_timeout.c2
-rw-r--r--support/support_select_normalizes_timeout.c2
-rw-r--r--support/support_set_small_thread_stack_size.c2
-rw-r--r--support/support_set_vma_name_supported.c4
-rw-r--r--support/support_shared_allocate.c2
-rw-r--r--support/support_small_stack_thread_attribute.c2
-rw-r--r--support/support_socket_so_timestamp_time64.c2
-rw-r--r--support/support_stack_alloc.c4
-rw-r--r--support/support_stat_nanoseconds.c2
-rw-r--r--support/support_subprocess.c2
-rw-r--r--support/support_test_compare_blob.c2
-rw-r--r--support/support_test_compare_failure.c13
-rw-r--r--support/support_test_compare_string.c2
-rw-r--r--support/support_test_compare_string_main.c2
-rw-r--r--support/support_test_compare_string_wide.c2
-rw-r--r--support/support_test_main.c2
-rw-r--r--support/support_test_verify_impl.c2
-rw-r--r--support/support_wait_for_thread_exit.c2
-rw-r--r--support/support_write_file_string.c2
-rw-r--r--support/temp_file-internal.h2
-rw-r--r--support/temp_file.c2
-rw-r--r--support/temp_file.h2
-rw-r--r--support/test-container.c15
-rw-r--r--support/test-driver.c3
-rw-r--r--support/test-driver.h2
-rw-r--r--support/test-run-command.c2
-rw-r--r--support/timespec-add-time64.c2
-rw-r--r--support/timespec-add.c3
-rw-r--r--support/timespec-sub-time64.c2
-rw-r--r--support/timespec-sub.c3
-rw-r--r--support/timespec-time64.c2
-rw-r--r--support/timespec.c2
-rw-r--r--support/timespec.h2
-rw-r--r--support/true-container.c2
-rw-r--r--support/tst-glibcpp.py2
-rw-r--r--support/tst-support-namespace.c2
-rw-r--r--support/tst-support-open-dev-null-range.c2
-rw-r--r--support/tst-support-openpty-c.c2
-rw-r--r--support/tst-support-openpty.c49
-rw-r--r--support/tst-support-process_state.c21
-rw-r--r--support/tst-support_blob_repeat.c2
-rw-r--r--support/tst-support_capture_subprocess.c2
-rw-r--r--support/tst-support_descriptors.c2
-rw-r--r--support/tst-support_format_dns_packet.c2
-rw-r--r--support/tst-support_fuse.c349
-rw-r--r--support/tst-support_quote_blob.c2
-rw-r--r--support/tst-support_quote_blob_wide.c2
-rw-r--r--support/tst-support_quote_string.c2
-rw-r--r--support/tst-support_readdir.c73
-rw-r--r--support/tst-support_record_failure-2.sh2
-rw-r--r--support/tst-support_record_failure.c2
-rw-r--r--support/tst-test_compare.c2
-rw-r--r--support/tst-test_compare_blob.c2
-rw-r--r--support/tst-test_compare_string.c2
-rw-r--r--support/tst-test_compare_string_wide.c2
-rw-r--r--support/tst-timespec.c4
-rw-r--r--support/tst-xdirent.c80
-rw-r--r--support/tst-xreadlink.c2
-rw-r--r--support/tst-xsigstack.c2
-rw-r--r--support/tty.h2
-rw-r--r--support/write_message.c2
-rw-r--r--support/xaccept.c2
-rw-r--r--support/xaccept4.c2
-rw-r--r--support/xasprintf.c2
-rw-r--r--support/xbind.c2
-rw-r--r--support/xcalloc.c2
-rw-r--r--support/xchdir.c2
-rw-r--r--support/xchmod.c2
-rw-r--r--support/xchroot.c2
-rw-r--r--support/xclock_gettime.c2
-rw-r--r--support/xclock_gettime_time64.c2
-rw-r--r--support/xclock_settime.c2
-rw-r--r--support/xclock_settime_time64.c2
-rw-r--r--support/xclone.c2
-rw-r--r--support/xclose.c2
-rw-r--r--support/xclosedir.c28
-rw-r--r--support/xconnect.c2
-rw-r--r--support/xcopy_file_range.c2
-rw-r--r--support/xdirent.h86
-rw-r--r--support/xdlfcn.c2
-rw-r--r--support/xdlfcn.h2
-rw-r--r--support/xdlmopen.c2
-rw-r--r--support/xdup.c (renamed from support/support-xfstat.c)18
-rw-r--r--support/xdup2.c2
-rw-r--r--support/xfchmod.c2
-rw-r--r--support/xfclose.c2
-rw-r--r--support/xfdopendir.c30
-rw-r--r--support/xfgets.c2
-rw-r--r--support/xfopen.c2
-rw-r--r--support/xfork.c2
-rw-r--r--support/xfread.c2
-rw-r--r--support/xfreopen.c2
-rw-r--r--support/xftruncate.c2
-rw-r--r--support/xgetline.c2
-rw-r--r--support/xgetpeername.c2
-rw-r--r--support/xgetsockname.c2
-rw-r--r--support/xlisten.c2
-rw-r--r--support/xlseek.c2
-rw-r--r--support/xmalloc.c2
-rw-r--r--support/xmemstream.c2
-rw-r--r--support/xmemstream.h2
-rw-r--r--support/xmkdir.c2
-rw-r--r--support/xmkdirp.c2
-rw-r--r--support/xmkfifo.c2
-rw-r--r--support/xmmap.c2
-rw-r--r--support/xmprotect.c2
-rw-r--r--support/xmunmap.c2
-rw-r--r--support/xnewlocale.c2
-rw-r--r--support/xopen.c2
-rw-r--r--support/xopendir.c30
-rw-r--r--support/xpipe.c2
-rw-r--r--support/xpoll.c2
-rw-r--r--support/xposix_memalign.c2
-rw-r--r--support/xposix_spawn.c2
-rw-r--r--support/xposix_spawn_file_actions_addclose.c2
-rw-r--r--support/xposix_spawn_file_actions_adddup2.c2
-rw-r--r--support/xpthread_attr_destroy.c2
-rw-r--r--support/xpthread_attr_init.c2
-rw-r--r--support/xpthread_attr_setaffinity_np.c2
-rw-r--r--support/xpthread_attr_setdetachstate.c2
-rw-r--r--support/xpthread_attr_setguardsize.c2
-rw-r--r--support/xpthread_attr_setstack.c2
-rw-r--r--support/xpthread_attr_setstacksize.c2
-rw-r--r--support/xpthread_barrier_destroy.c2
-rw-r--r--support/xpthread_barrier_init.c2
-rw-r--r--support/xpthread_barrier_wait.c2
-rw-r--r--support/xpthread_barrierattr_destroy.c2
-rw-r--r--support/xpthread_barrierattr_init.c2
-rw-r--r--support/xpthread_barrierattr_setpshared.c2
-rw-r--r--support/xpthread_cancel.c2
-rw-r--r--support/xpthread_check_return.c2
-rw-r--r--support/xpthread_cond_signal.c2
-rw-r--r--support/xpthread_cond_wait.c2
-rw-r--r--support/xpthread_create.c2
-rw-r--r--support/xpthread_detach.c2
-rw-r--r--support/xpthread_join.c2
-rw-r--r--support/xpthread_key_create.c2
-rw-r--r--support/xpthread_key_delete.c2
-rw-r--r--support/xpthread_kill.c2
-rw-r--r--support/xpthread_mutex_consistent.c2
-rw-r--r--support/xpthread_mutex_destroy.c2
-rw-r--r--support/xpthread_mutex_init.c2
-rw-r--r--support/xpthread_mutex_lock.c2
-rw-r--r--support/xpthread_mutex_unlock.c2
-rw-r--r--support/xpthread_mutexattr_destroy.c2
-rw-r--r--support/xpthread_mutexattr_init.c2
-rw-r--r--support/xpthread_mutexattr_setprotocol.c2
-rw-r--r--support/xpthread_mutexattr_setpshared.c2
-rw-r--r--support/xpthread_mutexattr_setrobust.c2
-rw-r--r--support/xpthread_mutexattr_settype.c2
-rw-r--r--support/xpthread_once.c2
-rw-r--r--support/xpthread_rwlock_destroy.c2
-rw-r--r--support/xpthread_rwlock_init.c2
-rw-r--r--support/xpthread_rwlock_rdlock.c2
-rw-r--r--support/xpthread_rwlock_unlock.c2
-rw-r--r--support/xpthread_rwlock_wrlock.c2
-rw-r--r--support/xpthread_rwlockattr_init.c2
-rw-r--r--support/xpthread_rwlockattr_setkind_np.c2
-rw-r--r--support/xpthread_sigmask.c2
-rw-r--r--support/xpthread_spin_lock.c2
-rw-r--r--support/xpthread_spin_unlock.c2
-rw-r--r--support/xptrace.h2
-rw-r--r--support/xraise.c2
-rw-r--r--support/xread.c2
-rw-r--r--support/xreadlink.c2
-rw-r--r--support/xrealloc.c2
-rw-r--r--support/xrecvfrom.c2
-rw-r--r--support/xsched.h2
-rw-r--r--support/xsendto.c2
-rw-r--r--support/xsetlocale.c2
-rw-r--r--support/xsetsockopt.c2
-rw-r--r--support/xsigaction.c2
-rw-r--r--support/xsignal.c2
-rw-r--r--support/xsignal.h2
-rw-r--r--support/xsigstack.c4
-rw-r--r--support/xsocket.c2
-rw-r--r--support/xsocket.h2
-rw-r--r--support/xspawn.h2
-rw-r--r--support/xstatx.c (renamed from support/support-xfstat-time64.c)18
-rw-r--r--support/xstdio.h2
-rw-r--r--support/xstdlib.h2
-rw-r--r--support/xstrdup.c2
-rw-r--r--support/xstrndup.c2
-rw-r--r--support/xsymlink.c2
-rw-r--r--support/xsysconf.c2
-rw-r--r--support/xsystem.c2
-rw-r--r--support/xthread.h2
-rw-r--r--support/xtime.h2
-rw-r--r--support/xunistd.h35
-rw-r--r--support/xunlink.c2
-rw-r--r--support/xuselocale.c2
-rw-r--r--support/xwaitpid.c2
-rw-r--r--support/xwrite.c2
277 files changed, 4416 insertions, 453 deletions
diff --git a/support/Makefile b/support/Makefile
index aa57207..d41278e 100644
--- a/support/Makefile
+++ b/support/Makefile
@@ -1,5 +1,5 @@
# Makefile for support library, used only at build and test time
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -42,15 +42,15 @@ libsupport-routines = \
resolv_test \
set_fortify_handler \
support-open-dev-null-range \
- support-xfstat \
- support-xfstat-time64 \
- support-xstat \
- support-xstat-time64 \
support_become_root \
support_can_chroot \
support_capture_subprocess \
support_capture_subprocess_check \
+ support_check_stat_fd \
+ support_check_stat_path \
support_chroot \
+ support_compare_file_bytes \
+ support_compare_file_string \
support_copy_file \
support_copy_file_range \
support_create_timer \
@@ -64,9 +64,12 @@ libsupport-routines = \
support_format_herrno \
support_format_hostent \
support_format_netent \
+ support_fuse \
support_isolate_in_subprocess \
support_mutex_pi_monotonic \
support_need_proc \
+ support_open_and_compare_file_bytes \
+ support_open_and_compare_file_string \
support_openpty \
support_path_support_time64 \
support_paths \
@@ -75,6 +78,9 @@ libsupport-routines = \
support_quote_blob \
support_quote_blob_wide \
support_quote_string \
+ support_readdir \
+ support_readdir_check \
+ support_readdir_r_check \
support_record_failure \
support_run_diff \
support_select_modifies_timeout \
@@ -117,13 +123,16 @@ libsupport-routines = \
xclock_settime_time64 \
xclone \
xclose \
+ xclosedir \
xconnect \
xcopy_file_range \
xdlfcn \
xdlmopen \
+ xdup \
xdup2 \
xfchmod \
xfclose \
+ xfdopendir \
xfgets \
xfopen \
xfork \
@@ -135,8 +144,6 @@ libsupport-routines = \
xgetsockname \
xlisten \
xlseek \
- xlstat \
- xlstat-time64 \
xmalloc \
xmemstream \
xmkdir \
@@ -147,6 +154,7 @@ libsupport-routines = \
xmunmap \
xnewlocale \
xopen \
+ xopendir \
xpipe \
xpoll \
xposix_memalign \
@@ -210,6 +218,7 @@ libsupport-routines = \
xsignal \
xsigstack \
xsocket \
+ xstatx \
xstrdup \
xstrndup \
xsymlink \
@@ -272,6 +281,11 @@ CFLAGS-temp_file.c += -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64
ifeq (,$(CXX))
LINKS_DSO_PROGRAM = links-dso-program-c
+LDLIBS-links-dso-program-c = -lgcc
+ifeq ($(have-libgcc_s),yes)
+CFLAGS-links-dso-program-c.c += -fexceptions
+LDLIBS-links-dso-program-c += -lgcc_s $(libunwind)
+endif
else
LINKS_DSO_PROGRAM = links-dso-program
LDLIBS-links-dso-program = -lstdc++ -lgcc -lgcc_s $(libunwind)
@@ -316,24 +330,32 @@ tests = \
README-testing \
tst-support-namespace \
tst-support-open-dev-null-range \
+ tst-support-openpty \
tst-support-process_state \
tst-support_blob_repeat \
tst-support_capture_subprocess \
tst-support_descriptors \
tst-support_format_dns_packet \
+ tst-support_fuse \
tst-support_quote_blob \
tst-support_quote_blob_wide \
tst-support_quote_string \
+ tst-support_readdir \
tst-support_record_failure \
tst-test_compare \
tst-test_compare_blob \
tst-test_compare_string \
tst-test_compare_string_wide \
tst-timespec \
+ tst-xdirent \
tst-xreadlink \
tst-xsigstack \
# tests
+tests-container = \
+ tst-support-openpty-c \
+ # tests-container
+
ifeq ($(run-built-tests),yes)
tests-special = \
$(objpfx)tst-support_record_failure-2.out
diff --git a/support/blob_repeat.c b/support/blob_repeat.c
index 693956f..fc6ad2c 100644
--- a/support/blob_repeat.c
+++ b/support/blob_repeat.c
@@ -1,5 +1,5 @@
/* Repeating a memory blob, with alias mapping optimization.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -92,7 +92,7 @@ allocate_malloc (size_t total_size, const void *element, size_t element_size,
{
void *buffer = malloc (total_size);
if (buffer == NULL)
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
fill (buffer, element, element_size, count);
return (struct support_blob_repeat)
{
@@ -136,7 +136,7 @@ allocate_big (size_t total_size, const void *element, size_t element_size,
if (stride_size == 0)
{
errno = EOVERFLOW;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
/* Ensure that the stride size is at least maximum_small_size. This
@@ -154,7 +154,7 @@ allocate_big (size_t total_size, const void *element, size_t element_size,
void *target = mmap (NULL, total_size, PROT_NONE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (target == MAP_FAILED)
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
/* Create the backing file for the repeated mapping. Call mkstemp
directly to remove the resources backing the temporary file
@@ -191,7 +191,7 @@ allocate_big (size_t total_size, const void *element, size_t element_size,
xmunmap (target, total_size);
xclose (fd);
errno = saved_errno;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
if (ptr != target)
FAIL_EXIT1 ("mapping of %zu bytes moved from %p to %p",
@@ -235,7 +235,7 @@ allocate_big (size_t total_size, const void *element, size_t element_size,
xmunmap (target, total_size);
xclose (fd);
errno = saved_errno;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
if (ptr != current)
FAIL_EXIT1 ("MAP_PRIVATE mapping of %zu bytes moved from %p to %p",
@@ -263,7 +263,7 @@ repeat_allocate (const void *element, size_t element_size,
if (__builtin_mul_overflow (element_size, count, &total_size))
{
errno = EOVERFLOW;
- return (struct support_blob_repeat) { 0 };
+ return (struct support_blob_repeat) {};
}
if (total_size <= maximum_small_size)
return allocate_malloc (total_size, element, element_size, count);
@@ -297,5 +297,5 @@ support_blob_repeat_free (struct support_blob_repeat *blob)
xmunmap (blob->start, blob->size);
errno = saved_errno;
}
- *blob = (struct support_blob_repeat) { 0 };
+ *blob = (struct support_blob_repeat) {};
}
diff --git a/support/blob_repeat.h b/support/blob_repeat.h
index d1f7168..befffa6 100644
--- a/support/blob_repeat.h
+++ b/support/blob_repeat.h
@@ -1,5 +1,5 @@
/* Repeating a memory blob, with alias mapping optimization.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/bundled/README b/support/bundled/README
new file mode 100644
index 0000000..e861b3d
--- /dev/null
+++ b/support/bundled/README
@@ -0,0 +1,5 @@
+This subtree contains bundled files included verbatim from other
+sources. They are used for building the support/ infrastructure.
+
+linux/
+ Select files from the Linux 6.10 source tree.
diff --git a/support/bundled/linux/COPYING b/support/bundled/linux/COPYING
new file mode 100644
index 0000000..a635a38
--- /dev/null
+++ b/support/bundled/linux/COPYING
@@ -0,0 +1,20 @@
+The Linux Kernel is provided under:
+
+ SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+
+Being under the terms of the GNU General Public License version 2 only,
+according with:
+
+ LICENSES/preferred/GPL-2.0
+
+With an explicit syscall exception, as stated at:
+
+ LICENSES/exceptions/Linux-syscall-note
+
+In addition, other licenses may also apply. Please see:
+
+ Documentation/process/license-rules.rst
+
+for more details.
+
+All contributions to the Linux Kernel are subject to this COPYING file.
diff --git a/support/bundled/linux/LICENSES/exceptions/Linux-syscall-note b/support/bundled/linux/LICENSES/exceptions/Linux-syscall-note
new file mode 100644
index 0000000..adbe756
--- /dev/null
+++ b/support/bundled/linux/LICENSES/exceptions/Linux-syscall-note
@@ -0,0 +1,24 @@
+SPDX-Exception-Identifier: Linux-syscall-note
+SPDX-URL: https://spdx.org/licenses/Linux-syscall-note.html
+SPDX-Licenses: GPL-2.0, GPL-2.0+, GPL-1.0+, LGPL-2.0, LGPL-2.0+, LGPL-2.1, LGPL-2.1+, GPL-2.0-only, GPL-2.0-or-later
+Usage-Guide:
+ This exception is used together with one of the above SPDX-Licenses
+ to mark user space API (uapi) header files so they can be included
+ into non GPL compliant user space application code.
+ To use this exception add it with the keyword WITH to one of the
+ identifiers in the SPDX-Licenses tag:
+ SPDX-License-Identifier: <SPDX-License> WITH Linux-syscall-note
+License-Text:
+
+ NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the Linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Also note that the only valid version of the GPL as far as the kernel
+ is concerned is _this_ particular version of the license (ie v2, not
+ v2.2 or v3.x or whatever), unless explicitly otherwise stated.
+
+ Linus Torvalds
diff --git a/support/bundled/linux/LICENSES/preferred/GPL-2.0 b/support/bundled/linux/LICENSES/preferred/GPL-2.0
new file mode 100644
index 0000000..ff0812f
--- /dev/null
+++ b/support/bundled/linux/LICENSES/preferred/GPL-2.0
@@ -0,0 +1,359 @@
+Valid-License-Identifier: GPL-2.0
+Valid-License-Identifier: GPL-2.0-only
+Valid-License-Identifier: GPL-2.0+
+Valid-License-Identifier: GPL-2.0-or-later
+SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
+Usage-Guide:
+ To use this license in source code, put one of the following SPDX
+ tag/value pairs into a comment according to the placement
+ guidelines in the licensing rules documentation.
+ For 'GNU General Public License (GPL) version 2 only' use:
+ SPDX-License-Identifier: GPL-2.0
+ or
+ SPDX-License-Identifier: GPL-2.0-only
+ For 'GNU General Public License (GPL) version 2 or any later version' use:
+ SPDX-License-Identifier: GPL-2.0+
+ or
+ SPDX-License-Identifier: GPL-2.0-or-later
+License-Text:
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/support/bundled/linux/include/uapi/linux/fuse.h b/support/bundled/linux/include/uapi/linux/fuse.h
new file mode 100644
index 0000000..d08b99d
--- /dev/null
+++ b/support/bundled/linux/include/uapi/linux/fuse.h
@@ -0,0 +1,1189 @@
+/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
+/*
+ This file defines the kernel interface of FUSE
+ Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
+
+ This program can be distributed under the terms of the GNU GPL.
+ See the file COPYING.
+
+ This -- and only this -- header file may also be distributed under
+ the terms of the BSD Licence as follows:
+
+ Copyright (C) 2001-2007 Miklos Szeredi. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+*/
+
+/*
+ * This file defines the kernel interface of FUSE
+ *
+ * Protocol changelog:
+ *
+ * 7.1:
+ * - add the following messages:
+ * FUSE_SETATTR, FUSE_SYMLINK, FUSE_MKNOD, FUSE_MKDIR, FUSE_UNLINK,
+ * FUSE_RMDIR, FUSE_RENAME, FUSE_LINK, FUSE_OPEN, FUSE_READ, FUSE_WRITE,
+ * FUSE_RELEASE, FUSE_FSYNC, FUSE_FLUSH, FUSE_SETXATTR, FUSE_GETXATTR,
+ * FUSE_LISTXATTR, FUSE_REMOVEXATTR, FUSE_OPENDIR, FUSE_READDIR,
+ * FUSE_RELEASEDIR
+ * - add padding to messages to accommodate 32-bit servers on 64-bit kernels
+ *
+ * 7.2:
+ * - add FOPEN_DIRECT_IO and FOPEN_KEEP_CACHE flags
+ * - add FUSE_FSYNCDIR message
+ *
+ * 7.3:
+ * - add FUSE_ACCESS message
+ * - add FUSE_CREATE message
+ * - add filehandle to fuse_setattr_in
+ *
+ * 7.4:
+ * - add frsize to fuse_kstatfs
+ * - clean up request size limit checking
+ *
+ * 7.5:
+ * - add flags and max_write to fuse_init_out
+ *
+ * 7.6:
+ * - add max_readahead to fuse_init_in and fuse_init_out
+ *
+ * 7.7:
+ * - add FUSE_INTERRUPT message
+ * - add POSIX file lock support
+ *
+ * 7.8:
+ * - add lock_owner and flags fields to fuse_release_in
+ * - add FUSE_BMAP message
+ * - add FUSE_DESTROY message
+ *
+ * 7.9:
+ * - new fuse_getattr_in input argument of GETATTR
+ * - add lk_flags in fuse_lk_in
+ * - add lock_owner field to fuse_setattr_in, fuse_read_in and fuse_write_in
+ * - add blksize field to fuse_attr
+ * - add file flags field to fuse_read_in and fuse_write_in
+ * - Add ATIME_NOW and MTIME_NOW flags to fuse_setattr_in
+ *
+ * 7.10
+ * - add nonseekable open flag
+ *
+ * 7.11
+ * - add IOCTL message
+ * - add unsolicited notification support
+ * - add POLL message and NOTIFY_POLL notification
+ *
+ * 7.12
+ * - add umask flag to input argument of create, mknod and mkdir
+ * - add notification messages for invalidation of inodes and
+ * directory entries
+ *
+ * 7.13
+ * - make max number of background requests and congestion threshold
+ * tunables
+ *
+ * 7.14
+ * - add splice support to fuse device
+ *
+ * 7.15
+ * - add store notify
+ * - add retrieve notify
+ *
+ * 7.16
+ * - add BATCH_FORGET request
+ * - FUSE_IOCTL_UNRESTRICTED shall now return with array of 'struct
+ * fuse_ioctl_iovec' instead of ambiguous 'struct iovec'
+ * - add FUSE_IOCTL_32BIT flag
+ *
+ * 7.17
+ * - add FUSE_FLOCK_LOCKS and FUSE_RELEASE_FLOCK_UNLOCK
+ *
+ * 7.18
+ * - add FUSE_IOCTL_DIR flag
+ * - add FUSE_NOTIFY_DELETE
+ *
+ * 7.19
+ * - add FUSE_FALLOCATE
+ *
+ * 7.20
+ * - add FUSE_AUTO_INVAL_DATA
+ *
+ * 7.21
+ * - add FUSE_READDIRPLUS
+ * - send the requested events in POLL request
+ *
+ * 7.22
+ * - add FUSE_ASYNC_DIO
+ *
+ * 7.23
+ * - add FUSE_WRITEBACK_CACHE
+ * - add time_gran to fuse_init_out
+ * - add reserved space to fuse_init_out
+ * - add FATTR_CTIME
+ * - add ctime and ctimensec to fuse_setattr_in
+ * - add FUSE_RENAME2 request
+ * - add FUSE_NO_OPEN_SUPPORT flag
+ *
+ * 7.24
+ * - add FUSE_LSEEK for SEEK_HOLE and SEEK_DATA support
+ *
+ * 7.25
+ * - add FUSE_PARALLEL_DIROPS
+ *
+ * 7.26
+ * - add FUSE_HANDLE_KILLPRIV
+ * - add FUSE_POSIX_ACL
+ *
+ * 7.27
+ * - add FUSE_ABORT_ERROR
+ *
+ * 7.28
+ * - add FUSE_COPY_FILE_RANGE
+ * - add FOPEN_CACHE_DIR
+ * - add FUSE_MAX_PAGES, add max_pages to init_out
+ * - add FUSE_CACHE_SYMLINKS
+ *
+ * 7.29
+ * - add FUSE_NO_OPENDIR_SUPPORT flag
+ *
+ * 7.30
+ * - add FUSE_EXPLICIT_INVAL_DATA
+ * - add FUSE_IOCTL_COMPAT_X32
+ *
+ * 7.31
+ * - add FUSE_WRITE_KILL_PRIV flag
+ * - add FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING
+ * - add map_alignment to fuse_init_out, add FUSE_MAP_ALIGNMENT flag
+ *
+ * 7.32
+ * - add flags to fuse_attr, add FUSE_ATTR_SUBMOUNT, add FUSE_SUBMOUNTS
+ *
+ * 7.33
+ * - add FUSE_HANDLE_KILLPRIV_V2, FUSE_WRITE_KILL_SUIDGID, FATTR_KILL_SUIDGID
+ * - add FUSE_OPEN_KILL_SUIDGID
+ * - extend fuse_setxattr_in, add FUSE_SETXATTR_EXT
+ * - add FUSE_SETXATTR_ACL_KILL_SGID
+ *
+ * 7.34
+ * - add FUSE_SYNCFS
+ *
+ * 7.35
+ * - add FOPEN_NOFLUSH
+ *
+ * 7.36
+ * - extend fuse_init_in with reserved fields, add FUSE_INIT_EXT init flag
+ * - add flags2 to fuse_init_in and fuse_init_out
+ * - add FUSE_SECURITY_CTX init flag
+ * - add security context to create, mkdir, symlink, and mknod requests
+ * - add FUSE_HAS_INODE_DAX, FUSE_ATTR_DAX
+ *
+ * 7.37
+ * - add FUSE_TMPFILE
+ *
+ * 7.38
+ * - add FUSE_EXPIRE_ONLY flag to fuse_notify_inval_entry
+ * - add FOPEN_PARALLEL_DIRECT_WRITES
+ * - add total_extlen to fuse_in_header
+ * - add FUSE_MAX_NR_SECCTX
+ * - add extension header
+ * - add FUSE_EXT_GROUPS
+ * - add FUSE_CREATE_SUPP_GROUP
+ * - add FUSE_HAS_EXPIRE_ONLY
+ *
+ * 7.39
+ * - add FUSE_DIRECT_IO_ALLOW_MMAP
+ * - add FUSE_STATX and related structures
+ *
+ * 7.40
+ * - add max_stack_depth to fuse_init_out, add FUSE_PASSTHROUGH init flag
+ * - add backing_id to fuse_open_out, add FOPEN_PASSTHROUGH open flag
+ * - add FUSE_NO_EXPORT_SUPPORT init flag
+ * - add FUSE_NOTIFY_RESEND, add FUSE_HAS_RESEND init flag
+ */
+
+#ifndef _LINUX_FUSE_H
+#define _LINUX_FUSE_H
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#else
+#include <stdint.h>
+#endif
+
+/*
+ * Version negotiation:
+ *
+ * Both the kernel and userspace send the version they support in the
+ * INIT request and reply respectively.
+ *
+ * If the major versions match then both shall use the smallest
+ * of the two minor versions for communication.
+ *
+ * If the kernel supports a larger major version, then userspace shall
+ * reply with the major version it supports, ignore the rest of the
+ * INIT message and expect a new INIT message from the kernel with a
+ * matching major version.
+ *
+ * If the library supports a larger major version, then it shall fall
+ * back to the major protocol version sent by the kernel for
+ * communication and reply with that major version (and an arbitrary
+ * supported minor version).
+ */
+
+/** Version number of this interface */
+#define FUSE_KERNEL_VERSION 7
+
+/** Minor version number of this interface */
+#define FUSE_KERNEL_MINOR_VERSION 40
+
+/** The node ID of the root inode */
+#define FUSE_ROOT_ID 1
+
+/* Make sure all structures are padded to 64bit boundary, so 32bit
+ userspace works under 64bit kernels */
+
+struct fuse_attr {
+ uint64_t ino;
+ uint64_t size;
+ uint64_t blocks;
+ uint64_t atime;
+ uint64_t mtime;
+ uint64_t ctime;
+ uint32_t atimensec;
+ uint32_t mtimensec;
+ uint32_t ctimensec;
+ uint32_t mode;
+ uint32_t nlink;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t rdev;
+ uint32_t blksize;
+ uint32_t flags;
+};
+
+/*
+ * The following structures are bit-for-bit compatible with the statx(2) ABI in
+ * Linux.
+ */
+struct fuse_sx_time {
+ int64_t tv_sec;
+ uint32_t tv_nsec;
+ int32_t __reserved;
+};
+
+struct fuse_statx {
+ uint32_t mask;
+ uint32_t blksize;
+ uint64_t attributes;
+ uint32_t nlink;
+ uint32_t uid;
+ uint32_t gid;
+ uint16_t mode;
+ uint16_t __spare0[1];
+ uint64_t ino;
+ uint64_t size;
+ uint64_t blocks;
+ uint64_t attributes_mask;
+ struct fuse_sx_time atime;
+ struct fuse_sx_time btime;
+ struct fuse_sx_time ctime;
+ struct fuse_sx_time mtime;
+ uint32_t rdev_major;
+ uint32_t rdev_minor;
+ uint32_t dev_major;
+ uint32_t dev_minor;
+ uint64_t __spare2[14];
+};
+
+struct fuse_kstatfs {
+ uint64_t blocks;
+ uint64_t bfree;
+ uint64_t bavail;
+ uint64_t files;
+ uint64_t ffree;
+ uint32_t bsize;
+ uint32_t namelen;
+ uint32_t frsize;
+ uint32_t padding;
+ uint32_t spare[6];
+};
+
+struct fuse_file_lock {
+ uint64_t start;
+ uint64_t end;
+ uint32_t type;
+ uint32_t pid; /* tgid */
+};
+
+/**
+ * Bitmasks for fuse_setattr_in.valid
+ */
+#define FATTR_MODE (1 << 0)
+#define FATTR_UID (1 << 1)
+#define FATTR_GID (1 << 2)
+#define FATTR_SIZE (1 << 3)
+#define FATTR_ATIME (1 << 4)
+#define FATTR_MTIME (1 << 5)
+#define FATTR_FH (1 << 6)
+#define FATTR_ATIME_NOW (1 << 7)
+#define FATTR_MTIME_NOW (1 << 8)
+#define FATTR_LOCKOWNER (1 << 9)
+#define FATTR_CTIME (1 << 10)
+#define FATTR_KILL_SUIDGID (1 << 11)
+
+/**
+ * Flags returned by the OPEN request
+ *
+ * FOPEN_DIRECT_IO: bypass page cache for this open file
+ * FOPEN_KEEP_CACHE: don't invalidate the data cache on open
+ * FOPEN_NONSEEKABLE: the file is not seekable
+ * FOPEN_CACHE_DIR: allow caching this directory
+ * FOPEN_STREAM: the file is stream-like (no file position at all)
+ * FOPEN_NOFLUSH: don't flush data cache on close (unless FUSE_WRITEBACK_CACHE)
+ * FOPEN_PARALLEL_DIRECT_WRITES: Allow concurrent direct writes on the same inode
+ * FOPEN_PASSTHROUGH: passthrough read/write io for this open file
+ */
+#define FOPEN_DIRECT_IO (1 << 0)
+#define FOPEN_KEEP_CACHE (1 << 1)
+#define FOPEN_NONSEEKABLE (1 << 2)
+#define FOPEN_CACHE_DIR (1 << 3)
+#define FOPEN_STREAM (1 << 4)
+#define FOPEN_NOFLUSH (1 << 5)
+#define FOPEN_PARALLEL_DIRECT_WRITES (1 << 6)
+#define FOPEN_PASSTHROUGH (1 << 7)
+
+/**
+ * INIT request/reply flags
+ *
+ * FUSE_ASYNC_READ: asynchronous read requests
+ * FUSE_POSIX_LOCKS: remote locking for POSIX file locks
+ * FUSE_FILE_OPS: kernel sends file handle for fstat, etc... (not yet supported)
+ * FUSE_ATOMIC_O_TRUNC: handles the O_TRUNC open flag in the filesystem
+ * FUSE_EXPORT_SUPPORT: filesystem handles lookups of "." and ".."
+ * FUSE_BIG_WRITES: filesystem can handle write size larger than 4kB
+ * FUSE_DONT_MASK: don't apply umask to file mode on create operations
+ * FUSE_SPLICE_WRITE: kernel supports splice write on the device
+ * FUSE_SPLICE_MOVE: kernel supports splice move on the device
+ * FUSE_SPLICE_READ: kernel supports splice read on the device
+ * FUSE_FLOCK_LOCKS: remote locking for BSD style file locks
+ * FUSE_HAS_IOCTL_DIR: kernel supports ioctl on directories
+ * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
+ * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
+ * FUSE_READDIRPLUS_AUTO: adaptive readdirplus
+ * FUSE_ASYNC_DIO: asynchronous direct I/O submission
+ * FUSE_WRITEBACK_CACHE: use writeback cache for buffered writes
+ * FUSE_NO_OPEN_SUPPORT: kernel supports zero-message opens
+ * FUSE_PARALLEL_DIROPS: allow parallel lookups and readdir
+ * FUSE_HANDLE_KILLPRIV: fs handles killing suid/sgid/cap on write/chown/trunc
+ * FUSE_POSIX_ACL: filesystem supports posix acls
+ * FUSE_ABORT_ERROR: reading the device after abort returns ECONNABORTED
+ * FUSE_MAX_PAGES: init_out.max_pages contains the max number of req pages
+ * FUSE_CACHE_SYMLINKS: cache READLINK responses
+ * FUSE_NO_OPENDIR_SUPPORT: kernel supports zero-message opendir
+ * FUSE_EXPLICIT_INVAL_DATA: only invalidate cached pages on explicit request
+ * FUSE_MAP_ALIGNMENT: init_out.map_alignment contains log2(byte alignment) for
+ * foffset and moffset fields in struct
+ * fuse_setupmapping_out and fuse_removemapping_one.
+ * FUSE_SUBMOUNTS: kernel supports auto-mounting directory submounts
+ * FUSE_HANDLE_KILLPRIV_V2: fs kills suid/sgid/cap on write/chown/trunc.
+ * Upon write/truncate suid/sgid is only killed if caller
+ * does not have CAP_FSETID. Additionally upon
+ * write/truncate sgid is killed only if file has group
+ * execute permission. (Same as Linux VFS behavior).
+ * FUSE_SETXATTR_EXT: Server supports extended struct fuse_setxattr_in
+ * FUSE_INIT_EXT: extended fuse_init_in request
+ * FUSE_INIT_RESERVED: reserved, do not use
+ * FUSE_SECURITY_CTX: add security context to create, mkdir, symlink, and
+ * mknod
+ * FUSE_HAS_INODE_DAX: use per inode DAX
+ * FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir,
+ * symlink and mknod (single group that matches parent)
+ * FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation
+ * FUSE_DIRECT_IO_ALLOW_MMAP: allow shared mmap in FOPEN_DIRECT_IO mode.
+ * FUSE_NO_EXPORT_SUPPORT: explicitly disable export support
+ * FUSE_HAS_RESEND: kernel supports resending pending requests, and the high bit
+ * of the request ID indicates resend requests
+ */
+#define FUSE_ASYNC_READ (1 << 0)
+#define FUSE_POSIX_LOCKS (1 << 1)
+#define FUSE_FILE_OPS (1 << 2)
+#define FUSE_ATOMIC_O_TRUNC (1 << 3)
+#define FUSE_EXPORT_SUPPORT (1 << 4)
+#define FUSE_BIG_WRITES (1 << 5)
+#define FUSE_DONT_MASK (1 << 6)
+#define FUSE_SPLICE_WRITE (1 << 7)
+#define FUSE_SPLICE_MOVE (1 << 8)
+#define FUSE_SPLICE_READ (1 << 9)
+#define FUSE_FLOCK_LOCKS (1 << 10)
+#define FUSE_HAS_IOCTL_DIR (1 << 11)
+#define FUSE_AUTO_INVAL_DATA (1 << 12)
+#define FUSE_DO_READDIRPLUS (1 << 13)
+#define FUSE_READDIRPLUS_AUTO (1 << 14)
+#define FUSE_ASYNC_DIO (1 << 15)
+#define FUSE_WRITEBACK_CACHE (1 << 16)
+#define FUSE_NO_OPEN_SUPPORT (1 << 17)
+#define FUSE_PARALLEL_DIROPS (1 << 18)
+#define FUSE_HANDLE_KILLPRIV (1 << 19)
+#define FUSE_POSIX_ACL (1 << 20)
+#define FUSE_ABORT_ERROR (1 << 21)
+#define FUSE_MAX_PAGES (1 << 22)
+#define FUSE_CACHE_SYMLINKS (1 << 23)
+#define FUSE_NO_OPENDIR_SUPPORT (1 << 24)
+#define FUSE_EXPLICIT_INVAL_DATA (1 << 25)
+#define FUSE_MAP_ALIGNMENT (1 << 26)
+#define FUSE_SUBMOUNTS (1 << 27)
+#define FUSE_HANDLE_KILLPRIV_V2 (1 << 28)
+#define FUSE_SETXATTR_EXT (1 << 29)
+#define FUSE_INIT_EXT (1 << 30)
+#define FUSE_INIT_RESERVED (1 << 31)
+/* bits 32..63 get shifted down 32 bits into the flags2 field */
+#define FUSE_SECURITY_CTX (1ULL << 32)
+#define FUSE_HAS_INODE_DAX (1ULL << 33)
+#define FUSE_CREATE_SUPP_GROUP (1ULL << 34)
+#define FUSE_HAS_EXPIRE_ONLY (1ULL << 35)
+#define FUSE_DIRECT_IO_ALLOW_MMAP (1ULL << 36)
+#define FUSE_PASSTHROUGH (1ULL << 37)
+#define FUSE_NO_EXPORT_SUPPORT (1ULL << 38)
+#define FUSE_HAS_RESEND (1ULL << 39)
+
+/* Obsolete alias for FUSE_DIRECT_IO_ALLOW_MMAP */
+#define FUSE_DIRECT_IO_RELAX FUSE_DIRECT_IO_ALLOW_MMAP
+
+/**
+ * CUSE INIT request/reply flags
+ *
+ * CUSE_UNRESTRICTED_IOCTL: use unrestricted ioctl
+ */
+#define CUSE_UNRESTRICTED_IOCTL (1 << 0)
+
+/**
+ * Release flags
+ */
+#define FUSE_RELEASE_FLUSH (1 << 0)
+#define FUSE_RELEASE_FLOCK_UNLOCK (1 << 1)
+
+/**
+ * Getattr flags
+ */
+#define FUSE_GETATTR_FH (1 << 0)
+
+/**
+ * Lock flags
+ */
+#define FUSE_LK_FLOCK (1 << 0)
+
+/**
+ * WRITE flags
+ *
+ * FUSE_WRITE_CACHE: delayed write from page cache, file handle is guessed
+ * FUSE_WRITE_LOCKOWNER: lock_owner field is valid
+ * FUSE_WRITE_KILL_SUIDGID: kill suid and sgid bits
+ */
+#define FUSE_WRITE_CACHE (1 << 0)
+#define FUSE_WRITE_LOCKOWNER (1 << 1)
+#define FUSE_WRITE_KILL_SUIDGID (1 << 2)
+
+/* Obsolete alias; this flag implies killing suid/sgid only. */
+#define FUSE_WRITE_KILL_PRIV FUSE_WRITE_KILL_SUIDGID
+
+/**
+ * Read flags
+ */
+#define FUSE_READ_LOCKOWNER (1 << 1)
+
+/**
+ * Ioctl flags
+ *
+ * FUSE_IOCTL_COMPAT: 32bit compat ioctl on 64bit machine
+ * FUSE_IOCTL_UNRESTRICTED: not restricted to well-formed ioctls, retry allowed
+ * FUSE_IOCTL_RETRY: retry with new iovecs
+ * FUSE_IOCTL_32BIT: 32bit ioctl
+ * FUSE_IOCTL_DIR: is a directory
+ * FUSE_IOCTL_COMPAT_X32: x32 compat ioctl on 64bit machine (64bit time_t)
+ *
+ * FUSE_IOCTL_MAX_IOV: maximum of in_iovecs + out_iovecs
+ */
+#define FUSE_IOCTL_COMPAT (1 << 0)
+#define FUSE_IOCTL_UNRESTRICTED (1 << 1)
+#define FUSE_IOCTL_RETRY (1 << 2)
+#define FUSE_IOCTL_32BIT (1 << 3)
+#define FUSE_IOCTL_DIR (1 << 4)
+#define FUSE_IOCTL_COMPAT_X32 (1 << 5)
+
+#define FUSE_IOCTL_MAX_IOV 256
+
+/**
+ * Poll flags
+ *
+ * FUSE_POLL_SCHEDULE_NOTIFY: request poll notify
+ */
+#define FUSE_POLL_SCHEDULE_NOTIFY (1 << 0)
+
+/**
+ * Fsync flags
+ *
+ * FUSE_FSYNC_FDATASYNC: Sync data only, not metadata
+ */
+#define FUSE_FSYNC_FDATASYNC (1 << 0)
+
+/**
+ * fuse_attr flags
+ *
+ * FUSE_ATTR_SUBMOUNT: Object is a submount root
+ * FUSE_ATTR_DAX: Enable DAX for this file in per inode DAX mode
+ */
+#define FUSE_ATTR_SUBMOUNT (1 << 0)
+#define FUSE_ATTR_DAX (1 << 1)
+
+/**
+ * Open flags
+ * FUSE_OPEN_KILL_SUIDGID: Kill suid and sgid if executable
+ */
+#define FUSE_OPEN_KILL_SUIDGID (1 << 0)
+
+/**
+ * setxattr flags
+ * FUSE_SETXATTR_ACL_KILL_SGID: Clear SGID when system.posix_acl_access is set
+ */
+#define FUSE_SETXATTR_ACL_KILL_SGID (1 << 0)
+
+/**
+ * notify_inval_entry flags
+ * FUSE_EXPIRE_ONLY
+ */
+#define FUSE_EXPIRE_ONLY (1 << 0)
+
+/**
+ * extension type
+ * FUSE_MAX_NR_SECCTX: maximum value of &fuse_secctx_header.nr_secctx
+ * FUSE_EXT_GROUPS: &fuse_supp_groups extension
+ */
+enum fuse_ext_type {
+ /* Types 0..31 are reserved for fuse_secctx_header */
+ FUSE_MAX_NR_SECCTX = 31,
+ FUSE_EXT_GROUPS = 32,
+};
+
+enum fuse_opcode {
+ FUSE_LOOKUP = 1,
+ FUSE_FORGET = 2, /* no reply */
+ FUSE_GETATTR = 3,
+ FUSE_SETATTR = 4,
+ FUSE_READLINK = 5,
+ FUSE_SYMLINK = 6,
+ FUSE_MKNOD = 8,
+ FUSE_MKDIR = 9,
+ FUSE_UNLINK = 10,
+ FUSE_RMDIR = 11,
+ FUSE_RENAME = 12,
+ FUSE_LINK = 13,
+ FUSE_OPEN = 14,
+ FUSE_READ = 15,
+ FUSE_WRITE = 16,
+ FUSE_STATFS = 17,
+ FUSE_RELEASE = 18,
+ FUSE_FSYNC = 20,
+ FUSE_SETXATTR = 21,
+ FUSE_GETXATTR = 22,
+ FUSE_LISTXATTR = 23,
+ FUSE_REMOVEXATTR = 24,
+ FUSE_FLUSH = 25,
+ FUSE_INIT = 26,
+ FUSE_OPENDIR = 27,
+ FUSE_READDIR = 28,
+ FUSE_RELEASEDIR = 29,
+ FUSE_FSYNCDIR = 30,
+ FUSE_GETLK = 31,
+ FUSE_SETLK = 32,
+ FUSE_SETLKW = 33,
+ FUSE_ACCESS = 34,
+ FUSE_CREATE = 35,
+ FUSE_INTERRUPT = 36,
+ FUSE_BMAP = 37,
+ FUSE_DESTROY = 38,
+ FUSE_IOCTL = 39,
+ FUSE_POLL = 40,
+ FUSE_NOTIFY_REPLY = 41,
+ FUSE_BATCH_FORGET = 42,
+ FUSE_FALLOCATE = 43,
+ FUSE_READDIRPLUS = 44,
+ FUSE_RENAME2 = 45,
+ FUSE_LSEEK = 46,
+ FUSE_COPY_FILE_RANGE = 47,
+ FUSE_SETUPMAPPING = 48,
+ FUSE_REMOVEMAPPING = 49,
+ FUSE_SYNCFS = 50,
+ FUSE_TMPFILE = 51,
+ FUSE_STATX = 52,
+
+ /* CUSE specific operations */
+ CUSE_INIT = 4096,
+
+ /* Reserved opcodes: helpful to detect structure endian-ness */
+ CUSE_INIT_BSWAP_RESERVED = 1048576, /* CUSE_INIT << 8 */
+ FUSE_INIT_BSWAP_RESERVED = 436207616, /* FUSE_INIT << 24 */
+};
+
+enum fuse_notify_code {
+ FUSE_NOTIFY_POLL = 1,
+ FUSE_NOTIFY_INVAL_INODE = 2,
+ FUSE_NOTIFY_INVAL_ENTRY = 3,
+ FUSE_NOTIFY_STORE = 4,
+ FUSE_NOTIFY_RETRIEVE = 5,
+ FUSE_NOTIFY_DELETE = 6,
+ FUSE_NOTIFY_RESEND = 7,
+ FUSE_NOTIFY_CODE_MAX,
+};
+
+/* The read buffer is required to be at least 8k, but may be much larger */
+#define FUSE_MIN_READ_BUFFER 8192
+
+#define FUSE_COMPAT_ENTRY_OUT_SIZE 120
+
+struct fuse_entry_out {
+ uint64_t nodeid; /* Inode ID */
+ uint64_t generation; /* Inode generation: nodeid:gen must
+ be unique for the fs's lifetime */
+ uint64_t entry_valid; /* Cache timeout for the name */
+ uint64_t attr_valid; /* Cache timeout for the attributes */
+ uint32_t entry_valid_nsec;
+ uint32_t attr_valid_nsec;
+ struct fuse_attr attr;
+};
+
+struct fuse_forget_in {
+ uint64_t nlookup;
+};
+
+struct fuse_forget_one {
+ uint64_t nodeid;
+ uint64_t nlookup;
+};
+
+struct fuse_batch_forget_in {
+ uint32_t count;
+ uint32_t dummy;
+};
+
+struct fuse_getattr_in {
+ uint32_t getattr_flags;
+ uint32_t dummy;
+ uint64_t fh;
+};
+
+#define FUSE_COMPAT_ATTR_OUT_SIZE 96
+
+struct fuse_attr_out {
+ uint64_t attr_valid; /* Cache timeout for the attributes */
+ uint32_t attr_valid_nsec;
+ uint32_t dummy;
+ struct fuse_attr attr;
+};
+
+struct fuse_statx_in {
+ uint32_t getattr_flags;
+ uint32_t reserved;
+ uint64_t fh;
+ uint32_t sx_flags;
+ uint32_t sx_mask;
+};
+
+struct fuse_statx_out {
+ uint64_t attr_valid; /* Cache timeout for the attributes */
+ uint32_t attr_valid_nsec;
+ uint32_t flags;
+ uint64_t spare[2];
+ struct fuse_statx stat;
+};
+
+#define FUSE_COMPAT_MKNOD_IN_SIZE 8
+
+struct fuse_mknod_in {
+ uint32_t mode;
+ uint32_t rdev;
+ uint32_t umask;
+ uint32_t padding;
+};
+
+struct fuse_mkdir_in {
+ uint32_t mode;
+ uint32_t umask;
+};
+
+struct fuse_rename_in {
+ uint64_t newdir;
+};
+
+struct fuse_rename2_in {
+ uint64_t newdir;
+ uint32_t flags;
+ uint32_t padding;
+};
+
+struct fuse_link_in {
+ uint64_t oldnodeid;
+};
+
+struct fuse_setattr_in {
+ uint32_t valid;
+ uint32_t padding;
+ uint64_t fh;
+ uint64_t size;
+ uint64_t lock_owner;
+ uint64_t atime;
+ uint64_t mtime;
+ uint64_t ctime;
+ uint32_t atimensec;
+ uint32_t mtimensec;
+ uint32_t ctimensec;
+ uint32_t mode;
+ uint32_t unused4;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t unused5;
+};
+
+struct fuse_open_in {
+ uint32_t flags;
+ uint32_t open_flags; /* FUSE_OPEN_... */
+};
+
+struct fuse_create_in {
+ uint32_t flags;
+ uint32_t mode;
+ uint32_t umask;
+ uint32_t open_flags; /* FUSE_OPEN_... */
+};
+
+struct fuse_open_out {
+ uint64_t fh;
+ uint32_t open_flags;
+ int32_t backing_id;
+};
+
+struct fuse_release_in {
+ uint64_t fh;
+ uint32_t flags;
+ uint32_t release_flags;
+ uint64_t lock_owner;
+};
+
+struct fuse_flush_in {
+ uint64_t fh;
+ uint32_t unused;
+ uint32_t padding;
+ uint64_t lock_owner;
+};
+
+struct fuse_read_in {
+ uint64_t fh;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t read_flags;
+ uint64_t lock_owner;
+ uint32_t flags;
+ uint32_t padding;
+};
+
+#define FUSE_COMPAT_WRITE_IN_SIZE 24
+
+struct fuse_write_in {
+ uint64_t fh;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t write_flags;
+ uint64_t lock_owner;
+ uint32_t flags;
+ uint32_t padding;
+};
+
+struct fuse_write_out {
+ uint32_t size;
+ uint32_t padding;
+};
+
+#define FUSE_COMPAT_STATFS_SIZE 48
+
+struct fuse_statfs_out {
+ struct fuse_kstatfs st;
+};
+
+struct fuse_fsync_in {
+ uint64_t fh;
+ uint32_t fsync_flags;
+ uint32_t padding;
+};
+
+#define FUSE_COMPAT_SETXATTR_IN_SIZE 8
+
+struct fuse_setxattr_in {
+ uint32_t size;
+ uint32_t flags;
+ uint32_t setxattr_flags;
+ uint32_t padding;
+};
+
+struct fuse_getxattr_in {
+ uint32_t size;
+ uint32_t padding;
+};
+
+struct fuse_getxattr_out {
+ uint32_t size;
+ uint32_t padding;
+};
+
+struct fuse_lk_in {
+ uint64_t fh;
+ uint64_t owner;
+ struct fuse_file_lock lk;
+ uint32_t lk_flags;
+ uint32_t padding;
+};
+
+struct fuse_lk_out {
+ struct fuse_file_lock lk;
+};
+
+struct fuse_access_in {
+ uint32_t mask;
+ uint32_t padding;
+};
+
+struct fuse_init_in {
+ uint32_t major;
+ uint32_t minor;
+ uint32_t max_readahead;
+ uint32_t flags;
+ uint32_t flags2;
+ uint32_t unused[11];
+};
+
+#define FUSE_COMPAT_INIT_OUT_SIZE 8
+#define FUSE_COMPAT_22_INIT_OUT_SIZE 24
+
+struct fuse_init_out {
+ uint32_t major;
+ uint32_t minor;
+ uint32_t max_readahead;
+ uint32_t flags;
+ uint16_t max_background;
+ uint16_t congestion_threshold;
+ uint32_t max_write;
+ uint32_t time_gran;
+ uint16_t max_pages;
+ uint16_t map_alignment;
+ uint32_t flags2;
+ uint32_t max_stack_depth;
+ uint32_t unused[6];
+};
+
+#define CUSE_INIT_INFO_MAX 4096
+
+struct cuse_init_in {
+ uint32_t major;
+ uint32_t minor;
+ uint32_t unused;
+ uint32_t flags;
+};
+
+struct cuse_init_out {
+ uint32_t major;
+ uint32_t minor;
+ uint32_t unused;
+ uint32_t flags;
+ uint32_t max_read;
+ uint32_t max_write;
+ uint32_t dev_major; /* chardev major */
+ uint32_t dev_minor; /* chardev minor */
+ uint32_t spare[10];
+};
+
+struct fuse_interrupt_in {
+ uint64_t unique;
+};
+
+struct fuse_bmap_in {
+ uint64_t block;
+ uint32_t blocksize;
+ uint32_t padding;
+};
+
+struct fuse_bmap_out {
+ uint64_t block;
+};
+
+struct fuse_ioctl_in {
+ uint64_t fh;
+ uint32_t flags;
+ uint32_t cmd;
+ uint64_t arg;
+ uint32_t in_size;
+ uint32_t out_size;
+};
+
+struct fuse_ioctl_iovec {
+ uint64_t base;
+ uint64_t len;
+};
+
+struct fuse_ioctl_out {
+ int32_t result;
+ uint32_t flags;
+ uint32_t in_iovs;
+ uint32_t out_iovs;
+};
+
+struct fuse_poll_in {
+ uint64_t fh;
+ uint64_t kh;
+ uint32_t flags;
+ uint32_t events;
+};
+
+struct fuse_poll_out {
+ uint32_t revents;
+ uint32_t padding;
+};
+
+struct fuse_notify_poll_wakeup_out {
+ uint64_t kh;
+};
+
+struct fuse_fallocate_in {
+ uint64_t fh;
+ uint64_t offset;
+ uint64_t length;
+ uint32_t mode;
+ uint32_t padding;
+};
+
+/**
+ * FUSE request unique ID flag
+ *
+ * Indicates whether this is a resend request. The receiver should handle this
+ * request accordingly.
+ */
+#define FUSE_UNIQUE_RESEND (1ULL << 63)
+
+struct fuse_in_header {
+ uint32_t len;
+ uint32_t opcode;
+ uint64_t unique;
+ uint64_t nodeid;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t pid;
+ uint16_t total_extlen; /* length of extensions in 8byte units */
+ uint16_t padding;
+};
+
+struct fuse_out_header {
+ uint32_t len;
+ int32_t error;
+ uint64_t unique;
+};
+
+struct fuse_dirent {
+ uint64_t ino;
+ uint64_t off;
+ uint32_t namelen;
+ uint32_t type;
+ char name[];
+};
+
+/* Align variable length records to 64bit boundary */
+#define FUSE_REC_ALIGN(x) \
+ (((x) + sizeof(uint64_t) - 1) & ~(sizeof(uint64_t) - 1))
+
+#define FUSE_NAME_OFFSET offsetof(struct fuse_dirent, name)
+#define FUSE_DIRENT_ALIGN(x) FUSE_REC_ALIGN(x)
+#define FUSE_DIRENT_SIZE(d) \
+ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen)
+
+struct fuse_direntplus {
+ struct fuse_entry_out entry_out;
+ struct fuse_dirent dirent;
+};
+
+#define FUSE_NAME_OFFSET_DIRENTPLUS \
+ offsetof(struct fuse_direntplus, dirent.name)
+#define FUSE_DIRENTPLUS_SIZE(d) \
+ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
+
+struct fuse_notify_inval_inode_out {
+ uint64_t ino;
+ int64_t off;
+ int64_t len;
+};
+
+struct fuse_notify_inval_entry_out {
+ uint64_t parent;
+ uint32_t namelen;
+ uint32_t flags;
+};
+
+struct fuse_notify_delete_out {
+ uint64_t parent;
+ uint64_t child;
+ uint32_t namelen;
+ uint32_t padding;
+};
+
+struct fuse_notify_store_out {
+ uint64_t nodeid;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t padding;
+};
+
+struct fuse_notify_retrieve_out {
+ uint64_t notify_unique;
+ uint64_t nodeid;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t padding;
+};
+
+/* Matches the size of fuse_write_in */
+struct fuse_notify_retrieve_in {
+ uint64_t dummy1;
+ uint64_t offset;
+ uint32_t size;
+ uint32_t dummy2;
+ uint64_t dummy3;
+ uint64_t dummy4;
+};
+
+struct fuse_backing_map {
+ int32_t fd;
+ uint32_t flags;
+ uint64_t padding;
+};
+
+/* Device ioctls: */
+#define FUSE_DEV_IOC_MAGIC 229
+#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t)
+#define FUSE_DEV_IOC_BACKING_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 1, \
+ struct fuse_backing_map)
+#define FUSE_DEV_IOC_BACKING_CLOSE _IOW(FUSE_DEV_IOC_MAGIC, 2, uint32_t)
+
+struct fuse_lseek_in {
+ uint64_t fh;
+ uint64_t offset;
+ uint32_t whence;
+ uint32_t padding;
+};
+
+struct fuse_lseek_out {
+ uint64_t offset;
+};
+
+struct fuse_copy_file_range_in {
+ uint64_t fh_in;
+ uint64_t off_in;
+ uint64_t nodeid_out;
+ uint64_t fh_out;
+ uint64_t off_out;
+ uint64_t len;
+ uint64_t flags;
+};
+
+#define FUSE_SETUPMAPPING_FLAG_WRITE (1ull << 0)
+#define FUSE_SETUPMAPPING_FLAG_READ (1ull << 1)
+struct fuse_setupmapping_in {
+ /* An already open handle */
+ uint64_t fh;
+ /* Offset into the file to start the mapping */
+ uint64_t foffset;
+ /* Length of mapping required */
+ uint64_t len;
+ /* Flags, FUSE_SETUPMAPPING_FLAG_* */
+ uint64_t flags;
+ /* Offset in Memory Window */
+ uint64_t moffset;
+};
+
+struct fuse_removemapping_in {
+ /* number of fuse_removemapping_one follows */
+ uint32_t count;
+};
+
+struct fuse_removemapping_one {
+ /* Offset into the dax window start the unmapping */
+ uint64_t moffset;
+ /* Length of mapping required */
+ uint64_t len;
+};
+
+#define FUSE_REMOVEMAPPING_MAX_ENTRY \
+ (PAGE_SIZE / sizeof(struct fuse_removemapping_one))
+
+struct fuse_syncfs_in {
+ uint64_t padding;
+};
+
+/*
+ * For each security context, send fuse_secctx with size of security context
+ * fuse_secctx will be followed by security context name and this in turn
+ * will be followed by actual context label.
+ * fuse_secctx, name, context
+ */
+struct fuse_secctx {
+ uint32_t size;
+ uint32_t padding;
+};
+
+/*
+ * Contains the information about how many fuse_secctx structures are being
+ * sent and what's the total size of all security contexts (including
+ * size of fuse_secctx_header).
+ *
+ */
+struct fuse_secctx_header {
+ uint32_t size;
+ uint32_t nr_secctx;
+};
+
+/**
+ * struct fuse_ext_header - extension header
+ * @size: total size of this extension including this header
+ * @type: type of extension
+ *
+ * This is made compatible with fuse_secctx_header by using type values >
+ * FUSE_MAX_NR_SECCTX
+ */
+struct fuse_ext_header {
+ uint32_t size;
+ uint32_t type;
+};
+
+/**
+ * struct fuse_supp_groups - Supplementary group extension
+ * @nr_groups: number of supplementary groups
+ * @groups: flexible array of group IDs
+ */
+struct fuse_supp_groups {
+ uint32_t nr_groups;
+ uint32_t groups[];
+};
+
+#endif /* _LINUX_FUSE_H */
diff --git a/support/capture_subprocess.h b/support/capture_subprocess.h
index 93b7245..b37462d 100644
--- a/support/capture_subprocess.h
+++ b/support/capture_subprocess.h
@@ -1,5 +1,5 @@
/* Capture output from a subprocess.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -42,11 +42,12 @@ struct support_capture_subprocess support_capture_subprocess
struct support_capture_subprocess support_capture_subprogram
(const char *file, char *const argv[], char *const envp[]);
-/* Copy the running program into a setgid binary and run it with CHILD_ID
- argument. If execution is successful, return the exit status of the child
- program, otherwise return a non-zero failure exit code. */
-int support_capture_subprogram_self_sgid
- (char *child_id);
+/* Copy the running program into a setgid binary and run it with
+ CHILD_ID argument. If the program exits with a non-zero status,
+ exit with that exit status (or status 1 if the program did not exit
+ normally). If the test cannot be performed, exit with
+ EXIT_UNSUPPORTED. */
+void support_capture_subprogram_self_sgid (const char *child_id);
/* Deallocate the subprocess data captured by
support_capture_subprocess. */
diff --git a/support/check.c b/support/check.c
index 6ae7b70..d8bf637 100644
--- a/support/check.c
+++ b/support/check.c
@@ -1,5 +1,5 @@
/* Support code for reporting test results.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/check.h b/support/check.h
index 7ea22c7..49db05a 100644
--- a/support/check.h
+++ b/support/check.h
@@ -1,5 +1,5 @@
/* Functionality for reporting test results.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -207,6 +207,9 @@ void support_record_failure_reset (void);
failures or not. */
int support_record_failure_is_failed (void);
+/* Terminate the process if any failures have been encountered so far. */
+void support_record_failure_barrier (void);
+
__END_DECLS
#endif /* SUPPORT_CHECK_H */
diff --git a/support/check_addrinfo.c b/support/check_addrinfo.c
index 8954aed..e893767 100644
--- a/support/check_addrinfo.c
+++ b/support/check_addrinfo.c
@@ -1,5 +1,5 @@
/* Compare struct addrinfo values against a formatted string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/check_dns_packet.c b/support/check_dns_packet.c
index 4faa64a..85a236e 100644
--- a/support/check_dns_packet.c
+++ b/support/check_dns_packet.c
@@ -1,5 +1,5 @@
/* Check that a DNS packet buffer has the expected contents.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/check_hostent.c b/support/check_hostent.c
index 99e707a..7b2e682 100644
--- a/support/check_hostent.c
+++ b/support/check_hostent.c
@@ -1,5 +1,5 @@
/* Compare struct hostent values against a formatted string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/check_netent.c b/support/check_netent.c
index bf08f58..c58a0b4 100644
--- a/support/check_netent.c
+++ b/support/check_netent.c
@@ -1,5 +1,5 @@
/* Compare struct netent values against a formatted string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/check_nss.h b/support/check_nss.h
index 31cfe7d..5f8f0a9 100644
--- a/support/check_nss.h
+++ b/support/check_nss.h
@@ -1,5 +1,5 @@
/* Test verification functions for NSS- and DNS-related data.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/delayed_exit.c b/support/delayed_exit.c
index c9ebc91..60a470b 100644
--- a/support/delayed_exit.c
+++ b/support/delayed_exit.c
@@ -1,5 +1,5 @@
/* Time-triggered process termination.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/descriptors.h b/support/descriptors.h
index 951ad1d..d030d32 100644
--- a/support/descriptors.h
+++ b/support/descriptors.h
@@ -1,5 +1,5 @@
/* Monitoring file descriptor usage.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/dtotimespec-time64.c b/support/dtotimespec-time64.c
index b7cf0e1..aa97774 100644
--- a/support/dtotimespec-time64.c
+++ b/support/dtotimespec-time64.c
@@ -1,5 +1,5 @@
/* Convert double to timespec. 64-bit time support.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
diff --git a/support/dtotimespec.c b/support/dtotimespec.c
index 106b64f..b4e252c 100644
--- a/support/dtotimespec.c
+++ b/support/dtotimespec.c
@@ -1,5 +1,5 @@
/* Convert double to timespec.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
diff --git a/support/echo-container.c b/support/echo-container.c
index 897ab69..52f45fa 100644
--- a/support/echo-container.c
+++ b/support/echo-container.c
@@ -1,5 +1,5 @@
/* Minimal /bin/echo for in-container use.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/file_contents.h b/support/file_contents.h
new file mode 100644
index 0000000..7a3edc8
--- /dev/null
+++ b/support/file_contents.h
@@ -0,0 +1,63 @@
+/* Functionality for checking file contents.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef SUPPORT_FILE_CONTENTS_H
+#define SUPPORT_FILE_CONTENTS_H
+
+#include <support/check.h>
+#include <stdio.h>
+
+__BEGIN_DECLS
+
+/* Check that an already-open file has exactly the given bytes,
+ starting at the current location in the file. The file position
+ indicator is updated to point after the bytes compared. Return 0
+ if equal, 1 otherwise or on read error. */
+int support_compare_file_bytes (FILE *fp, const char *contents, size_t length);
+
+/* Check that an already-open file has exactly the given string as
+ contents, starting at the current offset. The file position
+ indicator is updated to point after the bytes compared. Return 0
+ if equal, 1 otherwise or on read error. */
+int support_compare_file_string (FILE *fp, const char *contents);
+
+/* Check that a not-currently-open file has exactly the given bytes.
+ Return 0 if equal, 1 otherwise or on read error. */
+int support_open_and_compare_file_bytes (const char *file,
+ const char *contents,
+ size_t length);
+
+/* Check that a not-currently-open file has exactly the given string
+ as contents, starting at the current offset. Return 0 if equal, 1
+ otherwise or on read error. */
+int support_open_and_compare_file_string (const char *file,
+ const char *contents);
+
+/* Compare bytes read from an open file with the given string. The
+ file position indicator is updated to point after the bytes
+ compared. */
+#define TEST_COMPARE_FILE_STRING(FP, CONTENTS) \
+ TEST_COMPARE (support_compare_file_string (FP, CONTENTS), 0)
+
+/* Read a file and compare bytes read from it with the given string. */
+#define TEST_OPEN_AND_COMPARE_FILE_STRING(FILE, CONTENTS) \
+ TEST_COMPARE (support_open_and_compare_file_string (FILE, CONTENTS), 0)
+
+__END_DECLS
+
+#endif /* SUPPORT_FILE_CONTENTS_H */
diff --git a/support/format_nss.h b/support/format_nss.h
index f0cfde5..dda5926 100644
--- a/support/format_nss.h
+++ b/support/format_nss.h
@@ -1,5 +1,5 @@
/* String formatting functions for NSS- and DNS-related data.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/fuse.h b/support/fuse.h
new file mode 100644
index 0000000..7b246de
--- /dev/null
+++ b/support/fuse.h
@@ -0,0 +1,217 @@
+/* Facilities for FUSE-backed file system tests.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+/* To run FUSE tests under valgrind, pass the
+ --sim-hints=fuse-compatible option to valgrind. This option tells
+ valgrind that additional system calls effectively call back into
+ the current program. */
+
+#ifndef SUPPORT_FUSE_H
+#define SUPPORT_FUSE_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <support/bundled/linux/include/uapi/linux/fuse.h>
+
+/* This function must be called furst, before support_fuse_mount, to
+ prepare unprivileged mounting. */
+void support_fuse_init (void);
+
+/* This function can be called instead of support_fuse_init. It does
+ not use mount and user namespaces, so it requires root privileges,
+ and cleanup after testing may be incomplete. This is intended only
+ for test development. */
+void support_fuse_init_no_namespace (void);
+
+/* Opaque type for tracking FUSE mount state. */
+struct support_fuse;
+
+/* This function disables a mount point created using
+ support_fuse_mount. */
+void support_fuse_unmount (struct support_fuse *) __nonnull ((1));
+
+/* This function is called on a separate thread after calling
+ support_fuse_mount. F is the mount state, and CLOSURE the argument
+ that was passed to support_fuse_mount. The callback function is
+ expected to call support_fuse_next to read packets from the kernel
+ and handle them according to the test's need. */
+typedef void (*support_fuse_callback) (struct support_fuse *f, void *closure);
+
+/* This function creates a new mount point, implemented by CALLBACK.
+ CLOSURE is passed to CALLBACK as the second argument. */
+struct support_fuse *support_fuse_mount (support_fuse_callback callback,
+ void *closure)
+ __nonnull ((1)) __attr_dealloc (support_fuse_unmount, 1);
+
+/* This function returns the path to the mount point for F. The
+ returned string is valid until support_fuse_unmount (F) is called. */
+const char * support_fuse_mountpoint (struct support_fuse *f) __nonnull ((1));
+
+
+/* Renders the OPCODE as a string (FUSE_* constant. The caller must
+ free the returned string. */
+char * support_fuse_opcode (uint32_t opcode) __attr_dealloc_free;
+
+/* Use to provide a checked cast facility. Use the
+ support_fuse_in_cast macro below. */
+void *support_fuse_cast_internal (struct fuse_in_header *, uint32_t)
+ __nonnull ((1));
+void *support_fuse_cast_name_internal (struct fuse_in_header *, uint32_t,
+ size_t skip, char **name)
+ __nonnull ((1));
+
+/* The macro expansion support_fuse_in_cast (P, TYPE) casts the
+ pointer INH to the appropriate type corresponding to the FUSE_TYPE
+ opcode. It fails (terminates the process) if INH->opcode does not
+ match FUSE_TYPE. The type of the returned pointer matches that of
+ the FUSE_* constant.
+
+ Maintenance note: Adding support for additional struct fuse_*_in
+ types is generally easy, except when there is trailing data after
+ the struct (see below for support_fuse_cast_name, for example), and
+ the kernel has changed struct sizes over time. This has happened
+ recently with struct fuse_setxattr_in, and would require special
+ handling if implemented. */
+#define support_fuse_payload_type_INIT struct fuse_init_in
+#define support_fuse_payload_type_LOOKUP char
+#define support_fuse_payload_type_OPEN struct fuse_open_in
+#define support_fuse_payload_type_READ struct fuse_read_in
+#define support_fuse_payload_type_SETATTR struct fuse_setattr_in
+#define support_fuse_payload_type_WRITE struct fuse_write_in
+#define support_fuse_cast(typ, inh) \
+ ((support_fuse_payload_type_##typ *) \
+ support_fuse_cast_internal ((inh), FUSE_##typ))
+
+/* Same as support_fuse_cast, but also writes the passed name to *NAMEP. */
+#define support_fuse_payload_name_type_CREATE struct fuse_create_in
+#define support_fuse_payload_name_type_MKDIR struct fuse_mkdir_in
+#define support_fuse_cast_name(typ, inh, namep) \
+ ((support_fuse_payload_name_type_##typ *) \
+ support_fuse_cast_name_internal \
+ ((inh), FUSE_##typ, sizeof (support_fuse_payload_name_type_##typ), \
+ (namep)))
+
+/* This function should be called from the callback function. It
+ returns NULL if the mount point has been unmounted. The result can
+ be cast using support_fuse_in_cast. The pointer is invalidated
+ with the next call to support_fuse_next.
+
+ Typical use involves handling some basics using the
+ support_fuse_handle_* building blocks, following by a switch
+ statement on the result member of the returned struct, to implement
+ what a particular test needs. Casts to payload data should be made
+ using support_fuse_in_cast.
+
+ By default, FUSE_FORGET responses are filtered. See
+ support_fuse_filter_forget for turning that off. */
+struct fuse_in_header *support_fuse_next (struct support_fuse *f)
+ __nonnull ((1));
+
+/* This function can be called from a callback function to handle
+ basic aspects of directories (OPENDIR, GETATTR, RELEASEDIR).
+ inh->nodeid is used as the inode number for the directory. This
+ function must be called after support_fuse_next. */
+bool support_fuse_handle_directory (struct support_fuse *f) __nonnull ((1));
+
+/* This function can be called from a callback function to handle
+ access to the mount point itself, after call support_fuse_next. */
+bool support_fuse_handle_mountpoint (struct support_fuse *f) __nonnull ((1));
+
+/* If FILTER_ENABLED, future support_fuse_next calls will not return
+ FUSE_FORGET events (and simply discared them, as they require no
+ reply). If !FILTER_ENABLED, the callback needs to handle
+ FUSE_FORGET events and call support_fuse_no_reply. */
+void support_fuse_filter_forget (struct support_fuse *f, bool filter_enabled)
+ __nonnull ((1));
+
+/* This function should be called from the callback function after
+ support_fuse_next returned a non-null pointer. It sends out a
+ response packet on the FUSE device with the supplied payload data. */
+void support_fuse_reply (struct support_fuse *f,
+ const void *payload, size_t payload_size)
+ __nonnull ((1)) __attr_access ((__read_only__, 2, 3));
+
+/* This function should be called from the callback function. It
+ replies to a request with an error indicator. ERROR must be positive. */
+void support_fuse_reply_error (struct support_fuse *f, uint32_t error)
+ __nonnull ((1));
+
+/* This function should be called from the callback function. It
+ sends out an empty (but success-indicating) reply packet. */
+void support_fuse_reply_empty (struct support_fuse *f) __nonnull ((1));
+
+/* Do not send a reply. Only to be used after a support_fuse_next
+ call that returned a FUSE_FORGET event. */
+void support_fuse_no_reply (struct support_fuse *f) __nonnull ((1));
+
+/* Specific reponse preparation functions. The returned object can be
+ updated as needed. If a NODEID argument is present, it will be
+ used to set the inode and FUSE nodeid fields. Without such an
+ argument, it is initialized from the current request (if the reply
+ requires this field). This function must be called after
+ support_fuse_next. The actual response must be sent using
+ support_fuse_reply_prepared (or a support_fuse_reply_error call can
+ be used to cancel the response). */
+struct fuse_entry_out *support_fuse_prepare_entry (struct support_fuse *f,
+ uint64_t nodeid)
+ __nonnull ((1));
+struct fuse_attr_out *support_fuse_prepare_attr (struct support_fuse *f)
+ __nonnull ((1));
+
+/* Similar to the other support_fuse_prepare_* functions, but it
+ prepares for two response packets. They can be updated through the
+ pointers written to *OUT_ENTRY and *OUT_OPEN prior to calling
+ support_fuse_reply_prepared. */
+void support_fuse_prepare_create (struct support_fuse *f,
+ uint64_t nodeid,
+ struct fuse_entry_out **out_entry,
+ struct fuse_open_out **out_open)
+ __nonnull ((1, 3, 4));
+
+
+/* Prepare sending a directory stream. Must be called after
+ support_fuse_next and before support_fuse_dirstream_add. */
+struct support_fuse_dirstream;
+struct support_fuse_dirstream *support_fuse_prepare_readdir (struct
+ support_fuse *f);
+
+/* Adds directory using D_INO, D_OFF, D_TYPE, D_NAME to the directory
+ stream D. Must be called after support_fuse_prepare_readdir.
+
+ D_OFF is the offset of the next directory entry, not the current
+ one. The first entry has offset zero. The first requested offset
+ can be obtained from the READ payload (struct fuse_read_in) prior
+ to calling this function.
+
+ Returns true if the entry could be added to the buffer, or false if
+ there was insufficient room. Sending the buffer is delayed until
+ support_fuse_reply_prepared is called. */
+bool support_fuse_dirstream_add (struct support_fuse_dirstream *d,
+ uint64_t d_ino, uint64_t d_off,
+ uint32_t d_type,
+ const char *d_name);
+
+/* Send a prepared response. Must be called after one of the
+ support_fuse_prepare_* functions and before the next
+ support_fuse_next call. */
+void support_fuse_reply_prepared (struct support_fuse *f) __nonnull ((1));
+
+#endif /* SUPPORT_FUSE_H */
diff --git a/support/ignore_stderr.c b/support/ignore_stderr.c
index 5534b61..c24d804 100644
--- a/support/ignore_stderr.c
+++ b/support/ignore_stderr.c
@@ -1,5 +1,5 @@
/* Avoid all the buffer overflow messages on stderr.
- Copyright (C) 2015-2024 Free Software Foundation, Inc.
+ Copyright (C) 2015-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/links-dso-program-c.c b/support/links-dso-program-c.c
index 5fcbab2..efe65b4 100644
--- a/support/links-dso-program-c.c
+++ b/support/links-dso-program-c.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <dlfcn.h>
/* makedb needs selinux dso's. */
#ifdef HAVE_SELINUX
@@ -13,6 +14,20 @@
such dependencies.
*/
+/* Use attribute cleanup to force linking against libgcc_s. */
+static void
+cleanup_function (int *ignored)
+{
+ puts ("cleanup performed");
+}
+
+void
+invoke_callback (void (*callback) (int *))
+{
+ __attribute__ ((cleanup (cleanup_function))) int i = 0;
+ callback (&i);
+}
+
int
main (int argc, char **argv)
{
@@ -22,5 +37,10 @@ main (int argc, char **argv)
/* This exists to force libselinux.so to be required. */
printf ("selinux %d\n", is_selinux_enabled ());
#endif
+ /* Prevent invoke_callback from being optimized away. */
+ {
+ Dl_info dli;
+ dladdr (invoke_callback, &dli);
+ }
return 0;
}
diff --git a/support/namespace.h b/support/namespace.h
index 998aab9..6b9b226 100644
--- a/support/namespace.h
+++ b/support/namespace.h
@@ -1,5 +1,5 @@
/* Entering namespaces for test case isolation.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -75,6 +75,7 @@ struct support_chroot_configuration
const char *hosts; /* /etc/hosts. */
const char *host_conf; /* /etc/host.conf. */
const char *aliases; /* /etc/aliases. */
+ const char *networks; /* /etc/networks. */
};
/* The result of the creation of a chroot. */
@@ -92,6 +93,7 @@ struct support_chroot
char *path_hosts; /* /etc/hosts. */
char *path_host_conf; /* /etc/host.conf. */
char *path_aliases; /* /etc/aliases. */
+ char *path_networks; /* /etc/networks. */
};
/* Create a chroot environment. The returned data should be freed
diff --git a/support/next_to_fault.c b/support/next_to_fault.c
index 44d5477..b60d5a5 100644
--- a/support/next_to_fault.c
+++ b/support/next_to_fault.c
@@ -1,5 +1,5 @@
-/* Memory allocation next to an unmapped page.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Memory allocation either before or after an unmapped page.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,34 +16,58 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <stdbool.h>
#include <support/check.h>
#include <support/next_to_fault.h>
#include <support/xunistd.h>
#include <sys/mman.h>
#include <sys/param.h>
-struct support_next_to_fault
-support_next_to_fault_allocate (size_t size)
+static struct support_next_to_fault
+support_next_to_fault_allocate_any (size_t size, bool fault_after_alloc)
{
long page_size = sysconf (_SC_PAGE_SIZE);
+ long protect_offset = 0;
+ long buffer_offset = page_size;
+
TEST_VERIFY_EXIT (page_size > 0);
struct support_next_to_fault result;
result.region_size = roundup (size, page_size) + page_size;
if (size + page_size <= size || result.region_size <= size)
- FAIL_EXIT1 ("support_next_to_fault_allocate (%zu): overflow", size);
+ FAIL_EXIT1 ("%s (%zu): overflow", __func__, size);
result.region_start
= xmmap (NULL, result.region_size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1);
- /* Unmap the page after the allocation. */
- xmprotect (result.region_start + (result.region_size - page_size),
- page_size, PROT_NONE);
- /* Align the allocation within the region so that it ends just
- before the PROT_NONE page. */
- result.buffer = result.region_start + result.region_size - page_size - size;
+
+ if (fault_after_alloc)
+ {
+ protect_offset = result.region_size - page_size;
+ buffer_offset = protect_offset - size;
+ }
+
+ /* Unmap the page before or after the allocation. */
+ xmprotect (result.region_start + protect_offset, page_size, PROT_NONE);
+ /* Align the allocation within the region so that it starts after or ends
+ just before the PROT_NONE page. */
+ result.buffer = result.region_start + buffer_offset;
result.length = size;
return result;
}
+/* Unmapped a page after the buffer */
+struct support_next_to_fault
+support_next_to_fault_allocate (size_t size)
+{
+ return support_next_to_fault_allocate_any (size, true);
+}
+
+/* Unmapped a page before the buffer */
+struct support_next_to_fault
+support_next_to_fault_allocate_before (size_t size)
+{
+ return support_next_to_fault_allocate_any (size, false);
+}
+
void
support_next_to_fault_free (struct support_next_to_fault *ntf)
{
diff --git a/support/next_to_fault.h b/support/next_to_fault.h
index c16d3d5..cec4b97 100644
--- a/support/next_to_fault.h
+++ b/support/next_to_fault.h
@@ -1,5 +1,5 @@
/* Memory allocation next to an unmapped page.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -41,6 +41,11 @@ struct support_next_to_fault
fault). */
struct support_next_to_fault support_next_to_fault_allocate (size_t size);
+/* Allocate a buffer of SIZE bytes just *after* a page which is mapped
+ with PROT_NONE (so that under-running the buffer will cause a
+ fault). */
+struct support_next_to_fault support_next_to_fault_allocate_before (size_t size);
+
/* Deallocate the memory region allocated by
next_to_fault_allocate. */
void support_next_to_fault_free (struct support_next_to_fault *);
diff --git a/support/oom_error.c b/support/oom_error.c
index d7f9b39..8b1ea5d 100644
--- a/support/oom_error.c
+++ b/support/oom_error.c
@@ -1,5 +1,5 @@
/* Reporting out-of-memory errors.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/process_state.h b/support/process_state.h
index 1cf902e..36126c3 100644
--- a/support/process_state.h
+++ b/support/process_state.h
@@ -1,5 +1,5 @@
/* Wait for process state.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,13 +31,16 @@ enum support_process_state
support_process_state_dead = 0x20, /* X (dead). */
support_process_state_zombie = 0x40, /* Z (zombie). */
support_process_state_parked = 0x80, /* P (parked). */
+ support_process_state_invalid = 0x100 /* Invalid state. */
};
/* Wait for process PID to reach state STATE. It can be a combination of
multiple possible states ('process_state_running | process_state_sleeping')
where the function return when any of these state are observed.
For an invalid state not represented by SUPPORT_PROCESS_STATE, it fallbacks
- to a 2 second sleep. */
-void support_process_state_wait (pid_t pid, enum support_process_state state);
+ to a 2 second sleep.
+ Return the found process state. */
+enum support_process_state
+support_process_state_wait (pid_t pid, enum support_process_state state);
#endif
diff --git a/support/readdir.h b/support/readdir.h
new file mode 100644
index 0000000..32e3e4e
--- /dev/null
+++ b/support/readdir.h
@@ -0,0 +1,85 @@
+/* Type-generic wrapper for readdir functions.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef SUPPORT_READDIR_H
+#define SUPPORT_READDIR_H
+
+#include <dirent.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+/* Definition independent of _FILE_OFFSET_BITS. */
+struct support_dirent
+{
+ uint64_t d_ino;
+ uint64_t d_off; /* 0 if d_off is not supported. */
+ uint32_t d_type;
+ char *d_name;
+};
+
+/* Operation to be performed by support_readdir below. */
+enum support_readdir_op
+ {
+ SUPPORT_READDIR,
+ SUPPORT_READDIR64,
+ SUPPORT_READDIR_R,
+ SUPPORT_READDIR64_R,
+ SUPPORT_READDIR64_COMPAT,
+ SUPPORT_READDIR64_R_COMPAT,
+ };
+
+/* Returns the last supported function. May exclude
+ SUPPORT_READDIR64_R_COMPAT if not implemented. */
+enum support_readdir_op support_readdir_op_last (void);
+
+/* Returns the name of the function that corresponds to the OP constant. */
+const char *support_readdir_function (enum support_readdir_op op);
+
+/* Returns the d_ino field width for OP, in bits. */
+unsigned int support_readdir_inode_width (enum support_readdir_op op);
+
+/* Returns the d_off field width for OP, in bits. Zero if not present. */
+unsigned int support_readdir_offset_width (enum support_readdir_op op);
+
+/* Returns true if OP is an _r variant with name length restrictions. */
+bool support_readdir_r_variant (enum support_readdir_op op);
+
+/* First, free E->d_name and set the field to NULL. Then call the
+ readdir variant as specified by OP. If successfully, copy fields
+ to E, make a copy of the entry name using strdup, and write its
+ addres sto E->d_name.
+
+ Return true if an entry was read, or false if the end of the
+ directory stream was reached. Terminates the process upon error.
+ The caller is expected to free E->d_name if the function is not
+ called again for this E.
+
+ Note that this function assumes that E->d_name has been initialized
+ to NULL or has been allocated by a previous call to this function. */
+bool support_readdir (DIR *stream, enum support_readdir_op op,
+ struct support_dirent *e) __nonnull ((1, 3));
+
+/* Checks that the readdir operation OP fails with errno value EXPECTED. */
+void support_readdir_expect_error (DIR *stream, enum support_readdir_op op,
+ int expected) __nonnull ((1));
+
+__END_DECLS
+
+#endif /* SUPPORT_READDIR_H */
diff --git a/support/resolv_response_context_duplicate.c b/support/resolv_response_context_duplicate.c
index 81a4477..c69e36f 100644
--- a/support/resolv_response_context_duplicate.c
+++ b/support/resolv_response_context_duplicate.c
@@ -1,5 +1,5 @@
/* Duplicate a response context used in DNS resolver tests.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/resolv_response_context_free.c b/support/resolv_response_context_free.c
index 5baf208..35a87cf 100644
--- a/support/resolv_response_context_free.c
+++ b/support/resolv_response_context_free.c
@@ -1,5 +1,5 @@
/* Free a response context used in DNS resolver tests.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/resolv_test.c b/support/resolv_test.c
index f1613bd..ab37d3d 100644
--- a/support/resolv_test.c
+++ b/support/resolv_test.c
@@ -1,5 +1,5 @@
/* DNS test framework and libresolv redirection.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/resolv_test.h b/support/resolv_test.h
index 63ef13d..9e29e35 100644
--- a/support/resolv_test.h
+++ b/support/resolv_test.h
@@ -1,5 +1,5 @@
/* DNS test framework and libresolv redirection.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/run_diff.h b/support/run_diff.h
index 5a3400d..22a7082 100644
--- a/support/run_diff.h
+++ b/support/run_diff.h
@@ -1,5 +1,5 @@
/* Invoke the system diff tool to compare two strings.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/set_fortify_handler.c b/support/set_fortify_handler.c
index d4dace0..f2ff6b8 100644
--- a/support/set_fortify_handler.c
+++ b/support/set_fortify_handler.c
@@ -1,5 +1,5 @@
/* Set signal handler for use in fortify tests.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/shell-container.c b/support/shell-container.c
index ca83379..dcf53ad 100644
--- a/support/shell-container.c
+++ b/support/shell-container.c
@@ -1,5 +1,5 @@
/* Minimal /bin/sh for in-container use.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -119,7 +119,7 @@ copy_func (char **argv)
goto out;
}
- if (support_copy_file_range (sfd, 0, dfd, 0, st.st_size, 0) != st.st_size)
+ if (support_copy_file_range (sfd, NULL, dfd, NULL, st.st_size, 0) != st.st_size)
{
fprintf (stderr, "cp: cannot copy file %s to %s: %s\n",
sname, dname, strerror (errno));
@@ -145,7 +145,7 @@ exit_func (char **argv)
{
int exit_val = 0;
- if (argv[0] != 0)
+ if (argv[0] != NULL)
exit_val = atoi (argv[0]) & 0xff;
exit (exit_val);
return 0;
diff --git a/support/subprocess.h b/support/subprocess.h
index 8274a2b..308c803 100644
--- a/support/subprocess.h
+++ b/support/subprocess.h
@@ -1,5 +1,5 @@
/* Create a subprocess.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support-open-dev-null-range.c b/support/support-open-dev-null-range.c
index bdfd604..812d579 100644
--- a/support/support-open-dev-null-range.c
+++ b/support/support-open-dev-null-range.c
@@ -1,5 +1,5 @@
/* Return a range of open file descriptors.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support.h b/support/support.h
index ba21ec9..4998a34 100644
--- a/support/support.h
+++ b/support/support.h
@@ -1,5 +1,5 @@
/* Common extra functions.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
@@ -113,7 +113,7 @@ void *xposix_memalign (size_t alignment, size_t n)
__attribute_malloc__ __attribute_alloc_align__ ((1))
__attribute_alloc_size__ ((2)) __attr_dealloc_free __returns_nonnull;
char *xasprintf (const char *format, ...)
- __attribute__ ((format (printf, 1, 2), malloc)) __attr_dealloc_free
+ __attribute__ ((format (printf, 1, 2), __malloc__)) __attr_dealloc_free
__returns_nonnull;
char *xstrdup (const char *) __attr_dealloc_free __returns_nonnull;
char *xstrndup (const char *, size_t) __attr_dealloc_free __returns_nonnull;
diff --git a/support/support_become_root.c b/support/support_become_root.c
index 5920fc8..0f24c18 100644
--- a/support/support_become_root.c
+++ b/support/support_become_root.c
@@ -1,5 +1,5 @@
/* Acquire root privileges.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_can_chroot.c b/support/support_can_chroot.c
index b50f48f..b82e97f 100644
--- a/support/support_can_chroot.c
+++ b/support/support_can_chroot.c
@@ -1,5 +1,5 @@
/* Return true if the process can perform a chroot operation.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
index 5384719..b4e4bf9 100644
--- a/support/support_capture_subprocess.c
+++ b/support/support_capture_subprocess.c
@@ -1,5 +1,5 @@
/* Capture output from a subprocess.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -21,12 +21,17 @@
#include <errno.h>
#include <fcntl.h>
+#include <grp.h>
+#include <scratch_buffer.h>
+#include <stdio_ext.h>
#include <stdlib.h>
+#include <string.h>
#include <support/check.h>
#include <support/xunistd.h>
#include <support/xsocket.h>
#include <support/xspawn.h>
#include <support/support.h>
+#include <support/temp_file.h>
#include <support/test-driver.h>
static void
@@ -109,111 +114,88 @@ support_capture_subprogram (const char *file, char *const argv[],
/* Copies the executable into a restricted directory, so that we can
safely make it SGID with the TARGET group ID. Then runs the
executable. */
-static int
-copy_and_spawn_sgid (char *child_id, gid_t gid)
+static void
+copy_and_spawn_sgid (const char *child_id, gid_t gid)
{
- char *dirname = xasprintf ("%s/tst-tunables-setuid.%jd",
- test_dir, (intmax_t) getpid ());
+ char *dirname = support_create_temp_directory ("tst-glibc-sgid-");
char *execname = xasprintf ("%s/bin", dirname);
- int infd = -1;
- int outfd = -1;
- int ret = 1, status = 1;
-
- TEST_VERIFY (mkdir (dirname, 0700) == 0);
- if (support_record_failure_is_failed ())
- goto err;
+ add_temp_file (execname);
- infd = open ("/proc/self/exe", O_RDONLY);
- if (infd < 0)
+ if (access ("/proc/self/exe", R_OK) != 0)
FAIL_UNSUPPORTED ("unsupported: Cannot read binary from procfs\n");
- outfd = open (execname, O_WRONLY | O_CREAT | O_EXCL, 0700);
- TEST_VERIFY (outfd >= 0);
- if (support_record_failure_is_failed ())
- goto err;
-
- char buf[4096];
- for (;;)
- {
- ssize_t rdcount = read (infd, buf, sizeof (buf));
- TEST_VERIFY (rdcount >= 0);
- if (support_record_failure_is_failed ())
- goto err;
- if (rdcount == 0)
- break;
- char *p = buf;
- char *end = buf + rdcount;
- while (p != end)
- {
- ssize_t wrcount = write (outfd, buf, end - p);
- if (wrcount == 0)
- errno = ENOSPC;
- TEST_VERIFY (wrcount > 0);
- if (support_record_failure_is_failed ())
- goto err;
- p += wrcount;
- }
- }
+ support_copy_file ("/proc/self/exe", execname);
- bool chowned = false;
- TEST_VERIFY ((chowned = fchown (outfd, getuid (), gid) == 0)
- || errno == EPERM);
- if (support_record_failure_is_failed ())
- goto err;
- else if (!chowned)
- {
- ret = 77;
- goto err;
- }
+ if (chown (execname, getuid (), gid) != 0)
+ FAIL_UNSUPPORTED ("cannot change group of \"%s\" to %jd: %m",
+ execname, (intmax_t) gid);
- TEST_VERIFY (fchmod (outfd, 02750) == 0);
- if (support_record_failure_is_failed ())
- goto err;
- TEST_VERIFY (close (outfd) == 0);
- if (support_record_failure_is_failed ())
- goto err;
- TEST_VERIFY (close (infd) == 0);
- if (support_record_failure_is_failed ())
- goto err;
+ if (chmod (execname, 02750) != 0)
+ FAIL_UNSUPPORTED ("cannot make \"%s\" SGID: %m ", execname);
/* We have the binary, now spawn the subprocess. Avoid using
support_subprogram because we only want the program exit status, not the
contents. */
- ret = 0;
- infd = outfd = -1;
- char * const args[] = {execname, child_id, NULL};
+ char * const args[] = {execname, (char *) child_id, NULL};
+ int status = support_subprogram_wait (args[0], args);
- status = support_subprogram_wait (args[0], args);
+ free (execname);
+ free (dirname);
-err:
- if (outfd >= 0)
- close (outfd);
- if (infd >= 0)
- close (infd);
- if (execname != NULL)
+ if (WIFEXITED (status))
{
- unlink (execname);
- free (execname);
+ if (WEXITSTATUS (status) == 0)
+ return;
+ else
+ exit (WEXITSTATUS (status));
}
- if (dirname != NULL)
+ else
+ FAIL_EXIT1 ("subprogram failed with status %d", status);
+}
+
+/* Returns true if a group with NAME has been found, and writes its
+ GID to *TARGET. */
+static bool
+find_sgid_group (gid_t *target, const char *name)
+{
+ /* Do not use getgrname_r because it does not work in statically
+ linked binaries if the system libc is different. */
+ FILE *fp = fopen ("/etc/group", "rce");
+ if (fp == NULL)
+ return false;
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+ bool ok = false;
+ struct scratch_buffer buf;
+ scratch_buffer_init (&buf);
+ while (true)
{
- rmdir (dirname);
- free (dirname);
+ struct group grp;
+ struct group *result = NULL;
+ int status = fgetgrent_r (fp, &grp, buf.data, buf.length, &result);
+ if (status == 0 && result != NULL)
+ {
+ if (strcmp (result->gr_name, name) == 0)
+ {
+ *target = result->gr_gid;
+ ok = true;
+ break;
+ }
+ }
+ else if (errno != ERANGE)
+ break;
+ else if (!scratch_buffer_grow (&buf))
+ break;
}
-
- if (ret == 77)
- FAIL_UNSUPPORTED ("Failed to make sgid executable for test\n");
- if (ret != 0)
- FAIL_EXIT1 ("Failed to make sgid executable for test\n");
-
- return status;
+ scratch_buffer_free (&buf);
+ fclose (fp);
+ return ok;
}
-int
-support_capture_subprogram_self_sgid (char *child_id)
+void
+support_capture_subprogram_self_sgid (const char *child_id)
{
- gid_t target = 0;
const int count = 64;
gid_t groups[count];
@@ -225,6 +207,7 @@ support_capture_subprogram_self_sgid (char *child_id)
(intmax_t) getuid ());
gid_t current = getgid ();
+ gid_t target = current;
for (int i = 0; i < ret; ++i)
{
if (groups[i] != current)
@@ -234,11 +217,18 @@ support_capture_subprogram_self_sgid (char *child_id)
}
}
- if (target == 0)
- FAIL_UNSUPPORTED("Could not find a suitable GID for user %jd\n",
- (intmax_t) getuid ());
+ if (target == current)
+ {
+ /* If running as root, try to find a harmless group for SGID. */
+ if (getuid () != 0
+ || (!find_sgid_group (&target, "nogroup")
+ && !find_sgid_group (&target, "bin")
+ && !find_sgid_group (&target, "daemon")))
+ FAIL_UNSUPPORTED("Could not find a suitable GID for user %jd\n",
+ (intmax_t) getuid ());
+ }
- return copy_and_spawn_sgid (child_id, target);
+ copy_and_spawn_sgid (child_id, target);
}
void
diff --git a/support/support_capture_subprocess_check.c b/support/support_capture_subprocess_check.c
index 7d045ac..f92e90f 100644
--- a/support/support_capture_subprocess_check.c
+++ b/support/support_capture_subprocess_check.c
@@ -1,5 +1,5 @@
/* Verify capture output from a subprocess.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xlstat.c b/support/support_check_stat_fd.c
index 87df988..7fe530a 100644
--- a/support/xlstat.c
+++ b/support/support_check_stat_fd.c
@@ -1,5 +1,5 @@
-/* lstat64 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Error checking for descriptor-based stat functions.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -18,11 +18,10 @@
#include <support/check.h>
#include <support/xunistd.h>
-#include <sys/stat.h>
void
-xlstat (const char *path, struct stat64 *result)
+support_check_stat_fd (const char *name, int fd, int result)
{
- if (lstat64 (path, result) != 0)
- FAIL_EXIT1 ("lstat64 (\"%s\"): %m", path);
+ if (result != 0)
+ FAIL_EXIT1 ("%s (%d): %m", name, fd);
}
diff --git a/support/support-xstat.c b/support/support_check_stat_path.c
index ce866f7..6e2ac57 100644
--- a/support/support-xstat.c
+++ b/support/support_check_stat_path.c
@@ -1,5 +1,5 @@
-/* stat64 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* Error checking for path-based stat functions.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,15 +16,12 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
-
#include <support/check.h>
#include <support/xunistd.h>
-#include <sys/stat.h>
void
-xstat (const char *path, struct stat64 *result)
+support_check_stat_path (const char *name, const char *path, int result)
{
- if (stat64 (path, result) != 0)
- FAIL_EXIT1 ("stat64 (\"%s\"): %m", path);
+ if (result != 0)
+ FAIL_EXIT1 ("%s (\"%s\"): %m", name, path);
}
diff --git a/support/support_chroot.c b/support/support_chroot.c
index 809342c..92c2a45 100644
--- a/support/support_chroot.c
+++ b/support/support_chroot.c
@@ -1,5 +1,5 @@
/* Setup a chroot environment for use within tests.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -57,6 +57,7 @@ support_chroot_create (struct support_chroot_configuration conf)
write_file (path_etc, "hosts", conf.hosts, &chroot->path_hosts);
write_file (path_etc, "host.conf", conf.host_conf, &chroot->path_host_conf);
write_file (path_etc, "aliases", conf.aliases, &chroot->path_aliases);
+ write_file (path_etc, "networks", conf.networks, &chroot->path_networks);
free (path_etc);
@@ -79,5 +80,6 @@ support_chroot_free (struct support_chroot *chroot)
free (chroot->path_hosts);
free (chroot->path_host_conf);
free (chroot->path_aliases);
+ free (chroot->path_networks);
free (chroot);
}
diff --git a/support/support_compare_file_bytes.c b/support/support_compare_file_bytes.c
new file mode 100644
index 0000000..b0417e2
--- /dev/null
+++ b/support/support_compare_file_bytes.c
@@ -0,0 +1,42 @@
+/* Compare bytes from an open file.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+#include <support/file_contents.h>
+
+/* Check that an already-open file has exactly the given bytes,
+ starting at the current offset. */
+
+int
+support_compare_file_bytes (FILE *fp, const char *contents, size_t length)
+{
+ int c;
+ while (length > 0)
+ {
+ c = getc (fp);
+ if (c == EOF || (unsigned char) c != (unsigned char) contents[0])
+ return 1;
+ contents++;
+ length--;
+ }
+ c = getc (fp);
+ if (c != EOF || ferror (fp))
+ return 1;
+ return 0;
+}
diff --git a/support/support_compare_file_string.c b/support/support_compare_file_string.c
new file mode 100644
index 0000000..5495fa0
--- /dev/null
+++ b/support/support_compare_file_string.c
@@ -0,0 +1,28 @@
+/* Compare string from an open file.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <support/file_contents.h>
+
+int
+support_compare_file_string (FILE *fp, const char *contents)
+{
+ return support_compare_file_bytes (fp, contents, strlen (contents));
+}
diff --git a/support/support_copy_file.c b/support/support_copy_file.c
index e07b4e9..1addfc0 100644
--- a/support/support_copy_file.c
+++ b/support/support_copy_file.c
@@ -1,5 +1,5 @@
/* Copy a file from one path to another.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_copy_file_range.c b/support/support_copy_file_range.c
index bc93a61..d07dba1 100644
--- a/support/support_copy_file_range.c
+++ b/support/support_copy_file_range.c
@@ -1,5 +1,5 @@
/* Simplified copy_file_range with cross-device copy.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_create_timer.c b/support/support_create_timer.c
index 6f67760..e823195 100644
--- a/support/support_create_timer.c
+++ b/support/support_create_timer.c
@@ -1,5 +1,5 @@
/* Create a periodic timer.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_descriptor_supports_holes.c b/support/support_descriptor_supports_holes.c
index 9cf397b..dff7224 100644
--- a/support/support_descriptor_supports_holes.c
+++ b/support/support_descriptor_supports_holes.c
@@ -1,5 +1,5 @@
/* Test for file system hole support.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_descriptors.c b/support/support_descriptors.c
index c10a1a8..f7c99e1 100644
--- a/support/support_descriptors.c
+++ b/support/support_descriptors.c
@@ -1,5 +1,5 @@
/* Monitoring file descriptor usage.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_enter_mount_namespace.c b/support/support_enter_mount_namespace.c
index e138356..537bd23 100644
--- a/support/support_enter_mount_namespace.c
+++ b/support/support_enter_mount_namespace.c
@@ -1,5 +1,5 @@
/* Enter a mount namespace.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_enter_network_namespace.c b/support/support_enter_network_namespace.c
index 1ee5b17..fb17c85 100644
--- a/support/support_enter_network_namespace.c
+++ b/support/support_enter_network_namespace.c
@@ -1,5 +1,5 @@
/* Enter a network namespace.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_format_address_family.c b/support/support_format_address_family.c
index 89b198e..b800653 100644
--- a/support/support_format_address_family.c
+++ b/support/support_format_address_family.c
@@ -1,5 +1,5 @@
/* Convert an address family to a string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_format_addrinfo.c b/support/support_format_addrinfo.c
index cbc7291..57b7612 100644
--- a/support/support_format_addrinfo.c
+++ b/support/support_format_addrinfo.c
@@ -1,5 +1,5 @@
/* Convert struct addrinfo values to a string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +22,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <support/support.h>
#include <support/xmemstream.h>
diff --git a/support/support_format_dns_packet.c b/support/support_format_dns_packet.c
index f518f37..f1dffca 100644
--- a/support/support_format_dns_packet.c
+++ b/support/support_format_dns_packet.c
@@ -1,5 +1,5 @@
/* Convert a DNS packet to a human-readable representation.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_format_herrno.c b/support/support_format_herrno.c
index d2c202a..24a3fb3 100644
--- a/support/support_format_herrno.c
+++ b/support/support_format_herrno.c
@@ -1,5 +1,5 @@
/* Convert a h_errno error code to a string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_format_hostent.c b/support/support_format_hostent.c
index a19d27f..b37082f 100644
--- a/support/support_format_hostent.c
+++ b/support/support_format_hostent.c
@@ -1,5 +1,5 @@
/* Convert a struct hostent object to a string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_format_netent.c b/support/support_format_netent.c
index 4b00106..5cd3e6b 100644
--- a/support/support_format_netent.c
+++ b/support/support_format_netent.c
@@ -1,5 +1,5 @@
/* Convert a struct netent object to a string.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_fuse.c b/support/support_fuse.c
new file mode 100644
index 0000000..a70a74c
--- /dev/null
+++ b/support/support_fuse.c
@@ -0,0 +1,706 @@
+/* Facilities for FUSE-backed file system tests.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/fuse.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/sysmacros.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include <array_length.h>
+#include <support/check.h>
+#include <support/namespace.h>
+#include <support/support.h>
+#include <support/test-driver.h>
+#include <support/xdirent.h>
+#include <support/xthread.h>
+#include <support/xunistd.h>
+
+#ifdef __linux__
+# include <sys/mount.h>
+#else
+/* Fallback definitions that mark the test as unsupported. */
+# define mount(...) ({ FAIL_UNSUPPORTED ("mount"); -1; })
+# define umount(...) ({ FAIL_UNSUPPORTED ("mount"); -1; })
+#endif
+
+struct support_fuse
+{
+ char *mountpoint;
+ void *buffer_start; /* Begin of allocation. */
+ void *buffer_next; /* Next read position. */
+ void *buffer_limit; /* End of buffered data. */
+ void *buffer_end; /* End of allocation. */
+ struct fuse_in_header *inh; /* Most recent request (support_fuse_next). */
+ union /* Space for prepared responses. */
+ {
+ struct fuse_attr_out attr;
+ struct fuse_entry_out entry;
+ struct
+ {
+ struct fuse_entry_out entry;
+ struct fuse_open_out open;
+ } create;
+ } prepared;
+ void *prepared_pointer; /* NULL if inactive. */
+ size_t prepared_size; /* 0 if inactive. */
+
+ /* Used for preparing readdir responses. Already used-up area for
+ the current request is counted by prepared_size. */
+ void *readdir_buffer;
+ size_t readdir_buffer_size;
+
+ pthread_t handler; /* Thread handling requests. */
+ uid_t uid; /* Cached value for the current process. */
+ uid_t gid; /* Cached value for the current process. */
+ int fd; /* FUSE file descriptor. */
+ int connection; /* Entry under /sys/fs/fuse/connections. */
+ bool filter_forget; /* Controls FUSE_FORGET event dropping. */
+ _Atomic bool disconnected;
+};
+
+struct fuse_thread_wrapper_args
+{
+ struct support_fuse *f;
+ support_fuse_callback callback;
+ void *closure;
+};
+
+/* Set by support_fuse_init to indicate that support_fuse_mount may be
+ called. */
+static bool support_fuse_init_called;
+
+/* Allocate the read buffer in F with SIZE bytes capacity. Does not
+ free the previously allocated buffer. */
+static void support_fuse_allocate (struct support_fuse *f, size_t size)
+ __nonnull ((1));
+
+/* Internal mkdtemp replacement */
+static char * support_fuse_mkdir (const char *prefix) __nonnull ((1));
+
+/* Low-level allocation function for support_fuse_mount. Does not
+ perform the mount. */
+static struct support_fuse *support_fuse_open (void);
+
+/* Thread wrapper function for use with pthread_create. Uses struct
+ fuse_thread_wrapper_args. */
+static void *support_fuse_thread_wrapper (void *closure) __nonnull ((1));
+
+/* Initial step before preparing a reply. SIZE must be the size of
+ the F->prepared member that is going to be used. */
+static void support_fuse_prepare_1 (struct support_fuse *f, size_t size);
+
+/* Similar to support_fuse_reply_error, but not check that ERROR is
+ not zero. */
+static void support_fuse_reply_error_1 (struct support_fuse *f,
+ uint32_t error) __nonnull ((1));
+
+/* Path to the directory containing mount points. Initialized by an
+ ELF constructor. All mountpoints are collected there so that the
+ test wrapper can clean them up without keeping track of them
+ individually. */
+static char *support_fuse_mountpoints;
+
+/* PID of the process that should clean up the mount points in the ELF
+ destructor. */
+static pid_t support_fuse_cleanup_pid;
+
+static void
+support_fuse_allocate (struct support_fuse *f, size_t size)
+{
+ f->buffer_start = xmalloc (size);
+ f->buffer_end = f->buffer_start + size;
+ f->buffer_limit = f->buffer_start;
+ f->buffer_next = f->buffer_limit;
+}
+
+void
+support_fuse_filter_forget (struct support_fuse *f, bool filter)
+{
+ f->filter_forget = filter;
+}
+
+void *
+support_fuse_cast_internal (struct fuse_in_header *p, uint32_t expected)
+{
+ if (expected != p->opcode
+ && !(expected == FUSE_READ && p->opcode == FUSE_READDIR))
+ {
+ char *expected1 = support_fuse_opcode (expected);
+ char *actual = support_fuse_opcode (p->opcode);
+ FAIL_EXIT1 ("attempt to cast %s to %s", actual, expected1);
+ }
+ return p + 1;
+}
+
+void *
+support_fuse_cast_name_internal (struct fuse_in_header *p, uint32_t expected,
+ size_t skip, char **name)
+{
+ char *result = support_fuse_cast_internal (p, expected);
+ *name = result + skip;
+ return result;
+}
+
+bool
+support_fuse_dirstream_add (struct support_fuse_dirstream *d,
+ uint64_t d_ino, uint64_t d_off,
+ uint32_t d_type, const char *d_name)
+{
+ struct support_fuse *f = (struct support_fuse *) d;
+ size_t structlen = offsetof (struct fuse_dirent, name);
+ size_t namelen = strlen (d_name); /* No null termination. */
+ size_t required_size = FUSE_DIRENT_ALIGN (structlen + namelen);
+ if (f->readdir_buffer_size - f->prepared_size < required_size)
+ return false;
+ struct fuse_dirent entry =
+ {
+ .ino = d_ino,
+ .off = d_off,
+ .type = d_type,
+ .namelen = namelen,
+ };
+ memcpy (f->readdir_buffer + f->prepared_size, &entry, structlen);
+ /* Use strncpy to write padding and avoid passing uninitialized
+ bytes to the read system call. */
+ strncpy (f->readdir_buffer + f->prepared_size + structlen, d_name,
+ required_size - structlen);
+ f->prepared_size += required_size;
+ return true;
+}
+
+bool
+support_fuse_handle_directory (struct support_fuse *f)
+{
+ TEST_VERIFY (f->inh != NULL);
+ switch (f->inh->opcode)
+ {
+ case FUSE_OPENDIR:
+ {
+ struct fuse_open_out out =
+ {
+ };
+ support_fuse_reply (f, &out, sizeof (out));
+ }
+ return true;
+ case FUSE_RELEASEDIR:
+ support_fuse_reply_empty (f);
+ return true;
+ case FUSE_GETATTR:
+ {
+ struct fuse_attr_out *out = support_fuse_prepare_attr (f);
+ out->attr.mode = S_IFDIR | 0700;
+ support_fuse_reply_prepared (f);
+ }
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool
+support_fuse_handle_mountpoint (struct support_fuse *f)
+{
+ TEST_VERIFY (f->inh != NULL);
+ /* 1 is the root node. */
+ if (f->inh->opcode == FUSE_GETATTR && f->inh->nodeid == 1)
+ return support_fuse_handle_directory (f);
+ return false;
+}
+
+void
+support_fuse_init (void)
+{
+ support_fuse_init_called = true;
+
+ support_become_root ();
+ if (!support_enter_mount_namespace ())
+ FAIL_UNSUPPORTED ("mount namespaces not supported");
+}
+
+void
+support_fuse_init_no_namespace (void)
+{
+ support_fuse_init_called = true;
+}
+
+static char *
+support_fuse_mkdir (const char *prefix)
+{
+ /* Do not use mkdtemp to avoid interfering with its tests. */
+ unsigned int counter = 1;
+ unsigned int pid = getpid ();
+ while (true)
+ {
+ char *path = xasprintf ("%s%u.%u/", prefix, pid, counter);
+ if (mkdir (path, 0700) == 0)
+ return path;
+ if (errno != EEXIST)
+ FAIL_EXIT1 ("mkdir (\"%s\"): %m", path);
+ free (path);
+ ++counter;
+ }
+}
+
+struct support_fuse *
+support_fuse_mount (support_fuse_callback callback, void *closure)
+{
+ TEST_VERIFY_EXIT (support_fuse_init_called);
+
+ /* Request at least minor version 12 because it changed struct sizes. */
+ enum { min_version = 12 };
+
+ struct support_fuse *f = support_fuse_open ();
+ char *mount_options
+ = xasprintf ("fd=%d,rootmode=040700,user_id=%u,group_id=%u",
+ f->fd, f->uid, f->gid);
+ if (mount ("fuse", f->mountpoint, "fuse.glibc",
+ MS_NOSUID|MS_NODEV, mount_options)
+ != 0)
+ FAIL_EXIT1 ("FUSE mount on %s: %m", f->mountpoint);
+ free (mount_options);
+
+ /* Retry with an older FUSE version. */
+ while (true)
+ {
+ struct fuse_in_header *inh = support_fuse_next (f);
+ struct fuse_init_in *init_in = support_fuse_cast (INIT, inh);
+ if (init_in->major < 7
+ || (init_in->major == 7 && init_in->minor < min_version))
+ FAIL_UNSUPPORTED ("kernel FUSE version is %u.%u, too old",
+ init_in->major, init_in->minor);
+ if (init_in->major > 7)
+ {
+ uint32_t major = 7;
+ support_fuse_reply (f, &major, sizeof (major));
+ continue;
+ }
+ TEST_VERIFY (init_in->flags & FUSE_DONT_MASK);
+ struct fuse_init_out out =
+ {
+ .major = 7,
+ .minor = min_version,
+ /* Request that the kernel does not apply umask. */
+ .flags = FUSE_DONT_MASK,
+ };
+ support_fuse_reply (f, &out, sizeof (out));
+
+ {
+ struct fuse_thread_wrapper_args args =
+ {
+ .f = f,
+ .callback = callback,
+ .closure = closure,
+ };
+ f->handler = xpthread_create (NULL,
+ support_fuse_thread_wrapper, &args);
+ struct stat64 st;
+ xstat64 (f->mountpoint, &st);
+ f->connection = minor (st.st_dev);
+ /* Got a reply from the thread, safe to deallocate args. */
+ }
+
+ return f;
+ }
+}
+
+const char *
+support_fuse_mountpoint (struct support_fuse *f)
+{
+ return f->mountpoint;
+}
+
+void
+support_fuse_no_reply (struct support_fuse *f)
+{
+ TEST_VERIFY (f->inh != NULL);
+ TEST_COMPARE (f->inh->opcode, FUSE_FORGET);
+ f->inh = NULL;
+}
+
+char *
+support_fuse_opcode (uint32_t op)
+{
+ const char *result;
+ switch (op)
+ {
+#define X(n) case n: result = #n; break
+ X(FUSE_LOOKUP);
+ X(FUSE_FORGET);
+ X(FUSE_GETATTR);
+ X(FUSE_SETATTR);
+ X(FUSE_READLINK);
+ X(FUSE_SYMLINK);
+ X(FUSE_MKNOD);
+ X(FUSE_MKDIR);
+ X(FUSE_UNLINK);
+ X(FUSE_RMDIR);
+ X(FUSE_RENAME);
+ X(FUSE_LINK);
+ X(FUSE_OPEN);
+ X(FUSE_READ);
+ X(FUSE_WRITE);
+ X(FUSE_STATFS);
+ X(FUSE_RELEASE);
+ X(FUSE_FSYNC);
+ X(FUSE_SETXATTR);
+ X(FUSE_GETXATTR);
+ X(FUSE_LISTXATTR);
+ X(FUSE_REMOVEXATTR);
+ X(FUSE_FLUSH);
+ X(FUSE_INIT);
+ X(FUSE_OPENDIR);
+ X(FUSE_READDIR);
+ X(FUSE_RELEASEDIR);
+ X(FUSE_FSYNCDIR);
+ X(FUSE_GETLK);
+ X(FUSE_SETLK);
+ X(FUSE_SETLKW);
+ X(FUSE_ACCESS);
+ X(FUSE_CREATE);
+ X(FUSE_INTERRUPT);
+ X(FUSE_BMAP);
+ X(FUSE_DESTROY);
+ X(FUSE_IOCTL);
+ X(FUSE_POLL);
+ X(FUSE_NOTIFY_REPLY);
+ X(FUSE_BATCH_FORGET);
+ X(FUSE_FALLOCATE);
+ X(FUSE_READDIRPLUS);
+ X(FUSE_RENAME2);
+ X(FUSE_LSEEK);
+ X(FUSE_COPY_FILE_RANGE);
+ X(FUSE_SETUPMAPPING);
+ X(FUSE_REMOVEMAPPING);
+ X(FUSE_SYNCFS);
+ X(FUSE_TMPFILE);
+ X(FUSE_STATX);
+#undef X
+ default:
+ return xasprintf ("FUSE_unknown_%u", op);
+ }
+ return xstrdup (result);
+}
+
+static struct support_fuse *
+support_fuse_open (void)
+{
+ struct support_fuse *result = xmalloc (sizeof (*result));
+ result->mountpoint = support_fuse_mkdir (support_fuse_mountpoints);
+ result->inh = NULL;
+ result->prepared_pointer = NULL;
+ result->prepared_size = 0;
+ result->readdir_buffer = NULL;
+ result->readdir_buffer_size = 0;
+ result->uid = getuid ();
+ result->gid = getgid ();
+ result->fd = open ("/dev/fuse", O_RDWR, 0);
+ if (result->fd < 0)
+ {
+ if (errno == ENOENT || errno == ENODEV || errno == EPERM
+ || errno == EACCES)
+ FAIL_UNSUPPORTED ("cannot open /dev/fuse: %m");
+ else
+ FAIL_EXIT1 ("cannot open /dev/fuse: %m");
+ }
+ result->connection = -1;
+ result->filter_forget = true;
+ result->disconnected = false;
+ support_fuse_allocate (result, FUSE_MIN_READ_BUFFER);
+ return result;
+}
+
+static void
+support_fuse_prepare_1 (struct support_fuse *f, size_t size)
+{
+ TEST_VERIFY (f->prepared_pointer == NULL);
+ f->prepared_size = size;
+ memset (&f->prepared, 0, size);
+ f->prepared_pointer = &f->prepared;
+}
+
+struct fuse_attr_out *
+support_fuse_prepare_attr (struct support_fuse *f)
+{
+ support_fuse_prepare_1 (f, sizeof (f->prepared.attr));
+ f->prepared.attr.attr.uid = f->uid;
+ f->prepared.attr.attr.gid = f->gid;
+ f->prepared.attr.attr.ino = f->inh->nodeid;
+ return &f->prepared.attr;
+}
+
+void
+support_fuse_prepare_create (struct support_fuse *f,
+ uint64_t nodeid,
+ struct fuse_entry_out **out_entry,
+ struct fuse_open_out **out_open)
+{
+ support_fuse_prepare_1 (f, sizeof (f->prepared.create));
+ f->prepared.create.entry.nodeid = nodeid;
+ f->prepared.create.entry.attr.uid = f->uid;
+ f->prepared.create.entry.attr.gid = f->gid;
+ f->prepared.create.entry.attr.ino = nodeid;
+ *out_entry = &f->prepared.create.entry;
+ *out_open = &f->prepared.create.open;
+}
+
+struct fuse_entry_out *
+support_fuse_prepare_entry (struct support_fuse *f, uint64_t nodeid)
+{
+ support_fuse_prepare_1 (f, sizeof (f->prepared.entry));
+ f->prepared.entry.nodeid = nodeid;
+ f->prepared.entry.attr.uid = f->uid;
+ f->prepared.entry.attr.gid = f->gid;
+ f->prepared.entry.attr.ino = nodeid;
+ return &f->prepared.entry;
+}
+
+struct support_fuse_dirstream *
+support_fuse_prepare_readdir (struct support_fuse *f)
+{
+ support_fuse_prepare_1 (f, 0);
+ struct fuse_read_in *p = support_fuse_cast (READ, f->inh);
+ if (p->size > f->readdir_buffer_size)
+ {
+ free (f->readdir_buffer);
+ f->readdir_buffer = xmalloc (p->size);
+ f->readdir_buffer_size = p->size;
+ }
+ f->prepared_pointer = f->readdir_buffer;
+ return (struct support_fuse_dirstream *) f;
+}
+
+struct fuse_in_header *
+support_fuse_next (struct support_fuse *f)
+{
+ TEST_VERIFY (f->inh == NULL);
+ while (true)
+ {
+ if (f->buffer_next < f->buffer_limit)
+ {
+ f->inh = f->buffer_next;
+ f->buffer_next = (void *) f->buffer_next + f->inh->len;
+ /* Suppress FUSE_FORGET responses if requested. */
+ if (f->filter_forget && f->inh->opcode == FUSE_FORGET)
+ {
+ f->inh = NULL;
+ continue;
+ }
+ return f->inh;
+ }
+ ssize_t ret = read (f->fd, f->buffer_start,
+ f->buffer_end - f->buffer_start);
+ if (ret == 0)
+ FAIL_EXIT (1, "unexpected EOF on FUSE device");
+ if (ret < 0 && errno == EINVAL)
+ {
+ /* Increase buffer size. */
+ size_t new_size = 2 * (size_t) (f->buffer_end - f->buffer_start);
+ free (f->buffer_start);
+ support_fuse_allocate (f, new_size);
+ continue;
+ }
+ if (ret < 0)
+ {
+ if (f->disconnected)
+ /* Unmount detected. */
+ return NULL;
+ FAIL_EXIT1 ("read error on FUSE device: %m");
+ }
+ /* Read was successful, make [next, limit) the active buffer area. */
+ f->buffer_next = f->buffer_start;
+ f->buffer_limit = (void *) f->buffer_start + ret;
+ }
+}
+
+void
+support_fuse_reply (struct support_fuse *f,
+ const void *payload, size_t payload_size)
+{
+ TEST_VERIFY_EXIT (f->inh != NULL);
+ TEST_VERIFY (f->prepared_pointer == NULL);
+ struct fuse_out_header outh =
+ {
+ .len = sizeof (outh) + payload_size,
+ .unique = f->inh->unique,
+ };
+ struct iovec iov[] =
+ {
+ { &outh, sizeof (outh) },
+ { (void *) payload, payload_size },
+ };
+ ssize_t ret = writev (f->fd, iov, array_length (iov));
+ if (ret < 0)
+ {
+ if (!f->disconnected)
+ /* Some kernels produce write errors upon disconnect. */
+ FAIL_EXIT1 ("FUSE write failed for %s response"
+ " (%zu bytes payload): %m",
+ support_fuse_opcode (f->inh->opcode), payload_size);
+ }
+ else if (ret != sizeof (outh) + payload_size)
+ FAIL_EXIT1 ("FUSE write short for %s response (%zu bytes payload):"
+ " %zd bytes",
+ support_fuse_opcode (f->inh->opcode), payload_size, ret);
+ f->inh = NULL;
+}
+
+void
+support_fuse_reply_empty (struct support_fuse *f)
+{
+ support_fuse_reply_error_1 (f, 0);
+}
+
+static void
+support_fuse_reply_error_1 (struct support_fuse *f, uint32_t error)
+{
+ TEST_VERIFY_EXIT (f->inh != NULL);
+ struct fuse_out_header outh =
+ {
+ .len = sizeof (outh),
+ .error = -error,
+ .unique = f->inh->unique,
+ };
+ ssize_t ret = write (f->fd, &outh, sizeof (outh));
+ if (ret < 0)
+ {
+ /* Some kernels produce write errors upon disconnect. */
+ if (!f->disconnected)
+ FAIL_EXIT1 ("FUSE write failed for %s error response: %m",
+ support_fuse_opcode (f->inh->opcode));
+ }
+ else if (ret != sizeof (outh))
+ FAIL_EXIT1 ("FUSE write short for %s error response: %zd bytes",
+ support_fuse_opcode (f->inh->opcode), ret);
+ f->inh = NULL;
+ f->prepared_pointer = NULL;
+ f->prepared_size = 0;
+}
+
+void
+support_fuse_reply_error (struct support_fuse *f, uint32_t error)
+{
+ TEST_VERIFY (error > 0);
+ support_fuse_reply_error_1 (f, error);
+}
+
+void
+support_fuse_reply_prepared (struct support_fuse *f)
+{
+ TEST_VERIFY_EXIT (f->prepared_pointer != NULL);
+ /* Re-use the non-prepared reply function. It requires
+ f->prepared_* to be non-null, so reset the fields before the call. */
+ void *prepared_pointer = f->prepared_pointer;
+ size_t prepared_size = f->prepared_size;
+ f->prepared_pointer = NULL;
+ f->prepared_size = 0;
+ support_fuse_reply (f, prepared_pointer, prepared_size);
+}
+
+static void *
+support_fuse_thread_wrapper (void *closure)
+{
+ struct fuse_thread_wrapper_args args
+ = *(struct fuse_thread_wrapper_args *) closure;
+
+ /* Handle the initial stat call. */
+ struct fuse_in_header *inh = support_fuse_next (args.f);
+ if (inh == NULL || !support_fuse_handle_mountpoint (args.f))
+ {
+ support_fuse_reply_error (args.f, EIO);
+ return NULL;
+ }
+
+ args.callback (args.f, args.closure);
+ return NULL;
+}
+
+void
+support_fuse_unmount (struct support_fuse *f)
+{
+ /* Signal the unmount to the handler thread. Some kernels report
+ not just ENODEV errors on read. */
+ f->disconnected = true;
+
+ {
+ char *path = xasprintf ("/sys/fs/fuse/connections/%d/abort",
+ f->connection);
+ /* Some kernels do not support these files under /sys. */
+ int fd = open (path, O_RDWR | O_TRUNC);
+ if (fd >= 0)
+ {
+ TEST_COMPARE (write (fd, "1", 1), 1);
+ xclose (fd);
+ }
+ free (path);
+ }
+ if (umount (f->mountpoint) != 0)
+ FAIL ("FUSE: umount (\"%s\"): %m", f->mountpoint);
+ xpthread_join (f->handler);
+ if (rmdir (f->mountpoint) != 0)
+ FAIL ("FUSE: rmdir (\"%s\"): %m", f->mountpoint);
+ xclose (f->fd);
+ free (f->buffer_start);
+ free (f->mountpoint);
+ free (f->readdir_buffer);
+ free (f);
+}
+
+static void __attribute__ ((constructor))
+init (void)
+{
+ /* The test_dir test driver variable is not yet set at this point. */
+ const char *tmpdir = getenv ("TMPDIR");
+ if (tmpdir == NULL || tmpdir[0] == '\0')
+ tmpdir = "/tmp";
+
+ char *prefix = xasprintf ("%s/glibc-tst-fuse.", tmpdir);
+ support_fuse_mountpoints = support_fuse_mkdir (prefix);
+ free (prefix);
+ support_fuse_cleanup_pid = getpid ();
+}
+
+static void __attribute__ ((destructor))
+fini (void)
+{
+ if (support_fuse_cleanup_pid != getpid ()
+ || support_fuse_mountpoints == NULL)
+ return;
+ DIR *dir = xopendir (support_fuse_mountpoints);
+ while (true)
+ {
+ struct dirent64 *e = readdir64 (dir);
+ if (e == NULL)
+ /* Ignore errors. */
+ break;
+ if (*e->d_name == '.')
+ /* Skip "." and "..". No hidden files expected. */
+ continue;
+ if (unlinkat (dirfd (dir), e->d_name, AT_REMOVEDIR) != 0)
+ break;
+ rewinddir (dir);
+ }
+ xclosedir (dir);
+ rmdir (support_fuse_mountpoints);
+ free (support_fuse_mountpoints);
+ support_fuse_mountpoints = NULL;
+}
diff --git a/support/support_isolate_in_subprocess.c b/support/support_isolate_in_subprocess.c
index 59b9d14..5a4a39c 100644
--- a/support/support_isolate_in_subprocess.c
+++ b/support/support_isolate_in_subprocess.c
@@ -1,5 +1,5 @@
/* Run a function in a subprocess.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_mutex_pi_monotonic.c b/support/support_mutex_pi_monotonic.c
index e227ee0..a3678ba 100644
--- a/support/support_mutex_pi_monotonic.c
+++ b/support/support_mutex_pi_monotonic.c
@@ -1,5 +1,5 @@
/* Returns whether Priority Inheritance support CLOCK_MONOTONIC.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_need_proc.c b/support/support_need_proc.c
index 53356dd..99797ad 100644
--- a/support/support_need_proc.c
+++ b/support/support_need_proc.c
@@ -1,5 +1,5 @@
/* Indicate that a test requires a working /proc.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support-xstat-time64.c b/support/support_open_and_compare_file_bytes.c
index 4519487..4719f46 100644
--- a/support/support-xstat-time64.c
+++ b/support/support_open_and_compare_file_bytes.c
@@ -1,5 +1,5 @@
-/* 64-bit time_t stat with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Compare bytes from a file.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,17 +16,18 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
+#include <support/file_contents.h>
+#include <support/xstdio.h>
-#include <support/check.h>
-#include <support/xunistd.h>
-#include <sys/stat.h>
+/* Check that a not-currently-open file has exactly the given
+ bytes. */
-#if __TIMESIZE != 64
-void
-xstat_time64 (const char *path, struct __stat64_t64 *result)
+int
+support_open_and_compare_file_bytes (const char *file, const char *contents,
+ size_t length)
{
- if (__stat64_time64 (path, result) != 0)
- FAIL_EXIT1 ("__stat64_time64 (\"%s\"): %m", path);
+ FILE *fp = xfopen (file, "r");
+ int ret = support_compare_file_bytes (fp, contents, length);
+ xfclose (fp);
+ return ret;
}
-#endif
diff --git a/support/support_open_and_compare_file_string.c b/support/support_open_and_compare_file_string.c
new file mode 100644
index 0000000..3fed31d
--- /dev/null
+++ b/support/support_open_and_compare_file_string.c
@@ -0,0 +1,32 @@
+/* Compare string from a file.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <string.h>
+
+#include <support/file_contents.h>
+#include <support/xstdio.h>
+
+/* Check that a not-currently-open file has exactly the given string
+ as contents, starting at the current offset. */
+
+int
+support_open_and_compare_file_string (const char *file, const char *contents)
+{
+ return support_open_and_compare_file_bytes (file, contents,
+ strlen (contents));
+}
diff --git a/support/support_openpty.c b/support/support_openpty.c
index fbf9f71..f16dc04 100644
--- a/support/support_openpty.c
+++ b/support/support_openpty.c
@@ -1,5 +1,5 @@
/* Open a pseudoterminal.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -57,7 +57,7 @@ support_openpty (int *a_outer, int *a_inner, char **a_name,
const struct winsize *winp)
{
int outer = -1, inner = -1;
- char *namebuf = 0;
+ char *namebuf = NULL;
outer = posix_openpt (O_RDWR | O_NOCTTY);
if (outer == -1)
diff --git a/support/support_path_support_time64.c b/support/support_path_support_time64.c
index acc5ce1..4e2a25c 100644
--- a/support/support_path_support_time64.c
+++ b/support/support_path_support_time64.c
@@ -1,5 +1,5 @@
/* Check if path supports 64-bit time interfaces.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_paths.c b/support/support_paths.c
index 3cad09a..b89ca2e 100644
--- a/support/support_paths.c
+++ b/support/support_paths.c
@@ -1,5 +1,5 @@
/* Various paths that might be needed.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_process_state.c b/support/support_process_state.c
index 0623352..d2cb546 100644
--- a/support/support_process_state.c
+++ b/support/support_process_state.c
@@ -1,5 +1,5 @@
/* Wait for process state.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -27,7 +27,7 @@
#include <support/xstdio.h>
#include <support/check.h>
-void
+enum support_process_state
support_process_state_wait (pid_t pid, enum support_process_state state)
{
#ifdef __linux__
@@ -75,7 +75,7 @@ support_process_state_wait (pid_t pid, enum support_process_state state)
{
free (line);
xfclose (fstatus);
- return;
+ return process_states[i].s;
}
rewind (fstatus);
@@ -90,4 +90,6 @@ support_process_state_wait (pid_t pid, enum support_process_state state)
/* Fallback to nanosleep if an invalid state is found. */
#endif
nanosleep (&(struct timespec) { 1, 0 }, NULL);
+
+ return support_process_state_invalid;
}
diff --git a/support/support_ptrace.c b/support/support_ptrace.c
index 043f2f3..dc31189 100644
--- a/support/support_ptrace.c
+++ b/support/support_ptrace.c
@@ -1,5 +1,5 @@
/* Support functions handling ptrace_scope.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_quote_blob.c b/support/support_quote_blob.c
index c6addce..214f124 100644
--- a/support/support_quote_blob.c
+++ b/support/support_quote_blob.c
@@ -1,5 +1,5 @@
/* Quote a narrow string blob so that it can be used in C literals.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_quote_blob_main.c b/support/support_quote_blob_main.c
index f591d2a..fd8130e 100644
--- a/support/support_quote_blob_main.c
+++ b/support/support_quote_blob_main.c
@@ -1,5 +1,5 @@
/* Quote a blob so that it can be used in C literals.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_quote_blob_wide.c b/support/support_quote_blob_wide.c
index 091e83a..e796a7a 100644
--- a/support/support_quote_blob_wide.c
+++ b/support/support_quote_blob_wide.c
@@ -1,5 +1,5 @@
/* Quote a wide string blob so that it can be used in C literals.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_quote_string.c b/support/support_quote_string.c
index 4e49e79..fdb8340 100644
--- a/support/support_quote_string.c
+++ b/support/support_quote_string.c
@@ -1,5 +1,5 @@
/* Quote a string so that it can be used in C literals.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_readdir.c b/support/support_readdir.c
new file mode 100644
index 0000000..c4ccc3d
--- /dev/null
+++ b/support/support_readdir.c
@@ -0,0 +1,318 @@
+/* Type-generic wrapper for readdir functions.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/readdir.h>
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xdirent.h>
+
+/* Copied from <olddirent.h>. */
+struct __old_dirent64
+ {
+ __ino_t d_ino;
+ __off64_t d_off;
+ unsigned short int d_reclen;
+ unsigned char d_type;
+ char d_name[256];
+ };
+
+static struct __old_dirent64 *(*readdir64_compat) (DIR *);
+static int (*readdir64_r_compat) (DIR *, struct __old_dirent64 *,
+ struct __old_dirent64 **);
+
+static void __attribute__ ((constructor))
+init (void)
+{
+ /* These compat symbols exists on alpha, i386, m67k , powerpc, s390,
+ sparc. at the same GLIBC_2.1 version. */
+ readdir64_compat = dlvsym (RTLD_DEFAULT, "readdir64", "GLIBC_2.1");
+ readdir64_r_compat = dlvsym (RTLD_DEFAULT, "readdir64_r", "GLIBC_2.1");
+}
+
+enum support_readdir_op
+support_readdir_op_last (void)
+{
+ if (readdir64_r_compat != NULL)
+ {
+ TEST_VERIFY (readdir64_compat != NULL);
+ return SUPPORT_READDIR64_R_COMPAT;
+ }
+ else
+ return SUPPORT_READDIR64_R;
+}
+
+const char *
+support_readdir_function (enum support_readdir_op op)
+{
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ return "readdir";
+ case SUPPORT_READDIR64:
+ return "readdir64";
+ case SUPPORT_READDIR_R:
+ return "readdir_r";
+ case SUPPORT_READDIR64_R:
+ return "readdir64_r";
+ case SUPPORT_READDIR64_COMPAT:
+ return "readdir64@GBLIC_2.1";
+ case SUPPORT_READDIR64_R_COMPAT:
+ return "readdir64_r@GBLIC_2.1";
+ }
+ FAIL_EXIT1 ("invalid support_readdir_op constant: %d", op);
+}
+
+unsigned int
+support_readdir_inode_width (enum support_readdir_op op)
+{
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ case SUPPORT_READDIR_R:
+ return sizeof ((struct dirent) { 0, }.d_ino) * 8;
+ case SUPPORT_READDIR64:
+ case SUPPORT_READDIR64_R:
+ return sizeof ((struct dirent64) { 0, }.d_ino) * 8;
+ case SUPPORT_READDIR64_COMPAT:
+ case SUPPORT_READDIR64_R_COMPAT:
+ return sizeof ((struct __old_dirent64) { 0, }.d_ino) * 8;
+ }
+ FAIL_EXIT1 ("invalid support_readdir_op constant: %d", op);
+}
+
+unsigned int
+support_readdir_offset_width (enum support_readdir_op op)
+{
+#ifdef _DIRENT_HAVE_D_OFF
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ case SUPPORT_READDIR_R:
+ return sizeof ((struct dirent) { 0, }.d_off) * 8;
+ case SUPPORT_READDIR64:
+ case SUPPORT_READDIR64_R:
+ return sizeof ((struct dirent64) { 0, }.d_off) * 8;
+ case SUPPORT_READDIR64_COMPAT:
+ case SUPPORT_READDIR64_R_COMPAT:
+ return sizeof ((struct __old_dirent64) { 0, }.d_off) * 8;
+ }
+#else
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ case SUPPORT_READDIR_R:
+ case SUPPORT_READDIR64:
+ case SUPPORT_READDIR64_R:
+ case SUPPORT_READDIR64_COMPAT:
+ case SUPPORT_READDIR64_R_COMPAT:
+ return 0;
+ }
+#endif
+ FAIL_EXIT1 ("invalid support_readdir_op constant: %d", op);
+}
+
+bool
+support_readdir_r_variant (enum support_readdir_op op)
+{
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ case SUPPORT_READDIR64:
+ case SUPPORT_READDIR64_COMPAT:
+ return false;
+ case SUPPORT_READDIR_R:
+ case SUPPORT_READDIR64_R:
+ case SUPPORT_READDIR64_R_COMPAT:
+ return true;
+ }
+ FAIL_EXIT1 ("invalid support_readdir_op constant: %d", op);
+}
+
+static bool
+copy_dirent (struct support_dirent *dst, struct dirent *src)
+{
+ if (src == NULL)
+ return false;
+ dst->d_ino = src->d_ino;
+#ifdef _DIRENT_HAVE_D_OFF
+ dst->d_off = src->d_off;
+#else
+ dst->d_off = 0;
+#endif
+ dst->d_type = src->d_type;
+ dst->d_name = xstrdup (src->d_name);
+ return true;
+}
+
+static bool
+copy_dirent64 (struct support_dirent *dst, struct dirent64 *src)
+{
+ if (src == NULL)
+ return false;
+ dst->d_ino = src->d_ino;
+#ifdef _DIRENT_HAVE_D_OFF
+ dst->d_off = src->d_off;
+#else
+ dst->d_off = 0;
+#endif
+ dst->d_type = src->d_type;
+ dst->d_name = xstrdup (src->d_name);
+ return true;
+}
+
+static bool
+copy_old_dirent64 (struct support_dirent *dst, struct __old_dirent64 *src)
+{
+ if (src == NULL)
+ return false;
+ dst->d_ino = src->d_ino;
+#ifdef _DIRENT_HAVE_D_OFF
+ dst->d_off = src->d_off;
+#else
+ dst->d_off = 0;
+#endif
+ dst->d_type = src->d_type;
+ dst->d_name = xstrdup (src->d_name);
+ return true;
+}
+
+bool
+support_readdir (DIR *stream, enum support_readdir_op op,
+ struct support_dirent *e)
+{
+ free (e->d_name);
+ e->d_name = NULL;
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ return copy_dirent (e, xreaddir (stream));
+ case SUPPORT_READDIR64:
+ return copy_dirent64 (e, xreaddir64 (stream));
+
+ /* The functions readdir_r, readdir64_r were deprecated in glibc 2.24. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+ case SUPPORT_READDIR_R:
+ {
+ struct dirent buf;
+ if (!xreaddir_r (stream, &buf))
+ return false;
+ return copy_dirent (e, &buf);
+ }
+ case SUPPORT_READDIR64_R:
+ {
+ struct dirent64 buf;
+ if (!xreaddir64_r (stream, &buf))
+ return false;
+ return copy_dirent64 (e, &buf);
+ }
+
+ DIAG_POP_NEEDS_COMMENT;
+
+ case SUPPORT_READDIR64_COMPAT:
+ if (readdir64_compat == NULL)
+ FAIL_EXIT1 ("readdir64 compat function not implemented");
+ return copy_old_dirent64 (e, readdir64_compat (stream));
+
+ case SUPPORT_READDIR64_R_COMPAT:
+ {
+ if (readdir64_r_compat == NULL)
+ FAIL_EXIT1 ("readdir64_r compat function not implemented");
+ struct __old_dirent64 buf;
+ struct __old_dirent64 *e1;
+ int ret = readdir64_r_compat (stream, &buf, &e1);
+ if (ret != 0)
+ {
+ errno = ret;
+ FAIL ("readdir64_r@GLIBC_2.1: %m");
+ return false;
+ }
+ if (e1 == NULL)
+ return false;
+ return copy_old_dirent64 (e, e1);
+ }
+ }
+ FAIL_EXIT1 ("support_readdir: invalid op argument %d", (int) op);
+}
+
+void
+support_readdir_expect_error (DIR *stream, enum support_readdir_op op,
+ int expected)
+{
+ switch (op)
+ {
+ case SUPPORT_READDIR:
+ errno = 0;
+ TEST_VERIFY (readdir (stream) == NULL);
+ TEST_COMPARE (errno, expected);
+ return;
+ case SUPPORT_READDIR64:
+ errno = 0;
+ TEST_VERIFY (readdir64 (stream) == NULL);
+ TEST_COMPARE (errno, expected);
+ return;
+
+ /* The functions readdir_r, readdir64_r were deprecated in glibc 2.24. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+ case SUPPORT_READDIR_R:
+ {
+ struct dirent buf;
+ struct dirent *e;
+ errno = readdir_r (stream, &buf, &e);
+ TEST_COMPARE (errno, expected);;
+ }
+ return;
+ case SUPPORT_READDIR64_R:
+ {
+ struct dirent64 buf;
+ struct dirent64 *e;
+ errno = readdir64_r (stream, &buf, &e);
+ TEST_COMPARE (errno, expected);;
+ }
+ return;
+
+ DIAG_POP_NEEDS_COMMENT;
+
+ case SUPPORT_READDIR64_COMPAT:
+ if (readdir64_compat == NULL)
+ FAIL_EXIT1 ("readdir64_r compat function not implemented");
+ errno = 0;
+ TEST_VERIFY (readdir64_compat (stream) == NULL);
+ TEST_COMPARE (errno, expected);
+ return;
+ case SUPPORT_READDIR64_R_COMPAT:
+ {
+ if (readdir64_r_compat == NULL)
+ FAIL_EXIT1 ("readdir64_r compat function not implemented");
+ struct __old_dirent64 buf;
+ struct __old_dirent64 *e;
+ errno = readdir64_r_compat (stream, &buf, &e);
+ TEST_COMPARE (errno, expected);
+ }
+ return;
+ }
+ FAIL_EXIT1 ("support_readdir_expect_error: invalid op argument %d",
+ (int) op);
+}
diff --git a/support/support_readdir_check.c b/support/support_readdir_check.c
new file mode 100644
index 0000000..e76be5a
--- /dev/null
+++ b/support/support_readdir_check.c
@@ -0,0 +1,30 @@
+/* Error-checking helper for xreaddir, xreaddir64.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+void *
+support_readdir_check (const char *name, void *result, int saved_errno)
+{
+ if (result == NULL && errno != 0)
+ FAIL_EXIT1 ("%s: %m", name);
+ errno = saved_errno;
+ return result;
+}
diff --git a/support/xlstat-time64.c b/support/support_readdir_r_check.c
index 2bc3ca6..870db67 100644
--- a/support/xlstat-time64.c
+++ b/support/support_readdir_r_check.c
@@ -1,5 +1,5 @@
-/* 64-bit time_t stat with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Error-checking helper for xreaddir_r, xreaddir64_r.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,17 +16,20 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
+#include <support/xdirent.h>
#include <support/check.h>
-#include <support/xunistd.h>
-#include <sys/stat.h>
-#if __TIMESIZE != 64
-void
-xlstat_time64 (const char *path, struct __stat64_t64 *result)
+int
+support_readdir_r_check (const char *name, int result, void *buf, void *ptr)
{
- if (__lstat64_time64 (path, result) != 0)
- FAIL_EXIT1 ("__lstat64_time64 (\"%s\"): %m", path);
+ if (result != 0)
+ {
+ errno = result;
+ FAIL_EXIT1 ("%s: %m", name);
+ }
+ if (buf != ptr)
+ FAIL_EXIT1 ("%s: buffer pointer and returned pointer differ: %p != %p",
+ name, buf, ptr);
+ return result;
}
-#endif
diff --git a/support/support_record_failure.c b/support/support_record_failure.c
index 9781237..c69be20 100644
--- a/support/support_record_failure.c
+++ b/support/support_record_failure.c
@@ -1,5 +1,5 @@
/* Global test failure counter.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -112,3 +112,13 @@ support_record_failure_is_failed (void)
synchronization for reliable test error reporting anyway. */
return __atomic_load_n (&state->failed, __ATOMIC_RELAXED);
}
+
+void
+support_record_failure_barrier (void)
+{
+ if (__atomic_load_n (&state->failed, __ATOMIC_RELAXED))
+ {
+ puts ("error: exiting due to previous errors");
+ exit (1);
+ }
+}
diff --git a/support/support_run_diff.c b/support/support_run_diff.c
index dc8292a..b6ee836 100644
--- a/support/support_run_diff.c
+++ b/support/support_run_diff.c
@@ -1,5 +1,5 @@
/* Invoke the system diff tool to compare two strings.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_select_modifies_timeout.c b/support/support_select_modifies_timeout.c
index db734b1..d6ec2a4 100644
--- a/support/support_select_modifies_timeout.c
+++ b/support/support_select_modifies_timeout.c
@@ -1,5 +1,5 @@
/* Return whether select modifies the timeout.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_select_normalizes_timeout.c b/support/support_select_normalizes_timeout.c
index 82b420d..2c1371c 100644
--- a/support/support_select_normalizes_timeout.c
+++ b/support/support_select_normalizes_timeout.c
@@ -1,5 +1,5 @@
/* Return whether select normalizes the timeout.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_set_small_thread_stack_size.c b/support/support_set_small_thread_stack_size.c
index 0c9d901..21db446 100644
--- a/support/support_set_small_thread_stack_size.c
+++ b/support/support_set_small_thread_stack_size.c
@@ -1,5 +1,5 @@
/* Set a small stack size, but still large enough for glibc's needs.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_set_vma_name_supported.c b/support/support_set_vma_name_supported.c
index 2de066f..2d58a09 100644
--- a/support/support_set_vma_name_supported.c
+++ b/support/support_set_vma_name_supported.c
@@ -1,5 +1,5 @@
/* Check if kernel supports set VMA range name.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@ support_set_vma_name_supported (void)
if (size == -1)
FAIL_EXIT1 ("sysconf (_SC_PAGESIZE): %m\n");
- void *vma = xmmap (0,
+ void *vma = xmmap (NULL,
size,
PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE,
diff --git a/support/support_shared_allocate.c b/support/support_shared_allocate.c
index 1cae5ba..5398ec7 100644
--- a/support/support_shared_allocate.c
+++ b/support/support_shared_allocate.c
@@ -1,5 +1,5 @@
/* Allocate a memory region shared across processes.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_small_stack_thread_attribute.c b/support/support_small_stack_thread_attribute.c
index 83b073f..f747b74 100644
--- a/support/support_small_stack_thread_attribute.c
+++ b/support/support_small_stack_thread_attribute.c
@@ -1,5 +1,5 @@
/* A thread attribute with a small stack.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_socket_so_timestamp_time64.c b/support/support_socket_so_timestamp_time64.c
index 6040389..d904a19 100644
--- a/support/support_socket_so_timestamp_time64.c
+++ b/support/support_socket_so_timestamp_time64.c
@@ -1,5 +1,5 @@
/* Return whether socket supports 64-bit timestamps.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_stack_alloc.c b/support/support_stack_alloc.c
index edf3dbf..5e576be 100644
--- a/support/support_stack_alloc.c
+++ b/support/support_stack_alloc.c
@@ -1,5 +1,5 @@
/* Allocate a stack suitable to be used with xclone or xsigaltstack.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -58,7 +58,7 @@ support_stack_alloc (size_t size)
/* Use MAP_NORESERVE so that RAM will not be wasted on the guard
bands; touch all the pages of the actual stack before returning,
so we know they are allocated. */
- void *alloc_base = xmmap (0,
+ void *alloc_base = xmmap (NULL,
alloc_size,
PROT_NONE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE|MAP_STACK,
diff --git a/support/support_stat_nanoseconds.c b/support/support_stat_nanoseconds.c
index c80c13e..2c26d36 100644
--- a/support/support_stat_nanoseconds.c
+++ b/support/support_stat_nanoseconds.c
@@ -1,5 +1,5 @@
/* Check if stat supports nanosecond resolution.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_subprocess.c b/support/support_subprocess.c
index b692a7f..be00dde 100644
--- a/support/support_subprocess.c
+++ b/support/support_subprocess.c
@@ -1,5 +1,5 @@
/* Create subprocess.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_test_compare_blob.c b/support/support_test_compare_blob.c
index 0a7acff..f2690b2 100644
--- a/support/support_test_compare_blob.c
+++ b/support/support_test_compare_blob.c
@@ -1,5 +1,5 @@
/* Check two binary blobs for equality.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_test_compare_failure.c b/support/support_test_compare_failure.c
index ae73d20..c6cfa4b 100644
--- a/support/support_test_compare_failure.c
+++ b/support/support_test_compare_failure.c
@@ -1,5 +1,5 @@
/* Reporting a numeric comparison failure.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,7 +17,9 @@
<https://www.gnu.org/licenses/>. */
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
+#include <string.h>
#include <support/check.h>
static void
@@ -31,7 +33,14 @@ report (const char *which, const char *expr, long long value, int positive,
printf ("%lld", value);
unsigned long long mask
= (~0ULL) >> (8 * (sizeof (unsigned long long) - size));
- printf (" (0x%llx); from: %s\n", (unsigned long long) value & mask, expr);
+ const char *errno_constant = NULL;
+ if (strcmp (expr, "errno") == 0
+ && positive && (unsigned long long int) value <= INT_MAX)
+ errno_constant = strerrorname_np (value);
+ printf (" (0x%llx", (unsigned long long) value & mask);
+ if (errno_constant != NULL)
+ printf (", %s", errno_constant);
+ printf ("); from: %s\n", expr);
}
void
diff --git a/support/support_test_compare_string.c b/support/support_test_compare_string.c
index d28b8cc..8e517d2 100644
--- a/support/support_test_compare_string.c
+++ b/support/support_test_compare_string.c
@@ -1,5 +1,5 @@
/* Check two strings for equality.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_test_compare_string_main.c b/support/support_test_compare_string_main.c
index 08f4f03..d556ad7 100644
--- a/support/support_test_compare_string_main.c
+++ b/support/support_test_compare_string_main.c
@@ -1,5 +1,5 @@
/* Check two strings for equality.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_test_compare_string_wide.c b/support/support_test_compare_string_wide.c
index c260e87..7ad3440 100644
--- a/support/support_test_compare_string_wide.c
+++ b/support/support_test_compare_string_wide.c
@@ -1,5 +1,5 @@
/* Check two wide strings for equality.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_test_main.c b/support/support_test_main.c
index cca82d8..bd6c728 100644
--- a/support/support_test_main.c
+++ b/support/support_test_main.c
@@ -1,5 +1,5 @@
/* Main worker function for the test driver.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_test_verify_impl.c b/support/support_test_verify_impl.c
index 0d8d972..95fd6c0 100644
--- a/support/support_test_verify_impl.c
+++ b/support/support_test_verify_impl.c
@@ -1,5 +1,5 @@
/* Implementation of the TEST_VERIFY and TEST_VERIFY_EXIT macros.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_wait_for_thread_exit.c b/support/support_wait_for_thread_exit.c
index 449f1fc..3c7a474 100644
--- a/support/support_wait_for_thread_exit.c
+++ b/support/support_wait_for_thread_exit.c
@@ -1,5 +1,5 @@
/* Wait until all threads except the current thread has exited.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support_write_file_string.c b/support/support_write_file_string.c
index b249d28..8deac93 100644
--- a/support/support_write_file_string.c
+++ b/support/support_write_file_string.c
@@ -1,5 +1,5 @@
/* Write a string to a file.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/temp_file-internal.h b/support/temp_file-internal.h
index 606f534..8d3b1a7 100644
--- a/support/temp_file-internal.h
+++ b/support/temp_file-internal.h
@@ -1,5 +1,5 @@
/* Internal weak declarations for temporary file handling.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/temp_file.c b/support/temp_file.c
index 28a0043..bd687d1 100644
--- a/support/temp_file.c
+++ b/support/temp_file.c
@@ -1,5 +1,5 @@
/* Temporary file handling for tests.
- Copyright (C) 1998-2024 Free Software Foundation, Inc.
+ Copyright (C) 1998-2025 Free Software Foundation, Inc.
Copyright The GNU Tools Authors.
This file is part of the GNU C Library.
diff --git a/support/temp_file.h b/support/temp_file.h
index 52def9d..4222ed1 100644
--- a/support/temp_file.h
+++ b/support/temp_file.h
@@ -1,5 +1,5 @@
/* Declarations for temporary file handling.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/test-container.c b/support/test-container.c
index ebcc722..a641250 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -1,5 +1,5 @@
/* Run a test case in an isolated namespace.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -440,7 +440,7 @@ copy_one_file (const char *sname, const char *dname)
if (dfd < 0)
FAIL_EXIT1 ("unable to open %s for writing\n", dname);
- xcopy_file_range (sfd, 0, dfd, 0, st.st_size, 0);
+ xcopy_file_range (sfd, NULL, dfd, NULL, st.st_size, 0);
xclose (sfd);
xclose (dfd);
@@ -1151,6 +1151,9 @@ main (int argc, char **argv)
devmount (new_root_path, "null");
devmount (new_root_path, "zero");
devmount (new_root_path, "urandom");
+#ifdef __linux__
+ devmount (new_root_path, "ptmx");
+#endif
/* We're done with the "old" root, switch to the new one. */
if (chroot (new_root_path) < 0)
@@ -1217,6 +1220,14 @@ main (int argc, char **argv)
maybe_xmkdir ("/tmp", 0755);
+#ifdef __linux__
+ maybe_xmkdir ("/dev/pts", 0777);
+ if (mount ("/dev/pts", "/dev/pts", "devpts", 0, "newinstance,ptmxmode=0666,mode=0666") < 0)
+ FAIL_EXIT1 ("can't mount /dev/pts: %m\n");
+ if (mount ("/dev/pts/ptmx", "/dev/ptmx", "", MS_BIND | MS_REC, NULL) < 0)
+ FAIL_EXIT1 ("can't mount /dev/ptmx\n");
+#endif
+
if (require_pidns)
{
/* Now that we're pid 1 (effectively "root") we can mount /proc */
diff --git a/support/test-driver.c b/support/test-driver.c
index f4c3e4d..40e2bc0 100644
--- a/support/test-driver.c
+++ b/support/test-driver.c
@@ -1,5 +1,5 @@
/* Main function for test programs.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -155,6 +155,7 @@ main (int argc, char **argv)
{
CMDLINE_OPTIONS
TEST_DEFAULT_OPTIONS
+ { 0, }
};
test_config.options = &options;
#endif
diff --git a/support/test-driver.h b/support/test-driver.h
index 2255aac..9291611 100644
--- a/support/test-driver.h
+++ b/support/test-driver.h
@@ -1,5 +1,5 @@
/* Interfaces for the test driver.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/test-run-command.c b/support/test-run-command.c
index 63d466d..039ab58 100644
--- a/support/test-run-command.c
+++ b/support/test-run-command.c
@@ -1,5 +1,5 @@
/* Main program for test-run-command support utility.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/timespec-add-time64.c b/support/timespec-add-time64.c
index b957675..6d58ee2 100644
--- a/support/timespec-add-time64.c
+++ b/support/timespec-add-time64.c
@@ -1,5 +1,5 @@
/* Add two struct __timespec64 values. 64-bit time support.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
diff --git a/support/timespec-add.c b/support/timespec-add.c
index 55fd812..b1125b1 100644
--- a/support/timespec-add.c
+++ b/support/timespec-add.c
@@ -1,5 +1,5 @@
/* Add two struct timespec values.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
@@ -20,7 +20,6 @@
/* Return the sum of two timespec values A and B. On overflow, return
an extremal value. This assumes 0 <= tv_nsec < TIMESPEC_HZ. */
-#include <config.h>
#include "timespec.h"
#include "intprops.h"
diff --git a/support/timespec-sub-time64.c b/support/timespec-sub-time64.c
index c7ad70a..2803f11 100644
--- a/support/timespec-sub-time64.c
+++ b/support/timespec-sub-time64.c
@@ -1,5 +1,5 @@
/* Subtract two struct __timespec64 values. 64-bit time support.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
diff --git a/support/timespec-sub.c b/support/timespec-sub.c
index 7d89c14..cae24d6 100644
--- a/support/timespec-sub.c
+++ b/support/timespec-sub.c
@@ -1,5 +1,5 @@
/* Subtract two struct timespec values.
- Copyright (C) 2011-2024 Free Software Foundation, Inc.
+ Copyright (C) 2011-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
@@ -21,7 +21,6 @@
overflow, return an extremal value. This assumes 0 <= tv_nsec <
TIMESPEC_HZ. */
-#include <config.h>
#include "timespec.h"
#include "intprops.h"
diff --git a/support/timespec-time64.c b/support/timespec-time64.c
index 7801deb..3d2c211 100644
--- a/support/timespec-time64.c
+++ b/support/timespec-time64.c
@@ -1,5 +1,5 @@
/* Support code for timespec checks. 64-bit time support.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/timespec.c b/support/timespec.c
index 14e6e74..bf72338 100644
--- a/support/timespec.c
+++ b/support/timespec.c
@@ -1,5 +1,5 @@
/* Support code for timespec checks.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/timespec.h b/support/timespec.h
index 5ccc716..cbafd90 100644
--- a/support/timespec.h
+++ b/support/timespec.h
@@ -1,5 +1,5 @@
/* Useful functions for tests that use struct timespec.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/true-container.c b/support/true-container.c
index dd7348e..e3bcdeb 100644
--- a/support/true-container.c
+++ b/support/true-container.c
@@ -1,5 +1,5 @@
/* Minimal /bin/true for in-container use.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-glibcpp.py b/support/tst-glibcpp.py
index 44f2a3a..0925699 100644
--- a/support/tst-glibcpp.py
+++ b/support/tst-glibcpp.py
@@ -1,6 +1,6 @@
#! /usr/bin/python3
# Tests for scripts/glibcpp.py
-# Copyright (C) 2022-2024 Free Software Foundation, Inc.
+# Copyright (C) 2022-2025 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
#
# The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support-namespace.c b/support/tst-support-namespace.c
index c156728..bf8926f 100644
--- a/support/tst-support-namespace.c
+++ b/support/tst-support-namespace.c
@@ -1,5 +1,5 @@
/* Test entering namespaces.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support-open-dev-null-range.c b/support/tst-support-open-dev-null-range.c
index 5f98294..6db20f0 100644
--- a/support/tst-support-open-dev-null-range.c
+++ b/support/tst-support-open-dev-null-range.c
@@ -1,5 +1,5 @@
/* Tests for support_open_dev_null_range.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support-openpty-c.c b/support/tst-support-openpty-c.c
new file mode 100644
index 0000000..0a6a428
--- /dev/null
+++ b/support/tst-support-openpty-c.c
@@ -0,0 +1,2 @@
+/* Same test, but in a test-container. */
+#include "tst-support-openpty.c"
diff --git a/support/tst-support-openpty.c b/support/tst-support-openpty.c
new file mode 100644
index 0000000..1222d70
--- /dev/null
+++ b/support/tst-support-openpty.c
@@ -0,0 +1,49 @@
+/* Basic test for support_openpty support in test-container.
+ Copyright (C) 2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <termios.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+
+#include <support/tty.h>
+#include <support/check.h>
+#include <support/support.h>
+
+/* Note: the purpose of this test isn't to test if ptys function
+ correctly, but only to verify that test-container's support for
+ them is correct. The many checks in support_openpty.c are
+ sufficient for this. */
+
+int
+do_test (void)
+{
+ int outer, inner;
+ char *name;
+ struct termios term;
+ struct winsize win;
+
+ cfmakeraw (&term);
+ win.ws_row = 24;
+ win.ws_col = 80;
+
+ support_openpty (&outer, &inner, &name, &term, &win);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/support/tst-support-process_state.c b/support/tst-support-process_state.c
index d732693..9a333b2 100644
--- a/support/tst-support-process_state.c
+++ b/support/tst-support-process_state.c
@@ -1,5 +1,5 @@
/* Wait for process state tests.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -68,28 +68,39 @@ do_test (void)
if (test_verbose)
printf ("info: waiting pid %d, state_stopped/state_tracing_stop\n",
(int) pid);
- support_process_state_wait (pid, stop_state);
+ {
+ enum support_process_state state =
+ support_process_state_wait (pid, stop_state);
+ TEST_VERIFY (state == support_process_state_stopped
+ || state == support_process_state_tracing_stop);
+ }
if (kill (pid, SIGCONT) != 0)
FAIL_RET ("kill (%d, SIGCONT): %m\n", pid);
if (test_verbose)
printf ("info: waiting pid %d, state_sleeping\n", (int) pid);
- support_process_state_wait (pid, support_process_state_sleeping);
+ TEST_COMPARE (support_process_state_wait (pid,
+ support_process_state_sleeping),
+ support_process_state_sleeping);
if (kill (pid, SIGUSR1) != 0)
FAIL_RET ("kill (%d, SIGUSR1): %m\n", pid);
if (test_verbose)
printf ("info: waiting pid %d, state_running\n", (int) pid);
- support_process_state_wait (pid, support_process_state_running);
+ TEST_COMPARE (support_process_state_wait (pid,
+ support_process_state_running),
+ support_process_state_running);
if (kill (pid, SIGKILL) != 0)
FAIL_RET ("kill (%d, SIGKILL): %m\n", pid);
if (test_verbose)
printf ("info: waiting pid %d, state_zombie\n", (int) pid);
- support_process_state_wait (pid, support_process_state_zombie);
+ TEST_COMPARE (support_process_state_wait (pid,
+ support_process_state_zombie),
+ support_process_state_zombie);;
siginfo_t info;
int r = waitid (P_PID, pid, &info, WEXITED);
diff --git a/support/tst-support_blob_repeat.c b/support/tst-support_blob_repeat.c
index a5d95d5..4e7e6bd 100644
--- a/support/tst-support_blob_repeat.c
+++ b/support/tst-support_blob_repeat.c
@@ -1,5 +1,5 @@
/* Tests for <support/blob_repeat.h>
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_capture_subprocess.c b/support/tst-support_capture_subprocess.c
index 756fb75..edd8412 100644
--- a/support/tst-support_capture_subprocess.c
+++ b/support/tst-support_capture_subprocess.c
@@ -1,5 +1,5 @@
/* Test capturing output from a subprocess.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_descriptors.c b/support/tst-support_descriptors.c
index 1e6e37a..2bac719 100644
--- a/support/tst-support_descriptors.c
+++ b/support/tst-support_descriptors.c
@@ -1,5 +1,5 @@
/* Tests for monitoring file descriptor usage.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_format_dns_packet.c b/support/tst-support_format_dns_packet.c
index 4de629a..39e860d 100644
--- a/support/tst-support_format_dns_packet.c
+++ b/support/tst-support_format_dns_packet.c
@@ -1,5 +1,5 @@
/* Tests for the support_format_dns_packet function.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_fuse.c b/support/tst-support_fuse.c
new file mode 100644
index 0000000..b47648b
--- /dev/null
+++ b/support/tst-support_fuse.c
@@ -0,0 +1,349 @@
+/* Facilities for FUSE-backed file system tests.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/fuse.h>
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/support.h>
+#include <support/xdirent.h>
+#include <support/xunistd.h>
+
+static void
+fuse_thread (struct support_fuse *f, void *closure)
+{
+ /* Turn on returning FUSE_FORGET responses. */
+ support_fuse_filter_forget (f, false);
+
+ /* Inode and nodeid for "file" and "new". */
+ enum { NODE_FILE = 2, NODE_NEW, NODE_SUBDIR, NODE_SYMLINK };
+ struct fuse_in_header *inh;
+ while ((inh = support_fuse_next (f)) != NULL)
+ {
+ {
+ char *opcode = support_fuse_opcode (inh->opcode);
+ printf ("info: (T) event %s(%llu) len=%u nodeid=%llu\n",
+ opcode, (unsigned long long int) inh->unique, inh->len,
+ (unsigned long long int) inh->nodeid);
+ free (opcode);
+ }
+
+ /* Handle mountpoint and basic directory operation for the root (1). */
+ if (support_fuse_handle_mountpoint (f)
+ || (inh->nodeid == 1 && support_fuse_handle_directory (f)))
+ continue;
+
+ switch (inh->opcode)
+ {
+ case FUSE_READDIR:
+ /* Implementation of getdents64. */
+ if (inh->nodeid == 1)
+ {
+ struct support_fuse_dirstream *d
+ = support_fuse_prepare_readdir (f);
+ TEST_COMPARE (support_fuse_cast (READ, inh)->offset, 0);
+ TEST_VERIFY (support_fuse_dirstream_add (d, 1, 1, DT_DIR, "."));
+ TEST_VERIFY (support_fuse_dirstream_add (d, 1, 2, DT_DIR, ".."));
+ TEST_VERIFY (support_fuse_dirstream_add (d, NODE_FILE, 3, DT_REG,
+ "file"));
+ support_fuse_reply_prepared (f);
+ }
+ else
+ support_fuse_reply_error (f, EIO);
+ break;
+ case FUSE_LOOKUP:
+ /* Part of the implementation of open. */
+ {
+ char *name = support_fuse_cast (LOOKUP, inh);
+ printf (" name: %s\n", name);
+ if (inh->nodeid == 1 && strcmp (name, "file") == 0)
+ {
+ struct fuse_entry_out *out
+ = support_fuse_prepare_entry (f, NODE_FILE);
+ out->attr.mode = S_IFREG | 0600;
+ support_fuse_reply_prepared (f);
+ }
+ else if (inh->nodeid == 1 && strcmp (name, "symlink") == 0)
+ {
+ struct fuse_entry_out *out
+ = support_fuse_prepare_entry (f, NODE_SYMLINK);
+ out->attr.mode = S_IFLNK | 0777;
+ support_fuse_reply_prepared (f);
+ }
+ else
+ support_fuse_reply_error (f, ENOENT);
+ }
+ break;
+ case FUSE_OPEN:
+ /* Implementation of open. */
+ {
+ struct fuse_open_in *p = support_fuse_cast (OPEN, inh);
+ if (inh->nodeid == NODE_FILE)
+ {
+ TEST_VERIFY (!(p->flags & O_EXCL));
+ struct fuse_open_out out = { 0, };
+ support_fuse_reply (f, &out, sizeof (out));
+ }
+ else
+ support_fuse_reply_error (f, ENOENT);
+ }
+ break;
+ case FUSE_GETATTR:
+ /* Happens after open. */
+ if (inh->nodeid == NODE_FILE)
+ {
+ struct fuse_attr_out *out = support_fuse_prepare_attr (f);
+ out->attr.mode = S_IFREG | 0600;
+ out->attr.size = strlen ("Hello, world!");
+ support_fuse_reply_prepared (f);
+ }
+ else
+ support_fuse_reply_error (f, ENOENT);
+ break;
+ case FUSE_READ:
+ /* Implementation of read. */
+ if (inh->nodeid == NODE_FILE)
+ {
+ struct fuse_read_in *p = support_fuse_cast (READ, inh);
+ TEST_COMPARE (p->offset, 0);
+ TEST_VERIFY (p->size >= strlen ("Hello, world!"));
+ support_fuse_reply (f,
+ "Hello, world!", strlen ("Hello, world!"));
+ }
+ else
+ support_fuse_reply_error (f, EIO);
+ break;
+ case FUSE_FLUSH:
+ /* Sent in response to close. */
+ support_fuse_reply_empty (f);
+ break;
+ case FUSE_GETXATTR:
+ /* This happens as part of a open-for-write operation.
+ Signal no support for extended attributes. */
+ support_fuse_reply_error (f, ENOSYS);
+ break;
+ case FUSE_SETATTR:
+ /* This happens as part of a open-for-write operation to
+ implement O_TRUNC. */
+ if (inh->nodeid == NODE_FILE)
+ {
+ struct fuse_setattr_in *p = support_fuse_cast (SETATTR, inh);
+ /* FATTR_LOCKOWNER may also be set. */
+ TEST_COMPARE ((p->valid) & ~ FATTR_LOCKOWNER, FATTR_SIZE);
+ TEST_COMPARE (p->size, 0);
+ struct fuse_attr_out *out = support_fuse_prepare_attr (f);
+ out->attr.mode = S_IFREG | 0600;
+ support_fuse_reply_prepared (f);
+ }
+ else
+ support_fuse_reply_error (f, EIO);
+ break;
+ case FUSE_WRITE:
+ /* Implementation of write. */
+ if (inh->nodeid == NODE_FILE)
+ {
+ struct fuse_write_in *p = support_fuse_cast (WRITE, inh);
+ TEST_COMPARE (p->offset, 0);
+ /* Write payload follows after struct fuse_write_in. */
+ TEST_COMPARE_BLOB (p + 1, p->size,
+ "Good day to you too.",
+ strlen ("Good day to you too."));
+ struct fuse_write_out out =
+ {
+ .size = p->size,
+ };
+ support_fuse_reply (f, &out, sizeof (out));
+ }
+ else
+ support_fuse_reply_error (f, EIO);
+ break;
+ case FUSE_CREATE:
+ /* Implementation of O_CREAT. */
+ if (inh->nodeid == 1)
+ {
+ char *name;
+ struct fuse_create_in *p
+ = support_fuse_cast_name (CREATE, inh, &name);
+ TEST_VERIFY (S_ISREG (p->mode));
+ TEST_COMPARE (p->mode & 07777, 0600);
+ TEST_COMPARE_STRING (name, "new");
+ struct fuse_entry_out *out_entry;
+ struct fuse_open_out *out_open;
+ support_fuse_prepare_create (f, NODE_NEW, &out_entry, &out_open);
+ out_entry->attr.mode = S_IFREG | 0600;
+ support_fuse_reply_prepared (f);
+ }
+ else
+ support_fuse_reply_error (f, EIO);
+ break;
+ case FUSE_MKDIR:
+ /* Implementation of mkdir. */
+ {
+ if (inh->nodeid == 1)
+ {
+ char *name;
+ struct fuse_mkdir_in *p
+ = support_fuse_cast_name (MKDIR, inh, &name);
+ TEST_COMPARE (p->mode, 01234);
+ TEST_COMPARE_STRING (name, "subdir");
+ struct fuse_entry_out *out
+ = support_fuse_prepare_entry (f, NODE_SUBDIR);
+ out->attr.mode = S_IFDIR | p->mode;
+ support_fuse_reply_prepared (f);
+ }
+ else
+ support_fuse_reply_error (f, EIO);
+ }
+ break;
+ case FUSE_READLINK:
+ /* Implementation of readlink. */
+ TEST_COMPARE (inh->nodeid, NODE_SYMLINK);
+ if (inh->nodeid == NODE_SYMLINK)
+ support_fuse_reply (f, "target-of-symbolic-link",
+ strlen ("target-of-symbolic-link"));
+ else
+ support_fuse_reply_error (f, EINVAL);
+ break;
+ case FUSE_FORGET:
+ support_fuse_no_reply (f);
+ break;
+ default:
+ support_fuse_reply_error (f, EIO);
+ }
+ }
+}
+
+static int
+do_test (void)
+{
+ support_fuse_init ();
+
+ struct support_fuse *f = support_fuse_mount (fuse_thread, NULL);
+
+ printf ("info: Attributes of mountpoint/root directory %s\n",
+ support_fuse_mountpoint (f));
+ {
+ struct statx st;
+ xstatx (AT_FDCWD, support_fuse_mountpoint (f), 0, STATX_BASIC_STATS, &st);
+ TEST_COMPARE (st.stx_uid, getuid ());
+ TEST_COMPARE (st.stx_gid, getgid ());
+ TEST_VERIFY (S_ISDIR (st.stx_mode));
+ TEST_COMPARE (st.stx_mode & 07777, 0700);
+ }
+
+ printf ("info: List directory %s\n", support_fuse_mountpoint (f));
+ {
+ DIR *dir = xopendir (support_fuse_mountpoint (f));
+
+ struct dirent *e = xreaddir (dir);
+ TEST_COMPARE (e->d_ino, 1);
+#ifdef _DIRENT_HAVE_D_OFF
+ TEST_COMPARE (e->d_off, 1);
+#endif
+ TEST_COMPARE (e->d_type, DT_DIR);
+ TEST_COMPARE_STRING (e->d_name, ".");
+
+ e = xreaddir (dir);
+ TEST_COMPARE (e->d_ino, 1);
+#ifdef _DIRENT_HAVE_D_OFF
+ TEST_COMPARE (e->d_off, 2);
+#endif
+ TEST_COMPARE (e->d_type, DT_DIR);
+ TEST_COMPARE_STRING (e->d_name, "..");
+
+ e = xreaddir (dir);
+ TEST_COMPARE (e->d_ino, 2);
+#ifdef _DIRENT_HAVE_D_OFF
+ TEST_COMPARE (e->d_off, 3);
+#endif
+ TEST_COMPARE (e->d_type, DT_REG);
+ TEST_COMPARE_STRING (e->d_name, "file");
+
+ TEST_COMPARE (closedir (dir), 0);
+ }
+
+ char *file_path = xasprintf ("%s/file", support_fuse_mountpoint (f));
+
+ printf ("info: Attributes of file %s\n", file_path);
+ {
+ struct statx st;
+ xstatx (AT_FDCWD, file_path, 0, STATX_BASIC_STATS, &st);
+ TEST_COMPARE (st.stx_uid, getuid ());
+ TEST_COMPARE (st.stx_gid, getgid ());
+ TEST_VERIFY (S_ISREG (st.stx_mode));
+ TEST_COMPARE (st.stx_mode & 07777, 0600);
+ TEST_COMPARE (st.stx_size, strlen ("Hello, world!"));
+ }
+
+ printf ("info: Read from %s\n", file_path);
+ {
+ int fd = xopen (file_path, O_RDONLY, 0);
+ char buf[64];
+ ssize_t len = read (fd, buf, sizeof (buf));
+ if (len < 0)
+ FAIL_EXIT1 ("read: %m");
+ TEST_COMPARE_BLOB (buf, len, "Hello, world!", strlen ("Hello, world!"));
+ xclose (fd);
+ }
+
+ printf ("info: Write to %s\n", file_path);
+ {
+ int fd = xopen (file_path, O_WRONLY | O_TRUNC, 0);
+ xwrite (fd, "Good day to you too.", strlen ("Good day to you too."));
+ xclose (fd);
+ }
+
+ printf ("info: Attempt O_EXCL creation of existing %s\n", file_path);
+ /* O_EXCL creation shall fail. */
+ errno = 0;
+ TEST_COMPARE (open64 (file_path, O_RDWR | O_EXCL | O_CREAT, 0600), -1);
+ TEST_COMPARE (errno, EEXIST);
+
+ free (file_path);
+
+ {
+ char *new_path = xasprintf ("%s/new", support_fuse_mountpoint (f));
+ printf ("info: Test successful O_EXCL creation at %s\n", new_path);
+ int fd = xopen (new_path, O_RDWR | O_EXCL | O_CREAT, 0600);
+ xclose (fd);
+ free (new_path);
+ }
+
+ {
+ char *subdir_path = xasprintf ("%s/subdir", support_fuse_mountpoint (f));
+ xmkdir (subdir_path, 01234);
+ free (subdir_path);
+ }
+
+ {
+ char *symlink_path = xasprintf ("%s/symlink", support_fuse_mountpoint (f));
+ char *target = xreadlink (symlink_path);
+ TEST_COMPARE_STRING (target, "target-of-symbolic-link");
+ free (target);
+ free (symlink_path);
+ }
+
+ support_fuse_unmount (f);
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/support/tst-support_quote_blob.c b/support/tst-support_quote_blob.c
index 1e17e67..d731c74 100644
--- a/support/tst-support_quote_blob.c
+++ b/support/tst-support_quote_blob.c
@@ -1,5 +1,5 @@
/* Test the support_quote_blob function.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_quote_blob_wide.c b/support/tst-support_quote_blob_wide.c
index b3fea26..d3591a4 100644
--- a/support/tst-support_quote_blob_wide.c
+++ b/support/tst-support_quote_blob_wide.c
@@ -1,5 +1,5 @@
/* Test the support_quote_blob_wide function.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_quote_string.c b/support/tst-support_quote_string.c
index 57fbb6b..dec96c2 100644
--- a/support/tst-support_quote_string.c
+++ b/support/tst-support_quote_string.c
@@ -1,5 +1,5 @@
/* Test the support_quote_string function.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_readdir.c b/support/tst-support_readdir.c
new file mode 100644
index 0000000..bd2c8fb
--- /dev/null
+++ b/support/tst-support_readdir.c
@@ -0,0 +1,73 @@
+/* Test the support_readdir function.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/readdir.h>
+
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <support/check.h>
+#include <support/xdirent.h>
+#include <support/xunistd.h>
+
+static int
+do_test (void)
+{
+ DIR *reference_stream = xopendir (".");
+ struct dirent64 *reference = xreaddir64 (reference_stream);
+
+ for (enum support_readdir_op op = 0; op <= support_readdir_op_last (); ++op)
+ {
+ DIR *stream = xopendir (".");
+ struct support_dirent e;
+ memset (&e, 0xcc, sizeof (e));
+ e.d_name = NULL;
+ TEST_VERIFY (support_readdir (stream, op, &e));
+ TEST_COMPARE (e.d_ino, reference->d_ino);
+#ifdef _DIRENT_HAVE_D_OFF
+ TEST_VERIFY (support_readdir_offset_width (op) != 0);
+ TEST_COMPARE (e.d_off, reference->d_off);
+#else
+ TEST_COMPARE (support_readdir_offset_width (op), 0);
+ TEST_COMPARE (e.d_off, 0);
+#endif
+ TEST_COMPARE (e.d_type, reference->d_type);
+ TEST_COMPARE_STRING (e.d_name, reference->d_name);
+ free (e.d_name);
+ xclosedir (stream);
+ }
+
+ xclosedir (reference_stream);
+
+ /* Error injection test. */
+ int devnull = xopen ("/dev/null", O_RDONLY, 0);
+ for (enum support_readdir_op op = 0; op <= support_readdir_op_last (); ++op)
+ {
+ DIR *stream = xopendir (".");
+ /* A descriptor incompatible with readdir. */
+ xdup2 (devnull, dirfd (stream));
+ errno = -1;
+ support_readdir_expect_error (stream, op, ENOTDIR);
+ xclosedir (stream);
+ }
+ xclose (devnull);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/support/tst-support_record_failure-2.sh b/support/tst-support_record_failure-2.sh
index a6751bb..048acd5 100644
--- a/support/tst-support_record_failure-2.sh
+++ b/support/tst-support_record_failure-2.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Test failure recording (with and without --direct).
-# Copyright (C) 2016-2024 Free Software Foundation, Inc.
+# Copyright (C) 2016-2025 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-support_record_failure.c b/support/tst-support_record_failure.c
index d8f8343..fa40ed9 100644
--- a/support/tst-support_record_failure.c
+++ b/support/tst-support_record_failure.c
@@ -1,5 +1,5 @@
/* Test support_record_failure state sharing.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-test_compare.c b/support/tst-test_compare.c
index 779a9e9..390fcf3 100644
--- a/support/tst-test_compare.c
+++ b/support/tst-test_compare.c
@@ -1,5 +1,5 @@
/* Basic test for the TEST_COMPARE macro.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-test_compare_blob.c b/support/tst-test_compare_blob.c
index 9c1484a..a2043b1 100644
--- a/support/tst-test_compare_blob.c
+++ b/support/tst-test_compare_blob.c
@@ -1,5 +1,5 @@
/* Basic test for the TEST_COMPARE_BLOB macro.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-test_compare_string.c b/support/tst-test_compare_string.c
index b966734..96238e7 100644
--- a/support/tst-test_compare_string.c
+++ b/support/tst-test_compare_string.c
@@ -1,5 +1,5 @@
/* Basic test for the TEST_COMPARE_STRING macro.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-test_compare_string_wide.c b/support/tst-test_compare_string_wide.c
index b7978a2..ca19b8b 100644
--- a/support/tst-test_compare_string_wide.c
+++ b/support/tst-test_compare_string_wide.c
@@ -1,5 +1,5 @@
/* Basic test for the TEST_COMPARE_STRING_WIDE macro.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-timespec.c b/support/tst-timespec.c
index 66fc42c..3c960b6 100644
--- a/support/tst-timespec.c
+++ b/support/tst-timespec.c
@@ -1,5 +1,5 @@
/* Test for support_timespec_check_in_range function.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -287,7 +287,7 @@ struct timespec_test_case check_cases[] = {
{.expected = {.tv_sec = 0, .tv_nsec = 1},
.observed = {.tv_sec = TIME_T_MAX / TIMESPEC_HZ,
.tv_nsec = TIMESPEC_HZ - 1},
- .upper_bound = TIME_T_MAX, .lower_bound = 1, .result = 1,
+ .upper_bound = (double) TIME_T_MAX, .lower_bound = 1, .result = 1,
},
};
diff --git a/support/tst-xdirent.c b/support/tst-xdirent.c
new file mode 100644
index 0000000..d2aa042
--- /dev/null
+++ b/support/tst-xdirent.c
@@ -0,0 +1,80 @@
+/* Compile test for error-checking wrappers for <dirent.h>
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <libc-diag.h>
+#include <support/check.h>
+#include <unistd.h>
+
+static int
+do_test (void)
+{
+ {
+ DIR *d = xopendir (".");
+ struct dirent *e = xreaddir (d);
+ /* Assume that the "." special entry always comes first. */
+ TEST_COMPARE_STRING (e->d_name, ".");
+ while (xreaddir (d) != NULL)
+ ;
+ xclosedir (d);
+ }
+
+ {
+ DIR *d = xopendir (".");
+ struct dirent64 *e = xreaddir64 (d);
+ TEST_COMPARE_STRING (e->d_name, ".");
+ while (xreaddir64 (d) != NULL)
+ ;
+ xclosedir (d);
+ }
+
+ /* The functions readdir_r, readdir64_r were deprecated in glibc 2.24. */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+ {
+ DIR *d = xopendir (".");
+ union
+ {
+ struct dirent d;
+ char b[offsetof (struct dirent, d_name) + NAME_MAX + 1];
+ } buf;
+ TEST_VERIFY (xreaddir_r (d, &buf.d));
+ TEST_COMPARE_STRING (buf.d.d_name, ".");
+ while (xreaddir_r (d, &buf.d))
+ ;
+ xclosedir (d);
+ }
+
+ {
+ DIR *d = xopendir (".");
+ struct dirent64 buf = { 0, };
+ TEST_VERIFY (xreaddir64_r (d, &buf));
+ TEST_COMPARE_STRING (buf.d_name, ".");
+ while (xreaddir64_r (d, &buf))
+ ;
+ xclosedir (d);
+ }
+
+ DIAG_POP_NEEDS_COMMENT;
+
+ return 0;
+}
+
+#include <support/test-driver.c>
diff --git a/support/tst-xreadlink.c b/support/tst-xreadlink.c
index fbd09d1..5f5e6fb 100644
--- a/support/tst-xreadlink.c
+++ b/support/tst-xreadlink.c
@@ -1,5 +1,5 @@
/* Test the xreadlink function.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tst-xsigstack.c b/support/tst-xsigstack.c
index 0624c56..195b686 100644
--- a/support/tst-xsigstack.c
+++ b/support/tst-xsigstack.c
@@ -1,5 +1,5 @@
/* Test of sigaltstack wrappers.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/tty.h b/support/tty.h
index 8abe0da..5e4483c 100644
--- a/support/tty.h
+++ b/support/tty.h
@@ -1,5 +1,5 @@
/* Support functions related to (pseudo)terminals.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/write_message.c b/support/write_message.c
index 6974f12..1668773 100644
--- a/support/write_message.c
+++ b/support/write_message.c
@@ -1,5 +1,5 @@
/* Write a message to standard output.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xaccept.c b/support/xaccept.c
index b8cfbf4..2439db3 100644
--- a/support/xaccept.c
+++ b/support/xaccept.c
@@ -1,5 +1,5 @@
/* accept with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xaccept4.c b/support/xaccept4.c
index cff4f4a..e5f85cc 100644
--- a/support/xaccept4.c
+++ b/support/xaccept4.c
@@ -1,5 +1,5 @@
/* accept4 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xasprintf.c b/support/xasprintf.c
index b0f2edb..a71ad19 100644
--- a/support/xasprintf.c
+++ b/support/xasprintf.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for asprintf.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xbind.c b/support/xbind.c
index 3729d01..969b02d 100644
--- a/support/xbind.c
+++ b/support/xbind.c
@@ -1,5 +1,5 @@
/* bind with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xcalloc.c b/support/xcalloc.c
index 3b28ed7..e3cba69 100644
--- a/support/xcalloc.c
+++ b/support/xcalloc.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for calloc.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xchdir.c b/support/xchdir.c
index 6cfeb03..4d641ce 100644
--- a/support/xchdir.c
+++ b/support/xchdir.c
@@ -1,5 +1,5 @@
/* chdir with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xchmod.c b/support/xchmod.c
index f37ed76..c82f767 100644
--- a/support/xchmod.c
+++ b/support/xchmod.c
@@ -1,5 +1,5 @@
/* chmod with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xchroot.c b/support/xchroot.c
index 33c9d62..7f48586 100644
--- a/support/xchroot.c
+++ b/support/xchroot.c
@@ -1,5 +1,5 @@
/* chroot with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclock_gettime.c b/support/xclock_gettime.c
index 595d76b..0d4f4d9 100644
--- a/support/xclock_gettime.c
+++ b/support/xclock_gettime.c
@@ -1,5 +1,5 @@
/* clock_gettime with error checking.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclock_gettime_time64.c b/support/xclock_gettime_time64.c
index 6f6ba14..fd5cf06 100644
--- a/support/xclock_gettime_time64.c
+++ b/support/xclock_gettime_time64.c
@@ -1,5 +1,5 @@
/* clock_settime with error checking. 64-bit time_t support.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclock_settime.c b/support/xclock_settime.c
index ebcae04..13114b9 100644
--- a/support/xclock_settime.c
+++ b/support/xclock_settime.c
@@ -1,5 +1,5 @@
/* clock_settime with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclock_settime_time64.c b/support/xclock_settime_time64.c
index b4c0a7f..c49eb13 100644
--- a/support/xclock_settime_time64.c
+++ b/support/xclock_settime_time64.c
@@ -1,5 +1,5 @@
/* clock_settime helper with error checking - 64-bit time_t support.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclone.c b/support/xclone.c
index 074aac4..0bfd10e 100644
--- a/support/xclone.c
+++ b/support/xclone.c
@@ -1,5 +1,5 @@
/* Auxiliary functions to issue the clone syscall.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclose.c b/support/xclose.c
index 25719645..d9acec5 100644
--- a/support/xclose.c
+++ b/support/xclose.c
@@ -1,5 +1,5 @@
/* close with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xclosedir.c b/support/xclosedir.c
new file mode 100644
index 0000000..0eea8a6
--- /dev/null
+++ b/support/xclosedir.c
@@ -0,0 +1,28 @@
+/* Error-checking wrapper for closedir.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+void
+xclosedir (DIR *dir)
+{
+ if (closedir (dir) != 0)
+ FAIL_EXIT1 ("closedir: %m");
+}
diff --git a/support/xconnect.c b/support/xconnect.c
index 397caa3..bd8381a 100644
--- a/support/xconnect.c
+++ b/support/xconnect.c
@@ -1,5 +1,5 @@
/* connect with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xcopy_file_range.c b/support/xcopy_file_range.c
index 1e1d8b2..6659945 100644
--- a/support/xcopy_file_range.c
+++ b/support/xcopy_file_range.c
@@ -1,5 +1,5 @@
/* copy_file_range with error checking.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xdirent.h b/support/xdirent.h
new file mode 100644
index 0000000..4feb0c2
--- /dev/null
+++ b/support/xdirent.h
@@ -0,0 +1,86 @@
+/* Error-checking wrappers for <dirent.h>
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#ifndef SUPPORT_XDIRENT_H
+#define SUPPORT_XDIRENT_H
+
+#include <dirent.h>
+#include <errno.h>
+#include <libc-diag.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+__BEGIN_DECLS
+
+DIR *xopendir (const char *path);
+DIR *xfdopendir (int fd);
+void xclosedir (DIR *);
+
+void *support_readdir_check (const char *, void *, int);
+
+static __attribute__ ((unused)) struct dirent *
+xreaddir (DIR *stream)
+{
+ int saved_errno = errno;
+ errno = 0;
+ struct dirent *result = readdir (stream);
+ return support_readdir_check ("readdir", result, saved_errno);
+}
+
+static __attribute__ ((unused)) struct dirent64 *
+xreaddir64 (DIR *stream)
+{
+ int saved_errno = errno;
+ errno = 0;
+ struct dirent64 *result = readdir64 (stream);
+ return support_readdir_check ("readdir64", result, saved_errno);
+}
+
+/* The functions readdir_r, readdir64_r were deprecated in glibc 2.24. */
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
+
+int support_readdir_r_check (const char *, int, void *, void *);
+
+static __attribute__ ((unused)) bool
+xreaddir_r (DIR *stream, struct dirent *buf)
+{
+ struct dirent *ptr;
+ int ret = readdir_r (stream, buf, &ptr);
+ if (ret == 0 && ptr == NULL)
+ return false;
+ support_readdir_r_check ("readdir_r", ret, buf, ptr);
+ return true;
+}
+
+static __attribute__ ((unused)) bool
+xreaddir64_r (DIR *stream, struct dirent64 *buf)
+{
+ struct dirent64 *ptr;
+ int ret = readdir64_r (stream, buf, &ptr);
+ if (ret == 0 && ptr == NULL)
+ return false;
+ support_readdir_r_check ("readdir64_r", ret, buf, ptr);
+ return true;
+}
+
+DIAG_POP_NEEDS_COMMENT;
+
+__END_DECLS
+
+#endif /* SUPPORT_XDIRENT_H */
diff --git a/support/xdlfcn.c b/support/xdlfcn.c
index baea7ce..b208173 100644
--- a/support/xdlfcn.c
+++ b/support/xdlfcn.c
@@ -1,5 +1,5 @@
/* Support functionality for using dlopen/dlclose/dlsym.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xdlfcn.h b/support/xdlfcn.h
index ea51410..f54caab 100644
--- a/support/xdlfcn.h
+++ b/support/xdlfcn.h
@@ -1,5 +1,5 @@
/* Support functionality for using dlopen/dlclose/dlsym.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xdlmopen.c b/support/xdlmopen.c
index 46f28bf..3181676 100644
--- a/support/xdlmopen.c
+++ b/support/xdlmopen.c
@@ -1,5 +1,5 @@
/* dlmopen with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support-xfstat.c b/support/xdup.c
index ab4b01c..1eab317 100644
--- a/support/support-xfstat.c
+++ b/support/xdup.c
@@ -1,5 +1,5 @@
-/* fstat64 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+/* dup with error checking.
+ Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,13 +16,15 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-#include <support/check.h>
#include <support/xunistd.h>
-#include <sys/stat.h>
+#include <support/check.h>
-void
-xfstat (int fd, struct stat64 *result)
+int
+xdup (int from)
{
- if (fstat64 (fd, result) != 0)
- FAIL_EXIT1 ("fstat64 (%d): %m", fd);
+ int ret = dup (from);
+ if (ret < 0)
+ FAIL_EXIT1 ("dup (%d): %m", from);
+
+ return ret;
}
diff --git a/support/xdup2.c b/support/xdup2.c
index 8f843cb..5c2b443 100644
--- a/support/xdup2.c
+++ b/support/xdup2.c
@@ -1,5 +1,5 @@
/* dup2 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfchmod.c b/support/xfchmod.c
index 34b9e40..b7ec9ab 100644
--- a/support/xfchmod.c
+++ b/support/xfchmod.c
@@ -1,5 +1,5 @@
/* fchmod with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfclose.c b/support/xfclose.c
index b3bc911..87e333b 100644
--- a/support/xfclose.c
+++ b/support/xfclose.c
@@ -1,5 +1,5 @@
/* fclose with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfdopendir.c b/support/xfdopendir.c
new file mode 100644
index 0000000..0b749b6
--- /dev/null
+++ b/support/xfdopendir.c
@@ -0,0 +1,30 @@
+/* Error-checking wrapper for fdopendir.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+DIR *
+xfdopendir (int fd)
+{
+ DIR *result = fdopendir (fd);
+ if (result == NULL)
+ FAIL_EXIT1 ("fdopendir (%d): %m", fd);
+ return result;
+}
diff --git a/support/xfgets.c b/support/xfgets.c
index 921cc00..f11e2d2 100644
--- a/support/xfgets.c
+++ b/support/xfgets.c
@@ -1,5 +1,5 @@
/* fgets with error checking.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfopen.c b/support/xfopen.c
index 04bdd3d..a5462a1 100644
--- a/support/xfopen.c
+++ b/support/xfopen.c
@@ -1,5 +1,5 @@
/* fopen with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfork.c b/support/xfork.c
index 10e87a6..d4ceb3e 100644
--- a/support/xfork.c
+++ b/support/xfork.c
@@ -1,5 +1,5 @@
/* fork with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfread.c b/support/xfread.c
index b4b755b..9d297a8 100644
--- a/support/xfread.c
+++ b/support/xfread.c
@@ -1,5 +1,5 @@
/* fread with error checking.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xfreopen.c b/support/xfreopen.c
index f6cb32b..2a84b54 100644
--- a/support/xfreopen.c
+++ b/support/xfreopen.c
@@ -1,5 +1,5 @@
/* freopen with error checking.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xftruncate.c b/support/xftruncate.c
index c8a0544..4b6e442 100644
--- a/support/xftruncate.c
+++ b/support/xftruncate.c
@@ -1,5 +1,5 @@
/* ftruncate with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xgetline.c b/support/xgetline.c
index ad828a9..656b09f 100644
--- a/support/xgetline.c
+++ b/support/xgetline.c
@@ -1,5 +1,5 @@
/* fopen with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xgetpeername.c b/support/xgetpeername.c
index 6f448e4..e840394 100644
--- a/support/xgetpeername.c
+++ b/support/xgetpeername.c
@@ -1,5 +1,5 @@
/* getpeername with error checking.
- Copyright (C) 2024 Free Software Foundation, Inc.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xgetsockname.c b/support/xgetsockname.c
index 7848046..96db176 100644
--- a/support/xgetsockname.c
+++ b/support/xgetsockname.c
@@ -1,5 +1,5 @@
/* getsockname with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
diff --git a/support/xlisten.c b/support/xlisten.c
index 64d0eeb..55a8efa 100644
--- a/support/xlisten.c
+++ b/support/xlisten.c
@@ -1,5 +1,5 @@
/* listen with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xlseek.c b/support/xlseek.c
index 39e5f7c..67b7826 100644
--- a/support/xlseek.c
+++ b/support/xlseek.c
@@ -1,5 +1,5 @@
/* lseek with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmalloc.c b/support/xmalloc.c
index a90bbe9..1bae53b 100644
--- a/support/xmalloc.c
+++ b/support/xmalloc.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for malloc.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmemstream.c b/support/xmemstream.c
index 17139f1..f2d93ee 100644
--- a/support/xmemstream.c
+++ b/support/xmemstream.c
@@ -1,5 +1,5 @@
/* Error-checking wrappers for memstream functions.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmemstream.h b/support/xmemstream.h
index 3cb4321..f6450b6 100644
--- a/support/xmemstream.h
+++ b/support/xmemstream.h
@@ -1,5 +1,5 @@
/* Error-checking wrappers for memstream functions.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmkdir.c b/support/xmkdir.c
index 1a67cdc..bf61f90 100644
--- a/support/xmkdir.c
+++ b/support/xmkdir.c
@@ -1,5 +1,5 @@
/* mkdir with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmkdirp.c b/support/xmkdirp.c
index c984f3a..68b913f 100644
--- a/support/xmkdirp.c
+++ b/support/xmkdirp.c
@@ -1,5 +1,5 @@
/* Error-checking replacement for "mkdir -p".
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmkfifo.c b/support/xmkfifo.c
index 9166961..7a5d5ed 100644
--- a/support/xmkfifo.c
+++ b/support/xmkfifo.c
@@ -1,5 +1,5 @@
/* mkfifo with error checking.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmmap.c b/support/xmmap.c
index acec28f..f19880c 100644
--- a/support/xmmap.c
+++ b/support/xmmap.c
@@ -1,5 +1,5 @@
/* mmap with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmprotect.c b/support/xmprotect.c
index 961d75b..be29127 100644
--- a/support/xmprotect.c
+++ b/support/xmprotect.c
@@ -1,5 +1,5 @@
/* mprotect with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xmunmap.c b/support/xmunmap.c
index bcef6ff..148843f 100644
--- a/support/xmunmap.c
+++ b/support/xmunmap.c
@@ -1,5 +1,5 @@
/* munmap with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xnewlocale.c b/support/xnewlocale.c
index afb2522..72e247c 100644
--- a/support/xnewlocale.c
+++ b/support/xnewlocale.c
@@ -1,5 +1,5 @@
/* newlocale with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xopen.c b/support/xopen.c
index e1a454b..4fd280a 100644
--- a/support/xopen.c
+++ b/support/xopen.c
@@ -1,5 +1,5 @@
/* open64 with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xopendir.c b/support/xopendir.c
new file mode 100644
index 0000000..43b53a9
--- /dev/null
+++ b/support/xopendir.c
@@ -0,0 +1,30 @@
+/* Error-checking wrapper for opendir.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
+
+#include <support/xdirent.h>
+
+#include <support/check.h>
+
+DIR *
+xopendir (const char *path)
+{
+ DIR *result = opendir (path);
+ if (result == NULL)
+ FAIL_EXIT1 ("opendir (\"%s\"): %m", path);
+ return result;
+}
diff --git a/support/xpipe.c b/support/xpipe.c
index ae65092..19dccb1 100644
--- a/support/xpipe.c
+++ b/support/xpipe.c
@@ -1,5 +1,5 @@
/* pipe with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpoll.c b/support/xpoll.c
index eb78948..cc0067f 100644
--- a/support/xpoll.c
+++ b/support/xpoll.c
@@ -1,5 +1,5 @@
/* poll with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xposix_memalign.c b/support/xposix_memalign.c
index e5cdb9b..d746bd1 100644
--- a/support/xposix_memalign.c
+++ b/support/xposix_memalign.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for posix_memalign.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xposix_spawn.c b/support/xposix_spawn.c
index 1ae0c59..9875106 100644
--- a/support/xposix_spawn.c
+++ b/support/xposix_spawn.c
@@ -1,5 +1,5 @@
/* xposix_spawn implementation.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xposix_spawn_file_actions_addclose.c b/support/xposix_spawn_file_actions_addclose.c
index 0daa163..0d103ff 100644
--- a/support/xposix_spawn_file_actions_addclose.c
+++ b/support/xposix_spawn_file_actions_addclose.c
@@ -1,5 +1,5 @@
/* xposix_spawn_file_actions_addclose implementation.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xposix_spawn_file_actions_adddup2.c b/support/xposix_spawn_file_actions_adddup2.c
index 2850bc6..cbdf018 100644
--- a/support/xposix_spawn_file_actions_adddup2.c
+++ b/support/xposix_spawn_file_actions_adddup2.c
@@ -1,5 +1,5 @@
/* xposix_spawn_file_actions_adddup2 implementation.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_destroy.c b/support/xpthread_attr_destroy.c
index f031a7c..15983ef 100644
--- a/support/xpthread_attr_destroy.c
+++ b/support/xpthread_attr_destroy.c
@@ -1,5 +1,5 @@
/* pthread_attr_destroy with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_init.c b/support/xpthread_attr_init.c
index 49a4556..833ec04 100644
--- a/support/xpthread_attr_init.c
+++ b/support/xpthread_attr_init.c
@@ -1,5 +1,5 @@
/* pthread_attr_init with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_setaffinity_np.c b/support/xpthread_attr_setaffinity_np.c
index e5b9d58..0947c32 100644
--- a/support/xpthread_attr_setaffinity_np.c
+++ b/support/xpthread_attr_setaffinity_np.c
@@ -1,5 +1,5 @@
/* pthread_attr_setaffinity_np with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_setdetachstate.c b/support/xpthread_attr_setdetachstate.c
index d0c6ea6..d0ecd7c 100644
--- a/support/xpthread_attr_setdetachstate.c
+++ b/support/xpthread_attr_setdetachstate.c
@@ -1,5 +1,5 @@
/* pthread_attr_setdetachstate with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_setguardsize.c b/support/xpthread_attr_setguardsize.c
index b3461cf..54e0982 100644
--- a/support/xpthread_attr_setguardsize.c
+++ b/support/xpthread_attr_setguardsize.c
@@ -1,5 +1,5 @@
/* pthread_attr_setguardsize with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_setstack.c b/support/xpthread_attr_setstack.c
index 9a4e1d4..6453729 100644
--- a/support/xpthread_attr_setstack.c
+++ b/support/xpthread_attr_setstack.c
@@ -1,5 +1,5 @@
/* pthread_attr_setstack with error checking.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_attr_setstacksize.c b/support/xpthread_attr_setstacksize.c
index a0b1ff9..7e158d0 100644
--- a/support/xpthread_attr_setstacksize.c
+++ b/support/xpthread_attr_setstacksize.c
@@ -1,5 +1,5 @@
/* pthread_attr_setstacksize with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_barrier_destroy.c b/support/xpthread_barrier_destroy.c
index 4d20b97..33176f9 100644
--- a/support/xpthread_barrier_destroy.c
+++ b/support/xpthread_barrier_destroy.c
@@ -1,5 +1,5 @@
/* pthread_barrier_destroy with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_barrier_init.c b/support/xpthread_barrier_init.c
index d957deb..566172e 100644
--- a/support/xpthread_barrier_init.c
+++ b/support/xpthread_barrier_init.c
@@ -1,5 +1,5 @@
/* pthread_barrier_init with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_barrier_wait.c b/support/xpthread_barrier_wait.c
index 4c65d99..bc5f1f5 100644
--- a/support/xpthread_barrier_wait.c
+++ b/support/xpthread_barrier_wait.c
@@ -1,5 +1,5 @@
/* pthread_barrier_wait with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_barrierattr_destroy.c b/support/xpthread_barrierattr_destroy.c
index 4e51b1b..93412c5 100644
--- a/support/xpthread_barrierattr_destroy.c
+++ b/support/xpthread_barrierattr_destroy.c
@@ -1,5 +1,5 @@
/* pthread_barrierattr_destroy with error checking.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_barrierattr_init.c b/support/xpthread_barrierattr_init.c
index 9dad164..b58c928 100644
--- a/support/xpthread_barrierattr_init.c
+++ b/support/xpthread_barrierattr_init.c
@@ -1,5 +1,5 @@
/* pthread_barrierattr_init with error checking.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_barrierattr_setpshared.c b/support/xpthread_barrierattr_setpshared.c
index daabfa2..6b87f37 100644
--- a/support/xpthread_barrierattr_setpshared.c
+++ b/support/xpthread_barrierattr_setpshared.c
@@ -1,5 +1,5 @@
/* pthread_barrierattr_setpshared with error checking.
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_cancel.c b/support/xpthread_cancel.c
index afec13f..532d6d3 100644
--- a/support/xpthread_cancel.c
+++ b/support/xpthread_cancel.c
@@ -1,5 +1,5 @@
/* pthread_cancel with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_check_return.c b/support/xpthread_check_return.c
index b9737b8..3b004ff 100644
--- a/support/xpthread_check_return.c
+++ b/support/xpthread_check_return.c
@@ -1,5 +1,5 @@
/* Return value checking for pthread functions, exit variant.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_cond_signal.c b/support/xpthread_cond_signal.c
index 62770d0..b8a9161 100644
--- a/support/xpthread_cond_signal.c
+++ b/support/xpthread_cond_signal.c
@@ -1,5 +1,5 @@
/* pthread_cond_signal with error checking.
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_cond_wait.c b/support/xpthread_cond_wait.c
index 5a0c2f1..7bd08e6 100644
--- a/support/xpthread_cond_wait.c
+++ b/support/xpthread_cond_wait.c
@@ -1,5 +1,5 @@
/* pthread_cond_wait with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_create.c b/support/xpthread_create.c
index 1250929..ae8f3a6 100644
--- a/support/xpthread_create.c
+++ b/support/xpthread_create.c
@@ -1,5 +1,5 @@
/* pthread_create with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_detach.c b/support/xpthread_detach.c
index cd3a270..cf8fff2 100644
--- a/support/xpthread_detach.c
+++ b/support/xpthread_detach.c
@@ -1,5 +1,5 @@
/* pthread_detach with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_join.c b/support/xpthread_join.c
index 2d49775..54403d0 100644
--- a/support/xpthread_join.c
+++ b/support/xpthread_join.c
@@ -1,5 +1,5 @@
/* pthread_join with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_key_create.c b/support/xpthread_key_create.c
index a7b594b..0391f77 100644
--- a/support/xpthread_key_create.c
+++ b/support/xpthread_key_create.c
@@ -1,5 +1,5 @@
/* pthread_key_create with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/support/xpthread_key_delete.c b/support/xpthread_key_delete.c
index c11702d..0712f80 100644
--- a/support/xpthread_key_delete.c
+++ b/support/xpthread_key_delete.c
@@ -1,5 +1,5 @@
/* pthread_key_delete with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
diff --git a/support/xpthread_kill.c b/support/xpthread_kill.c
index 0ad9191..f9d08d6 100644
--- a/support/xpthread_kill.c
+++ b/support/xpthread_kill.c
@@ -1,5 +1,5 @@
/* pthread_kill with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutex_consistent.c b/support/xpthread_mutex_consistent.c
index ed8bc3f..00ce935 100644
--- a/support/xpthread_mutex_consistent.c
+++ b/support/xpthread_mutex_consistent.c
@@ -1,5 +1,5 @@
/* pthread_mutex_consistent with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutex_destroy.c b/support/xpthread_mutex_destroy.c
index 2c65517..b326755 100644
--- a/support/xpthread_mutex_destroy.c
+++ b/support/xpthread_mutex_destroy.c
@@ -1,5 +1,5 @@
/* pthread_mutex_destroy with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutex_init.c b/support/xpthread_mutex_init.c
index 1059460..c1a3942 100644
--- a/support/xpthread_mutex_init.c
+++ b/support/xpthread_mutex_init.c
@@ -1,5 +1,5 @@
/* pthread_mutex_init with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutex_lock.c b/support/xpthread_mutex_lock.c
index 109bc93..97aca50 100644
--- a/support/xpthread_mutex_lock.c
+++ b/support/xpthread_mutex_lock.c
@@ -1,5 +1,5 @@
/* pthread_mutex_lock with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutex_unlock.c b/support/xpthread_mutex_unlock.c
index 20dd055..f29cb40 100644
--- a/support/xpthread_mutex_unlock.c
+++ b/support/xpthread_mutex_unlock.c
@@ -1,5 +1,5 @@
/* pthread_mutex_unlock with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutexattr_destroy.c b/support/xpthread_mutexattr_destroy.c
index 25cdec4..24bdbff1 100644
--- a/support/xpthread_mutexattr_destroy.c
+++ b/support/xpthread_mutexattr_destroy.c
@@ -1,5 +1,5 @@
/* pthread_mutexattr_destroy with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutexattr_init.c b/support/xpthread_mutexattr_init.c
index 36e5bfb..305b7ab 100644
--- a/support/xpthread_mutexattr_init.c
+++ b/support/xpthread_mutexattr_init.c
@@ -1,5 +1,5 @@
/* pthread_mutexattr_init with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutexattr_setprotocol.c b/support/xpthread_mutexattr_setprotocol.c
index 2e967a3..ce6b98d 100644
--- a/support/xpthread_mutexattr_setprotocol.c
+++ b/support/xpthread_mutexattr_setprotocol.c
@@ -1,5 +1,5 @@
/* pthread_mutexattr_setprotocol with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutexattr_setpshared.c b/support/xpthread_mutexattr_setpshared.c
index 19f4d0a..5fb4fbf 100644
--- a/support/xpthread_mutexattr_setpshared.c
+++ b/support/xpthread_mutexattr_setpshared.c
@@ -1,5 +1,5 @@
/* pthread_mutexattr_setpshared with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutexattr_setrobust.c b/support/xpthread_mutexattr_setrobust.c
index 0ee5f20..6b2397f 100644
--- a/support/xpthread_mutexattr_setrobust.c
+++ b/support/xpthread_mutexattr_setrobust.c
@@ -1,5 +1,5 @@
/* pthread_mutexattr_setrobust with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_mutexattr_settype.c b/support/xpthread_mutexattr_settype.c
index a974572..929dd91 100644
--- a/support/xpthread_mutexattr_settype.c
+++ b/support/xpthread_mutexattr_settype.c
@@ -1,5 +1,5 @@
/* pthread_mutexattr_settype with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_once.c b/support/xpthread_once.c
index d995119..f72212c 100644
--- a/support/xpthread_once.c
+++ b/support/xpthread_once.c
@@ -1,5 +1,5 @@
/* pthread_once with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlock_destroy.c b/support/xpthread_rwlock_destroy.c
index 9d8098a..aa6a045 100644
--- a/support/xpthread_rwlock_destroy.c
+++ b/support/xpthread_rwlock_destroy.c
@@ -1,5 +1,5 @@
/* pthread_rwlock_destroy with error checking.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlock_init.c b/support/xpthread_rwlock_init.c
index aeb34cd..ac20c7f 100644
--- a/support/xpthread_rwlock_init.c
+++ b/support/xpthread_rwlock_init.c
@@ -1,5 +1,5 @@
/* pthread_rwlock_init with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlock_rdlock.c b/support/xpthread_rwlock_rdlock.c
index 26e79a1..b988f58 100644
--- a/support/xpthread_rwlock_rdlock.c
+++ b/support/xpthread_rwlock_rdlock.c
@@ -1,5 +1,5 @@
/* pthread_rwlock_rdlock with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlock_unlock.c b/support/xpthread_rwlock_unlock.c
index d92fd2b..fc7f76a 100644
--- a/support/xpthread_rwlock_unlock.c
+++ b/support/xpthread_rwlock_unlock.c
@@ -1,5 +1,5 @@
/* pthread_rwlock_unlock with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlock_wrlock.c b/support/xpthread_rwlock_wrlock.c
index eda9785..09d2fac 100644
--- a/support/xpthread_rwlock_wrlock.c
+++ b/support/xpthread_rwlock_wrlock.c
@@ -1,5 +1,5 @@
/* pthread_rwlock_wrlock with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlockattr_init.c b/support/xpthread_rwlockattr_init.c
index 3b2bb16..c852b96 100644
--- a/support/xpthread_rwlockattr_init.c
+++ b/support/xpthread_rwlockattr_init.c
@@ -1,5 +1,5 @@
/* pthread_rwlockattr_init with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_rwlockattr_setkind_np.c b/support/xpthread_rwlockattr_setkind_np.c
index 1d5c811..768ae69 100644
--- a/support/xpthread_rwlockattr_setkind_np.c
+++ b/support/xpthread_rwlockattr_setkind_np.c
@@ -1,5 +1,5 @@
/* pthread_rwlockattr_setkind_np with error checking.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_sigmask.c b/support/xpthread_sigmask.c
index 6835976..1cab55a 100644
--- a/support/xpthread_sigmask.c
+++ b/support/xpthread_sigmask.c
@@ -1,5 +1,5 @@
/* pthread_sigmask with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_spin_lock.c b/support/xpthread_spin_lock.c
index c2e45af..4965360 100644
--- a/support/xpthread_spin_lock.c
+++ b/support/xpthread_spin_lock.c
@@ -1,5 +1,5 @@
/* pthread_spin_lock with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xpthread_spin_unlock.c b/support/xpthread_spin_unlock.c
index 6a66345..88701be 100644
--- a/support/xpthread_spin_unlock.c
+++ b/support/xpthread_spin_unlock.c
@@ -1,5 +1,5 @@
/* pthread_spin_unlock with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xptrace.h b/support/xptrace.h
index d88f26d..67191c9 100644
--- a/support/xptrace.h
+++ b/support/xptrace.h
@@ -1,5 +1,5 @@
/* Support functions handling ptrace_scope.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xraise.c b/support/xraise.c
index b0b4e00..7b3c3a7 100644
--- a/support/xraise.c
+++ b/support/xraise.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for raise.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xread.c b/support/xread.c
index 87085f3..e406c3a 100644
--- a/support/xread.c
+++ b/support/xread.c
@@ -1,5 +1,5 @@
/* read with error checking and retries.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xreadlink.c b/support/xreadlink.c
index 59dc435..ba6d95f 100644
--- a/support/xreadlink.c
+++ b/support/xreadlink.c
@@ -1,5 +1,5 @@
/* Error-checking, allocating wrapper for readlink.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xrealloc.c b/support/xrealloc.c
index 87238f8..c988541 100644
--- a/support/xrealloc.c
+++ b/support/xrealloc.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for realloc.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xrecvfrom.c b/support/xrecvfrom.c
index 22892ae..59700ef 100644
--- a/support/xrecvfrom.c
+++ b/support/xrecvfrom.c
@@ -1,5 +1,5 @@
/* recvfrom with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsched.h b/support/xsched.h
index 9740076..db19875 100644
--- a/support/xsched.h
+++ b/support/xsched.h
@@ -1,5 +1,5 @@
/* Wrapper for sched.h functions.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+ Copyright (C) 2021-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsendto.c b/support/xsendto.c
index 03c976e..8d5ed9a 100644
--- a/support/xsendto.c
+++ b/support/xsendto.c
@@ -1,5 +1,5 @@
/* sendto with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsetlocale.c b/support/xsetlocale.c
index 9151190..c3348bb 100644
--- a/support/xsetlocale.c
+++ b/support/xsetlocale.c
@@ -1,5 +1,5 @@
/* setlocale with error checking.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsetsockopt.c b/support/xsetsockopt.c
index 858366f..19128e2 100644
--- a/support/xsetsockopt.c
+++ b/support/xsetsockopt.c
@@ -1,5 +1,5 @@
/* setsockopt with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsigaction.c b/support/xsigaction.c
index 67ebce7..e3f0145 100644
--- a/support/xsigaction.c
+++ b/support/xsigaction.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for sigaction.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsignal.c b/support/xsignal.c
index d745a54..35c4874 100644
--- a/support/xsignal.c
+++ b/support/xsignal.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for signal.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsignal.h b/support/xsignal.h
index 7a7d946..43fcdd1 100644
--- a/support/xsignal.h
+++ b/support/xsignal.h
@@ -1,5 +1,5 @@
/* Support functionality for using signals.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsigstack.c b/support/xsigstack.c
index 415e659..08272c3 100644
--- a/support/xsigstack.c
+++ b/support/xsigstack.c
@@ -1,5 +1,5 @@
/* sigaltstack wrappers.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -64,7 +64,7 @@ xfree_sigstack (void *stack)
{
struct sigstack_desc *desc = stack;
- if (sigaltstack (&desc->old_stack, 0))
+ if (sigaltstack (&desc->old_stack, NULL))
FAIL_EXIT1 ("sigaltstack (restore old stack: sp=%p, size=%zu, flags=%u): "
"%m\n", desc->old_stack.ss_sp, desc->old_stack.ss_size,
desc->old_stack.ss_flags);
diff --git a/support/xsocket.c b/support/xsocket.c
index b054431..23febe3 100644
--- a/support/xsocket.c
+++ b/support/xsocket.c
@@ -1,5 +1,5 @@
/* socket with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsocket.h b/support/xsocket.h
index 4ac0e1f..c2bc7ed 100644
--- a/support/xsocket.h
+++ b/support/xsocket.h
@@ -1,5 +1,5 @@
/* Error-checking wrappers for socket functions.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xspawn.h b/support/xspawn.h
index 456360f..a321517 100644
--- a/support/xspawn.h
+++ b/support/xspawn.h
@@ -1,5 +1,5 @@
/* posix_spawn with support checks.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/support-xfstat-time64.c b/support/xstatx.c
index 589a69b..96e11dd 100644
--- a/support/support-xfstat-time64.c
+++ b/support/xstatx.c
@@ -1,5 +1,5 @@
-/* 64-bit time_t stat with error checking.
- Copyright (C) 2021-2024 Free Software Foundation, Inc.
+/* Error-checking wrapper for statx.
+ Copyright (C) 2024-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -16,17 +16,17 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
-/* NB: Non-standard file name to avoid sysdeps override for xstat. */
+#include <support/xunistd.h>
+#include <fcntl.h>
#include <support/check.h>
-#include <support/xunistd.h>
#include <sys/stat.h>
-#if __TIMESIZE != 64
void
-xfstat_time64 (int fd, struct __stat64_t64 *result)
+xstatx (int fd, const char *path, int flags, unsigned int mask,
+ struct statx *stx)
{
- if (__fstat64_time64 (fd, result) != 0)
- FAIL_EXIT1 ("__fstat64_time64 (%d): %m", fd);
+ if (statx (fd, path, flags, mask, stx) != 0)
+ FAIL_EXIT1 ("statx (AT_FDCWD, \"%s\", 0x%x, 0x%x): %m",
+ path, (unsigned int) flags, mask);
}
-#endif
diff --git a/support/xstdio.h b/support/xstdio.h
index 942b622..c3fdf94 100644
--- a/support/xstdio.h
+++ b/support/xstdio.h
@@ -1,5 +1,5 @@
/* Error-checking wrappers for stdio functions.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xstdlib.h b/support/xstdlib.h
index 4237c79..6d288a2 100644
--- a/support/xstdlib.h
+++ b/support/xstdlib.h
@@ -1,5 +1,5 @@
/* Error-checking wrappers for stdlib functions.
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xstrdup.c b/support/xstrdup.c
index 3f922d2..f25126c 100644
--- a/support/xstrdup.c
+++ b/support/xstrdup.c
@@ -1,5 +1,5 @@
/* strdup with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xstrndup.c b/support/xstrndup.c
index 4c1f618..12e6ed3 100644
--- a/support/xstrndup.c
+++ b/support/xstrndup.c
@@ -1,5 +1,5 @@
/* strndup with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsymlink.c b/support/xsymlink.c
index e08078e..504fd78 100644
--- a/support/xsymlink.c
+++ b/support/xsymlink.c
@@ -1,5 +1,5 @@
/* Error-checking replacement for "symlink".
- Copyright (C) 2018-2024 Free Software Foundation, Inc.
+ Copyright (C) 2018-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsysconf.c b/support/xsysconf.c
index c15dc0b..b5969e8 100644
--- a/support/xsysconf.c
+++ b/support/xsysconf.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for sysconf.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xsystem.c b/support/xsystem.c
index 0b21b00..b775479 100644
--- a/support/xsystem.c
+++ b/support/xsystem.c
@@ -1,5 +1,5 @@
/* Error-checking replacement for "system".
- Copyright (C) 2023-2024 Free Software Foundation, Inc.
+ Copyright (C) 2023-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xthread.h b/support/xthread.h
index 2fdbbb8..c63c38f 100644
--- a/support/xthread.h
+++ b/support/xthread.h
@@ -1,5 +1,5 @@
/* Support functionality for using threads.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xtime.h b/support/xtime.h
index 9961899..f7fc953 100644
--- a/support/xtime.h
+++ b/support/xtime.h
@@ -1,5 +1,5 @@
/* Support functionality for using time.
- Copyright (C) 2019-2024 Free Software Foundation, Inc.
+ Copyright (C) 2019-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xunistd.h b/support/xunistd.h
index 13be9a4..55afa43 100644
--- a/support/xunistd.h
+++ b/support/xunistd.h
@@ -1,5 +1,5 @@
/* POSIX-specific extra functions.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -29,28 +29,29 @@
__BEGIN_DECLS
-struct stat64;
+struct statx;
pid_t xfork (void);
pid_t xwaitpid (pid_t, int *status, int flags);
void xpipe (int[2]);
void xdup2 (int, int);
+int xdup (int);
int xopen (const char *path, int flags, mode_t);
-#ifndef __USE_TIME64_REDIRECTS
-# ifdef __USE_FILE_OFFSET64
-void xstat (const char *path, struct stat *);
-void xlstat (const char *path, struct stat *);
-void xfstat (int fd, struct stat *);
-# else
-void xstat (const char *path, struct stat64 *);
-void xlstat (const char *path, struct stat64 *);
-void xfstat (int fd, struct stat64 *);
-# endif
-#else
-void __REDIRECT (xstat, (const char *path, struct stat *), xstat_time64);
-void __REDIRECT (xlstat, (const char *path, struct stat *), xlstat_time64);
-void __REDIRECT (xfstat, (int fd, struct stat *), xfstat_time64);
-#endif
+void support_check_stat_fd (const char *name, int fd, int result);
+void support_check_stat_path (const char *name, const char *path, int result);
+#define xstat(path, st) \
+ (support_check_stat_path ("stat", (path), stat ((path), (st))))
+#define xfstat(fd, st) \
+ (support_check_stat_fd ("fstat", (fd), fstat ((fd), (st))))
+#define xlstat(path, st) \
+ (support_check_stat_path ("lstat", (path), lstat ((path), (st))))
+#define xstat64(path, st) \
+ (support_check_stat_path ("stat64", (path), stat64 ((path), (st))))
+#define xfstat64(fd, st) \
+ (support_check_stat_fd ("fstat64", (fd), fstat64 ((fd), (st))))
+#define xlstat64(path, st) \
+ (support_check_stat_path ("lstat64", (path), lstat64 ((path), (st))))
+void xstatx (int, const char *, int, unsigned int, struct statx *);
void xmkdir (const char *path, mode_t);
void xchroot (const char *path);
void xunlink (const char *path);
diff --git a/support/xunlink.c b/support/xunlink.c
index 3f64309..e957b16 100644
--- a/support/xunlink.c
+++ b/support/xunlink.c
@@ -1,5 +1,5 @@
/* Error-checking wrapper for unlink.
- Copyright (C) 2017-2024 Free Software Foundation, Inc.
+ Copyright (C) 2017-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xuselocale.c b/support/xuselocale.c
index 9d81f24..4330fe9 100644
--- a/support/xuselocale.c
+++ b/support/xuselocale.c
@@ -1,5 +1,5 @@
/* uselocale with error checking.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xwaitpid.c b/support/xwaitpid.c
index 1cf04b3..5853445 100644
--- a/support/xwaitpid.c
+++ b/support/xwaitpid.c
@@ -1,5 +1,5 @@
/* waitpid with error checking.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
diff --git a/support/xwrite.c b/support/xwrite.c
index 3f50e1c..dd3fcfb 100644
--- a/support/xwrite.c
+++ b/support/xwrite.c
@@ -1,5 +1,5 @@
/* write with error checking and retries.
- Copyright (C) 2016-2024 Free Software Foundation, Inc.
+ Copyright (C) 2016-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or