-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Dual process implementation for resolving AccessDenied #304
Comments
From jlo...@gmail.com on July 13, 2012 05:43:55 The other way to handle this that comes to mind is similar to what we I realize caching might not be feasible if we're looking at volatile My main question/issue with using NtQuerySystemInformation() so heavily is |
From wj32...@gmail.com on July 13, 2012 05:53:52 I don't think you have to worry about NtQuerySystemInformation being
I like jloden's idea of caching properties for multiple processes, but of |
From g.rodola on July 13, 2012 07:26:24 Since we're talking about volatile info I can't see any consistent way to cache
...later on:
Also, note that I've already introduced caching where possible in latest As for populating the struct simultaneously please note that using |
From g.rodola on July 13, 2012 13:25:20 Ok, this is now fixed.
Status: FixedInSVN |
From g.rodola on August 13, 2012 09:25:13 Fixed in version 0.6.0, released just now. Status: Fixed |
From g.rodola on March 02, 2013 04:11:03 Updated csets after the SVN -> Mercurial migration: r1448 == revision |
From g.rodola on July 13, 2012 13:31:17
This is similar to issue 297 but for Windows.
On Windows we use native APIs to extract process information such as CPU times,
memory info etc.
Such APIs systematically fail with an AccessDenied exception for any process
owned by NT AUTHORITY SYSTEM user (system processes, typically) imposing a
severe usability issue for those who want to inspect processes not owned by the
current user (e.g. a task manager like app).
Example:
I realized that a considerable amount of process information which we currently
extract by using documented Windows APIs is also stored in the
SYSTEM_PROCESS_INFORMATION structure, which can be obtained via
NtQuerySystemInformation():
http://undocumented.ntinternals.net/UserMode/Undocumented%20Functions/System%20Information/Structures/SYSTEM_PROCESS_INFORMATION.html
The peculiarity of NtQuerySystemInformation() is that it succeeds for
basically ALL processes except for PID 0!
On the other hand it is sensibly slower compared to using native APIs.
As such, a natural approach seems to be using the current, native APIs
implementation and fall back on using NtQuerySystemInformation in case of
permission error. Something like:
Obviously, a robust set of unit tests will have to be written in order to make
sure that the two methods return the exact same value.
Follows a summary of Process methods which can apparently take benefit from
this approach:
@wj32.64, given the massive amount of code rewriting involved, I'd like to hear
your opinion about this. Does it sounds reasonable and reliable to you?
Original issue: http://code.google.com/p/psutil/issues/detail?id=304
The text was updated successfully, but these errors were encountered: