qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] linux-user: Implement handling of 5 POSIX t


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 2/2] linux-user: Implement handling of 5 POSIX timer syscalls.
Date: Fri, 18 Oct 2013 10:28:00 +0100

On 18 October 2013 09:05,  <address@hidden> wrote:
> From: Erik de Castro Lopo <address@hidden>
>
> Implement timer_create, timer_settime, timer_gettime, timer_getoverrun
> and timer_delete.
> ---
>  linux-user/syscall.c | 199 
> +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 199 insertions(+)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 4a14a43..ccab0a1 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -428,6 +428,48 @@ _syscall4(int, sys_prlimit64, pid_t, pid, int, resource,
>            struct host_rlimit64 *, old_limit)
>  #endif
>
> +#if defined(TARGET_NR_timer_create)
> +#ifndef __NR_timer_create
> +# define __NR_timer_create -1
> +# define __NR_timer_settime -1
> +# define __NR_timer_gettime -1
> +# define __NR_timer_getoverrun -1
> +# define __NR_timer_delete -1
> +#endif
> +
> +#define __NR_sys_timer_create __NR_timer_create
> +#define __NR_sys_timer_settime __NR_timer_settime
> +#define __NR_sys_timer_gettime __NR_timer_gettime
> +#define __NR_sys_timer_getoverrun __NR_timer_getoverrun
> +#define __NR_sys_timer_delete __NR_timer_delete
> +
> +
> +/* Maxiumum of 32 active timers allowed at any one time. */
> +static timer_t g_posix_timers[32] = { 0, } ;
> +
> +_syscall3(int, sys_timer_create,
> +          clockid_t, clockid, struct sigevent *, sevp, timer_t *, timerid)
> +_syscall4(int, sys_timer_settime,
> +          timer_t, timerid, int, flags, const struct itimerspec *, new_value,
> +          struct itimerspec *, old_value)
> +_syscall2(int, sys_timer_gettime,
> +          timer_t, timerid, struct itimerspec *, curr_value)
> +_syscall1(int, sys_timer_getoverrun, timer_t, timerid)
> +_syscall1(int, sys_timer_delete, timer_t, timerid)

Is there a good reason for doing these all via manual syscalls
rather than just using the host's libc interface to them?

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]