陈越 3 years ago
parent
commit
195bd57a74
3 changed files with 6 additions and 3 deletions
  1. +1
    -1
      fun_2.c
  2. BIN
      main
  3. +5
    -2
      mytop.c

+ 1
- 1
fun_2.c View File

@ -8,7 +8,7 @@ int pipe(int *fd);
int fork(); int fork();
int close(int arg); int close(int arg);
int dup(int fd); int dup(int fd);
int execvp(const char* command, char* argv[]);
int execvp(const char *, char * const *);
int wait(int arg); int wait(int arg);
static int num = 0; static int num = 0;
static char storage[MAXLINE][MAXLINE]; static char storage[MAXLINE][MAXLINE];

BIN
main View File


+ 5
- 2
mytop.c View File

@ -1,4 +1,4 @@
/*
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>
@ -116,7 +116,7 @@ void parse_file(pid_t pid)
p->p_endpoint = endpt; p->p_endpoint = endpt;
p->p_pid = pid; p->p_pid = pid;
// //
if (fscanf(fp, " %255s %c %d %d %lu %*u %lu %lu",
if (fscanf(fp, " %255s %c %d %d %ld %*u %lu %lu",
name, &state, &p->p_blocked, &p->p_priority, name, &state, &p->p_blocked, &p->p_priority,
&p->p_user_time, &cycles_hi, &cycles_lo) != 7) { &p->p_user_time, &cycles_hi, &cycles_lo) != 7) {
@ -335,3 +335,6 @@ void mytop()
print_procs(prev_proc,proc,1); print_procs(prev_proc,proc,1);
return; return;
} }
*/
void mytop()
{}

Loading…
Cancel
Save