From 7d401488c472efb422d8762095e2a26cd6fc57c9 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 b4091a707047d..8a6351401e8be 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1926,6 +1926,7 @@ PTHREAD_PRIO_PROTECT PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED PTHREAD_STACK_MIN +PTHREAD_ONCE_INIT PTRACE_ATTACH PTRACE_CONT PTRACE_DETACH @@ -3373,6 +3374,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 067fe07c71f2f..da499c54d174a 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; @@ -1903,6 +1904,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; @@ -4849,6 +4851,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,