From nobody Sun Aug 20 07:37:48 2023 X-Original-To: dev-commits-src-all@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 4RT6s85JDPz4qs3P; Sun, 20 Aug 2023 07:37:48 +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 4RT6s84XD7z3DMQ; Sun, 20 Aug 2023 07:37:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692517068; 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=Zf3NIJMzoUJmn2X0v6NGe1vm255fvsCX/s8Wt4mXVHA=; b=b9eUf9esDHU+S2AwltxI0pNjKUH91ZK647QnbieaEur2ZtUkjUO7nGWMOMtrPRqSrqurL/ pm8YwmRQJigIt7n0ADhZOC9CN+B3ISHSuWf5IoAAM7QHkUYHORA8M9Seybscv7pLAbOBdm 6ACX4Hl/J8qC7CUH9RCAbAUvxOs+womL6LiXL8wWJVBnORJchD85H6YV9+E0n1tUgxVYcN 1gac1BlVQNmcEvtNwsIocMgLwTnEtszw4OzyBJ3y7CW/LYWKn6+SUyucXsFpPdizgUa4Gr B/JHvOZJaA0bmA8Jr0MZTxxcY3usHOObI3HF8UUii1w6aOdHwUSqq68iniR3/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692517068; 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=Zf3NIJMzoUJmn2X0v6NGe1vm255fvsCX/s8Wt4mXVHA=; b=JkS2fB0RyKHT6dEFIiLfo59frb2RFYnlshe3EQtHxJyK1ALeWAptfcW7fN96xse8LMKxnk KktaFoVwRPjKfL3WsRq2yrDLAgYyirh6orPg0vHVaxwlyY12iheaIOK+ENclEVerPMBMfG 39ED3Zm8jocp+EH9f7hmwut6RvMdbNa/lKvn9PU51FQsYwwWrHpj0RlJq6xVbrHkCw8tgi fotCMsLOI5ixx4OJy9paaVyts65lOawXJD2dEPSr3PhViGE6TnEYAC/sYv9IkFO1bN/bEh SkT2PYMLjPUdH0gx0bbPCls2/sKxRxuWLA/bSZhoqA+vn85rPMJnzvbUE8QEQA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692517068; a=rsa-sha256; cv=none; b=BY+X5tcrEj7bcegpejBaVMT/Rzsl30DrUnVYfrrX06IB5+JJPp/kEHWhaceOT23FuwXv+i O3ZxrVl6lYOEhwiA9olKgmNXQA5bNVikw0x4NfZYXlEvVlbU9pnvsQkjvkBNEXW2TJC9P8 QTco6EZ237mQLIWcbV9zXoCSAnUkhpQSgaG1KJvCqLl+KXPv3U/cI1/Ej4yDUy3gEIsJ+F ELTexP7zKPGxYti9bNMRdOPKtKrRcLWTAzk9eIXHsBmlB7M2xWjeJZOtoKAy8uZS97pRZg ONcDU82/kxlz2s2WKDSMRe69rdBlHabWuZumI7hFbm0rsw6XM16viri46JVvDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RT6s83c7TzWfZ; Sun, 20 Aug 2023 07:37:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37K7bm2J049742; Sun, 20 Aug 2023 07:37:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37K7bm2e049739; Sun, 20 Aug 2023 07:37:48 GMT (envelope-from git) Date: Sun, 20 Aug 2023 07:37:48 GMT Message-Id: <202308200737.37K7bm2e049739@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: 4231b825ac19 - main - linux(4): Add a dedicated writev syscall wrapper List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 4231b825ac19112b84b4001625e0ef7a80e82f80 Auto-Submitted: auto-generated The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=4231b825ac19112b84b4001625e0ef7a80e82f80 commit 4231b825ac19112b84b4001625e0ef7a80e82f80 Author: Dmitry Chagin AuthorDate: 2023-08-20 07:36:31 +0000 Commit: Dmitry Chagin CommitDate: 2023-08-20 07:36:31 +0000 linux(4): Add a dedicated writev syscall wrapper Adding a writev syscall wrapper is needed due to Linux family of write syscalls doesn't distinguish between in kernel blocking operations and always returns EAGAIN while FreeBSD can return ENOBUFS. MFC after: 1 month --- sys/amd64/linux32/linux32_machdep.c | 14 -------------- sys/compat/linux/linux_file.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index 2598384aada5..ac8234503bdd 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -196,20 +196,6 @@ linux_readv(struct thread *td, struct linux_readv_args *uap) return (error); } -int -linux_writev(struct thread *td, struct linux_writev_args *uap) -{ - struct uio *auio; - int error; - - error = linux32_copyinuio(uap->iovp, uap->iovcnt, &auio); - if (error) - return (error); - error = kern_writev(td, uap->fd, auio); - free(auio, M_IOV); - return (error); -} - struct l_ipc_kludge { l_uintptr_t msgp; l_long msgtyp; diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 6a1f61984b08..27b6e1a5f77d 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -47,6 +47,7 @@ #ifdef COMPAT_LINUX32 #include +#include #include #include #else @@ -1855,3 +1856,21 @@ linux_write(struct thread *td, struct linux_write_args *args) return (linux_enobufs2eagain(td, args->fd, sys_write(td, &bargs))); } + +int +linux_writev(struct thread *td, struct linux_writev_args *args) +{ + struct uio *auio; + int error; + +#ifdef COMPAT_LINUX32 + error = freebsd32_copyinuio(PTRIN(args->iovp), args->iovcnt, &auio); +#else + error = copyinuio(args->iovp, args->iovcnt, &auio); +#endif + if (error != 0) + return (error); + error = kern_writev(td, args->fd, auio); + free(auio, M_IOV); + return (linux_enobufs2eagain(td, args->fd, error)); +}