site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Le 18 août 2009 à 17:28, Terry Lambert a écrit : Have you looked at the sources to ps or top? (e..g, http://opensource.apple.com/source/top/top-39/) (e) you won't have to deal with permissions issues as ps is suid. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Aug 18, 2009, at 4:32 AM, Mo McRoberts <lists@ilaven.net> wrote: On Tue, Aug 18, 2009 at 08:30, Marc Lohse<Lohse@mpimp-golm.mpg.de> wrote: The kind of information i need is essentially what's supplied by the ps -axv command. Please be aware the the APIs used by these programs are considered SPI, and are therefore unstable from software update to software update, and, as I noted the other day, at least in Leopard, they are not even guaranteed to be 64 bit clean. Portability of the code to Tiger and earlier versions is also problematic, as the SPI in use for this changed in that time frame (i.e. your code will not work on all of Tiger, Leopard, and later simultaneously in all bitness, even if you compile from source each time). Despite what he wants or doesn't want, popen'ing the ps command and using the POSIX mandated -A option for "all processes" and the POSIX mandated -o option to control output formatting to make it easy to parse the program output are your best bets to ensure binary compatibility. We (a) have to maintain POSIX compliance for the ps command, (b) will rev the ps command in lockstep with the changes to the SPI, so you are reasonably assured it will keep working over SPI changes, or be fixed quickly, (c) POSIX itself rarely changes the list of supported options to command line commands, and (d) your code will be portable to other POSIX compliant OSs, without modification. This email sent to site_archiver@lists.apple.com