mailing list of musl libc
 help / color / mirror / code / Atom feed
d9fe404dae1c6b85b6a14bd6f4c0fc877a3d3bb4 blob 1063 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
 
#define _GNU_SOURCE
#include <sys/sem.h>
#include <errno.h>
#include "syscall.h"
#include "ipc.h"

#define IS32BIT(x) !((x)+0x80000000ULL>>32)
#define CLAMP(x) (int)(IS32BIT(x) ? (x) : 0x7fffffffU+((0ULL+(x))>>63))

#if !defined(SYS_semtimedop) && !defined(SYS_ipc)
#define NO_TIME32 1
#else
#define NO_TIME32 0
#endif

int semtimedop(int id, struct sembuf *buf, size_t n, const struct timespec *ts)
{
#ifdef SYS_semtimedop_time64
	static int use_semtimedop_time64 = 1;
	time_t s = ts ? ts->tv_sec : 0;
	long ns = ts ? ts->tv_nsec : 0;
	int r = -ENOSYS;
	if (use_semtimedop_time64) {
		if (NO_TIME32 || !IS32BIT(s))
			r = __syscall(SYS_semtimedop_time64, id, buf, n,
				ts ? ((long long[]){s, ns}) : 0);
		if (NO_TIME32 || r!=-ENOSYS) return __syscall_ret(r);
		else use_semtimedop_time64 = 0;
	}
	ts = ts ? (void *)(long[]){CLAMP(s), ns} : 0;
#endif
#if defined(SYS_ipc)
	return syscall(SYS_ipc, IPCOP_semtimedop, id, n, 0, buf, ts);
#elif defined(SYS_semtimedop)
	return syscall(SYS_semtimedop, id, buf, n, ts);
#else
	return __syscall_ret(-ENOSYS);
#endif
}
debug log:

solving d9fe404d ...
found d9fe404d in https://inbox.vuxu.org/musl/CAHHiRUTn__COy59J78MMGSyU52Fyn7HBJdzrM6VvcuFq5Rj6HQ@mail.gmail.com/
found 1632e7b0 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 1632e7b03f38ad6a2bb43c1ec890bc195f4367d2	src/ipc/semtimedop.c

applying [1/1] https://inbox.vuxu.org/musl/CAHHiRUTn__COy59J78MMGSyU52Fyn7HBJdzrM6VvcuFq5Rj6HQ@mail.gmail.com/
diff --git a/src/ipc/semtimedop.c b/src/ipc/semtimedop.c
index 1632e7b0..d9fe404d 100644

Checking patch src/ipc/semtimedop.c...
Applied patch src/ipc/semtimedop.c cleanly.

index at:
100644 d9fe404dae1c6b85b6a14bd6f4c0fc877a3d3bb4	src/ipc/semtimedop.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).