Skip to content

fix(freebsd): incorrect constant type from ttycom.h #2616

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

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

nanpuyue
Copy link
Contributor

@nanpuyue nanpuyue commented Jan 5, 2022

ref: #493

the value and type of the constant are obtained by executing the following script

ttycom.sh:

#/bin/sh

cat <<EOF
#include <stdio.h>
#include <sys/ttycom.h>
#include <sys/time.h>
#include <termios.h>

void main() {
EOF

grep -o TIOC[A-Z_]* /usr/include/sys/ttycom.h | sort -u |\
 xargs -I{} echo '    printf("pub const {}: u%lu = 0x%lx;\n", sizeof({})*8, {});'

echo '}'
./ttycom.sh > main.c
clang main.c
./a.out

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon.

Please see the contribution instructions for more information.

@nanpuyue nanpuyue force-pushed the fix-freebsd-ttycom branch 3 times, most recently from a05c2a8 to 2842f14 Compare January 5, 2022 19:06
@nanpuyue nanpuyue force-pushed the fix-freebsd-ttycom branch from 2842f14 to d35e9ea Compare January 5, 2022 19:32
@Amanieu
Copy link
Member

Amanieu commented Jan 5, 2022

cc @asomers

Copy link
Contributor

@asomers asomers left a comment

Choose a reason for hiding this comment

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

LGTM. These should all be unsigned long in Rust, because while in C they're defined typelessly, their main function is to be passed to ioctl, which expects an unsigned long.

@Amanieu
Copy link
Member

Amanieu commented Jan 5, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jan 5, 2022

📌 Commit d35e9ea has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Jan 5, 2022

⌛ Testing commit d35e9ea with merge 1f1ebd5...

@bors
Copy link
Contributor

bors commented Jan 6, 2022

☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13
Approved by: Amanieu
Pushing 1f1ebd5 to master...

@bors bors merged commit 1f1ebd5 into rust-lang:master Jan 6, 2022
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.

5 participants