From nobody Tue Feb 10 01:33:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1564597406; cv=none; d=zoho.com; s=zohoarc; b=PAhQbc2HVBtZKBTRMJRvyp/s1Fp0nzyuA0X3AfYNz+RtNj8o3evT9QCemrOC5S7wVvOeen2EumpLrkbZVj2vcgoODG/jtJMEQjjZG+RmjDg2zR9rPgwSOhvzsqHw9N/oohJyD+W8a9cOATGWJ91WylPHyKMvoWMUiebT+MKG3co= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564597406; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=BGduTydV5WfKDKfds0sCLIkJwbIBdDrYTwCW7oJrfQg=; b=OpZLmA5hv3/S2LZGFK/cHFaVMsr7ke2hRqjxUW9UEpQY75z0QE4K+b+a/zpHitDfAtdmSQmA3Q43/OvUUUEFPUcnXuD3YjqMMGcxyXdkxn0QliJ2ldczx4weHZSykZQ3yZlMETj6ZTW0nZQBtXpschdZFLtmgYW2VfEzahMPFMU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1564597406115333.8263588564088; Wed, 31 Jul 2019 11:23:26 -0700 (PDT) Received: from localhost ([::1]:43595 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hstG1-0002Al-72 for importer@patchew.org; Wed, 31 Jul 2019 14:23:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50717) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hstCs-0002tF-1g for qemu-devel@nongnu.org; Wed, 31 Jul 2019 14:20:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hstCq-0001Mi-FQ for qemu-devel@nongnu.org; Wed, 31 Jul 2019 14:20:09 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:44058 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hstCq-0001IQ-8e for qemu-devel@nongnu.org; Wed, 31 Jul 2019 14:20:08 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 171791A22AB; Wed, 31 Jul 2019 20:19:56 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id E87361A2217; Wed, 31 Jul 2019 20:19:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Wed, 31 Jul 2019 20:19:38 +0200 Message-Id: <1564597178-24649-13-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564597178-24649-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1564597178-24649-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH for 4.2 v4 12/12] linux-user: Add support for semtimedop() syscall X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Rikalo , laurent@vivier.eu, amarkovic@wavecomp.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Aleksandar Rikalo Add support for semtimedop() emulation. It is based on invocation of safe_semtimedop(). Conversion is left out of safe_semtimedop(), since other safe_xxx() usually don't contain similar conversions. Signed-off-by: Aleksandar Rikalo Signed-off-by: Aleksandar Markovic --- linux-user/syscall.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index ee80175..6825458 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6650,7 +6650,43 @@ static inline abi_long host_to_target_statx(struct t= arget_statx *host_stx, return 0; } #endif +#ifdef TARGET_NR_semtimedop +static inline abi_long do_semtimedop(int semid, abi_long ptr, unsigned nso= ps, + abi_long timeout) +{ + struct sembuf *sops; + struct timespec ts, *pts; + abi_long ret; + + if (timeout) { + pts =3D &ts; + if (target_to_host_timespec(pts, timeout)) { + return -TARGET_EFAULT; + } + } else { + pts =3D NULL; + } =20 + sops =3D g_malloc(sizeof(struct sembuf) * nsops); + if (sops =3D=3D NULL) { + return -TARGET_EFAULT; + } + + if (target_to_host_sembuf(sops, ptr, nsops)) { + g_free(sops); + return -TARGET_EFAULT; + } + +#ifdef __NR_semtimedop + ret =3D get_errno(safe_semtimedop(semid, sops, nsops, pts)); +#else + ret =3D -TARGET_ENOSYS; +#endif + g_free(sops); + + return ret; +} +#endif =20 /* ??? Using host futex calls even when target atomic operations are not really atomic probably breaks things. However implementing @@ -9194,6 +9230,10 @@ static abi_long do_syscall1(void *cpu_env, int num, = abi_long arg1, case TARGET_NR_semop: return do_semop(arg1, arg2, arg3); #endif +#ifdef TARGET_NR_semtimedop + case TARGET_NR_semtimedop: + return do_semtimedop(arg1, arg2, arg3, arg4); +#endif #ifdef TARGET_NR_semctl case TARGET_NR_semctl: return do_semctl(arg1, arg2, arg3, arg4); --=20 2.7.4