Skip to content

About set_thread_res_uid and Uid types #1453

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

Open
rusty-snake opened this issue Apr 25, 2025 · 0 comments
Open

About set_thread_res_uid and Uid types #1453

rusty-snake opened this issue Apr 25, 2025 · 0 comments

Comments

@rusty-snake
Copy link
Contributor

Uid in rustix has a strange history of not liking the value -1. While it is nowadays sound (no unsafe) to create one, it is still incorrect.

At the same time the set_thread_res_uid takes three Uids that have a clear use of being -1 in this syscall interface.

It is possible to implement set_thread_euid like

set_thread_res_uid(
    Uid::from_raw_unchecked(-1_i32 as u32),
    euid,
    Uid::from_raw_unchecked(-1_i32 as u32),
)?;

this is

  • ugly, complicated and long
  • documented as being incorrect

So my suggestion is to change set_thread_res_uid to take three Option<Uid> in a semver compatible way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant