mailing list of musl libc
 help / color / mirror / code / Atom feed
c08310f7fd78e6d51698cbaa944a35f8c9d7d041 blob 1059 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
#include <time.h>
#include <errno.h>
#include "syscall.h"
#include "libc.h"
#include "threads.h"

/* Roughly __syscall already returns the right thing: 0 if all went
   well or a negative error indication, otherwise. */
int thrd_sleep(const struct timespec *req, struct timespec *rem)
{
  int ret = __syscall(SYS_nanosleep, req, rem);
  // compile time comparison, constant propagated
  if (EINTR != 1) {
    switch (ret) {
    case 0: return 0;
      /* error described by POSIX:                                    */
      /* EINTR  The nanosleep() function was interrupted by a signal. */
      /* The C11 wording is:                                          */
      /* -1 if it has been interrupted by a signal                    */
    case -EINTR:  return -1;
      /* error described by POSIX */
    case -EINVAL: return -2;
      /* described for linux */
    case -EFAULT: return -3;
      /* No other error returns are specified. */
    default: return INT_MIN;
    }
  }
  // potentially a tail call
  return ret;
}
debug log:

solving 6570b0c ...
found 6570b0c in https://inbox.vuxu.org/musl/1409177505.4476.75.camel@eris.loria.fr/ ||
	https://inbox.vuxu.org/musl/1407144603.8274.248.camel@eris.loria.fr/ ||
	https://inbox.vuxu.org/musl/1408049748.4951.134.camel@eris.loria.fr/ ||
	https://inbox.vuxu.org/musl/1407801532.15134.96.camel@eris.loria.fr/

applying [1/4] https://inbox.vuxu.org/musl/1409177505.4476.75.camel@eris.loria.fr/
diff --git a/src/time/thrd_sleep.c b/src/time/thrd_sleep.c\r
new file mode 100644\r
index 0000000..6570b0c\r

1:7: trailing whitespace.
#include <time.h>\r
1:8: trailing whitespace.
#include <errno.h>\r
1:9: trailing whitespace.
#include "syscall.h"\r
1:10: trailing whitespace.
#include "libc.h"\r
1:11: trailing whitespace.
#include "threads.h"\r
Checking patch src/time/thrd_sleep.c...
Applied patch src/time/thrd_sleep.c cleanly.
warning: squelched 26 whitespace errors
warning: 31 lines add whitespace errors.

skipping https://inbox.vuxu.org/musl/1407144603.8274.248.camel@eris.loria.fr/ for 6570b0c
skipping https://inbox.vuxu.org/musl/1408049748.4951.134.camel@eris.loria.fr/ for 6570b0c
skipping https://inbox.vuxu.org/musl/1407801532.15134.96.camel@eris.loria.fr/ for 6570b0c
index at:
100644 c08310f7fd78e6d51698cbaa944a35f8c9d7d041	src/time/thrd_sleep.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).