|
1 | 1 | //! Socket interface functions
|
2 | 2 | //!
|
3 | 3 | //! [Further reading](https://man7.org/linux/man-pages/man7/socket.7.html)
|
4 |
| -#[cfg(target_os = "linux")] |
| 4 | +#[cfg(any(target_os = "android", target_os = "linux"))] |
5 | 5 | #[cfg(feature = "uio")]
|
6 | 6 | use crate::sys::time::TimeSpec;
|
7 | 7 | #[cfg(not(target_os = "redox"))]
|
@@ -236,7 +236,7 @@ impl SockProtocol {
|
236 | 236 | #[allow(non_upper_case_globals)]
|
237 | 237 | pub const CanBcm: SockProtocol = SockProtocol::NetlinkUserSock; // Matches libc::CAN_BCM
|
238 | 238 | }
|
239 |
| -#[cfg(target_os = "linux")] |
| 239 | +#[cfg(any(target_os = "android", target_os = "linux"))] |
240 | 240 | libc_bitflags! {
|
241 | 241 | /// Configuration flags for `SO_TIMESTAMPING` interface
|
242 | 242 | ///
|
@@ -737,12 +737,12 @@ pub enum ControlMessageOwned {
|
737 | 737 | /// A set of nanosecond resolution timestamps
|
738 | 738 | ///
|
739 | 739 | /// [Further reading](https://www.kernel.org/doc/html/latest/networking/timestamping.html)
|
740 |
| - #[cfg(all(target_os = "linux"))] |
| 740 | + #[cfg(any(target_os = "android", target_os = "linux"))] |
741 | 741 | ScmTimestampsns(Timestamps),
|
742 | 742 | /// Nanoseconds resolution timestamp
|
743 | 743 | ///
|
744 | 744 | /// [Further reading](https://www.kernel.org/doc/html/latest/networking/timestamping.html)
|
745 |
| - #[cfg(all(target_os = "linux"))] |
| 745 | + #[cfg(any(target_os = "android", target_os = "linux"))] |
746 | 746 | #[cfg_attr(docsrs, doc(cfg(all())))]
|
747 | 747 | ScmTimestampns(TimeSpec),
|
748 | 748 | #[cfg(any(
|
@@ -839,7 +839,7 @@ pub enum ControlMessageOwned {
|
839 | 839 | }
|
840 | 840 |
|
841 | 841 | /// For representing packet timestamps via `SO_TIMESTAMPING` interface
|
842 |
| -#[cfg(all(target_os = "linux"))] |
| 842 | +#[cfg(any(target_os = "android", target_os = "linux"))] |
843 | 843 | #[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
844 | 844 | pub struct Timestamps {
|
845 | 845 | /// software based timestamp, usually one containing data
|
@@ -892,12 +892,12 @@ impl ControlMessageOwned {
|
892 | 892 | let tv: libc::timeval = ptr::read_unaligned(p as *const _);
|
893 | 893 | ControlMessageOwned::ScmTimestamp(TimeVal::from(tv))
|
894 | 894 | },
|
895 |
| - #[cfg(all(target_os = "linux"))] |
| 895 | + #[cfg(any(target_os = "android", target_os = "linux"))] |
896 | 896 | (libc::SOL_SOCKET, libc::SCM_TIMESTAMPNS) => {
|
897 | 897 | let ts: libc::timespec = ptr::read_unaligned(p as *const _);
|
898 | 898 | ControlMessageOwned::ScmTimestampns(TimeSpec::from(ts))
|
899 | 899 | }
|
900 |
| - #[cfg(all(target_os = "linux"))] |
| 900 | + #[cfg(any(target_os = "android", target_os = "linux"))] |
901 | 901 | (libc::SOL_SOCKET, libc::SCM_TIMESTAMPING) => {
|
902 | 902 | let tp = p as *const libc::timespec;
|
903 | 903 | let ts: libc::timespec = ptr::read_unaligned(tp);
|
|
0 commit comments