proc: resurrect /proc/PID/stat and fix a few fields
Change-Id: I8ffcfde4db78c66ea10845a0451ae2610261f832
This commit is contained in:
committed by
Dominique Martinet
parent
e5c1fdf129
commit
2ce695b47b
@@ -669,6 +669,42 @@ int process_procfs_request(struct ikc_scd_packet *rpacket)
|
||||
}
|
||||
|
||||
if (!strcmp(p, "stat")) {
|
||||
const char *comm = "exe";
|
||||
char state;
|
||||
|
||||
if (proc->saved_cmdline) {
|
||||
comm = strrchr(proc->saved_cmdline, '/');
|
||||
if (comm)
|
||||
comm++;
|
||||
else
|
||||
comm = proc->saved_cmdline;
|
||||
}
|
||||
|
||||
switch (thread->status & (0x3f)) {
|
||||
case PS_INTERRUPTIBLE:
|
||||
state = 'S';
|
||||
break;
|
||||
case PS_UNINTERRUPTIBLE:
|
||||
state = 'D';
|
||||
break;
|
||||
case PS_ZOMBIE:
|
||||
state = 'Z';
|
||||
break;
|
||||
case PS_EXITED:
|
||||
state = 'X';
|
||||
break;
|
||||
case PS_STOPPED:
|
||||
state = 'T';
|
||||
break;
|
||||
case PS_RUNNING:
|
||||
default:
|
||||
if (thread->in_syscall_offload > 0) {
|
||||
state = 'S';
|
||||
}
|
||||
else {
|
||||
state = 'R';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* pid (comm) state ppid
|
||||
@@ -695,8 +731,9 @@ int process_procfs_request(struct ikc_scd_packet *rpacket)
|
||||
"%lu %lu %lu %lu " // sigignore...
|
||||
"%lu %d %d %u " // cnswap...
|
||||
"%u %llu %lu %ld\n", // policy...
|
||||
0, "exe", 'R', 0, // pid...
|
||||
0, 0, 0, 0, // pgrp...
|
||||
thread->tid, comm, state,
|
||||
thread->proc->ppid_parent->pid, // pid...
|
||||
thread->proc->pid, 0, 0, 0, // pgrp...
|
||||
0, 0L, 0L, 0L, // flags...
|
||||
0L, 0L, 0L, 0L, // cmajflt...
|
||||
0L, 0L, 0L, 0L, // cstime...
|
||||
|
||||
@@ -4324,6 +4324,7 @@ SYSCALL_DECLARE(rt_sigtimedwait)
|
||||
thread->sigevent = 1;
|
||||
for(;;){
|
||||
while(thread->sigevent == 0){
|
||||
thread->status = PS_INTERRUPTIBLE;
|
||||
if(timeout){
|
||||
if (gettime_local_support)
|
||||
calculate_time_from_tsc(&ats);
|
||||
@@ -4340,6 +4341,7 @@ SYSCALL_DECLARE(rt_sigtimedwait)
|
||||
thread->sigevent = 0;
|
||||
#endif /* POSTK_DEBUG_TEMP_FIX_33 */
|
||||
|
||||
thread->status = PS_RUNNING;
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
mcs_rwlock_writer_lock(lock, &mcs_rw_node);
|
||||
@@ -4454,6 +4456,8 @@ do_sigsuspend(struct thread *thread, const sigset_t *set)
|
||||
int do_schedule = 0;
|
||||
struct cpu_local_var *v;
|
||||
long runq_irqstate;
|
||||
|
||||
thread->status = PS_INTERRUPTIBLE;
|
||||
runq_irqstate =
|
||||
ihk_mc_spinlock_lock(&(get_this_cpu_local_var()->runq_lock));
|
||||
v = get_this_cpu_local_var();
|
||||
@@ -4475,6 +4479,7 @@ do_sigsuspend(struct thread *thread, const sigset_t *set)
|
||||
thread->sigevent = 0;
|
||||
#endif /* POSTK_DEBUG_TEMP_FIX_33 */
|
||||
|
||||
thread->status = PS_RUNNING;
|
||||
lock = &thread->sigcommon->lock;
|
||||
head = &thread->sigcommon->sigpending;
|
||||
mcs_rwlock_writer_lock(lock, &mcs_rw_node);
|
||||
|
||||
Reference in New Issue
Block a user