mailing list of musl libc
 help / color / mirror / code / Atom feed
5a21d5625e59eef0dfbf1283c8ca2b9696698b78 blob 3961 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
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
 
#include <sys/timex.h>
#include <time.h>
#include <errno.h>
#include "syscall.h"

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

struct ktimex64 {
	unsigned modes;
	int :32;
	long long offset, freq, maxerror, esterror;
	int status;
	int :32;
	long long constant, precision, tolerance;
	long long time_sec, time_usec;
	long long tick, ppsfreq, jitter;
	int shift;
	int :32;
	long long stabil, jitcnt, calcnt, errcnt, stbcnt;
	int tai;
	int __padding[11];
};

struct ktimex {
	unsigned modes;
	long offset, freq, maxerror, esterror;
	int status;
	long constant, precision, tolerance;
	long time_sec, time_usec;
	long tick, ppsfreq, jitter;
	int shift;
	long stabil, jitcnt, calcnt, errcnt, stbcnt;
	int tai;
	int __padding[11];
};

int clock_adjtime (clockid_t clock_id, struct timex *utx)
{
	int r = -ENOSYS;
#ifdef SYS_clock_adjtime64
	struct ktimex64 ktx = {
		.modes = utx->modes,
		.offset = utx->offset,
		.freq = utx->freq,
		.maxerror = utx->maxerror,
		.esterror = utx->esterror,
		.status = utx->status,
		.constant = utx->constant,
		.precision = utx->precision,
		.tolerance = utx->tolerance,
		.time_sec = utx->time.tv_sec,
		.time_usec = utx->time.tv_usec,
		.tick = utx->tick,
		.ppsfreq = utx->ppsfreq,
		.jitter = utx->jitter,
		.shift = utx->shift,
		.stabil = utx->stabil,
		.jitcnt = utx->jitcnt,
		.calcnt = utx->calcnt,
		.errcnt = utx->errcnt,
		.stbcnt = utx->stbcnt,
		.tai = utx->tai,
	};
	r = __syscall(SYS_clock_adjtime64, clock_id, &ktx);
	if (r>=0) {
		utx->modes = ktx.modes;
		utx->offset = ktx.offset;
		utx->freq = ktx.freq;
		utx->maxerror = ktx.maxerror;
		utx->esterror = ktx.esterror;
		utx->status = ktx.status;
		utx->constant = ktx.constant;
		utx->precision = ktx.precision;
		utx->tolerance = ktx.tolerance;
		utx->time.tv_sec = ktx.time_sec;
		utx->time.tv_usec = ktx.time_usec;
		utx->tick = ktx.tick;
		utx->ppsfreq = ktx.ppsfreq;
		utx->jitter = ktx.jitter;
		utx->shift = ktx.shift;
		utx->stabil = ktx.stabil;
		utx->jitcnt = ktx.jitcnt;
		utx->calcnt = ktx.calcnt;
		utx->errcnt = ktx.errcnt;
		utx->stbcnt = ktx.stbcnt;
		utx->tai = ktx.tai;
	}
	if (SYS_clock_adjtime == SYS_clock_adjtime64 || r!=-ENOSYS)
		return __syscall_ret(r);
	if ((utx->modes & ADJ_SETOFFSET) && !IS32BIT(utx->time.tv_sec))
		return __syscall_ret(-ENOTSUP);
#endif
	if (sizeof(time_t) > sizeof(long)) {
		struct ktimex ktx = {
			.modes = utx->modes,
			.offset = utx->offset,
			.freq = utx->freq,
			.maxerror = utx->maxerror,
			.esterror = utx->esterror,
			.status = utx->status,
			.constant = utx->constant,
			.precision = utx->precision,
			.tolerance = utx->tolerance,
			.time_sec = utx->time.tv_sec,
			.time_usec = utx->time.tv_usec,
			.tick = utx->tick,
			.ppsfreq = utx->ppsfreq,
			.jitter = utx->jitter,
			.shift = utx->shift,
			.stabil = utx->stabil,
			.jitcnt = utx->jitcnt,
			.calcnt = utx->calcnt,
			.errcnt = utx->errcnt,
			.stbcnt = utx->stbcnt,
			.tai = utx->tai,
		};
		r = __syscall(SYS_clock_adjtime, clock_id, &ktx);
#ifdef SYS_adjtimex
		if (r == -ENOSYS && clock_id == CLOCK_REALTIME)
			r = __syscall(SYS_adjtimex, &ktx);
#endif
		if (r>=0) {
			utx->modes = ktx.modes;
			utx->offset = ktx.offset;
			utx->freq = ktx.freq;
			utx->maxerror = ktx.maxerror;
			utx->esterror = ktx.esterror;
			utx->status = ktx.status;
			utx->constant = ktx.constant;
			utx->precision = ktx.precision;
			utx->tolerance = ktx.tolerance;
			utx->time.tv_sec = ktx.time_sec;
			utx->time.tv_usec = ktx.time_usec;
			utx->tick = ktx.tick;
			utx->ppsfreq = ktx.ppsfreq;
			utx->jitter = ktx.jitter;
			utx->shift = ktx.shift;
			utx->stabil = ktx.stabil;
			utx->jitcnt = ktx.jitcnt;
			utx->calcnt = ktx.calcnt;
			utx->errcnt = ktx.errcnt;
			utx->stbcnt = ktx.stbcnt;
			utx->tai = ktx.tai;
		}
		return __syscall_ret(r);
	}
	r = __syscall(SYS_clock_adjtime, clock_id, utx);
#ifdef SYS_adjtimex
	if (r == -ENOSYS && clock_id == CLOCK_REALTIME)
		r = __syscall(SYS_adjtimex, utx);
#endif
	return __syscall_ret(r);
}
debug log:

solving 5a21d5625e59 ...
found 5a21d5625e59 in https://inbox.vuxu.org/musl/20201227184032.22413-3-alobakin@pm.me/
found d4d03d24df40 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 d4d03d24df401b7cbb0eac4ad163d43e90252346	src/linux/clock_adjtime.c

applying [1/1] https://inbox.vuxu.org/musl/20201227184032.22413-3-alobakin@pm.me/
diff --git a/src/linux/clock_adjtime.c b/src/linux/clock_adjtime.c
index d4d03d24df40..5a21d5625e59 100644

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

index at:
100644 5a21d5625e59eef0dfbf1283c8ca2b9696698b78	src/linux/clock_adjtime.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).