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
48371f72
Commit
48371f72
authored
Oct 31, 2011
by
Cyrill Gorcunov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: Add static sleep test
Signed-off-by:
Cyrill Gorcunov
<
gorcunov@gmail.com
>
parent
6898d7f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
Makefile
test/Makefile
+7
-0
testee-static-syssleep.c
test/testee-static-syssleep.c
+55
-0
No files found.
test/Makefile
View file @
48371f72
OBJS
+=
testee.o
OBJS
+=
testee.o
OBJS
+=
testee-static.o
OBJS
+=
testee-static.o
OBJS
+=
testee-static-syssleep.o
OBJS
+=
testee-threads.o
OBJS
+=
testee-threads.o
OBJS
+=
testee-unlinked.o
OBJS
+=
testee-unlinked.o
OBJS
+=
asmem.o
OBJS
+=
asmem.o
...
@@ -20,6 +21,12 @@ testee: testee.c
...
@@ -20,6 +21,12 @@ testee: testee.c
$(E)
" LINK "
$@
$(E)
" LINK "
$@
$(Q)
$(CC)
-o
$@
$
(
patsubst %.c,%.o,
$<
)
$(Q)
$(CC)
-o
$@
$
(
patsubst %.c,%.o,
$<
)
testee-static-syssleep
:
testee-static-syssleep.c
$(E)
" CC "
$
(
patsubst %.c,%.o,
$<
)
$(Q)
$(CC)
-c
$(CFLAGS)
$<
-o
$
(
patsubst %.c,%.o,
$<
)
$(E)
" LINK "
$@
$(Q)
$(CC)
-static
-o
$@
$
(
patsubst %.c,%.o,
$<
)
testee-static
:
testee-static.c
testee-static
:
testee-static.c
$(E)
" CC "
$
(
patsubst %.c,%.o,
$<
)
$(E)
" CC "
$
(
patsubst %.c,%.o,
$<
)
$(Q)
$(CC)
-c
$(CFLAGS)
$<
-o
$
(
patsubst %.c,%.o,
$<
)
$(Q)
$(CC)
-c
$(CFLAGS)
$<
-o
$
(
patsubst %.c,%.o,
$<
)
...
...
test/testee-static-syssleep.c
0 → 100644
View file @
48371f72
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sched.h>
#ifndef always_inline
# define always_inline __always_inline
#endif
#define __NR_nanosleep 35
static
always_inline
long
syscall2
(
int
nr
,
unsigned
long
arg0
,
unsigned
long
arg1
)
{
long
ret
;
asm
volatile
(
"syscall"
:
"=a"
(
ret
)
:
"a"
(
nr
),
"D"
(
arg0
),
"S"
(
arg1
)
:
"memory"
);
return
ret
;
}
static
always_inline
long
sys_nanosleep
(
struct
timespec
*
req
,
struct
timespec
*
rem
)
{
return
syscall2
(
__NR_nanosleep
,
(
unsigned
long
)
req
,
(
unsigned
long
)
rem
);
}
static
void
always_inline
local_sleep
(
long
seconds
)
{
struct
timespec
req
,
rem
;
req
=
(
struct
timespec
){
.
tv_sec
=
seconds
,
.
tv_nsec
=
0
,
};
sys_nanosleep
(
&
req
,
&
rem
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
for
(;;)
local_sleep
(
5
);
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