From nobody Wed May 04 10:08:23 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EE9291AAB8AF; Wed, 4 May 2022 10:08:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KtXbC69Ksz4dQN; Wed, 4 May 2022 10:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651658904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m7fztRrJUjx72MW0MAtlITMRDKlOVLnQ8aNbWlolaFo=; b=LlAz1FqLhbZFzI6uMj/DL9IBIbTqZOfelWP4zRRxIlXYMUL590TdY4lrpynk+0q+9JhVzs OR/R4hYjUdMDw/4j23WMdix2GhNsI5bq9DkqCBwJsNI15+vhAe3j6KMsSZYzLHOvFTJ654 4ZpqWx7M9ncQjH4eBGMDk0CVHHbS8UGZoa72V8zhPgfFfbkFY4pT47ephBSSDqjp4jYOa8 a4YTb5PgMxoqbVH+IvcjOBeIelbodxs/gmlCSdSfwh5YSQ2PfA1NV7vKXCjiQcRtSwZUng 0JlPE1tMEJ/oiAkrGnMY+YnpauCsTIPvmkkTC6td78vlVczziAvHc0JjYSiwzw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3D6710DF3; Wed, 4 May 2022 10:08:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 244A8Nlw000666; Wed, 4 May 2022 10:08:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 244A8NKk000665; Wed, 4 May 2022 10:08:23 GMT (envelope-from git) Date: Wed, 4 May 2022 10:08:23 GMT Message-Id: <202205041008.244A8NKk000665@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 1744f14e26c9 - main - linux(4): Implement recvmmsg_time64 syscall. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1744f14e26c99af704650922e19e6934aa9a1271 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651658904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m7fztRrJUjx72MW0MAtlITMRDKlOVLnQ8aNbWlolaFo=; b=sXI1OPxHJEAZ9CqqvsvSvp8zw9L0ciERDjw0WUT83oZEFvKygpmCixnWbZzs5yQHTce/CN y28J7MVq8yGtAiWjp7nWcNfnsp9dQF4NNRxR9YN/n2WttbE4k6zEML/K0K0XabGMkCtrmf TyNVaKPF6nq53UlWoNb3KtII2YgE519HdqWZuGS0Hjb5h3hm7p3GJuVfg2gs4r4KyQCFGB iCwVZF0e4V28qO6DSfeiHRzER9amzi9IZppLd4470jiJh53Yvyhei8AhHeIlN3+tSNMkGy UrDQeFH4GRxqNfG8aDPZyl2zT1+Slikok6iIK/eciRrIIQvZGMIoc/KzLhtrtg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651658904; a=rsa-sha256; cv=none; b=gm6fEF+P16SkAhvdO/QBlvd5I2T4Xgt+tCoNRcD7EXeat3bWkpTmnw/9vwIh9LoYUO3w0R TnqcrdSuBwutgUSVwoaxFvpGxrlp6sE0aCaplzNH5XVhpFZhXN5TYaLaJT4tXnbLKtpdd7 Ttbt6uYxHZ611+dLZzgSG+FPscK0cATalamIGkiP1vmDpUJvgTpETmSMBh1f44MmP7iSzQ 9tDrhknZXyOCX76BSs1o0krLvikUknfNipXqpTdbn2FtSEi6xXVP3nN/QIHdZDTQOr/BCz RbOFfWDq+EHYCPOvyUY983NythooPFSKXbRYb7JDVuUJoCnMHfs/YnJoVSpMuQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=1744f14e26c99af704650922e19e6934aa9a1271 commit 1744f14e26c99af704650922e19e6934aa9a1271 Author: Dmitry Chagin AuthorDate: 2022-05-04 10:06:53 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-04 10:06:53 +0000 linux(4): Implement recvmmsg_time64 syscall. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/compat/linux/linux_socket.c | 85 ++++++++++++++++++++++--------- sys/i386/linux/linux_dummy_machdep.c | 1 - 3 files changed, 61 insertions(+), 26 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 0cc1cd581c32..a5c61e252f9d 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -69,7 +69,6 @@ DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); DUMMY(io_pgetevents_time64); -DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64); DUMMY(mq_timedreceive_time64); DUMMY(semtimedop_time64); diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index d7e17596fde1..93b5cea7ecc3 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1736,32 +1736,19 @@ linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args) args->flags, &bsd_msg)); } -int -linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args) +static int +linux_recvmmsg_common(struct thread *td, l_int s, struct l_mmsghdr *msg, + l_uint vlen, l_uint flags, struct timespec *tts) { - struct l_mmsghdr *msg; struct msghdr bsd_msg; - struct l_timespec lts; - struct timespec ts, tts; + struct timespec ts; l_uint retval; int error, datagrams; - if (args->timeout) { - error = copyin(args->timeout, <s, sizeof(struct l_timespec)); - if (error != 0) - return (error); - error = linux_to_native_timespec(&ts, <s); - if (error != 0) - return (error); - getnanotime(&tts); - timespecadd(&tts, &ts, &tts); - } - - msg = PTRIN(args->msg); datagrams = 0; - while (datagrams < args->vlen) { - error = linux_recvmsg_common(td, args->s, &msg->msg_hdr, - args->flags & ~LINUX_MSG_WAITFORONE, &bsd_msg); + while (datagrams < vlen) { + error = linux_recvmsg_common(td, s, &msg->msg_hdr, + flags & ~LINUX_MSG_WAITFORONE, &bsd_msg); if (error != 0) break; @@ -1775,15 +1762,15 @@ linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args) /* * MSG_WAITFORONE turns on MSG_DONTWAIT after one packet. */ - if (args->flags & LINUX_MSG_WAITFORONE) - args->flags |= LINUX_MSG_DONTWAIT; + if (flags & LINUX_MSG_WAITFORONE) + flags |= LINUX_MSG_DONTWAIT; /* * See BUGS section of recvmmsg(2). */ - if (args->timeout) { + if (tts) { getnanotime(&ts); - timespecsub(&ts, &tts, &ts); + timespecsub(&ts, tts, &ts); if (!timespecisset(&ts) || ts.tv_sec > 0) break; } @@ -1796,6 +1783,56 @@ linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args) return (error); } +int +linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args) +{ + struct l_timespec lts; + struct timespec ts, tts, *ptts; + int error; + + if (args->timeout) { + error = copyin(args->timeout, <s, sizeof(struct l_timespec)); + if (error != 0) + return (error); + error = linux_to_native_timespec(&ts, <s); + if (error != 0) + return (error); + getnanotime(&tts); + timespecadd(&tts, &ts, &tts); + ptts = &tts; + } + else ptts = NULL; + + return (linux_recvmmsg_common(td, args->s, PTRIN(args->msg), + args->vlen, args->flags, ptts)); +} + +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_recvmmsg_time64(struct thread *td, struct linux_recvmmsg_time64_args *args) +{ + struct l_timespec64 lts; + struct timespec ts, tts, *ptts; + int error; + + if (args->timeout) { + error = copyin(args->timeout, <s, sizeof(struct l_timespec)); + if (error != 0) + return (error); + error = linux_to_native_timespec64(&ts, <s); + if (error != 0) + return (error); + getnanotime(&tts); + timespecadd(&tts, &ts, &tts); + ptts = &tts; + } + else ptts = NULL; + + return (linux_recvmmsg_common(td, args->s, PTRIN(args->msg), + args->vlen, args->flags, ptts)); +} +#endif + int linux_shutdown(struct thread *td, struct linux_shutdown_args *args) { diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 4619fa226a72..dd89444537d0 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -71,7 +71,6 @@ DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); DUMMY(io_pgetevents_time64); -DUMMY(recvmmsg_time64); DUMMY(mq_timedsend_time64); DUMMY(mq_timedreceive_time64); DUMMY(semtimedop_time64);