Commit 1e073d05 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

crtools: A few style update on proc_parse

No func changes.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 3202d72f
#ifndef __PROC_PARSE_H__ #ifndef PROC_PARSE_H__
#define __PROC_PARSE_H__ #define PROC_PARSE_H__
int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use_map_files);
#define TASK_COMM_LEN 16 #define TASK_COMM_LEN 16
...@@ -54,5 +53,7 @@ struct proc_pid_stat { ...@@ -54,5 +53,7 @@ struct proc_pid_stat {
unsigned long start_brk; unsigned long start_brk;
}; };
int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s); extern int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s);
#endif extern int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use_map_files);
#endif /* PROC_PARSE_H__ */
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
#include <dirent.h> #include <dirent.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "crtools.h"
#include "types.h" #include "types.h"
#include "list.h" #include "list.h"
#include "util.h" #include "util.h"
#include "crtools.h"
#include "proc_parse.h" #include "proc_parse.h"
int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use_map_files) int parse_maps(pid_t pid, int pid_dir, struct list_head *vma_area_list, bool use_map_files)
...@@ -183,7 +185,10 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s) ...@@ -183,7 +185,10 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s)
} }
memset(s, 0, sizeof(*s)); memset(s, 0, sizeof(*s));
fscanf(f, "%d (%s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %d %d %llu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu", fscanf(f,
"%d (%s %c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld "
"%ld %d %d %llu %lu %ld %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu "
"%lu %lu %lu %d %d %u %u %llu %lu %ld %lu %lu %lu",
&s->pid, &s->pid,
s->comm, s->comm,
&s->state, &s->state,
...@@ -234,5 +239,6 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s) ...@@ -234,5 +239,6 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s)
s->comm[strlen(s->comm) - 1] = '\0'; /* trim the ending ) */ s->comm[strlen(s->comm) - 1] = '\0'; /* trim the ending ) */
fclose(f); fclose(f);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment