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

Add and rearrange a few fcntl pieces #1756

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions libc-test/build.rs
Expand Up @@ -2472,7 +2472,7 @@ fn test_linux(target: &str) {
s if s.ends_with("_nsec") && struct_.starts_with("stat") => {
s.replace("e_nsec", ".tv_nsec")
}
// FIXME: epoll_event.data is actuall a union in C, but in Rust
// FIXME: epoll_event.data is actually a union in C, but in Rust
// it is only a u64 because we only expose one field
// http://man7.org/linux/man-pages/man2/epoll_wait.2.html
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
Expand All @@ -2482,7 +2482,8 @@ fn test_linux(target: &str) {
"type_"
if struct_ == "input_event"
|| struct_ == "input_mask"
|| struct_ == "ff_effect" =>
|| struct_ == "ff_effect"
|| struct_ == "f_owner_ex" =>
{
"type".to_string()
}
Expand Down
4 changes: 4 additions & 0 deletions src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
Expand Up @@ -634,7 +634,11 @@ pub const EFD_NONBLOCK: ::c_int = 0x800;

pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_GETOWN_EX: ::c_int = 16;
pub const F_GETSIG: ::c_int = 11;
pub const F_SETOWN: ::c_int = 8;
pub const F_SETOWN_EX: ::c_int = 15;
pub const F_SETSIG: ::c_int = 10;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_OFD_GETLK: ::c_int = 36;
Expand Down
5 changes: 5 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Expand Up @@ -541,6 +541,11 @@ s! {
pub can_id: canid_t,
pub can_mask: canid_t,
}

pub struct f_owner_ex {
pub type_: ::c_int,
Copy link
Member

Choose a reason for hiding this comment

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

We should add f_owner_ex here:

libc/libc-test/build.rs

Lines 2513 to 2522 in 0d37400

// The following structs have a field called `type` in C,
// but `type` is a Rust keyword, so these fields are translated
// to `type_` in Rust.
"type_"
if struct_ == "input_event"
|| struct_ == "input_mask"
|| struct_ == "ff_effect" =>
{
"type".to_string()
}

pub pid: ::pid_t,
}
}

s_no_extra_traits! {
Expand Down
3 changes: 0 additions & 3 deletions src/unix/linux_like/linux/musl/b32/hexagon.rs
Expand Up @@ -245,9 +245,6 @@ pub const FLUSHO: ::c_int = 4096;
pub const F_OFD_GETLK: ::c_int = 36;
pub const F_OFD_SETLK: ::c_int = 37;
pub const F_OFD_SETLKW: ::c_int = 38;
pub const F_OWNER_PGRP: ::c_int = 2;
pub const F_OWNER_PID: ::c_int = 1;
pub const F_OWNER_TID: ::c_int = 0;
pub const F_SETLK: ::c_int = 13;
pub const F_SETLKW: ::c_int = 14;
pub const F_SETOWN: ::c_int = 8;
Expand Down
4 changes: 4 additions & 0 deletions src/unix/linux_like/mod.rs
Expand Up @@ -476,6 +476,10 @@ pub const F_SEAL_WRITE: ::c_int = 0x0008;

// FIXME(#235): Include file sealing fcntls once we have a way to verify them.

pub const F_OWNER_PGRP: ::c_int = 2;
pub const F_OWNER_PID: ::c_int = 1;
pub const F_OWNER_TID: ::c_int = 0;

pub const SIGTRAP: ::c_int = 5;

pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
Expand Down