Implement clock_adjtime syscall decoder

* linux/dummy.h (sys_clock_adjtime): Remove.
* linux/syscall.h (sys_clock_adjtime): New prototype.
* time.c (do_adjtimex): New function, based on sys_adjtimex.
(sys_adjtimex): Use it.
(sys_clock_adjtime): New function.
This commit is contained in:
Дмитрий Левин 2012-03-11 21:25:51 +00:00
parent 51dba35d38
commit 73215473ce
3 changed files with 30 additions and 14 deletions

View File

@ -30,7 +30,6 @@
/* still unfinished */
#define sys_add_key printargs
#define sys_clock_adjtime printargs
#define sys_fanotify_init printargs
#define sys_fanotify_mark printargs
#define sys_get_robust_list printargs

View File

@ -44,6 +44,7 @@ int sys_capset();
int sys_chdir();
int sys_chmod();
int sys_chown();
int sys_clock_adjtime();
int sys_clock_gettime();
int sys_clock_nanosleep();
int sys_clock_settime();

42
time.c
View File

@ -582,22 +582,28 @@ tprint_timex(struct tcb *tcp, long addr)
return 0;
}
static int
do_adjtimex(struct tcb *tcp, long addr)
{
if (addr == 0)
tprints("NULL");
else if (syserror(tcp) || !verbose(tcp))
tprintf("%#lx", addr);
else if (tprint_timex(tcp, addr) < 0)
tprints("{...}");
if (syserror(tcp))
return 0;
tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
if (tcp->auxstr)
return RVAL_STR;
return 0;
}
int
sys_adjtimex(struct tcb *tcp)
{
if (exiting(tcp)) {
if (tcp->u_arg[0] == 0)
tprints("NULL");
else if (syserror(tcp) || !verbose(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else if (tprint_timex(tcp, tcp->u_arg[0]) < 0)
tprints("{...}");
if (syserror(tcp))
return 0;
tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
if (tcp->auxstr)
return RVAL_STR;
}
if (exiting(tcp))
return do_adjtimex(tcp, tcp->u_arg[0]);
return 0;
}
@ -676,6 +682,16 @@ sys_clock_nanosleep(struct tcb *tcp)
return 0;
}
int
sys_clock_adjtime(struct tcb *tcp)
{
if (exiting(tcp))
return do_adjtimex(tcp, tcp->u_arg[1]);
printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
tprints(", ");
return 0;
}
#ifndef SIGEV_THREAD_ID
# define SIGEV_THREAD_ID 4
#endif