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
acfd1d7f
Commit
acfd1d7f
authored
Jan 13, 2012
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crtools: Fix command line parsing in parse_pid_stat
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@openvz.org
>
parent
1e073d05
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
proc_parse.h
include/proc_parse.h
+2
-1
proc_parse.c
proc_parse.c
+5
-4
No files found.
include/proc_parse.h
View file @
acfd1d7f
#ifndef PROC_PARSE_H__
#define PROC_PARSE_H__
#define TASK_COMM_LEN 16
#define TASK_COMM_LEN 16
#define TASK_COMM_LEN_FMT "(%15s)"
struct
proc_pid_stat
{
int
pid
;
...
...
proc_parse.c
View file @
acfd1d7f
...
...
@@ -186,9 +186,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"
,
"%d "
TASK_COMM_LEN_FMT
" %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
,
...
...
@@ -237,7 +238,7 @@ int parse_pid_stat(pid_t pid, int pid_dir, struct proc_pid_stat *s)
&
s
->
end_data
,
&
s
->
start_brk
);
s
->
comm
[
strlen
(
s
->
comm
)
-
1
]
=
'\0'
;
/* trim the ending ) */
s
->
comm
[
TASK_COMM_LEN
-
1
]
=
'\0'
;
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