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 TCGETS2 and TCSETS2 (and variants) ioctl constants for Linux. #2508
Conversation
r? @Amanieu (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
05b4bdf
to
75b7725
Compare
75b7725
to
1338e2e
Compare
@bors r+ |
📌 Commit 1338e2e has been approved by |
1338e2e
to
8c9bfe0
Compare
Oops, I pushed a new commit to fix |
@bors r+ |
📌 Commit 8c9bfe0 has been approved by |
Add TCGETS2 and TCSETS2 (and variants) ioctl constants for Linux. I noticed that the `termios2` struct is already exposed, but the ioctl constants to use it are not. This PR adds the `TCGETS2`, `TCSETS2`, `TCSETSW2` and `TCSETSF2` on Linux so that you can actually do something with the `termios2` struct. The `powerpc` architecture is notably missing, because it does not seem to support the `TCGETS2`/`TCSETS2` ioctls. I *think* the constants are correct for all platforms, but I'm also not 100% sure. Do the unit tests verify the values for all supported platforms, by any chance?
💔 Test failed - checks-actions |
8c9bfe0
to
447e868
Compare
Ugh, the Yay for the test suite though <3 |
Yea the tests here are a lifesaver. @bors r+ |
📌 Commit 447e868 has been approved by |
Add TCGETS2 and TCSETS2 (and variants) ioctl constants for Linux. I noticed that the `termios2` struct is already exposed, but the ioctl constants to use it are not. This PR adds the `TCGETS2`, `TCSETS2`, `TCSETSW2` and `TCSETSF2` on Linux so that you can actually do something with the `termios2` struct. The `powerpc` architecture is notably missing, because it does not seem to support the `TCGETS2`/`TCSETS2` ioctls. I *think* the constants are correct for all platforms, but I'm also not 100% sure. Do the unit tests verify the values for all supported platforms, by any chance?
💔 Test failed - checks-actions |
447e868
to
fc89d7c
Compare
I had a typo in TCSETSF2 for sparc 😢 Fixed it now. Also, I noticed that the constants are all Or I can just leave them as |
fc89d7c
to
58a015c
Compare
@bors r+ |
📌 Commit 58a015c has been approved by |
☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13 |
\o/ Thanks for the reviews! |
Move termios2 struct and ioctl constants to linux::arch::*. When trying to use the newly added ioctls from #2508 I noticed that the `termios2` struct was not defined for musl or uclibc, except interestingly for the hexagon+musl target However, the `termios2` struct and ioctls are part of the Linux headers, not part of the libc headers. So the libc flavour doesn't matter for these definitions. This PR moves the definitions to the `linux::arch::*` modules, to make them available for all libc flavours and reduce code duplication as a bonus.
Move termios2 struct and ioctl constants to linux::arch::*. When trying to use the newly added ioctls from #2508 I noticed that the `termios2` struct was not defined for musl or uclibc, except interestingly for the hexagon+musl target However, the `termios2` struct and ioctls are part of the Linux headers, not part of the libc headers. So the libc flavour doesn't matter for these definitions. This PR moves the definitions to the `linux::arch::*` modules, to make them available for all libc flavours and reduce code duplication as a bonus.
Use libc specific type for architecture specific ioctl defines on Linux. This PR should fix the type change of some ioctl constants on Linux introduced by #2530. It does this by adding a `#[doc(hidden)]` type called `Ioctl`, which is defined in libc specific modules and used in arch specific modules. However, when doing this I noticed that when I added `TCGETS2`, `TCSETS2`, ... in #2508, I unconditionally used `c_ulong`. This is inconsistent with the other ioctl constants for `musl` and `uclibc`. This PR also changes those to use the libc specific types. However, PR #2508 has already been released in 0.2.107, so technically that is also a semver incompatible change. The impact is limited to new constants introduced in the last release, and only on `musl` and `uclibc` targets. So what is more important here? Consistency in the type of ioctl constants, or being very strict with backwards compatibility? If it is the latter, I'll revert `TCGETS2` etc to `c_ulong` for this PR.
I noticed that the
termios2
struct is already exposed, but the ioctl constants to use it are not. This PR adds theTCGETS2
,TCSETS2
,TCSETSW2
andTCSETSF2
on Linux so that you can actually do something with thetermios2
struct.The
powerpc
architecture is notably missing, because it does not seem to support theTCGETS2
/TCSETS2
ioctls.I think the constants are correct for all platforms, but I'm also not 100% sure. Do the unit tests verify the values for all supported platforms, by any chance?