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 struct ctl_info #3046

Merged
merged 1 commit into from
Jan 21, 2023
Merged

Add struct ctl_info #3046

merged 1 commit into from
Jan 21, 2023

Conversation

siegfried
Copy link
Contributor

Add the struct mentioned in #3045

Not sure if I should add CTLIOCGINFO because it is wrapped in a macro:

#define CTLIOCGINFO     _IOWR('N', 3, struct ctl_info)  /* get id from name */

The C definition of ctl_info is:

/*!
 *       @defined MAX_KCTL_NAME
 *   @discussion Kernel control names must be no longer than
 *       MAX_KCTL_NAME.
 */
#define MAX_KCTL_NAME   96

/*
 * Controls destined to the Controller Manager.
 */

/*!
 *       @struct ctl_info
 *       @discussion This structure is used with the CTLIOCGINFO ioctl to
 *               translate from a kernel control name to a control id.
 *       @field ctl_id The kernel control id, filled out upon return.
 *       @field ctl_name The kernel control name to find.
 */
struct ctl_info {
	u_int32_t   ctl_id;                             /* Kernel Controller ID  */
	char        ctl_name[MAX_KCTL_NAME];            /* Kernel Controller Name (a C string) */
};

@rustbot
Copy link
Collaborator

rustbot commented Dec 23, 2022

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.

@JohnTitor
Copy link
Member

Thanks! @bors r+

@bors
Copy link
Contributor

bors commented Jan 5, 2023

📌 Commit 0da767e has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 5, 2023

⌛ Testing commit 0da767e with merge 664ba6d...

bors added a commit that referenced this pull request Jan 5, 2023
Add struct ctl_info

Add the struct mentioned in #3045

Not sure if I should add `CTLIOCGINFO ` because it is wrapped in a macro:

```c
#define CTLIOCGINFO     _IOWR('N', 3, struct ctl_info)  /* get id from name */
```

The C definition of `ctl_info` is:
```c
/*!
 *       `@defined` MAX_KCTL_NAME
 *   `@discussion` Kernel control names must be no longer than
 *       MAX_KCTL_NAME.
 */
#define MAX_KCTL_NAME   96

/*
 * Controls destined to the Controller Manager.
 */

/*!
 *       `@struct` ctl_info
 *       `@discussion` This structure is used with the CTLIOCGINFO ioctl to
 *               translate from a kernel control name to a control id.
 *       `@field` ctl_id The kernel control id, filled out upon return.
 *       `@field` ctl_name The kernel control name to find.
 */
struct ctl_info {
	u_int32_t   ctl_id;                             /* Kernel Controller ID  */
	char        ctl_name[MAX_KCTL_NAME];            /* Kernel Controller Name (a C string) */
};
```
@bors
Copy link
Contributor

bors commented Jan 5, 2023

💔 Test failed - checks-actions

src/unix/bsd/apple/mod.rs Outdated Show resolved Hide resolved
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.

It'd also be great if you could squash commits into one.

build.rs Outdated Show resolved Hide resolved
@JohnTitor
Copy link
Member

Could you squash commits into one to clean up the history?

@siegfried
Copy link
Contributor Author

Could you squash commits into one to clean up the history?

Sure, if you have trouble squash merging on your side.

@JohnTitor
Copy link
Member

This repo uses bors and the bot only can merge PRs via merge commits. So you have to do that before merging.

@siegfried
Copy link
Contributor Author

Squashed.

@JohnTitor
Copy link
Member

👍, @bors r+

@bors
Copy link
Contributor

bors commented Jan 8, 2023

📌 Commit 9013963 has been approved by JohnTitor

It is now in the queue for this repository.

bors added a commit that referenced this pull request Jan 8, 2023
Add struct ctl_info

Add the struct mentioned in #3045

Not sure if I should add `CTLIOCGINFO ` because it is wrapped in a macro:

```c
#define CTLIOCGINFO     _IOWR('N', 3, struct ctl_info)  /* get id from name */
```

The C definition of `ctl_info` is:
```c
/*!
 *       `@defined` MAX_KCTL_NAME
 *   `@discussion` Kernel control names must be no longer than
 *       MAX_KCTL_NAME.
 */
#define MAX_KCTL_NAME   96

/*
 * Controls destined to the Controller Manager.
 */

/*!
 *       `@struct` ctl_info
 *       `@discussion` This structure is used with the CTLIOCGINFO ioctl to
 *               translate from a kernel control name to a control id.
 *       `@field` ctl_id The kernel control id, filled out upon return.
 *       `@field` ctl_name The kernel control name to find.
 */
struct ctl_info {
	u_int32_t   ctl_id;                             /* Kernel Controller ID  */
	char        ctl_name[MAX_KCTL_NAME];            /* Kernel Controller Name (a C string) */
};
```
@bors
Copy link
Contributor

bors commented Jan 8, 2023

⌛ Testing commit 9013963 with merge 6cf3080...

@bors
Copy link
Contributor

bors commented Jan 8, 2023

💔 Test failed - checks-actions

@bors
Copy link
Contributor

bors commented Jan 12, 2023

💔 Test failed - checks-actions

@siegfried
Copy link
Contributor Author

Still not working?

@JohnTitor
Copy link
Member

+ cargo +1.13.0 build -vv --no-default-features --target aarch64-apple-ios
warning: unused manifest key: package.categories
warning: unused manifest key: package.categories
warning: unused manifest key: package.categories
    Updating registry `[https://github.com/rust-lang/crates.io-index`](https://github.com/rust-lang/crates.io-index%60)
error: failed to parse registry's information for: serde

Caused by:
  Feature `playground` depends on `serde_derive` which is not an optional dependency.
Consider adding `optional = true` to the dependency

I believe it's unrelated to this PR, let me investigate after my day job.

@JohnTitor
Copy link
Member

rust-lang/crates.io#5929 should fix the issue, let's try out, @bors retry

@bors
Copy link
Contributor

bors commented Jan 13, 2023

⌛ Testing commit dfa2165 with merge a552a85...

bors added a commit that referenced this pull request Jan 13, 2023
Add struct ctl_info

Add the struct mentioned in #3045

Not sure if I should add `CTLIOCGINFO ` because it is wrapped in a macro:

```c
#define CTLIOCGINFO     _IOWR('N', 3, struct ctl_info)  /* get id from name */
```

The C definition of `ctl_info` is:
```c
/*!
 *       `@defined` MAX_KCTL_NAME
 *   `@discussion` Kernel control names must be no longer than
 *       MAX_KCTL_NAME.
 */
#define MAX_KCTL_NAME   96

/*
 * Controls destined to the Controller Manager.
 */

/*!
 *       `@struct` ctl_info
 *       `@discussion` This structure is used with the CTLIOCGINFO ioctl to
 *               translate from a kernel control name to a control id.
 *       `@field` ctl_id The kernel control id, filled out upon return.
 *       `@field` ctl_name The kernel control name to find.
 */
struct ctl_info {
	u_int32_t   ctl_id;                             /* Kernel Controller ID  */
	char        ctl_name[MAX_KCTL_NAME];            /* Kernel Controller Name (a C string) */
};
```
@bors
Copy link
Contributor

bors commented Jan 13, 2023

💔 Test failed - checks-actions

@siegfried
Copy link
Contributor Author

I rebased the commit to the tip.

@JohnTitor
Copy link
Member

The failure is valid:

error[E0277]: the trait bound `[i8; 96]: core::fmt::Debug` is not satisfied
   --> src/unix/bsd/apple/long_array.rs:4:9
    |
4   |           pub ctl_name: [::c_char; MAX_KCTL_NAME],
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `[i8; 96]` cannot be formatted using `:?`; if it is defined in your crate, add `#[derive(Debug)]` or manually implement it
    | 
   ::: src/lib.rs
    |
93  | / cfg_if! {
94  | |     if #[cfg(windows)] {
95  | |         mod fixed_width_ints;
96  | |         pub use fixed_width_ints::*;
...   |
156 | |     }
157 | | }
    | |_- in this macro invocation
    |
    = help: the trait `core::fmt::Debug` is not implemented for `[i8; 96]`
    = note: required because of the requirements on the impl of `core::fmt::Debug` for `&[i8; 96]`
    = note: required for the cast to the object type `core::fmt::Debug`

error[E0277]: the trait bound `[i8; 96]: core::cmp::Eq` is not satisfied
   --> src/unix/bsd/apple/long_array.rs:4:9
    |
4   |           pub ctl_name: [::c_char; MAX_KCTL_NAME],
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::cmp::Eq` is not implemented for `[i8; 96]`
    | 
   ::: src/lib.rs
    |
93  | / cfg_if! {
94  | |     if #[cfg(windows)] {
95  | |         mod fixed_width_ints;
96  | |         pub use fixed_width_ints::*;
...   |
156 | |     }
157 | | }
    | |_- in this macro invocation
    |
    = help: the following implementations were found:
              <[T; 19] as core::cmp::Eq>
              <[T; 22] as core::cmp::Eq>
              <[T; 10] as core::cmp::Eq>
              <[T; 32] as core::cmp::Eq>
            and 30 others
    = note: required by `core::cmp::AssertParamIsEq`

error[E0277]: the trait bound `[i8; 96]: core::hash::Hash` is not satisfied
   --> src/unix/bsd/apple/long_array.rs:4:9
    |
4   |           pub ctl_name: [::c_char; MAX_KCTL_NAME],
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `core::hash::Hash` is not implemented for `[i8; 96]`
    | 
   ::: src/lib.rs
    |
93  | / cfg_if! {
94  | |     if #[cfg(windows)] {
95  | |         mod fixed_width_ints;
96  | |         pub use fixed_width_ints::*;
...   |
156 | |     }
157 | | }
    | |_- in this macro invocation
    |
    = help: the following implementations were found:
              <[T; 20] as core::hash::Hash>
              <[T] as core::hash::Hash>
              <[T; 23] as core::hash::Hash>
              <[T; 12] as core::hash::Hash>
            and 30 others
    = note: required by `core::hash::Hash::hash`

error[E0369]: binary operation `==` cannot be applied to type `[i8; 96]`
   --> src/unix/bsd/apple/long_array.rs:4:9
    |
4   |           pub ctl_name: [::c_char; MAX_KCTL_NAME],
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: src/lib.rs
    |
93  | / cfg_if! {
94  | |     if #[cfg(windows)] {
95  | |         mod fixed_width_ints;
96  | |         pub use fixed_width_ints::*;
...   |
156 | |     }
157 | | }
    | |_- in this macro invocation
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `[i8; 96]`

error[E0369]: binary operation `!=` cannot be applied to type `[i8; 96]`
   --> src/unix/bsd/apple/long_array.rs:4:9
    |
4   |           pub ctl_name: [::c_char; MAX_KCTL_NAME],
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | 
   ::: src/lib.rs
    |
93  | / cfg_if! {
94  | |     if #[cfg(windows)] {
95  | |         mod fixed_width_ints;
96  | |         pub use fixed_width_ints::*;
...   |
156 | |     }
157 | | }
    | |_- in this macro invocation
    |
    = note: an implementation of `std::cmp::PartialEq` might be missing for `[i8; 96]`

1.19 cannot impl it and we have to use s_no_extra_traits! and manually impl them, I think.

@siegfried
Copy link
Contributor Author

How about support >= 1.20 only? Updated.

@JohnTitor
Copy link
Member

It will require 1.47, but it sounds good to me as I think it's old enough 👍

@siegfried
Copy link
Contributor Author

siegfried commented Jan 21, 2023

Sorry, I just saw this. Now I've changed the version to >= 1.47. Please review.

@JohnTitor
Copy link
Member

No worries, thanks! @bors r+

@bors
Copy link
Contributor

bors commented Jan 21, 2023

📌 Commit 950827b has been approved by JohnTitor

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jan 21, 2023

⌛ Testing commit 950827b with merge f1bb40a...

@bors
Copy link
Contributor

bors commented Jan 21, 2023

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

@bors bors merged commit f1bb40a into rust-lang:master Jan 21, 2023
@siegfried siegfried deleted the ctl_info branch April 28, 2023 17:57
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