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
8557e39b
Commit
8557e39b
authored
Dec 02, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Add sigaction test
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@openvz.org
>
parent
8a647a58
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
Makefile
test/Makefile
+1
-0
test-sigaction.c
test/test-sigaction.c
+53
-0
No files found.
test/Makefile
View file @
8557e39b
...
...
@@ -4,6 +4,7 @@ SRCS += test-shmem-async.c
SRCS
+=
test-shmem-three-async.c
SRCS
+=
test-pipe-async.c
SRCS
+=
test-vdso.c
SRCS
+=
test-sigaction.c
SRCS-TH
+=
test-pthreads.c
OBJS-TH
+=
$
(
patsubst %.c,%.o,
$
(
SRCS-TH
))
...
...
test/test-sigaction.c
0 → 100644
View file @
8557e39b
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>
static
void
forked_handler
(
int
sig
)
{
printf
(
"%d: %s
\n
"
,
getpid
(),
__func__
);
}
static
void
primary_handler
(
int
sig
)
{
printf
(
"%d: %s
\n
"
,
getpid
(),
__func__
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
sigaction
act
;
int
pid
;
printf
(
"%s pid %d
\n
"
,
argv
[
0
],
getpid
());
pid
=
fork
();
if
(
pid
<
0
)
{
exit
(
-
1
);
}
else
if
(
pid
==
0
)
{
act
.
sa_handler
=
forked_handler
;
act
.
sa_flags
=
0
;
sigemptyset
(
&
act
.
sa_mask
);
sigaction
(
SIGTSTP
,
&
act
,
0
);
while
(
1
)
{
kill
(
getppid
(),
SIGTSTP
);
kill
(
getpid
(),
SIGTSTP
);
sleep
(
1
);
}
}
else
{
act
.
sa_handler
=
primary_handler
;
act
.
sa_flags
=
0
;
sigemptyset
(
&
act
.
sa_mask
);
sigaction
(
SIGTSTP
,
&
act
,
0
);
while
(
1
)
{
sleep
(
1
);
}
}
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