Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhul
criu
Commits
1e073d05
Commit
1e073d05
authored
Jan 13, 2012
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crtools: A few style update on proc_parse
No func changes. Signed-off-by:
Cyrill Gorcunov
<
gorcunov@openvz.org
>
parent
3202d72f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
54 deletions
+61
-54
proc_parse.h
include/proc_parse.h
+53
-52
proc_parse.c
proc_parse.c
+8
-2
No files found.
include/proc_parse.h
View file @
1e073d05
#ifndef __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
);
#ifndef PROC_PARSE_H__
#define PROC_PARSE_H__
#define TASK_COMM_LEN 16
struct
proc_pid_stat
{
int
pid
;
char
comm
[
TASK_COMM_LEN
];
char
state
;
int
ppid
;
int
pgid
;
int
sid
;
int
tty_nr
;
int
tty_pgrp
;
unsigned
int
flags
;
unsigned
long
min_flt
;
unsigned
long
cmin_flt
;
unsigned
long
maj_flt
;
unsigned
long
cmaj_flt
;
unsigned
long
utime
;
unsigned
long
stime
;
long
cutime
;
long
cstime
;
long
priority
;
long
nice
;
int
num_threads
;
int
zero0
;
unsigned
long
long
start_time
;
unsigned
long
vsize
;
long
mm_rss
;
unsigned
long
rsslim
;
unsigned
long
start_code
;
unsigned
long
end_code
;
unsigned
long
start_stack
;
unsigned
long
esp
;
unsigned
long
eip
;
unsigned
long
sig_pending
;
unsigned
long
sig_blocked
;
unsigned
long
sig_ignored
;
unsigned
long
sig_handled
;
unsigned
long
wchan
;
unsigned
long
zero1
;
unsigned
long
zero2
;
int
exit_signal
;
int
task_cpu
;
unsigned
int
rt_priority
;
unsigned
int
policy
;
unsigned
long
long
delayacct_blkio_ticks
;
unsigned
long
gtime
;
long
cgtime
;
unsigned
long
start_data
;
unsigned
long
end_data
;
unsigned
long
start_brk
;
int
pid
;
char
comm
[
TASK_COMM_LEN
];
char
state
;
int
ppid
;
int
pgid
;
int
sid
;
int
tty_nr
;
int
tty_pgrp
;
unsigned
int
flags
;
unsigned
long
min_flt
;
unsigned
long
cmin_flt
;
unsigned
long
maj_flt
;
unsigned
long
cmaj_flt
;
unsigned
long
utime
;
unsigned
long
stime
;
long
cutime
;
long
cstime
;
long
priority
;
long
nice
;
int
num_threads
;
int
zero0
;
unsigned
long
long
start_time
;
unsigned
long
vsize
;
long
mm_rss
;
unsigned
long
rsslim
;
unsigned
long
start_code
;
unsigned
long
end_code
;
unsigned
long
start_stack
;
unsigned
long
esp
;
unsigned
long
eip
;
unsigned
long
sig_pending
;
unsigned
long
sig_blocked
;
unsigned
long
sig_ignored
;
unsigned
long
sig_handled
;
unsigned
long
wchan
;
unsigned
long
zero1
;
unsigned
long
zero2
;
int
exit_signal
;
int
task_cpu
;
unsigned
int
rt_priority
;
unsigned
int
policy
;
unsigned
long
long
delayacct_blkio_ticks
;
unsigned
long
gtime
;
long
cgtime
;
unsigned
long
start_data
;
unsigned
long
end_data
;
unsigned
long
start_brk
;
};
int
parse_pid_stat
(
pid_t
pid
,
int
pid_dir
,
struct
proc_pid_stat
*
s
);
#endif
extern
int
parse_pid_stat
(
pid_t
pid
,
int
pid_dir
,
struct
proc_pid_stat
*
s
);
extern
int
parse_maps
(
pid_t
pid
,
int
pid_dir
,
struct
list_head
*
vma_area_list
,
bool
use_map_files
);
#endif
/* PROC_PARSE_H__ */
proc_parse.c
View file @
1e073d05
...
...
@@ -6,10 +6,12 @@
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
#include "crtools.h"
#include "types.h"
#include "list.h"
#include "util.h"
#include "crtools.h"
#include "proc_parse.h"
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)
}
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
->
comm
,
&
s
->
state
,
...
...
@@ -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 ) */
fclose
(
f
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment