From owner-freebsd-questions@freebsd.org Wed Jun 16 00:09:02 2021 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E43C165716B for ; Wed, 16 Jun 2021 00:09:02 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: from outgoing.tristatelogic.com (segfault.tristatelogic.com [69.62.255.118]) by mx1.freebsd.org (Postfix) with ESMTP id 4G4QXG28rYz3sNm for ; Wed, 16 Jun 2021 00:09:02 +0000 (UTC) (envelope-from rfg@tristatelogic.com) Received: by segfault.tristatelogic.com (Postfix, from userid 1237) id 786C34E657; Tue, 15 Jun 2021 17:09:01 -0700 (PDT) From: "Ronald F. Guilmette" To: freeBSD Mailing List Subject: Re: Is a successful call to write(2) atomic? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26257.1623802141.1@segfault.tristatelogic.com> Content-Transfer-Encoding: quoted-printable Date: Tue, 15 Jun 2021 17:09:01 -0700 Message-ID: <26258.1623802141@segfault.tristatelogic.com> X-Rspamd-Queue-Id: 4G4QXG28rYz3sNm X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of rfg@tristatelogic.com designates 69.62.255.118 as permitted sender) smtp.mailfrom=rfg@tristatelogic.com X-Spamd-Result: default: False [-0.33 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[69.62.255.118:from]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[tristatelogic.com]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[69.62.255.118:from:127.0.2.255]; TO_DN_ALL(0.00)[]; NEURAL_SPAM_SHORT(0.96)[0.965]; RCVD_COUNT_ZERO(0.00)[0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:14051, ipnet:69.62.128.0/17, country:US]; SUBJECT_ENDS_QUESTION(1.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jun 2021 00:09:03 -0000 In message Paul Procacci wrote: >It now reads: > >This volume of POSIX.1-2017 does not specify the behavior of concurrent >writes to a regular file from multiple threads, except that each write is >atomic (see *Thread Interactions with Regular File Operations* >). >Applications should use some form of concurrency control. > >In both cases, it states: "Applications should use some form of >concurrency control". Sigh. The above (revised) verbage isn't my personal idea of unambiguous clarity. I mean it isn't even clear what -they- mean by "atomic" in this context. They may intend it to mean exactly what I have been using it to mean here, but if I have learned anything about Posix, it is that their documents are sometimes subtle in their use of terminology. (I sustained some serious verbal abuse on one Posix mailing list some months ago for my failure to fully appreciate this.) More to the point, if indeed each call to write() *is* "atomic"... at leas= t in the sense that the given buffer will be treated like an indivisable who= le, all of the way along its journey to some physical device... then why are users nontheless being encouraged, still, to "use some form of concurrency control"? I mean what would be the point of that if in fact write() never busts up the hunks of data given to it into separate sub-hunks? Sounds to me like they are saying "Here, we are giving you this belt, but we advise you to wear your suspenders also, just in case." This seems goofy on the face of it. Regards, rfg P.s. Thanks Paul, for researching the relevant Posix pronouncements.