Skip to content

Added sys::user. #606

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 5 commits into from
Closed

Added sys::user. #606

wants to merge 5 commits into from

Conversation

xd009642
Copy link
Contributor

This PR adds the various register structures for the x86 and x64 architectures. the Regs struct in particular is what accessed and modified by PTRACE_GETREGS and PTRACE_SETREGS so is of particular use to people using ptrace with rust-nix.

Following review comments I'll fix them and fill in the PR number in the changelog if the changes are accepted

xd009642 added 5 commits May 22, 2017 19:33
Added structs defined in sys/user.h adapted to follow rust naming conventions (so user_regs_struct becomes user::Regs).
EFlags (Extended Flags) represents different flags that can be raised during execution. Implemented constants representing the possible flags as a bitflag and placed into original register structs.
Updated the changelog to reflect addition of sys/user and updated the conditional compilation to only include x86 and x86_64 and not limit based on OS.


#[repr(C)]
#[cfg(any(target_arch = "x86_64"))]
Copy link
Contributor

Choose a reason for hiding this comment

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

This should just be #[cfg(target_arch = "x86_64")]. You should make the same change for the rest of these in this file.

@Susurrus
Copy link
Contributor

Thanks for your PR! I don't think I quite understand what this work is for. There's no functions here that produce or consume any of these values. Additionally, since all of the things you declared are safe, shouldn't they all be upstreaming into rust-lang/libc instead of here? nix serves as a thin safety layer on top of libc, but the constants and types used by it are originally defined upstream. I think you should instead file an equivalent PR to these against rust-lang/libc and this can be closed until safe wrappers are needed around some unsafe functions.

@xd009642
Copy link
Contributor Author

xd009642 commented May 23, 2017

That makes sense. I'll fork and submit a PR for libc.

Although the Eflag constants aren't defined in any system headers, I did have to check the x86 documentation for them. So are they still a good fit for libc?

@Susurrus
Copy link
Contributor

Cool, thanks @xd009642. As for the Eflag constants, you'll have to ask them. Sounds like those should go in a separate crate that defines some of those extra constants, as I imagine one exists, but I don't know which one.

@Susurrus
Copy link
Contributor

This is being upstreamed in rust-lang/libc#599.

@xd009642
Copy link
Contributor Author

xd009642 commented Jun 1, 2017

This has now been merged into libc. Closing the pull request.

@xd009642 xd009642 closed this Jun 1, 2017
@Susurrus
Copy link
Contributor

Susurrus commented Jun 1, 2017

Thanks, @xd009642 for getting that pushed.

@xd009642
Copy link
Contributor Author

xd009642 commented Jun 1, 2017

Follow up question @Susurrus, does rust-nix have a gitter or is there a means to message without opening a PR or issue?

@Susurrus
Copy link
Contributor

Susurrus commented Jun 1, 2017

Yeah, there's a gitter. We need to add it to our README (see #597).

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

Successfully merging this pull request may close these issues.

2 participants