From patchwork Tue Sep 27 12:39:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 116594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 10F3CB6F18 for ; Tue, 27 Sep 2011 22:40:30 +1000 (EST) Received: from localhost ([::1]:56881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8WxV-0007OQ-Vp for incoming@patchwork.ozlabs.org; Tue, 27 Sep 2011 08:40:25 -0400 Received: from eggs.gnu.org ([140.186.70.92]:57280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8WxM-0007OC-Vq for qemu-devel@nongnu.org; Tue, 27 Sep 2011 08:40:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8WxD-0005PZ-A8 for qemu-devel@nongnu.org; Tue, 27 Sep 2011 08:40:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49726 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8WxD-0005Op-4P for qemu-devel@nongnu.org; Tue, 27 Sep 2011 08:40:07 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 27E8A89471; Tue, 27 Sep 2011 14:40:06 +0200 (CEST) From: Alexander Graf To: qemu-devel@nongnu.org Date: Tue, 27 Sep 2011 14:39:42 +0200 Message-Id: <1317127182-3190-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: riku.voipio@linaro.org Subject: [Qemu-devel] [PATCH] linux-user: implement reboot syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- linux-user/syscall.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 27970a4..808f488 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -245,6 +245,8 @@ _syscall3(int, sys_sched_getaffinity, pid_t, pid, unsigned int, len, #define __NR_sys_sched_setaffinity __NR_sched_setaffinity _syscall3(int, sys_sched_setaffinity, pid_t, pid, unsigned int, len, unsigned long *, user_mask_ptr); +_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, }, @@ -5858,7 +5860,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, 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;