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
b3c8ee1b
Commit
b3c8ee1b
authored
Dec 03, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zdtm: Factor out ps showing code
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
0ecd6c33
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
ns.c
test/zdtm/lib/ns.c
+15
-14
No files found.
test/zdtm/lib/ns.c
View file @
b3c8ee1b
...
@@ -218,6 +218,19 @@ static int ns_exec(void *_arg)
...
@@ -218,6 +218,19 @@ static int ns_exec(void *_arg)
return
-
1
;
return
-
1
;
}
}
static
void
show_ps
(
void
)
{
int
pid
;
pid
=
fork
();
if
(
pid
==
0
)
{
execl
(
"/bin/ps"
,
"ps"
,
"axf"
,
"-o"
,
"pid,sid,comm"
,
NULL
);
fprintf
(
stderr
,
"Unable to execute ps: %m
\n
"
);
exit
(
1
);
}
else
if
(
pid
>
0
)
waitpid
(
pid
,
NULL
,
0
);
}
int
ns_init
(
int
argc
,
char
**
argv
)
int
ns_init
(
int
argc
,
char
**
argv
)
{
{
struct
sigaction
sa
=
{
struct
sigaction
sa
=
{
...
@@ -261,13 +274,7 @@ int ns_init(int argc, char **argv)
...
@@ -261,13 +274,7 @@ int ns_init(int argc, char **argv)
else
if
(
ret
)
else
if
(
ret
)
fprintf
(
stderr
,
"The test returned non-zero code %d
\n
"
,
ret
);
fprintf
(
stderr
,
"The test returned non-zero code %d
\n
"
,
ret
);
pid
=
fork
();
show_ps
();
if
(
pid
==
0
)
{
execl
(
"/bin/ps"
,
"ps"
,
"axf"
,
"-o"
,
"pid,sid,comm"
,
NULL
);
fprintf
(
stderr
,
"Unable to execute ps: %m
\n
"
);
exit
(
1
);
}
else
if
(
pid
>
0
)
waitpid
(
pid
,
NULL
,
0
);
if
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
))
{
if
(
sigaction
(
SIGCHLD
,
&
sa
,
NULL
))
{
fprintf
(
stderr
,
"Can't set SIGCHLD handler: %m
\n
"
);
fprintf
(
stderr
,
"Can't set SIGCHLD handler: %m
\n
"
);
...
@@ -297,13 +304,7 @@ int ns_init(int argc, char **argv)
...
@@ -297,13 +304,7 @@ int ns_init(int argc, char **argv)
/* suspend/resume */
/* suspend/resume */
test_waitsig
();
test_waitsig
();
pid
=
fork
();
show_ps
();
if
(
pid
==
0
)
{
execl
(
"/bin/ps"
,
"ps"
,
"axf"
,
"-o"
,
"pid,sid,comm"
,
NULL
);
fprintf
(
stderr
,
"Unable to execute ps: %m
\n
"
);
exit
(
1
);
}
else
if
(
pid
>
0
)
waitpid
(
pid
,
NULL
,
0
);
fd
=
open
(
pidfile
,
O_RDONLY
);
fd
=
open
(
pidfile
,
O_RDONLY
);
if
(
fd
==
-
1
)
{
if
(
fd
==
-
1
)
{
...
...
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