about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/os/unix/fs.rs5
-rw-r--r--library/std/src/sys/cmath.rs8
2 files changed, 13 insertions, 0 deletions
diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs
index ba6481f052c..04a45fd035a 100644
--- a/library/std/src/os/unix/fs.rs
+++ b/library/std/src/os/unix/fs.rs
@@ -987,6 +987,11 @@ impl DirBuilderExt for fs::DirBuilder {
 /// Changing the group typically requires either being the owner and a member of the group, or
 /// having privileges.
 ///
+/// Be aware that changing owner clears the `suid` and `sgid` permission bits in most cases
+/// according to POSIX, usually even if the user is root. The sgid is not cleared when
+/// the file is non-group-executable. See: <https://www.man7.org/linux/man-pages/man2/chown.2.html>
+/// This call may also clear file capabilities, if there was any.
+///
 /// If called on a symbolic link, this will change the owner and group of the link target. To
 /// change the owner and group of the link itself, see [`lchown`].
 ///
diff --git a/library/std/src/sys/cmath.rs b/library/std/src/sys/cmath.rs
index 2997e908fa1..ee36127cfdf 100644
--- a/library/std/src/sys/cmath.rs
+++ b/library/std/src/sys/cmath.rs
@@ -26,6 +26,7 @@ extern "C" {
     pub fn tgamma(n: f64) -> f64;
     pub fn tgammaf(n: f32) -> f32;
     pub fn lgamma_r(n: f64, s: &mut i32) -> f64;
+    #[cfg(not(target_os = "aix"))]
     pub fn lgammaf_r(n: f32, s: &mut i32) -> f32;
 
     pub fn acosf128(n: f128) -> f128;
@@ -56,6 +57,13 @@ extern "C" {
     }}
 }
 
+// On AIX, we don't have lgammaf_r only the f64 version, so we can
+// use the f64 version lgamma_r
+#[cfg(target_os = "aix")]
+pub unsafe fn lgammaf_r(n: f32, s: &mut i32) -> f32 {
+    lgamma_r(n.into(), s) as f32
+}
+
 // On 32-bit x86 MSVC these functions aren't defined, so we just define shims
 // which promote everything to f64, perform the calculation, and then demote
 // back to f32. While not precisely correct should be "correct enough" for now.