diff --git a/local/patches/relibc/P3-semaphore-comprehensive.patch b/local/patches/relibc/P3-semaphore-comprehensive.patch index 44c2dc1b5..59e659244 100644 --- a/local/patches/relibc/P3-semaphore-comprehensive.patch +++ b/local/patches/relibc/P3-semaphore-comprehensive.patch @@ -1,4 +1,5 @@ diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs +index 0ca2fa9..8a1cad4 100644 --- a/src/header/semaphore/mod.rs +++ b/src/header/semaphore/mod.rs @@ -2,12 +2,27 @@ @@ -30,7 +31,7 @@ diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs }; /// See . -@@ -19,11 +34,86 @@ +@@ -19,11 +34,87 @@ pub union sem_t { pub align: c_long, } pub type RlctSempahore = crate::sync::Semaphore; @@ -67,7 +68,8 @@ diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs +) -> *mut sem_t { + let create = (oflag & O_CREAT) != 0; + let shm_flags = if create { O_CREAT | O_EXCL | O_RDWR } else { O_RDWR }; -+ let fd = unsafe { shm_open(name, shm_flags, mode) }; ++ let canonical = alloc::format!("sem.{name_cstr}", name_cstr = unsafe { CStr::from_ptr(name) }.to_str().unwrap_or("")); ++ let fd = unsafe { shm_open(canonical.as_ptr() as *const c_char, shm_flags, mode) }; + if fd < 0 { + return SEM_FAILED_PTR; + } @@ -118,7 +120,7 @@ diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs } /// See . -@@ -50,13 +140,31 @@ +@@ -50,13 +141,31 @@ pub unsafe extern "C" fn sem_init(sem: *mut sem_t, _pshared: c_int, value: c_uin } /// See . @@ -154,7 +156,7 @@ diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs } /// See . -@@ -76,9 +184,12 @@ +@@ -76,9 +185,12 @@ pub unsafe extern "C" fn sem_trywait(sem: *mut sem_t) -> c_int { } /// See . @@ -169,19 +171,3 @@ diff --git a/src/header/semaphore/mod.rs b/src/header/semaphore/mod.rs } /// See . - - -diff --git a/src/header/semaphore/cbindgen.toml b/src/header/semaphore/cbindgen.toml ---- a/src/header/semaphore/cbindgen.toml -+++ b/src/header/semaphore/cbindgen.toml -@@ -3,6 +3,9 @@ - after_includes = """ - #include // for timespec - """ -+trailer = """ -+#define SEM_FAILED ((sem_t *) -1) -+""" - language = "C" - style = "Type" - no_includes = true -