From nobody Fri Jun 17 19:24:07 2022 X-Original-To: dev-commits-src-branches@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 E35548437F1; Fri, 17 Jun 2022 19:24:07 +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 4LPpr74R87z3C6k; Fri, 17 Jun 2022 19:24:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655493847; 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=Kbm0W6q0sJsCAjrTUVxnCjabQInWRWOsnAxBhOogKMk=; b=Ig+AtUNVRzawQFvWT3txW4AOSVcDPFd99sweIVU9E+L2MBzM7cGS+vRp4cHhdqwerjmSmv kEJP+Zw83LHb+hCug17NttqYmw/rWlWh5QoIKIUqRt1QPDMNxZ9FL+q7/QXCD0KNc0hx31 /rr0WT31kdpEyDaHsUSeklQNsqWW9GlEOz6i6DTziWM8Bl7Pn4KDp+7jbabwmwMNX1/HKJ KJ7pYrbea51DU+HIptHgouMq8k/9eAATSI9nIgbubSXf6cfVVpbfjgL0YmV7Z6HvbctCFz p3+ui7mq/p1fne6TkAjY5mRy+2Lwj6B7uwpf6PPhIZpRD1hiKF1jkLoKSXYW8w== 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 55B552563D; Fri, 17 Jun 2022 19:24:07 +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 25HJO77q096012; Fri, 17 Jun 2022 19:24:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJO78p096011; Fri, 17 Jun 2022 19:24:07 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:24:07 GMT Message-Id: <202206171924.25HJO78p096011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: f62db988942a - stable/13 - linux(4): Add F_GETPIPE_SZ fcntl operation which returns the capacity of the pipe referred by fd. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: f62db988942a337c6bbe04f52a1afb5a7be0fb8d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655493847; 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=Kbm0W6q0sJsCAjrTUVxnCjabQInWRWOsnAxBhOogKMk=; b=qRpIIPBb7nLjBbV9rJxA/Cz6YyZzvIa8me+fFzC1rdM5VDw+6xhmOCA5rkjPRMuBvMocAH 82M4bO1x5+HNgnE7ezwJdiMVihykQA11hhiXOVYVmKc8Ug2ix5cH6xW27lsyhbOQdGVNpn GvtLrU3BLD7rMwhh4ujwKi/Suku+2lwScA/VQO9OVEe6+E/8ucE3V+K6atxRloopEnXGuI p2Uolntot/kbI/PCRnP296G0maRxDApQ3SyTqaY9vd4AaXArE02RZ11W9tS3FRlaLnTuCk 1TgsjlMw0YDg757qZSY2ytyF8JQJ7Zqiy9gMd4uclY6PpWPZc7d3DrYy4Y7ahg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655493847; a=rsa-sha256; cv=none; b=SHCV/YJ8D2EM+XFb0VY3YdiIOAQd4jTDKzfhtcaakP8yuDnqJE/f/7QT/alxGz9osgTmNM 1m7qy4VWHxXGIYpY2LWvsQJIXE15IjRpFVQgyfdzw+7RtO0bHZ0cY6hRCEqr8APDU3V2Jb 0zuK9Cdntpj+bOPE4/OIRN1dHwwAW9DyrNGQfAScKqpDSfe65Th3W+cGzyUJkXf6EmtzFs v++IpIucuhal3b/eiTJi2LvpAe/mxTkSUIfUSOGTFXHKZN3riIhHYFfKCTuxXKW+TisODs HZsCCQUMewFj0eL9RIZuTNKBKYbAs243IX2+GpLM/sfShYzunr0D8kdStZeaWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f62db988942a337c6bbe04f52a1afb5a7be0fb8d commit f62db988942a337c6bbe04f52a1afb5a7be0fb8d Author: Dmitry Chagin AuthorDate: 2021-05-31 19:15:02 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:22:16 +0000 linux(4): Add F_GETPIPE_SZ fcntl operation which returns the capacity of the pipe referred by fd. Differential Revision: https://reviews.freebsd.org/D30517 MFC after: 2 weeks (cherry picked from commit a06c12464bb49750c6b113c971e2770408ce422a) --- sys/compat/linux/linux_file.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index ff5f5da7fc33..a5ab3506767e 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -1523,6 +1525,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_args *args) { struct l_flock linux_flock; struct flock bsd_flock; + struct pipe *fpipe; struct file *fp; long arg; int error, result; @@ -1654,6 +1657,21 @@ fcntl_common(struct thread *td, struct linux_fcntl_args *args) case LINUX_F_ADD_SEALS: return (kern_fcntl(td, args->fd, F_ADD_SEALS, linux_to_bsd_bits(args->arg, seal_bitmap, 0))); + + case LINUX_F_GETPIPE_SZ: + error = fget(td, args->fd, + &cap_fcntl_rights, &fp); + if (error != 0) + return (error); + if (fp->f_type != DTYPE_PIPE) { + fdrop(fp, td); + return (EINVAL); + } + fpipe = fp->f_data; + td->td_retval[0] = fpipe->pipe_buffer.size; + fdrop(fp, td); + return (0); + default: linux_msg(td, "unsupported fcntl cmd %d", args->cmd); return (EINVAL);