From 3406fe94fa3090d05680c19f385ddf2a3f3d091f Mon Sep 17 00:00:00 2001
From: Joerg Thalheim <joerg@thalheim.io>
Date: Thu, 12 Oct 2017 17:41:17 +0100
Subject: [PATCH] provide setfsgid/setfsuid also on android

---
 libc-test/build.rs             | 3 ++-
 src/unix/notbsd/android/mod.rs | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libc-test/build.rs b/libc-test/build.rs
index 9bb46e0a..b5ab2fbd 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -190,7 +190,6 @@ fn main() {
         cfg.header("sys/msg.h");
         cfg.header("sys/shm.h");
         cfg.header("sys/user.h");
-        cfg.header("sys/fsuid.h");
         cfg.header("sys/timerfd.h");
         cfg.header("shadow.h");
         if !emscripten {
@@ -240,6 +239,8 @@ fn main() {
     }
 
     if linux || android {
+        cfg.header("sys/fsuid.h");
+
         // DCCP support
         if !uclibc && !musl && !emscripten {
             cfg.header("linux/dccp.h");
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 065a5bd8..68bc73ed 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -1038,6 +1038,8 @@ extern {
                     in_fd: ::c_int,
                     offset: *mut off_t,
                     count: ::size_t) -> ::ssize_t;
+    pub fn setfsgid(gid: ::gid_t) -> ::c_int;
+    pub fn setfsuid(uid: ::uid_t) -> ::c_int;
     pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
     #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
     pub fn getgrgid_r(uid: ::uid_t,
-- 
GitLab