mirror of
https://github.com/lkl/linux.git
synced 2025-12-20 00:23:14 +09:00
lkl: follow up fixes after v5.1 merge (y2038)
This commit fixups the 32-bit compat syscall to properly work under new time_t 64bit environment. Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
This commit is contained in:
@@ -413,7 +413,10 @@ static int do_entry(const char *_src, const char *_dst, const char *name)
|
|||||||
if (cptofs) {
|
if (cptofs) {
|
||||||
struct lkl_timespec lkl_ts[] = { atime, mtime };
|
struct lkl_timespec lkl_ts[] = { atime, mtime };
|
||||||
|
|
||||||
ret = lkl_sys_utimensat(-1, dst, lkl_ts, LKL_AT_SYMLINK_NOFOLLOW);
|
ret = lkl_sys_utimensat(-1, dst,
|
||||||
|
(struct __lkl__kernel_timespec
|
||||||
|
*)lkl_ts,
|
||||||
|
LKL_AT_SYMLINK_NOFOLLOW);
|
||||||
} else {
|
} else {
|
||||||
struct timespec ts[] = {
|
struct timespec ts[] = {
|
||||||
{ .tv_sec = atime.tv_sec, .tv_nsec = atime.tv_nsec, },
|
{ .tv_sec = atime.tv_sec, .tv_nsec = atime.tv_nsec, },
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ static inline int lkl_sys_fstatfs(unsigned int fd, struct lkl_statfs *buf)
|
|||||||
return lkl_sys_fstatfs64(fd, sizeof(*buf), buf);
|
return lkl_sys_fstatfs64(fd, sizeof(*buf), buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int lkl_sys_nanosleep_time32(struct lkl_timespec *rqtp,
|
||||||
|
struct lkl_timespec *rmtp)
|
||||||
|
{
|
||||||
|
long p[6] = {(long)rqtp, (long)rmtp, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
return lkl_syscall(__lkl__NR_nanosleep, p);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int lkl_sys_stat(const char *path, struct lkl_stat *buf)
|
static inline int lkl_sys_stat(const char *path, struct lkl_stat *buf)
|
||||||
@@ -281,7 +289,8 @@ static inline long lkl_sys_select(int n, lkl_fd_set *rfds, lkl_fd_set *wfds,
|
|||||||
ts.tv_sec = extra_secs > max_time - tv->tv_sec ?
|
ts.tv_sec = extra_secs > max_time - tv->tv_sec ?
|
||||||
max_time : tv->tv_sec + extra_secs;
|
max_time : tv->tv_sec + extra_secs;
|
||||||
}
|
}
|
||||||
return lkl_sys_pselect6(n, rfds, wfds, efds, tv ? &ts : 0, data);
|
return lkl_sys_pselect6(n, rfds, wfds, efds, tv ?
|
||||||
|
(struct __lkl__kernel_timespec *)&ts : 0, data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -292,6 +301,7 @@ static inline long lkl_sys_select(int n, lkl_fd_set *rfds, lkl_fd_set *wfds,
|
|||||||
static inline long lkl_sys_poll(struct lkl_pollfd *fds, int n, int timeout)
|
static inline long lkl_sys_poll(struct lkl_pollfd *fds, int n, int timeout)
|
||||||
{
|
{
|
||||||
return lkl_sys_ppoll(fds, n, timeout >= 0 ?
|
return lkl_sys_ppoll(fds, n, timeout >= 0 ?
|
||||||
|
(struct __lkl__kernel_timespec *)
|
||||||
&((struct lkl_timespec){ .tv_sec = timeout/1000,
|
&((struct lkl_timespec){ .tv_sec = timeout/1000,
|
||||||
.tv_nsec = timeout%1000*1000000 }) : 0,
|
.tv_nsec = timeout%1000*1000000 }) : 0,
|
||||||
0, _LKL_NSIG/8);
|
0, _LKL_NSIG/8);
|
||||||
|
|||||||
@@ -275,7 +275,8 @@ long lkl_umount_timeout(char *path, int flags, long timeout_ms)
|
|||||||
do {
|
do {
|
||||||
err = lkl_sys_umount(path, flags);
|
err = lkl_sys_umount(path, flags);
|
||||||
if (err == -LKL_EBUSY) {
|
if (err == -LKL_EBUSY) {
|
||||||
lkl_sys_nanosleep(&ts, NULL);
|
lkl_sys_nanosleep((struct __lkl__kernel_timespec *)&ts,
|
||||||
|
NULL);
|
||||||
timeout_ms -= incr / 1000000;
|
timeout_ms -= incr / 1000000;
|
||||||
}
|
}
|
||||||
} while (err == -LKL_EBUSY && timeout_ms > 0);
|
} while (err == -LKL_EBUSY && timeout_ms > 0);
|
||||||
|
|||||||
@@ -451,7 +451,8 @@ static int lklfuse_utimens(const char *path, const struct timespec tv[2])
|
|||||||
ts[1].tv_sec = tv[0].tv_sec;
|
ts[1].tv_sec = tv[0].tv_sec;
|
||||||
ts[1].tv_nsec = tv[0].tv_nsec;
|
ts[1].tv_nsec = tv[0].tv_nsec;
|
||||||
|
|
||||||
return lkl_sys_utimensat(-1, path, ts, LKL_AT_SYMLINK_NOFOLLOW);
|
return lkl_sys_utimensat(-1, path, (struct __lkl__kernel_timespec *)ts,
|
||||||
|
LKL_AT_SYMLINK_NOFOLLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int lklfuse_fallocate(const char *path, int mode, off_t offset,
|
static int lklfuse_fallocate(const char *path, int mode, off_t offset,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ int lkl_test_nanosleep(void)
|
|||||||
long ret;
|
long ret;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &start);
|
clock_gettime(CLOCK_MONOTONIC, &start);
|
||||||
ret = lkl_sys_nanosleep(&ts, NULL);
|
ret = lkl_sys_nanosleep((struct __lkl__kernel_timespec *)&ts, NULL);
|
||||||
clock_gettime(CLOCK_MONOTONIC, &stop);
|
clock_gettime(CLOCK_MONOTONIC, &stop);
|
||||||
|
|
||||||
delta = 1e9*(stop.tv_sec - start.tv_sec) +
|
delta = 1e9*(stop.tv_sec - start.tv_sec) +
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ static int lkl_test_sleep(void)
|
|||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = lkl_sys_nanosleep(&ts, NULL);
|
ret = lkl_sys_nanosleep((struct __lkl__kernel_timespec *)&ts, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
lkl_test_logf("nanosleep error: %s\n", lkl_strerror(ret));
|
lkl_test_logf("nanosleep error: %s\n", lkl_strerror(ret));
|
||||||
return TEST_FAILURE;
|
return TEST_FAILURE;
|
||||||
|
|||||||
Reference in New Issue
Block a user