Skip to content

Process owner#264

Closed
k-brk wants to merge 11 commits intoheim-rs:masterfrom
k-brk:process_owner
Closed

Process owner#264
k-brk wants to merge 11 commits intoheim-rs:masterfrom
k-brk:process_owner

Conversation

@k-brk
Copy link

@k-brk k-brk commented Aug 11, 2020

Hey, I decided to give a try and fix #194, as author of #198 can't continue work. This is still work in progress as there are few problems. Both linux and macos User structs seems to be strongly tied to utmpx login records and this makes really hard to fill all fields in struct. Matching user to stream of currently connected users to get all required information will not work as some users might not appear to be connected and still have some processes ( for example daemons like dbus ). I could probably get hostname from /proc/sys/kernel/hostname but not sure about any others without any nasty tricks( like looking in all processes for terminal that is used by user and extracting information and that for every user ). It would be great to separate user from user login session but that probably would be a breaking change. For now, I decided to get information about uid from /proc/<pid>/status (File is not fully parsed atm.) and recreate user from func getpwuid, similarly for macOS but uid is extracted from process struct. At this moment it works but process owner information are limited on both linux and macOS. Any other way to find out some information's related to user?

@k-brk k-brk closed this Nov 10, 2020
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.

Process::user method

1 participant