Skip to content

Conversation

dalvescb
Copy link

What does this PR do

Fixes acct mod to provide custom methods that account for differences in AIX's libc::acctl type interface

Checklist:

  • I have read CONTRIBUTING.md
  • Does not require a change in tests or rustdoc comments
  • Does not require to change to nix' API

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Why does AIX need a mutable pointer? If there is any possibility that it may modify the caller-provided string, then your pointer cast is invalid.

@dalvescb
Copy link
Author

Why does AIX need a mutable pointer?

This is just how AIX defines acct in its system headers (see https://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/docs/apidiffs.html#read). On linux the function interface is int acct(const char *filename); and on AIX int acct (char *Path); The libc crate requires rust accurately reflects the system headers, hence when we ported it we needed to maintain a mutable pointer

If there is any possibility that it may modify the caller-provided string, then your pointer cast is invalid.

Despite the difference in interface, the Linux and AIX definitions of acct are documented as compatible and acct does not modify its argument. So the cast should be valid

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