From nobody Fri Mar 07 05:24:12 2025 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 4Z8F8F19QbzsyXP; Fri, 07 Mar 2025 05:24:13 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z8F8D4Y73z3lyM; Fri, 07 Mar 2025 05:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1741325052; 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=q8QyexcbUGjfO+fK5M6O6xyGv2dgAmkZBzjttk240no=; b=PSIJSojUEP0hXrPfjibt8V+P6KOKCvJnglHg+4xxxfnyc1x3NTnJVO/bPom8w87m+1/pqM rFFtyoR/dO8mww8M64TErVjoB0xxZliTVnxjE/+PHCNjVocwhpl9GwEkrBpht6oW37dNYW +M5mRyPHpLXB/cTurS4sEttXcJJ1f1AUDMwfLWm/bjEo+gxjiu1ZbQBTw02al4d99QPWxS eI6MJZeIyv+MnT1rdK61rrcXvyOmjbsd3Mb1zGaO17aj8n/cHoLcj2I+wJaCndbJtlwE3I HMFHWrhrYbGeMjJE4qdz7GjZnPtEAmFFb0vC2qnF1zCBkpMhIIiyMkCZYIePIw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1741325052; a=rsa-sha256; cv=none; b=Vqy1Ee9p58aM+LvLQj8B9ZI1dw7xufAuVCRdSfQLIP0pAemBv6PX7/qeqezlPg3mtb3tNT M+8RsGbaqvXOYRTdbROhXTnasB637vywXGOPGaTU0bFYozi0jvyFwxli/mfmdlDG8juoSJ ReaQM8TTplWy30TSeSAhU/T8mEGsSdwNraQSmfrUeYG39wlIKGo4i6RqDRw3EPknEv86DE sRXTBOBoPZKuKFW3mO1Lft4Qkes3tFzSfdR8XLScBGzZlc6blJ5Az6iAiMrGnCrvEIwUIT WeUNvfvWTWGJh8Du4I/lbGy7Cu4hpReI1EtLvb5ay+l+ak0R3FKL/tenb7UKrQ== 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=1741325052; 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=q8QyexcbUGjfO+fK5M6O6xyGv2dgAmkZBzjttk240no=; b=NduZ7S+uNb+ulRGjnnQ5CBJ+untqE4u+wNpFEWvS4f/PWSpFjlxwi4cGuqv7cjOufU8N5/ vuiPO7wykOhl0G8HCTBRVV2zwsRaxzt246sDmW2jwR+ygFcB+iy2pEGxGUS4IJ+6lxO2z4 vLOw7XVeFqiVF/oMCRVGKMS/Ulp4WUdo69vaDjPdadSOD8YcZPkVMumy9pGlTtKSt5CyX7 ZWyfd1pPjHJmb6bkMul8Klu7XnOWmzSxU29mizlrqjGGtYAw1FcWBjTazV33ROo5NVvkWU ZtwiYazx7ICWGEA/TnUQ6foqu94i5b0WJyy0P4Ryw2HKoWhi5MvyJ3Mgi++eXg== 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 4Z8F8D474wz7vq; Fri, 07 Mar 2025 05:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5275OCGD079851; Fri, 7 Mar 2025 05:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5275OC4R079848; Fri, 7 Mar 2025 05:24:12 GMT (envelope-from git) Date: Fri, 7 Mar 2025 05:24:12 GMT Message-Id: <202503070524.5275OC4R079848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3416ed9d077f - stable/14 - open.2: add separate paragraph for O_CREAT 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 3416ed9d077f75b314eb98a2cb1d6fd8273cce13 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3416ed9d077f75b314eb98a2cb1d6fd8273cce13 commit 3416ed9d077f75b314eb98a2cb1d6fd8273cce13 Author: artembunichev AuthorDate: 2025-02-27 14:21:20 +0000 Commit: Konstantin Belousov CommitDate: 2025-03-07 05:23:08 +0000 open.2: add separate paragraph for O_CREAT PR: 284353 (cherry picked from commit 8cebb0630046a8eb10c551a856397ed230e73833) --- lib/libc/sys/open.2 | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index ea4bc9160da1..e29abbb70342 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -231,16 +231,36 @@ is specified and the file exists, the file is truncated to zero length. .Pp If -.Dv O_EXCL -is set with .Dv O_CREAT -and the file already -exists, +is set, but file already exists, +this flag has no effect except when +.Dv O_EXCL +is set too, in this case .Fn open fails with .Er EEXIST . This may be used to implement a simple exclusive access locking mechanism. +In all other cases, the file is created +and the access permission bits (see +.Xr chmod 2) +of the file mode +are set to the value of the third argument taken as +.Fa "mode_t mode" +and passed through the +.Xr umask 2 . +This argument does not affect whether the file is opened +for reading, writing, or for both. +The open' request for a lock on the file, created with +.Dv O_CREAT , +will never fail +(provided that the underlying file system supports locking; +see also +.Dv O_SHLOCK +and +.Dv O_EXLOCK +below). +.Pp If .Dv O_EXCL is set and the last component of the pathname is @@ -289,10 +309,6 @@ semantics can be obtained by setting for a shared lock, or .Dv O_EXLOCK for an exclusive lock. -If creating a file with -.Dv O_CREAT , -the request for the lock will never fail -(provided that the underlying file system supports locking). .Pp .Dv O_DIRECT may be used to minimize or eliminate the cache effects of reading and writing.