Skip to content
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

Move more ioctl constants and flags to linux::arch::* modules. #2530

Merged
merged 3 commits into from Nov 15, 2021

Conversation

de-vri-es
Copy link
Contributor

This PR moves a few things to linux::arch::* modules and out of libc specific modules. Specifically, it:

  • Moves the TIOCM* ioclt constants and associated flags.
  • Moves the BOTHER flag.
  • Adds the IBSHIFT flag.

Without this PR, there are some arch+libc combinations that are missing some of these constants. Since these are all ioctl numbers or arguments to ioctls, they are not specific to any libc flavour. BOTHER and IBSHIFT don't even appear in glibc or musl headers.

@rust-highfive
Copy link

r? @JohnTitor

(rust-highfive has picked a reviewer for you, use r? to override)

@de-vri-es de-vri-es changed the title Move more IOCTLs and flags to linux::arch::* modules. Move more ioctl constants and flags to linux::arch::* modules. Nov 11, 2021
@de-vri-es de-vri-es force-pushed the tty-cleanup branch 2 times, most recently from 9f88c82 to 27c9174 Compare November 11, 2021 18:04
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet, thanks!

@JohnTitor
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Nov 15, 2021

📌 Commit 3fa2809 has been approved by JohnTitor

@bors
Copy link
Contributor

bors commented Nov 15, 2021

⌛ Testing commit 3fa2809 with merge 4f74e6e...

@bors
Copy link
Contributor

bors commented Nov 15, 2021

☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13
Approved by: JohnTitor
Pushing 4f74e6e to master...

@bors bors merged commit 4f74e6e into rust-lang:master Nov 15, 2021
@JohnTitor
Copy link
Member

@de-vri-es According to https://github.com/rust-lang/libc/runs/4218181867?check_suite_focus=true, this changed some consts' type, it's a breaking change. If that change is necessary, I'd like to deprecate them first then do the actual change in favor of https://github.com/rust-lang/libc/blob/master/CONTRIBUTING.md#breaking-change-policy, could you revert the breaking change part?

@de-vri-es
Copy link
Contributor Author

Ah I didn't notice that aarch64-musl has different types for the ioctl constants compared to the glibc targets D:

However, reverting that would mean putting everything back in libc+arch specific modules. Or alternatively, I could add a pub(crate) type Ioctl definition to the libc+arch specific modules type and use that from the arch specific modules.

What do you think is best?

@JohnTitor
Copy link
Member

Sounds fine, one problem is that older Rust doesn't support pub(crate) unfortunately so we could add a doc comment instead.

@de-vri-es
Copy link
Contributor Author

Alright, sounds good. I think I'll have time for that tomorrow. If this is blocking a release it might be best to simply revert the whole PR until I can put the fix in.

@de-vri-es
Copy link
Contributor Author

Fix proposed in #2550

bors added a commit that referenced this pull request Nov 18, 2021
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants