mailing list of musl libc
 help / color / mirror / code / Atom feed
703bf0cd6f4dcc15f950e127f24f981f76573e31 blob 919 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
 
#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)
{
	int r = -ENOSYS;
#ifdef SYS_semtimedop_time64
	time_t s = ts ? ts->tv_sec : 0;
	long ns = ts ? ts->tv_nsec : 0;
	r = __syscall(SYS_semtimedop_time64, id, buf, n,
		ts ? ((long long[]){s, ns}) : 0);
	if (NO_TIME32 || r!=-ENOSYS) return __syscall_ret(r);
	ts = ts ? (void *)(long[]){CLAMP(s), ns} : 0;
#endif
#ifdef SYS_semtimedop
	r = __syscall(SYS_semtimedop, id, buf, n, ts);
#endif
#ifdef SYS_ipc
	if (r == -ENOSYS)
		r = __syscall(SYS_ipc, IPCOP_semtimedop, id, n, 0, buf, ts);
#endif
	return __syscall_ret(r);
}
debug log:

solving 703bf0cd6f4d ...
found 703bf0cd6f4d in https://inbox.vuxu.org/musl/20201227184032.22413-15-alobakin@pm.me/
found 1632e7b03f38 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/20201227184032.22413-15-alobakin@pm.me/
diff --git a/src/ipc/semtimedop.c b/src/ipc/semtimedop.c
index 1632e7b03f38..703bf0cd6f4d 100644

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

index at:
100644 703bf0cd6f4dcc15f950e127f24f981f76573e31	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).