@@ -77,6 +77,7 @@ SYSCALL_DEF(getrlimit, ARG_DEC, ARG_PTR);
#endif
SYSCALL_DEF(getrusage, ARG_DEC, ARG_PTR);
SYSCALL_DEF(getsid, ARG_DEC);
+SYSCALL_DEF(gettimeofday, ARG_PTR);
#ifdef TARGET_NR_getxpid
SYSCALL_DEF(getxpid);
#endif
@@ -220,6 +221,7 @@ SYSCALL_DEF(setpgid, ARG_DEC, ARG_DEC);
SYSCALL_DEF(setrlimit, ARG_DEC, ARG_PTR);
#endif
SYSCALL_DEF(setsid);
+SYSCALL_DEF(settimeofday, ARG_PTR, ARG_PTR);
#if !defined(SYSCALL_TABLE) || defined(TARGET_NR_semop)
SYSCALL_DEF(semop, ARG_DEC, ARG_PTR, ARG_DEC);
#endif
@@ -16,6 +16,39 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+SYSCALL_IMPL(gettimeofday)
+{
+ struct timeval tv;
+ abi_long ret = get_errno(gettimeofday(&tv, NULL));
+
+ if (!is_error(ret) && copy_to_user_timeval(arg1, &tv)) {
+ return -TARGET_EFAULT;
+ }
+ return ret;
+}
+
+SYSCALL_IMPL(settimeofday)
+{
+ struct timeval tv, *ptv = NULL;
+ struct timezone tz, *ptz = NULL;
+
+ if (arg1) {
+ if (copy_from_user_timeval(&tv, arg1)) {
+ return -TARGET_EFAULT;
+ }
+ ptv = &tv;
+ }
+
+ if (arg2) {
+ if (copy_from_user_timezone(&tz, arg2)) {
+ return -TARGET_EFAULT;
+ }
+ ptz = &tz;
+ }
+
+ return get_errno(settimeofday(ptv, ptz));
+}
+
#ifdef TARGET_NR_stime
SYSCALL_IMPL(stime)
{
@@ -4240,37 +4240,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
void *p;
switch(num) {
- case TARGET_NR_gettimeofday:
- {
- struct timeval tv;
- ret = get_errno(gettimeofday(&tv, NULL));
- if (!is_error(ret)) {
- if (copy_to_user_timeval(arg1, &tv))
- return -TARGET_EFAULT;
- }
- }
- return ret;
- case TARGET_NR_settimeofday:
- {
- struct timeval tv, *ptv = NULL;
- struct timezone tz, *ptz = NULL;
-
- if (arg1) {
- if (copy_from_user_timeval(&tv, arg1)) {
- return -TARGET_EFAULT;
- }
- ptv = &tv;
- }
-
- if (arg2) {
- if (copy_from_user_timezone(&tz, arg2)) {
- return -TARGET_EFAULT;
- }
- ptz = &tz;
- }
-
- return get_errno(settimeofday(ptv, ptz));
- }
#if defined(TARGET_NR_select)
case TARGET_NR_select:
#if defined(TARGET_WANT_NI_OLD_SELECT)
@@ -296,9 +296,6 @@
#ifdef TARGET_NR_gettid
{ TARGET_NR_gettid, "gettid" , "%s()", NULL, NULL },
#endif
-#ifdef TARGET_NR_gettimeofday
-{ TARGET_NR_gettimeofday, "gettimeofday" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_getuid
{ TARGET_NR_getuid, "getuid" , "%s()", NULL, NULL },
#endif
@@ -1068,9 +1065,6 @@
#ifdef TARGET_NR_set_tid_address
{ TARGET_NR_set_tid_address, "set_tid_address" , NULL, NULL, NULL },
#endif
-#ifdef TARGET_NR_settimeofday
-{ TARGET_NR_settimeofday, "settimeofday" , NULL, NULL, NULL },
-#endif
#ifdef TARGET_NR_setuid
{ TARGET_NR_setuid, "setuid" , NULL, NULL, NULL },
#endif
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-time.inc.c | 33 +++++++++++++++++++++++++++++++++ linux-user/syscall.c | 31 ------------------------------- linux-user/strace.list | 6 ------ 4 files changed, 35 insertions(+), 37 deletions(-) -- 2.17.1