summaryrefslogtreecommitdiff
path: root/src/vxworks
diff options
context:
space:
mode:
authorDaniil Bondarev <xonatius@gmail.com>2020-09-12 23:15:38 -0700
committerDaniil Bondarev <xonatius@gmail.com>2020-09-12 23:38:06 -0700
commit773f5562ba04ad8b7ba772e99645922ea908be76 (patch)
tree3a7ce4ee9cdf67822733c196f78a04f5959e15fc /src/vxworks
parentc2a184b255c2d7548e17b66f19f0330192ce6484 (diff)
downloadrust-libc-773f5562ba04ad8b7ba772e99645922ea908be76.tar.gz
Use safe_f! consistently across platforms
The pr #1870 introduced safe_f! macro, which made some functions like WIFEXITED and WEXITSTATUS const and safe on linux_like platform only, which causes inconsistency when trying to use those functions in crates compiled across multiple platforms, as using unsafe on those functions will generate unused_unsafe warning on linux platforms and lack of unsafe block will fail compilation on non-linux platforms. To avoid the inconsistency, this commit applies the same macro for all the same functions on other platforms too.
Diffstat (limited to 'src/vxworks')
-rwxr-xr-xsrc/vxworks/mod.rs36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs
index 2a3ac7ff78..65362e9b58 100755
--- a/src/vxworks/mod.rs
+++ b/src/vxworks/mod.rs
@@ -2042,23 +2042,25 @@ extern "C" {
//Dummy functions, these don't really exist in VxWorks.
// wait.h macros
-pub fn WIFEXITED(status: ::c_int) -> bool {
- (status & 0xFF00) == 0
-}
-pub fn WIFSIGNALED(status: ::c_int) -> bool {
- (status & 0xFF00) != 0
-}
-pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0xFF0000) != 0
-}
-pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
- status & 0xFF
-}
-pub fn WTERMSIG(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xFF
-}
-pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
- (status >> 16) & 0xFF
+safe_f! {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
+ (status & 0xFF00) == 0
+ }
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
+ (status & 0xFF00) != 0
+ }
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
+ (status & 0xFF0000) != 0
+ }
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ status & 0xFF
+ }
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
+ (status >> 8) & 0xFF
+ }
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ (status >> 16) & 0xFF
+ }
}
pub fn pread(