Add clock_nanosleep syscall.

This commit is contained in:
njoly 2008-12-12 23:36:18 +00:00
parent 47b2a9219c
commit 99688b74d2
2 changed files with 38 additions and 4 deletions

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.43 2008/12/06 23:14:03 njoly Exp $
$NetBSD: syscalls.master,v 1.44 2008/12/12 23:36:18 njoly Exp $
; NetBSD i386 COMPAT_LINUX32 system call name/number "master" file.
; (See syscalls.conf to see what it is processed into.)
@ -426,7 +426,8 @@
linux32_timespecp_t tp); }
266 STD { int linux32_sys_clock_getres(clockid_t which, \
linux32_timespecp_t tp); }
267 UNIMPL clock_nanosleep
267 STD { int linux32_sys_clock_nanosleep(clockid_t which, int flags, \
linux32_timespecp_t rqtp, linux32_timespecp_t rmtp); }
268 UNIMPL statfs64
269 UNIMPL fstatfs64
270 UNIMPL tgkill

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux32_time.c,v 1.24 2008/12/08 11:52:35 njoly Exp $ */
/* $NetBSD: linux32_time.c,v 1.25 2008/12/12 23:36:18 njoly Exp $ */
/*-
* Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@ -33,7 +33,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.24 2008/12/08 11:52:35 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.25 2008/12/12 23:36:18 njoly Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -352,3 +352,36 @@ linux32_sys_clock_getres(struct lwp *l,
return 0;
}
int
linux32_sys_clock_nanosleep(struct lwp *l,
const struct linux32_sys_clock_nanosleep_args *uap, register_t *retval)
{
/* {
syscallarg(clockid_t) which;
syscallarg(int) flags;
syscallarg(linux32_timespecp_t) rqtp;
syscallarg(linux32_timespecp_t) rmtp;
} */
struct linux32_timespec lrqts, lrmts;
struct timespec rqts, rmts;
int error, error1;
if (SCARG(uap, flags) != 0)
return EINVAL; /* XXX deal with TIMER_ABSTIME */
if (SCARG(uap, which) != LINUX_CLOCK_REALTIME)
return EINVAL;
error = copyin(SCARG_P32(uap, rqtp), &lrqts, sizeof lrqts);
if (error != 0)
return error;
linux32_to_native_timespec(&rqts, &lrqts);
error = nanosleep1(l, &rqts, SCARG_P32(uap, rmtp) ? &rmts : 0);
if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
native_to_linux32_timespec(&lrmts, &rmts);
error1 = copyout(&lrmts, SCARG_P32(uap, rmtp), sizeof lrmts);
return error1 ? error1 : error;
}