Skip to content

Correct the function signatures for getpriority/setpriority #4458

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

Closed
wants to merge 1 commit into from

Conversation

chriswailes
Copy link

@chriswailes chriswailes commented May 22, 2025

The __priority_which_t type was incorrectly exposed as a type alias and defined as unsigned when they should be signed.

Description

This CL removes the __priority_which_t type alias from the unix::linux_like::linux::gnu module. It is not used for the same purpose as in the C++ source (enum value definition) and it is not supposed to be exposed to the user (see man setpriority). The type signatures for getpriority and setpriority are then updated to use the correct c_int type.

Sources

Libc source references:
*https://github.com/bminor/glibc/blob/4052d99ead880797cf271309fd87ddd2b95bd353/resource/sys/resource.h#L105

C++ Standard Reference:

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see rust-lang/libc#3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

Compilation error when running cargo test --target x86_64-unknown-linux-gnu:

error[E0061]: this function takes 3 arguments but 2 arguments were supplied
    --> ctest/src/lib.rs:2496:25
     |
2496 |                 Rc::new(macro_rules::compile(self.parse_sess, item)),
     |                         ^^^^^^^^^^^^^^^^^^^^                  ---- argument #2 of type `&RefCell<Features>` is missing
     |
note: function defined here
    --> /usr/local/google/home/chriswailes/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/garando_syntax-0.1.0/src/ext/tt/macro_rules.rs:172:8
     |
172  | pub fn compile(sess: &ParseSess, features: &RefCell<Features>, def: &ast::Item) -> SyntaxExtension {
     |        ^^^^^^^
help: provide the argument
     |
2496 |                 Rc::new(macro_rules::compile(self.parse_sess, /* &RefCell<Features> */, item)),
     |

This does not appear to be caused by this PR.

The type signatures were incorrectly hidden behind a type alias and
defined as unsigned when they should be signed.
@chriswailes
Copy link
Author

I apparently looked at the wrong portion of libc-test/semvar. I'm attempting to fix this now.

@chriswailes chriswailes deleted the priority-type branch May 23, 2025 00:44
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.

2 participants