Skip to content

Commit 1b91100

Browse files
committed
Resolve llvm#113.
1 parent 43d09ce commit 1b91100

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

filc/include/pizlonated_syscalls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ long zsys_get_mempolicy(int *mode, unsigned long *nodemask,
405405
unsigned long maxnode, void *addr, unsigned long flags);
406406
long zsys_set_mempolicy(int mode, const unsigned long *nodemask,
407407
unsigned long maxnode);
408+
int zsys_clock_adjtime(int clock_id, void* buf);
408409

409410
#ifdef __cplusplus
410411
}

filc/tests/miscsyscall/miscsyscall.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "utils.h"
3131
#include <threads.h>
3232
#include <stdlib.h>
33+
#include <sys/timex.h>
3334

3435
#ifndef SA_RESTORER
3536
#define SA_RESTORER 0x4000000
@@ -577,6 +578,9 @@ int main(int argc, char** argv)
577578
ZASSERT(!result || (result == -1 && errno == ENOTTY));
578579
#endif
579580

581+
struct timex timex;
582+
ZASSERT(!adjtimex(&timex));
583+
580584
zprintf("No worries.\n");
581585
return 0;
582586
}

libpas/src/libpas/filc_runtime.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12367,6 +12367,12 @@ long filc_native_zsys_keyctl_pkey_verify(filc_thread* my_thread, int key_id, fil
1236712367
filc_ptr_ptr(data_ptr), filc_ptr_ptr(sig_ptr)));
1236812368
}
1236912369

12370+
int filc_native_zsys_clock_adjtime(filc_thread* my_thread, int clock_id, filc_ptr buf_ptr)
12371+
{
12372+
filc_check_write(buf_ptr, sizeof(struct timex));
12373+
return FILC_SYSCALL(my_thread, clock_adjtime(clock_id, (struct timex*)filc_ptr_ptr(buf_ptr)));
12374+
}
12375+
1237012376
filc_ptr filc_native_zthread_self(filc_thread* my_thread)
1237112377
{
1237212378
static const bool verbose = false;

libpas/src/libpas/generate_pizlonated_forwarders.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ def addOutSig(name, rets, *args)
521521
"size_t"
522522
addSig "long", "zsys_get_mempolicy", "filc_ptr", "filc_ptr", "unsigned long", "filc_ptr", "unsigned long"
523523
addSig "long", "zsys_set_mempolicy", "int", "filc_ptr", "unsigned long"
524+
addSig "int", "zsys_clock_adjtime", "int", "filc_ptr"
524525

525526
addSig "filc_ptr", "zthread_self"
526527
addSig "unsigned", "zthread_get_id", "filc_ptr"

projects/user-glibc-2.40/sysdeps/unix/sysv/linux/clock_adjtime.c

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,12 @@
2222
#include <sysdep.h>
2323
#include <sys/timex.h>
2424
#include <kernel-features.h>
25+
#include <pizlonated_syscalls.h>
2526

2627
int
2728
__clock_adjtime64 (const clockid_t clock_id, struct __timex64 *tx64)
2829
{
29-
#ifndef __NR_clock_adjtime64
30-
# define __NR_clock_adjtime64 __NR_clock_adjtime
31-
#endif
32-
int r = INLINE_SYSCALL_CALL (clock_adjtime64, clock_id, tx64);
33-
#ifndef __ASSUME_TIME64_SYSCALLS
34-
if (r >= 0 || errno != ENOSYS)
35-
return r;
36-
37-
if (tx64->modes & ADJ_SETOFFSET
38-
&& ! in_int32_t_range (tx64->time.tv_sec))
39-
{
40-
__set_errno (EOVERFLOW);
41-
return -1;
42-
}
43-
44-
struct timex tx32 = valid_timex64_to_timex (*tx64);
45-
r = INLINE_SYSCALL_CALL (clock_adjtime, clock_id, &tx32);
46-
if (r >= 0)
47-
*tx64 = valid_timex_to_timex64 (tx32);
48-
#endif
49-
return r;
30+
return zsys_clock_adjtime (clock_id, tx64);
5031
}
5132

5233
#if __TIMESIZE != 64

0 commit comments

Comments
 (0)