From 4774fc1c9fec44d49ebe763eadc87f00d3425d9d Mon Sep 17 00:00:00 2001
From: gnzlbg <gonzalobg88@gmail.com>
Date: Wed, 22 May 2019 13:34:02 +0200
Subject: [PATCH] Deprecate ENOATTR on Linux and Android

---
 libc-test/build.rs             | 6 ++++++
 src/unix/notbsd/android/mod.rs | 5 ++++-
 src/unix/notbsd/linux/mod.rs   | 7 ++++---
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/libc-test/build.rs b/libc-test/build.rs
index af198812..5d915e13 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1379,6 +1379,12 @@ fn test_android(target: &str) {
             // FIXME: deprecated: not available in any header
             // See: https://github.com/rust-lang/libc/issues/1356
             "ENOATTR" => true,
+
+            // FIXME: still necessary?
+            "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness
+            // FIXME: still necessary?
+            "SIGUNUSED" => true, // removed in glibc 2.26
+
             _ => false,
         }
     });
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 51a2cafd..b6b67842 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -1792,7 +1792,10 @@ pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
 pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
 pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
 
-// Similarity to Linux it's not used but defined for compatibility.
+#[deprecated(
+    since = "0.2.55",
+    note = "ENOATTR is not available on Android; use ENODATA instead"
+)]
 pub const ENOATTR: ::c_int = ::ENODATA;
 
 // linux/if_alg.h
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index 71e2c376..a76f7a02 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -1409,9 +1409,10 @@ pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
 pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
 pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
 
-// On Linux, libc doesn't define this constant, libattr does instead.
-// We still define it for Linux as it's defined by libc on other platforms,
-// and it's mentioned in the man pages for getxattr and setxattr.
+#[deprecated(
+    since = "0.2.55",
+    note = "ENOATTR is not available on Linux; use ENODATA instead"
+)]
 pub const ENOATTR: ::c_int = ::ENODATA;
 
 pub const SO_ORIGINAL_DST: ::c_int = 80;
-- 
GitLab