virtualization/app-emulation/qemu/files/0.14.1/0020-linux-user-implement-r...

41 lines
1.4 KiB
Diff

From: Alexander Graf <agraf@suse.de>
For OBS, we're running a full cross-guest inside of a VM. When a build
is done there, we reboot the guest as shutdown mechanism.
Unfortunately, reboot is not implemented in linux-user. So this mechanism
fails, spilling unpretty warnings. This patch implements sys_reboot()
emulation.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
Index: qemu-0.14.1/linux-user/syscall.c
===================================================================
--- qemu-0.14.1.orig/linux-user/syscall.c
+++ qemu-0.14.1/linux-user/syscall.c
@@ -239,6 +239,8 @@ _syscall6(int,sys_futex,int *,uaddr,int,
const struct timespec *,timeout,int *,uaddr2,int,val3)
#endif
#endif
+_syscall4(int, reboot, int, magic1, int, magic2, unsigned int, cmd,
+ void *, arg);
static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -5536,7 +5538,11 @@ abi_long do_syscall(void *cpu_env, int n
break;
#endif
case TARGET_NR_reboot:
- goto unimplemented;
+ if (!(p = lock_user_string(arg4)))
+ goto efault;
+ ret = reboot(arg1, arg2, arg3, p);
+ unlock_user(p, arg4, 0);
+ break;
#ifdef TARGET_NR_readdir
case TARGET_NR_readdir:
goto unimplemented;