mailing list of musl libc
 help / color / mirror / code / Atom feed
bfaae1daf675b0ac33b7f49ed4e27b0309bc8e5c blob 1627 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
43
44
45
46
47
48
49
50
51
52
53
54
 
#include <sys/timerfd.h>
#include <errno.h>
#include "syscall.h"

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

int timerfd_create(int clockid, int flags)
{
	return syscall(SYS_timerfd_create, clockid, flags);
}

int timerfd_settime(int fd, int flags, const struct itimerspec *new, struct itimerspec *old)
{
#ifdef SYS_timerfd_settime64
	time_t is = new->it_interval.tv_sec, vs = new->it_value.tv_sec;
	long ins = new->it_interval.tv_nsec, vns = new->it_value.tv_nsec;
	int r = __syscall(SYS_timerfd_settime64, fd, flags,
		((long long[]){is, ins, vs, vns}), old);
	if (SYS_timerfd_settime == SYS_timerfd_settime64 || r!=-ENOSYS)
		return __syscall_ret(r);
	if (!IS32BIT(is) || !IS32BIT(vs))
		return __syscall_ret(-ENOTSUP);
	long old32[4];
	r = __syscall(SYS_timerfd_settime, fd, 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_timerfd_settime, fd, flags, new, old);
}

int timerfd_gettime(int fd, struct itimerspec *cur)
{
#ifdef SYS_timerfd_gettime64
	int r = __syscall(SYS_timerfd_gettime64, fd, cur);
	if (SYS_timerfd_gettime == SYS_timerfd_gettime64 || r!=-ENOSYS)
		return __syscall_ret(r);
	long cur32[4];
	r = __syscall(SYS_timerfd_gettime, fd, cur32);
	if (!r) {
		cur->it_interval.tv_sec = cur32[0];
		cur->it_interval.tv_nsec = cur32[1];
		cur->it_value.tv_sec = cur32[2];
		cur->it_value.tv_nsec = cur32[3];
	}
	return __syscall_ret(r);
#endif
	return syscall(SYS_timerfd_gettime, fd, cur);
}
debug log:

solving bfaae1daf675 ...
found bfaae1daf675 in https://inbox.vuxu.org/musl/20201227184032.22413-9-alobakin@pm.me/
found d26371cc1182 in https://inbox.vuxu.org/musl/20201227184032.22413-8-alobakin@pm.me/
found 5bdfaf165691 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 5bdfaf16569195231cf0d70e61c9312fe123b7fa	src/linux/timerfd.c

applying [1/2] https://inbox.vuxu.org/musl/20201227184032.22413-8-alobakin@pm.me/
diff --git a/src/linux/timerfd.c b/src/linux/timerfd.c
index 5bdfaf165691..d26371cc1182 100644


applying [2/2] https://inbox.vuxu.org/musl/20201227184032.22413-9-alobakin@pm.me/
diff --git a/src/linux/timerfd.c b/src/linux/timerfd.c
index d26371cc1182..bfaae1daf675 100644

Checking patch src/linux/timerfd.c...
Applied patch src/linux/timerfd.c cleanly.
Checking patch src/linux/timerfd.c...
Applied patch src/linux/timerfd.c cleanly.

index at:
100644 bfaae1daf675b0ac33b7f49ed4e27b0309bc8e5c	src/linux/timerfd.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).