From nobody Sun Nov 16 05:42:13 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=1598556643; cv=none; d=zohomail.com; s=zohoarc; b=apuMG17WVqcFly3kTSpM7sAyQG4EoS5hvo+3Zofy3MihGZEz9DUVG0xEbFPtvt6ohG3GnQvgUX7nrrBiq+F+alp0/fpfYxday2rQLqSmwSjqyvkqEAM9wlICROVGXjw9LM5V5z8sa0ZbjUgcF1q3jyCd93OtnIIcx4lTC+dfhwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598556643; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bpm4dHbY8zZwSMlngwxgufenJYj9xrdutm+XTnwzxtY=; b=hlSAE6yDl2j8TWsP8M2hG28wZkrKrvLE+I7PgaEmgSd0WtQy6HiFCG2p4tIB5eAh8rNqzsxK2/m2iZ0OD85NXlxk6Y5kET5LdHKAWZyTInh8a+CPWl2risIHfH3om7QTVN+sDmM1TvG5Ay96SqPyIga+BIFdim/5eodr/u60M4k= 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 1598556643374393.36886262861174; Thu, 27 Aug 2020 12:30:43 -0700 (PDT) Received: from localhost ([::1]:47506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBNbd-0006lf-Tg for importer@patchew.org; Thu, 27 Aug 2020 15:30:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBNSB-0004JO-96 for qemu-devel@nongnu.org; Thu, 27 Aug 2020 15:20:55 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:51089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBNS9-0000IJ-3e for qemu-devel@nongnu.org; Thu, 27 Aug 2020 15:20:54 -0400 Received: from localhost.localdomain ([82.252.135.186]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M8QNy-1kFnIo2N7I-004V66; Thu, 27 Aug 2020 21:20:42 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 15/18] linux-user: Add support for 'mq_timedsend_time64()' and 'mq_timedreceive_time64()' Date: Thu, 27 Aug 2020 21:20:15 +0200 Message-Id: <20200827192018.2442099-16-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200827192018.2442099-1-laurent@vivier.eu> References: <20200827192018.2442099-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:uv4eOu/tNfyzww5wB/LIXMENRklNHb+76HLgBz+ZSqV9+a96s/u YGyZ+hfxh+9fAG5vWx1LqWyo00EV1yfhnPJoImtyb+RmQ/jvqFqEzTuNESDj67C5aMOtnXH yIUWMRCiFFD1Tq/4oGX0mOoezR2cr2IdJiGXyqlG8A1IxiYnSS1N+1eBvDb/4PXoEciWOW6 rFAKe3i0Uz7kfuVBUpSDw== X-UI-Out-Filterresults: notjunk:1;V03:K0:tJTvFyXWkLs=:WFD7KveHIPkQ2mAsmq0di7 +B3d3v74cQlcr4HIF7+uEsCCfZ+uZC3K1Grd9s18ve9mSkIck1YD7eGYfUL5TCoqKtZZxg6bq tzdrWl3dgnfBl7F9CSHWhcF99P/udWBgSCBcOATGjMAPwlVsGWb9El5idYLq7DPP5d+hCpq7p WAaDDkeDpA7cjY8QGoh8iSin4KQM/e6EeAZFDA8oDya/X/YrCh/6kxKHsuR23Hncr4I8bCb4m omzUEwTMy/73uL0GZkcthahOGMrStV4bDwUZ9anka5+rorlyvFII1GywLM4l7/kGPiOLi8Uzs H6DoM9IsvY1n8Ukbn+IcQlJvT75nsZtpAQaWKORsxwmpEaKmu5syAI9y0KD35stVliZqF1WeS Tp1tZCuECXkXT/jlrIq/omBoeQp/IldxMKunWidsfHqB0A8Z7MtqwRPC6jfyzcsjLQlksaeWP TSKqSFXsGoySdXSt4spQKNZCZ7t0VlSQSl1NKEQEZ0YeLNWmgmC+CjdPRphDQB7iENaK0BKaC FnyYFC0oiItSzUxqjMRaJ0hxjpwVNLmGbVZfC7UFDFjDcGRHViQuWb0l2x1W22qxGeoBGQ4gK MFUJg80/mBDR8Xi3fmmkFcLdYt0RZj6tC1fsz3Gv0yKdnsyKbqVT9zgbV18b5G5dVtTvOPe9n JhEah4mvK0bdGC4aBIXBJSM8D5hgbH6IYgLchnDw443TgZqkEi06cZJFJKyjqWrTQpjMIlPpE NwA6mGu0nQNtEOURBw2TJac63LgAMYqT1Z5v4IGdaAV3rV0uXiaAlYj3FLxzinfUU0LgIrTtr zzWcPmQssYfZJK08baqKUW/GPRbB7c+cIYuUU8et+T1IFq4jZJa5NelxNHiSnbUaUVAeL46 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: none client-ip=217.72.192.73; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/27 15:20:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no 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: Riku Voipio , Laurent Vivier , Filip Bozuta Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Filip Bozuta This patch implements functionality for following time64 syscalls: *mq_timedsend_time64() This is a year 2038 safe vairant of syscall: int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout) --send a message to a message queue-- man page: https://www.man7.org/linux/man-pages/man2/mq_timedsend.2.html *mq_timedreceive_time64() This is a year 2038 safe variant of syscall: ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abs_timeout) --receive a message from a message queue-- man page: https://man7.org/linux/man-pages/man3/mq_receive.3.html Implementation notes: These syscalls were implemented in similar ways like 'mq_timedsend()' and 'mq_timedreceive' except that functions 'target_to_host_timespec64()' and 'host_to_target_timespec64()' were used to convert values of 'struct timespec' between host and target. Signed-off-by: Filip Bozuta Reviewed-by: Laurent Vivier Message-Id: <20200824193752.67950-3-Filip.Bozuta@syrmia.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 56 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3b725bbe2513..b28c8edb421e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -799,11 +799,13 @@ safe_syscall5(int, msgrcv, int, msgid, void *, msgp, = size_t, sz, safe_syscall4(int, semtimedop, int, semid, struct sembuf *, tsops, unsigned, nsops, const struct timespec *, timeout) #endif -#ifdef TARGET_NR_mq_timedsend +#if defined(TARGET_NR_mq_timedsend) || \ + defined(TARGET_NR_mq_timedsend_time64) safe_syscall5(int, mq_timedsend, int, mqdes, const char *, msg_ptr, size_t, len, unsigned, prio, const struct timespec *, timeou= t) #endif -#ifdef TARGET_NR_mq_timedreceive +#if defined(TARGET_NR_mq_timedreceive) || \ + defined(TARGET_NR_mq_timedreceive_time64) safe_syscall5(int, mq_timedreceive, int, mqdes, char *, msg_ptr, size_t, len, unsigned *, prio, const struct timespec *, time= out) #endif @@ -1218,6 +1220,8 @@ static inline abi_long target_to_host_timespec(struct= timespec *host_ts, =20 #if defined(TARGET_NR_clock_settime64) || defined(TARGET_NR_futex_time64) = || \ defined(TARGET_NR_timer_settime64) || \ + defined(TARGET_NR_mq_timedsend_time64) || \ + defined(TARGET_NR_mq_timedreceive_time64) || \ (defined(TARGET_NR_timerfd_settime64) && defined(CONFIG_TIMERFD)) static inline abi_long target_to_host_timespec64(struct timespec *host_ts, abi_ulong target_addr) @@ -12059,6 +12063,27 @@ static abi_long do_syscall1(void *cpu_env, int num= , abi_long arg1, } return ret; #endif +#ifdef TARGET_NR_mq_timedsend_time64 + case TARGET_NR_mq_timedsend_time64: + { + struct timespec ts; + + p =3D lock_user(VERIFY_READ, arg2, arg3, 1); + if (arg5 !=3D 0) { + if (target_to_host_timespec64(&ts, arg5)) { + return -TARGET_EFAULT; + } + ret =3D get_errno(safe_mq_timedsend(arg1, p, arg3, arg4, &= ts)); + if (!is_error(ret) && host_to_target_timespec64(arg5, &ts)= ) { + return -TARGET_EFAULT; + } + } else { + ret =3D get_errno(safe_mq_timedsend(arg1, p, arg3, arg4, N= ULL)); + } + unlock_user(p, arg2, arg3); + } + return ret; +#endif =20 #ifdef TARGET_NR_mq_timedreceive case TARGET_NR_mq_timedreceive: @@ -12086,6 +12111,33 @@ static abi_long do_syscall1(void *cpu_env, int num= , abi_long arg1, } return ret; #endif +#ifdef TARGET_NR_mq_timedreceive_time64 + case TARGET_NR_mq_timedreceive_time64: + { + struct timespec ts; + unsigned int prio; + + p =3D lock_user(VERIFY_READ, arg2, arg3, 1); + if (arg5 !=3D 0) { + if (target_to_host_timespec64(&ts, arg5)) { + return -TARGET_EFAULT; + } + ret =3D get_errno(safe_mq_timedreceive(arg1, p, arg3, + &prio, &ts)); + if (!is_error(ret) && host_to_target_timespec64(arg5, &ts)= ) { + return -TARGET_EFAULT; + } + } else { + ret =3D get_errno(safe_mq_timedreceive(arg1, p, arg3, + &prio, NULL)); + } + unlock_user(p, arg2, arg3); + if (arg4 !=3D 0) { + put_user_u32(prio, arg4); + } + } + return ret; +#endif =20 /* Not implemented for now... */ /* case TARGET_NR_mq_notify: */ --=20 2.26.2