-rw-r--r-- | noncore/settings/sysinfo/processinfo.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index f9263ea..4ecb704 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp | |||
@@ -84,56 +84,56 @@ void ProcessInfo::updateData() | |||
84 | QFileInfoListIterator it(*proclist); | 84 | QFileInfoListIterator it(*proclist); |
85 | QFileInfo *f; | 85 | QFileInfo *f; |
86 | while ( ( f = it.current() ) != 0 ) | 86 | while ( ( f = it.current() ) != 0 ) |
87 | { | 87 | { |
88 | ++it; | 88 | ++it; |
89 | processnum = f->fileName(); | 89 | processnum = f->fileName(); |
90 | if ( processnum >= "0" && processnum <= "99999" ) | 90 | if ( processnum >= "0" && processnum <= "99999" ) |
91 | { | 91 | { |
92 | FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); | 92 | FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); |
93 | 93 | ||
94 | if ( procfile ) | 94 | if ( procfile ) |
95 | { | 95 | { |
96 | fscanf( procfile, | 96 | fscanf( procfile, |
97 | "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u", | 97 | "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u", |
98 | &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, | 98 | &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, |
99 | &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, | 99 | &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, |
100 | &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, | 100 | &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, |
101 | &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); | 101 | &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); |
102 | processnum = processnum.rightJustify( 5, ' ' ); | 102 | processnum = processnum.rightJustify( 5, ' ' ); |
103 | processcmd = QString( comm ).replace( QRegExp( "(" ), "" ); | 103 | processcmd = QString( comm ).replace( QRegExp( "(" ), "" ); |
104 | processcmd = processcmd.replace( QRegExp( ")" ), "" ); | 104 | processcmd = processcmd.replace( QRegExp( ")" ), "" ); |
105 | processstatus = state; | 105 | processstatus = state; |
106 | processtime.setNum( ( utime + stime ) / 100 ); | 106 | processtime.setNum( ( utime + stime ) / 100 ); |
107 | processtime = processtime.rightJustify( 9, ' ' ); | 107 | processtime = processtime.rightJustify( 9, ' ' ); |
108 | fclose( procfile ); | 108 | fclose( procfile ); |
109 | 109 | ||
110 | ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); | 110 | ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | } | 113 | } |
114 | } | 114 | } |
115 | 115 | ||
116 | delete proclist; | 116 | delete proclist; |
117 | delete procdir; | 117 | delete procdir; |
118 | } | 118 | } |
119 | 119 | ||
120 | void ProcessInfo::viewProcess(QListViewItem *process) | 120 | void ProcessInfo::viewProcess(QListViewItem *process) |
121 | { | 121 | { |
122 | QString pid= process->text(0); | 122 | QString pid= process->text(0); |
123 | QString command = process->text(1); | 123 | QString command = process->text(1); |
124 | switch( QMessageBox::information( this, (tr("Kill Process?")), | 124 | switch( QMessageBox::information( this, (tr("Kill Process?")), |
125 | (tr("You really want to kill\n"+command+" PID: "+pid+"?")), | 125 | (tr("You really want to kill\n"+command+" PID: "+pid+"?")), |
126 | (tr("Yes")), (tr("No")), 0 )){ | 126 | (tr("Yes")), (tr("No")), 0 )){ |
127 | case 0: // Yes clicked, | 127 | case 0: // Yes clicked, |
128 | { | 128 | { |
129 | bool ok; | 129 | bool ok; |
130 | pid_t child=pid.toInt(&ok,10); | 130 | pid_t child=pid.toInt(&ok,10); |
131 | if((kill(child,SIGKILL)) < 0) | 131 | if((kill(child,SIGKILL)) < 0) |
132 | perror("kill:SIGTERM"); | 132 | perror("kill:SIGKILL"); |
133 | } | 133 | } |
134 | break; | 134 | break; |
135 | case 1: // Cancel | 135 | case 1: // Cancel |
136 | break; | 136 | break; |
137 | }; | 137 | }; |
138 | //printf("Double click for PID: %s\n", process->text(0).stripWhiteSpace().latin1()); | 138 | //printf("Double click for PID: %s\n", process->text(0).stripWhiteSpace().latin1()); |
139 | } | 139 | } |