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

Added all definitions from linux/ptp-clock.h #3353

Closed
wants to merge 1 commit into from

Conversation

davidv1992
Copy link

This still has some trouble passing CI due to two unnamed anonymous unions in ptp_perout_request. Any guidance on how to deal with those in a better way?

@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2023

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

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

Comment on lines +877 to +886
pub union __c_anonymous_ptp_perout_request_1 {
pub start: ptp_clock_time,
pub phase: ptp_clock_time,
}

#[cfg(libc_union)]
pub union __c_anonymous_ptp_perout_request_2 {
pub on: ptp_clock_time,
pub rsv: [::c_uint; 4],
}
Copy link
Contributor

Choose a reason for hiding this comment

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

based on

    #[cfg(libc_union)]
    pub union __c_anonymous_ifr_ifru {
        pub ifru_addr: ::sockaddr,
        pub ifru_dstaddr: ::sockaddr,

these need that #[cfg(libc_union)] pragma. Then at the use site they need a "default" (highest size and alignment of the variants, I guess)

    pub struct ifreq {
        /// interface name, e.g. "en0"
        pub ifr_name: [::c_char; ::IFNAMSIZ],
        #[cfg(libc_union)]
        pub ifr_ifru: __c_anonymous_ifr_ifru,
        #[cfg(not(libc_union))]
        pub ifr_ifru: ::sockaddr,
    }

@bors
Copy link
Contributor

bors commented Oct 8, 2023

☔ The latest upstream changes (presumably #3376) made this pull request unmergeable. Please resolve the merge conflicts.

@JohnTitor
Copy link
Member

Could you resolve the merge conflict and CI failure? Thanks!

@davidv1992
Copy link
Author

@JohnTitor I would love to, but I don't know how to fix the CI. Essentially, it is failing because the ptp_perout_request struct contains unnamed anonymous enums (so both the enum and the field that is of the type of the enum don't have a name), and I don't know how to tell the CI that properly.

@JohnTitor
Copy link
Member

You can check around:

libc/libc-test/build.rs

Lines 3480 to 3520 in d0ce87b

cfg.skip_type(move |ty| {
match ty {
// FIXME: `sighandler_t` type is incorrect, see:
// https://github.com/rust-lang/libc/issues/1359
"sighandler_t" => true,
// These cannot be tested when "resolv.h" is included and are tested
// in the `linux_elf.rs` file.
"Elf64_Phdr" | "Elf32_Phdr" => true,
// This type is private on Linux. It is implemented as a C `enum`
// (`c_uint`) and this clashes with the type of the `rlimit` APIs
// which expect a `c_int` even though both are ABI compatible.
"__rlimit_resource_t" => true,
// on Linux, this is a volatile int
"pthread_spinlock_t" => true,
// For internal use only, to define architecture specific ioctl constants with a libc
// specific type.
"Ioctl" => true,
// FIXME: requires >= 5.4.1 kernel headers
"pgn_t" if musl => true,
"priority_t" if musl => true,
"name_t" if musl => true,
t => {
if musl {
// LFS64 types have been removed in musl 1.2.4+
t.ends_with("64") || t.ends_with("64_t")
} else {
false
}
}
}
});
cfg.skip_struct(move |ty| {
if ty.starts_with("__c_anonymous_") {
return true;
}

@Brijeshkrishna
Copy link
Contributor

Brijeshkrishna commented Nov 25, 2023

libc/libc-test/build.rs

Lines 4180 to 4184 in 3195caf

(struct_ == "ifconf" && field == "ifc_ifcu") ||
// glibc uses a single array `uregs` instead of individual fields.
(struct_ == "user_regs" && arm)
});

add this

(struct_ == "ptp_perout_request" && field == "anonymous_1")

@davidv1992
Copy link
Author

Replaced by #3559

@davidv1992 davidv1992 closed this Jan 26, 2024
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

6 participants