-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for SO_TXTIME #1409
base: main
Are you sure you want to change the base?
Conversation
@@ -1522,6 +1526,20 @@ pub fn socket_peercred<Fd: AsFd>(fd: Fd) -> io::Result<super::UCred> { | |||
backend::net::sockopt::socket_peercred(fd.as_fd()) | |||
} | |||
|
|||
/// `getsockopt(fd, SOL_SOCKET, SO_TXTIME)` — Get transmit timing settings. | |||
#[cfg(all(target_os = "linux", feature = "time"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be #[cfg(linux_kernel)]
? I don't get the distinction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linux_kernel
is equivalent to any(target_os = "linux", target_os = "android"))
. If this feature compiles on Android, then we can enable it there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated with linux_kernel
, so I guess we'll see what happens in CI :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that's a no on android.
I just realized this needs the |
f9105fd
to
b87a4b0
Compare
@@ -94,6 +95,51 @@ pub enum ClockId { | |||
BoottimeAlarm = bitcast!(c::CLOCK_BOOTTIME_ALARM), | |||
} | |||
|
|||
#[cfg(not(any(apple, target_os = "wasi")))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this would be straightforward, but it's really not. libc has clockid_t
, while linux-raw-sys has __kernel_clockid_t
. Some platforms have neither. What's the best way to proceed with this? I need it for get_txtime
, since the kernel returns the configured clock.
Nevermind, importing __kernel_clockid_t as clockid_t
fixed it.
25f2f89
to
7372c46
Compare
Added |
linux-raw-sys 0.9.3 is now released, with sunfishcode/linux-raw-sys#153. |
9a91e1d
to
45c36e3
Compare
Great, thanks :) I rebased now and removed the hardcoded declarations. |
This is an undocumented linux feature that lets you time outgoing packets.
This is an undocumented linux feature that lets you time outgoing packets.
This depends on sunfishcode/linux-raw-sys#153.