X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=kitten%2Fkernel%2Flinux_syscalls%2Fsettimeofday.c;fp=kitten%2Fkernel%2Flinux_syscalls%2Fsettimeofday.c;h=748e05930d5afd00d9738f7b4a411cb5464b624c;hb=66a1a4c7a9edcd7d8bc207aca093d694a6e6b5b2;hp=0000000000000000000000000000000000000000;hpb=f7cf9c19ecb0a589dd45ae0d2c91814bd3c2acc2;p=palacios.git diff --git a/kitten/kernel/linux_syscalls/settimeofday.c b/kitten/kernel/linux_syscalls/settimeofday.c new file mode 100644 index 0000000..748e059 --- /dev/null +++ b/kitten/kernel/linux_syscalls/settimeofday.c @@ -0,0 +1,34 @@ +#include +#include +#include + +int +sys_settimeofday( + struct timeval __user * tv, + struct timezone __user * tz +) +{ + struct timeval _tv; + struct timezone _tz; + + if (tv != NULL) { + if (copy_from_user(&_tv, tv, sizeof(_tv))) + return -EFAULT; + + set_time( + (_tv.tv_sec * NSEC_PER_SEC) + (_tv.tv_usec * NSEC_PER_USEC) + ); + } + + if (tz != NULL) { + if (copy_from_user(&_tz, tz, sizeof(_tz))) + return -EFAULT; + + /* Only support setting timezone to 0 */ + if ((_tz.tz_minuteswest != 0) || (_tz.tz_dsttime != 0)) + return -EFAULT; + } + + return 0; +} +