From nobody Mon Feb 16 15:26:07 2026 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 4fF6740rvLz6RvyH for ; Mon, 16 Feb 2026 15:26:08 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fF6740LYtz4KmN for ; Mon, 16 Feb 2026 15:26:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771255568; 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=V6OrNEAFuaUPPamvg7D7G4z7pncr4Ze5xk+WeJyaS7Y=; b=gbMUUtXjAPmlkw0sBgxpWqrlr+guU4TpjunI3Rcf/ZjUv1GiuA7A0GIMuR32iCOChE8YQZ HOvNchPfQxIMQg1sucV39nLVI/B1QmiXgmMHyudrSfy/FtyAiX3lMvNpglKq45/M7Cp+Ml DOTbn0hDgTlQJ86ti1eMyf/xN8cDY01VEmXbbYM7kwNKBDkbqfuBdGxOc647RX7CtJqpef D0HtjayF1JEuX2FT6AyEft8+tkMAZkzfs1umEdfIesRdky7G7vGE+SH10majDd7c3OLycO INouimNCHU2+BNfF27nmbqjvoyCAHZuenpDZgEmJI7xEpmbczuDRv6UC5psTAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1771255568; a=rsa-sha256; cv=none; b=K0I5ezNiNdWYkL4gywdg27hOmF0s4C14ZFyoaxz3NJ3I+roTqD1M6Gd0h+Qr5PUXGbRkWM 9+dquNHYy6RoD6wtuJ3Q65rxMsmB9XYMvuJRL4fLumIkaux0SS+j1X3WNJQl8CzUF43bEm zALZ/B6nYhK4QJTXYhL4nrfKlfiQtDoLWHFs6BNrTKpPBNKA9uchU3Ibfe17chuC1lW7Fn YnU3g2d0GUVzduBhoQm5QZGHuoYOfkr0lu7Shoo0GZVd1AgNy9GszEuhzuyfWbwchji/bl JmRF36ZfKG/Gkpz8byZ/4RFXqvdzJM9vg6rfGgQf6ni2oYlUIW9tu6iF0itfpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1771255568; 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=V6OrNEAFuaUPPamvg7D7G4z7pncr4Ze5xk+WeJyaS7Y=; b=LhpHq4jMy3+ly/OprIfRLRqkL+K0u3fCXaYmCudRzAMNUsMVikZC0y6v80kvBUyyroD4oE 4e3l4BVL/oMPz6IfG0p4BLatc/fpwC9QbVYTAsZMnGLDBJC1GgXgCb1yaIPB7dzO36raoK QRCd0/y7dWRh74j5d2w7xkKSHynUfnArqiDNFH7/eFsjEN/KN51yIhqV58MBLVuaN6XskC A51wUjX0allb4kCTv6rUQRKXhsvVpWhlr8n3ZsmAuznDbu/uMpC76MlaMV3XefhybyTrri /KVjWYJuYsITesMfgETeWM1YaKdgnT5osKKV6Bi+/Yxklz7xCMged9jR00/vQw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fF6736pKVzDCh for ; Mon, 16 Feb 2026 15:26:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1e17e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 16 Feb 2026 15:26:07 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 5bcccc702b29 - main - open.2: stop making impression that fd must be directory 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bcccc702b29a0e173a5916b001771dd7b280c7c Auto-Submitted: auto-generated Date: Mon, 16 Feb 2026 15:26:07 +0000 Message-Id: <6993370f.1e17e.70f9c4ac@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5bcccc702b29a0e173a5916b001771dd7b280c7c commit 5bcccc702b29a0e173a5916b001771dd7b280c7c Author: Konstantin Belousov AuthorDate: 2026-02-16 07:28:22 +0000 Commit: Konstantin Belousov CommitDate: 2026-02-16 13:59:43 +0000 open.2: stop making impression that fd must be directory Reviewed by: des, rmacklem Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D55302 --- lib/libsys/open.2 | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/libsys/open.2 b/lib/libsys/open.2 index a0e905a8f375..b4463180e4bc 100644 --- a/lib/libsys/open.2 +++ b/lib/libsys/open.2 @@ -72,11 +72,18 @@ function is equivalent to the .Fn open function except in the case where the .Fa path -specifies a relative path. +specifies a relative path or the +.Va O_EMPTY_PATH +flag is specified. For .Fn openat and relative .Fa path , +when +.Fa fd +references directory and without the +.Va O_EMPTY_PATH +flag, the file to be opened is determined relative to the directory associated with the file descriptor .Fa fd @@ -104,6 +111,14 @@ it ignores the .Fa fd argument. .Pp +When +.Fn openat +is called with the +.Fa fd +argument that does not reference a directory, the call fails unless +.Va O_EMPTY_PATH +flag is specified, see below. +.Pp In .Xr capsicum 4 capability mode, @@ -421,9 +436,11 @@ by the descriptor at the time of the call. .Pp .Dv O_PATH -returns a file descriptor that can be used as a directory file descriptor for +returns a file descriptor that can be used as the first argument for .Fn openat -and other system calls taking a file descriptor argument, like +and other filesystem-related system calls collectively named +.Fn *at +taking a file descriptor argument, like .Xr fstatat 2 and others. The other functionality of the returned file descriptor is limited to