mailing list of musl libc
 help / color / mirror / code / Atom feed
373f00ced7f28f88f2b9981d9914875de162bda7 blob 1246 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
 
#include <time.h>
#include <limits.h>
#include "pthread_impl.h"

#define IS32BIT(x) !((x)+0x80000000ULL>>32)

int timer_settime(timer_t t, int flags, const struct itimerspec *restrict val, struct itimerspec *restrict old)
{
	if ((intptr_t)t < 0) {
		pthread_t td = (void *)((uintptr_t)t << 1);
		t = (void *)(uintptr_t)(td->timer_id & INT_MAX);
	}
#ifdef SYS_timer_settime64
	time_t is = val->it_interval.tv_sec, vs = val->it_value.tv_sec;
	long ins = val->it_interval.tv_nsec, vns = val->it_value.tv_nsec;
	int r = -ENOSYS;
	if (SYS_timer_settime == SYS_timer_settime64
	    || !IS32BIT(is) || !IS32BIT(vs) || (sizeof(time_t)>4 && old))
		r = __syscall(SYS_timer_settime64, t, flags,
			((long long[]){is, ins, vs, vns}), old);
	if (SYS_timer_settime == SYS_timer_settime64 || r!=-ENOSYS)
		return __syscall_ret(r);
	if (!IS32BIT(is) || !IS32BIT(vs))
		return __syscall_ret(-ENOTSUP);
	long old32[4];
	r = __syscall(SYS_timer_settime, t, flags,
		((long[]){is, ins, vs, vns}), old32);
	if (!r && old) {
		old->it_interval.tv_sec = old32[0];
		old->it_interval.tv_nsec = old32[1];
		old->it_value.tv_sec = old32[2];
		old->it_value.tv_nsec = old32[3];
	}
	return __syscall_ret(r);
#endif
	return syscall(SYS_timer_settime, t, flags, val, old);
}
debug log:

solving 373f00ced7f2 ...
found 373f00ced7f2 in https://git.vuxu.org/mirror/musl/

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).