From nobody Fri Nov 14 17:01:15 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.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=1589215297; cv=none; d=zohomail.com; s=zohoarc; b=iRYXUawVLMpJcY9baNMySXogpU+3+3m45QuJOHYBr1lbYFY2zMK7i8Hk8O38lS3nK54OpbqkWjdaWrVYzKSQuxeijVHQahwaodyaeBEXuubTLKUdslBuVhxdSzL7lgYORWVVQoCUiXU3dpLt0UNY2LH2Rl+/X5+X9SUIDRoeRCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589215297; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject; bh=zvn8qgQMd5kQ5XCNf/nvogTFUM1nvdcmLh/HotS2+jk=; b=aRdybCTOORaix6bH/899brJKVaVyBF99EuMBUtv/m6m7dJAWn2ydC2i1fFUmyAoeJjM2DiSH+WRkTgfeyNSh/yzUBZ3F/r2BHrbtvHox8jQ0NfwK6B9sntDR0DB7jBlnJi/URsQv9Uv+El+EZcZajykTVkbBfy7S34f2uxHLJ+E= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 1589215297138890.3360864930718; Mon, 11 May 2020 09:41:37 -0700 (PDT) Received: from localhost ([::1]:43202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYBUl-0005YS-U2 for importer@patchew.org; Mon, 11 May 2020 12:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYBTK-0004BW-LM for qemu-devel@nongnu.org; Mon, 11 May 2020 12:40:06 -0400 Received: from mx1.tachyum.com ([66.160.133.170]:52201 helo=mail.tachyum.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYBTI-000202-MD for qemu-devel@nongnu.org; Mon, 11 May 2020 12:40:06 -0400 Received: by mail.tachyum.com (Postfix, from userid 1001) id F256986A; Mon, 11 May 2020 01:40:04 -0700 (PDT) Received: from tsk-dev-swd001.tachyum.sk (unknown [93.184.71.90]) by mail.tachyum.com (Postfix) with ESMTP id 85741103; Mon, 11 May 2020 01:39:57 -0700 (PDT) From: Matus Kysel To: Subject: [PATCH] linux-user: support of semtimedop syscall Date: Mon, 11 May 2020 18:39:28 +0200 Message-Id: <20200511163928.70261-1-mkysel@tachyum.com> X-Mailer: git-send-email 2.17.1 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=66.160.133.170; envelope-from=mkysel@tachyum.com; helo=mail.tachyum.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/11 12:40:02 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: "open list:All patches CC here" , Riku Voipio , Laurent Vivier , Matus Kysel 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" We should add support of semtimedop syscall as new version of glibc 2.31 uses semop based on semtimedop (commit: https://gitlab.com/freed= esktop-sdk/mirrors/sourceware/glibc/-/commit/765cdd0bffd77960ae852104fc4ea5= edcdb8aed3 ). Signed-off-by: Matus Kysel --- linux-user/syscall.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3a924c0004..cb3978a2a5 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -3879,21 +3879,32 @@ static inline abi_long target_to_host_sembuf(struct= sembuf *host_sembuf, return 0; } =20 -static inline abi_long do_semop(int semid, abi_long ptr, unsigned nsops) +static inline abi_long do_semtimedop(int semid, + abi_long ptr, + unsigned nsops, + abi_long timeout) { struct sembuf sops[nsops]; + struct timespec ts, *pts =3D NULL; abi_long ret; =20 + if (timeout) { + pts =3D &ts; + if (target_to_host_timespec(pts, timeout)) { + return -TARGET_EFAULT; + } + } + if (target_to_host_sembuf(sops, ptr, nsops)) return -TARGET_EFAULT; =20 ret =3D -TARGET_ENOSYS; #ifdef __NR_semtimedop - ret =3D get_errno(safe_semtimedop(semid, sops, nsops, NULL)); + ret =3D get_errno(safe_semtimedop(semid, sops, nsops, pts)); #endif #ifdef __NR_ipc if (ret =3D=3D -TARGET_ENOSYS) { - ret =3D get_errno(safe_ipc(IPCOP_semtimedop, semid, nsops, 0, sops= , 0)); + ret =3D get_errno(safe_ipc(IPCOP_semtimedop, semid, nsops, 0, sops= , pts)); } #endif return ret; @@ -4373,7 +4384,8 @@ static abi_long do_ipc(CPUArchState *cpu_env, =20 switch (call) { case IPCOP_semop: - ret =3D do_semop(first, ptr, second); + case IPCOP_semtimedop: + ret =3D do_semtimedop(first, ptr, second, third); break; =20 case IPCOP_semget: @@ -9608,7 +9620,11 @@ static abi_long do_syscall1(void *cpu_env, int num, = abi_long arg1, #endif #ifdef TARGET_NR_semop case TARGET_NR_semop: - return do_semop(arg1, arg2, arg3); + return do_semtimedop(arg1, arg2, arg3, 0); +#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: --=20 2.17.1