Mac client: fill in command field of PROCINFO struct so <exclusive_app> log flag works properly on Mac.

svn path=/trunk/boinc/; revision=17760
This commit is contained in:
Charlie Fenton 2009-04-09 10:41:11 +00:00
parent 0cfb2747f9
commit dab27897c2
2 changed files with 11 additions and 2 deletions

View File

@ -3708,3 +3708,10 @@ Charlie 8 Apr 2009
mac_build/
boinc.xcodeproj/
project.pbxproj
Charlie 8 Apr 2009
- Mac client: fill in command field of PROCINFO struct so <exclusive_app>
log flag works properly on Mac.
lib/
procinfo_mac.cpp

View File

@ -52,6 +52,7 @@ int procinfo_setup(vector<PROCINFO>& pi) {
// Some values of possible interest available from 'ps' command:
// %cpu percentage cpu usage (alias pcpu)
// %mem percentage memory usage (alias pmem)
// command command (executable name)
// majflt total page faults
// minflt total page reclaims
// nswap total swaps in/out
@ -82,7 +83,7 @@ int procinfo_setup(vector<PROCINFO>& pi) {
// root; this was perceived by some users as a security risk.
fd = popen("ps -axopid,ppid,rsz,vsz,pagein,time", "r");
fd = popen("ps -axcopid,ppid,rsz,vsz,pagein,time,command", "r");
if (!fd) return 0;
// Skip over the header line
@ -96,7 +97,8 @@ int procinfo_setup(vector<PROCINFO>& pi) {
while (1) {
memset(&p, 0, sizeof(p));
c = fscanf(fd, "%d%d%d%d%ld%d:%lf\n", &p.id, &p.parentid, &real_mem, &virtual_mem, &p.page_fault_count, &hours, &p.user_time);
c = fscanf(fd, "%d%d%d%d%ld%d:%lf %[^\n]", &p.id, &p.parentid, &real_mem,
&virtual_mem, &p.page_fault_count, &hours, &p.user_time, p.command);
if (c < 7) break;
p.working_set_size = (double)real_mem * 1024.;
p.swap_size = (double)virtual_mem * 1024.;