repo.or.cz
/
newlib-cygwin.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git]
/
newlib
/
libc
/
posix
/
sleep.c
blob
0d6cd710ded80381001f35a28301e6a0d591885e
1
/* libc/posix/sleep.c - sleep function */
2
3
/* Written 2000 by Werner Almesberger */
4
5
#ifdef HAVE_NANOSLEEP
6
7
#include <errno.h>
8
#include <time.h>
9
#include <unistd.h>
10
#include <limits.h>
11
12
unsigned
sleep
(
unsigned
seconds
)
13
{
14
struct
timespec ts
;
15
16
ts
.
tv_sec
=
seconds
;
17
ts
.
tv_nsec
=
0
;
18
if
(!
nanosleep
(&
ts
,&
ts
))
return
0
;
19
if
(
errno
==
EINTR
)
return
ts
.
tv_sec
&
UINT_MAX
;
20
return
-
1
;
21
}
22
23
#endif