Browse Source

test mytop

master
10195501441 3 years ago
parent
commit
fe2cfb404a
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      yeeshell.c

+ 4
- 5
yeeshell.c View File

@ -507,15 +507,13 @@ void parse_file(pid_t pid)
unsigned long cycles_hi, cycles_lo;
FILE *fp;
struct proc *p;
int i;
int slot;
int i;
sprintf(path, "/proc/%d/psinfo", pid);
sprintf(path, "%d/psinfo", pid);
if ((fp = fopen(path, "r")) == NULL)
{
return;
}
if (fscanf(fp, "%d", &version) != 1)
{
@ -535,7 +533,6 @@ void parse_file(pid_t pid)
return;
}
slot++;
slot = SLOT_NR(endpt);
if (slot < 0 || slot >= nr_total)
@ -561,6 +558,7 @@ void parse_file(pid_t pid)
if (fscanf(fp, " %255s %c %d %d %lu %*u %lu %lu", name, &state, &p->p_blocked, &p->p_priority, &p->p_user_time, &cycles_hi, &cycles_lo) != 7)
{
fclose(fp);
return;
}
@ -580,6 +578,7 @@ void parse_file(pid_t pid)
int j;
if ((j = fscanf(fp, " %lu %*u %*u %*c %*d %*u %u %*u %d %*c %*d %*u", &p->p_memory, &effuid, &p->p_nice)) != 3)
{
fclose(fp);
return;
}

Loading…
Cancel
Save