mailing list of musl libc
 help / color / mirror / code / Atom feed
3d62272dfa7e622c2930dc7775048b9ef3f4bacd blob 1092 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
32
33
34
35
36
37
38
39
40
41
42
 
#include <pthread.h>
#include <time.h>
#include <errno.h>
#include "futex.h"
#include "syscall.h"

int __pthread_setcancelstate(int new, int *old);
int __clock_gettime(clockid_t clk, struct timespec *ts);

int __timedwait(volatile int *addr, int val,
	clockid_t clk, const struct timespec *at,
	void (*cleanup)(void *), void *arg, int priv)
{
	int r, cs;
	struct timespec to, *top=0;

	if (priv) priv = 128;

	if (at) {
		if (at->tv_nsec >= 1000000000UL) return EINVAL;
		if (__clock_gettime(clk, &to)) return EINVAL;
		to.tv_sec = at->tv_sec - to.tv_sec;
		if ((to.tv_nsec = at->tv_nsec - to.tv_nsec) < 0) {
			to.tv_sec--;
			to.tv_nsec += 1000000000;
		}
		if (to.tv_sec < 0) return ETIMEDOUT;
		top = &to;
	}

	if (!cleanup) __pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
	pthread_cleanup_push(cleanup, arg);

	r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT|priv, val, top);
	if (r == ENOSYS) r = -__syscall_cp(SYS_futex, addr, FUTEX_WAIT, val, top);
	if (r != EINTR && r != ETIMEDOUT) r = 0;

	pthread_cleanup_pop(0);
	if (!cleanup) __pthread_setcancelstate(cs, 0);

	return r;
}
debug log:

solving 3d62272 ...
found 3d62272 in https://inbox.vuxu.org/musl/d408051f223ecc194b28f8df1f113a30427d17f6.1409524413.git.Jens.Gustedt@inria.fr/ ||
	https://inbox.vuxu.org/musl/b91c6335ff9753691922f845f726c18f8e68802a.1409423162.git.Jens.Gustedt@inria.fr/ ||
	https://inbox.vuxu.org/musl/1409177505.4476.75.camel@eris.loria.fr/
found d6f1233 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 d6f1233173b30fda19f2c10dcd10c310454ddbd5	src/thread/__timedwait.c

applying [1/3] https://inbox.vuxu.org/musl/d408051f223ecc194b28f8df1f113a30427d17f6.1409524413.git.Jens.Gustedt@inria.fr/
diff --git a/src/thread/__timedwait.c b/src/thread/__timedwait.c
index d6f1233..3d62272 100644

Checking patch src/thread/__timedwait.c...
Applied patch src/thread/__timedwait.c cleanly.

skipping https://inbox.vuxu.org/musl/b91c6335ff9753691922f845f726c18f8e68802a.1409423162.git.Jens.Gustedt@inria.fr/ for 3d62272
skipping https://inbox.vuxu.org/musl/1409177505.4476.75.camel@eris.loria.fr/ for 3d62272
index at:
100644 3d62272dfa7e622c2930dc7775048b9ef3f4bacd	src/thread/__timedwait.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).