From 98e59458c3980e8746802294b6306354a6c6a2a4 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Thu, 17 Jun 2021 16:02:59 +0100 Subject: [PATCH 1/5] [watch_os] add support for Apple WatchOS --- .idea/.gitignore | 8 ++++++++ .idea/libc.iml | 13 +++++++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ src/unix/bsd/apple/mod.rs | 6 +++--- src/unix/bsd/mod.rs | 3 ++- src/unix/mod.rs | 6 ++++-- 7 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/libc.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000..73f69e0958611 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/libc.iml b/.idea/libc.iml new file mode 100644 index 0000000000000..80e43ea22e922 --- /dev/null +++ b/.idea/libc.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000..282976c70a3cb --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000..94a25f7f4cb41 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 5d10a0032b7fd..2983d56b32a4f 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1172,9 +1172,9 @@ s_no_extra_traits! { pub ifi_noproto: u64, pub ifi_recvtiming: u32, pub ifi_xmittiming: u32, - #[cfg(any(target_arch = "arm", target_arch = "x86"))] + #[cfg(any(target_arch = "arm", target_arch = "x86", target_pointer_width = "32"))] pub ifi_lastchange: ::timeval, - #[cfg(not(any(target_arch = "arm", target_arch = "x86")))] + #[cfg(not(any(target_arch = "arm", target_arch = "x86", target_pointer_width = "32")))] pub ifi_lastchange: timeval32, } @@ -5522,7 +5522,7 @@ extern "C" { } cfg_if! { - if #[cfg(any(target_arch = "arm", target_arch = "x86"))] { + if #[cfg(any(target_arch = "arm", target_arch = "x86", target_pointer_width = "32"))] { mod b32; pub use self::b32::*; } else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] { diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index a0729ee545d86..8ebca0930107a 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -37,6 +37,7 @@ s! { #[cfg(not(any(target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "netbsd", target_os = "openbsd")))] pub pw_fields: ::c_int, @@ -880,7 +881,7 @@ extern "C" { } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))] { mod apple; pub use self::apple::*; } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 5ff2294e797c3..2a5834ab5a41f 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -348,6 +348,7 @@ cfg_if! { extern {} } else if #[cfg(any(target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "android", target_os = "openbsd"))] { #[link(name = "c")] @@ -1017,7 +1018,7 @@ extern "C" { pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int; #[cfg_attr( - any(target_os = "macos", target_os = "ios"), + any(target_os = "macos", target_os = "ios", target_os = "watchos"), link_name = "realpath$DARWIN_EXTSN" )] pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char; @@ -1183,7 +1184,7 @@ extern "C" { ), link_name = "__res_init" )] - #[cfg_attr(any(target_os = "macos", target_os = "ios"), link_name = "res_9_init")] + #[cfg_attr(any(target_os = "macos", target_os = "ios", target_os = "watchos"), link_name = "res_9_init")] pub fn res_init() -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] @@ -1456,6 +1457,7 @@ cfg_if! { pub use self::linux_like::*; } else if #[cfg(any(target_os = "macos", target_os = "ios", + target_os = "watchos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", From b5987a236dcc0d5bf75f60b9b00ca4d9f264cd21 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 12:05:54 +0000 Subject: [PATCH 2/5] [watch_os] Fix format --- src/unix/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 2a5834ab5a41f..adc72f0ff50c4 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1184,7 +1184,10 @@ extern "C" { ), link_name = "__res_init" )] - #[cfg_attr(any(target_os = "macos", target_os = "ios", target_os = "watchos"), link_name = "res_9_init")] + #[cfg_attr( + any(target_os = "macos", target_os = "ios", target_os = "watchos"), + link_name = "res_9_init" + )] pub fn res_init() -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")] From cd0c38dad2266d72d5923e3dfd4e2eb9a7508b88 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 12:08:35 +0000 Subject: [PATCH 3/5] [watch_os] remove clion files ... --- .idea/.gitignore | 8 ------ .idea/libc.iml | 13 ---------- .idea/modules.xml | 8 ------ .idea/vcs.xml | 6 ----- .idea/workspace.xml | 62 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 35 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/libc.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 73f69e0958611..0000000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/libc.iml b/.idea/libc.iml deleted file mode 100644 index 80e43ea22e922..0000000000000 --- a/.idea/libc.iml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 282976c70a3cb..0000000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7f4cb41..0000000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000000..17a717698592d --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1646222736236 + + + + + + \ No newline at end of file From f073685f728891f104bf2125f1bcb9f123cf5d3b Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Tue, 8 Mar 2022 12:09:45 +0000 Subject: [PATCH 4/5] [watch_os] remove clion files .. again --- .idea/workspace.xml | 62 --------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 17a717698592d..0000000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1646222736236 - - - - - - \ No newline at end of file From 68c988ff64041b3a431d50e41d9dd1bab972b945 Mon Sep 17 00:00:00 2001 From: Vladimir Michael Eatwell Date: Thu, 17 Mar 2022 16:19:21 +0000 Subject: [PATCH 5/5] Use target_pointer_width attribute --- src/unix/bsd/apple/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 2983d56b32a4f..4133c2b504e1f 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1172,9 +1172,9 @@ s_no_extra_traits! { pub ifi_noproto: u64, pub ifi_recvtiming: u32, pub ifi_xmittiming: u32, - #[cfg(any(target_arch = "arm", target_arch = "x86", target_pointer_width = "32"))] + #[cfg(target_pointer_width = "32")] pub ifi_lastchange: ::timeval, - #[cfg(not(any(target_arch = "arm", target_arch = "x86", target_pointer_width = "32")))] + #[cfg(not(target_pointer_width = "32"))] pub ifi_lastchange: timeval32, } @@ -5522,10 +5522,10 @@ extern "C" { } cfg_if! { - if #[cfg(any(target_arch = "arm", target_arch = "x86", target_pointer_width = "32"))] { + if #[cfg(target_pointer_width = "32")] { mod b32; pub use self::b32::*; - } else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] { + } else if #[cfg(target_pointer_width = "64")] { mod b64; pub use self::b64::*; } else {