From patchwork Fri May 2 19:15:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 345230 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0EF711400F6 for ; Sat, 3 May 2014 05:16:42 +1000 (EST) Received: from localhost ([::1]:45943 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIwp-0000kx-Tx for incoming@patchwork.ozlabs.org; Fri, 02 May 2014 15:16:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIwD-000825-Hl for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgIw5-0000B7-CE for qemu-devel@nongnu.org; Fri, 02 May 2014 15:16:01 -0400 Received: from afflict.kos.to ([92.243.29.197]:48075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgIw5-00009c-49 for qemu-devel@nongnu.org; Fri, 02 May 2014 15:15:53 -0400 Received: from localhost.localdomain (afflict [92.243.29.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by afflict.kos.to (Postfix) with ESMTPSA id D138E264CD; Fri, 2 May 2014 21:15:50 +0200 (CEST) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Fri, 2 May 2014 22:15:41 +0300 Message-Id: <34d6086236baeb59f4b46e2380f2b271acd6f6cf.1399057853.git.riku.voipio@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 92.243.29.197 Cc: peter.maydell@linaro.org, Natanael Copa Subject: [Qemu-devel] [PULL 06/14] linux-user: avoid using glibc internals in _syscall5 and in definition of target_sigevent struct 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 From: Natanael Copa Use the public sigset_t instead of the glibc specific internal __sigset_t in _syscall. Calculate the sigevent pad size is calculated in similar way as kernel does it instead of using glibc internal field _pad. This is needed for building with musl libc. Signed-off-by: Natanael Copa Signed-off-by: Riku Voipio Reviewed-by: Peter Maydell --- linux-user/syscall.c | 2 +- linux-user/syscall_defs.h | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 15de6f8..af0bb35 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -411,7 +411,7 @@ static int sys_inotify_init1(int flags) #endif #define __NR_sys_ppoll __NR_ppoll _syscall5(int, sys_ppoll, struct pollfd *, fds, nfds_t, nfds, - struct timespec *, timeout, const __sigset_t *, sigmask, + struct timespec *, timeout, const sigset_t *, sigmask, size_t, sigsetsize) #endif diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index fdf9a47..69c3982 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2552,12 +2552,26 @@ struct target_timer_t { abi_ulong ptr; }; +#define TARGET_SIGEV_MAX_SIZE 64 + +/* This is architecture-specific but most architectures use the default */ +#ifdef TARGET_MIPS +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 + sizeof(abi_long)) +#else +#define TARGET_SIGEV_PREAMBLE_SIZE (sizeof(int32_t) * 2 \ + + sizeof(target_sigval_t)) +#endif + +#define TARGET_SIGEV_PAD_SIZE ((TARGET_SIGEV_MAX_SIZE \ + - TARGET_SIGEV_PREAMBLE_SIZE) \ + / sizeof(int32_t)) + struct target_sigevent { target_sigval_t sigev_value; int32_t sigev_signo; int32_t sigev_notify; union { - int32_t _pad[ARRAY_SIZE(((struct sigevent *)0)->_sigev_un._pad)]; + int32_t _pad[TARGET_SIGEV_PAD_SIZE]; int32_t _tid; struct {