From 81f546e9335151a6b989a1ecf9f67793199d2132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20Dupr=C3=A9=20Bertoni?= Date: Mon, 20 Mar 2023 17:21:33 +0200 Subject: [PATCH] Add pthread_once --- libc-test/semver/linux.txt | 3 +++ src/unix/linux_like/linux/mod.rs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index cdb007914431f..36c060a2b3952 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1868,6 +1868,7 @@ PTHREAD_PRIO_PROTECT PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED PTHREAD_STACK_MIN +PTHREAD_ONCE_INIT PTRACE_ATTACH PTRACE_CONT PTRACE_DETACH @@ -3300,6 +3301,8 @@ pthread_barrier_wait pthread_barrier_destroy pthread_barrierattr_t pthread_barrier_t +pthread_once +pthread_once_t ptrace ptsname_r pwrite64 diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 1d272d601d6fc..84bbcb4000989 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -14,6 +14,7 @@ pub type nl_item = ::c_int; pub type idtype_t = ::c_uint; pub type loff_t = ::c_longlong; pub type pthread_key_t = ::c_uint; +pub type pthread_once_t = ::c_int; pub type pthread_spinlock_t = ::c_int; pub type __u8 = ::c_uchar; @@ -1872,6 +1873,7 @@ align_const! { size: [0; __SIZEOF_PTHREAD_RWLOCK_T], }; } +pub const PTHREAD_ONCE_INIT: pthread_once_t = 0; pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; @@ -4760,6 +4762,8 @@ extern "C" { longindex: *mut ::c_int, ) -> ::c_int; + pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> ::c_int; + pub fn copy_file_range( fd_in: ::c_int, off_in: *mut ::off64_t,