From owner-freebsd-questions@freebsd.org Wed Jun 16 22:17:15 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 5C471645CEC for ; Wed, 16 Jun 2021 22:17:15 +0000 (UTC) (envelope-from bc979@lafn.org) Received: from mail.sermon-archive.info (sermon-archive.info [47.181.130.121]) by mx1.freebsd.org (Postfix) with ESMTP id 4G500p2Qmdz4SQv for ; Wed, 16 Jun 2021 22:17:13 +0000 (UTC) (envelope-from bc979@lafn.org) Received: from smtpclient.apple (mini [10.0.1.251]) by mail.sermon-archive.info (Postfix) with ESMTPSA id 4G500g3s32z2fjQ4 for ; Wed, 16 Jun 2021 15:17:07 -0700 (PDT) From: Doug Hardie Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: Is a successful call to write(2) atomic? Date: Wed, 16 Jun 2021 15:17:07 -0700 References: <26258.1623802141@segfault.tristatelogic.com> <7801a6e8-2428-619e-5722-7317841595a1@qeng-ho.org> To: freeBSD Mailing List In-Reply-To: <7801a6e8-2428-619e-5722-7317841595a1@qeng-ho.org> Message-Id: <331B1E28-0643-4F85-8682-C2C04235C6BF@sermon-archive.info> X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Virus-Scanned: clamav-milter 0.103.1 at mail X-Virus-Status: Clean X-Rspamd-Queue-Id: 4G500p2Qmdz4SQv X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of bc979@lafn.org designates 47.181.130.121 as permitted sender) smtp.mailfrom=bc979@lafn.org X-Spamd-Result: default: False [2.30 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_SPAM_SHORT(1.00)[0.999]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[47.181.130.121:from]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[lafn.org: no valid DMARC record]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[47.181.130.121:from:127.0.2.255]; TO_DN_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_ALLOW(-0.20)[+mx]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:5650, ipnet:47.181.128.0/18, country:US]; RCVD_COUNT_TWO(0.00)[2]; 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 22:17:15 -0000 My approach to this problem was to create a daemon that listened to a = named pipe. It then wrote the data to the file. This approach has the = advantage that the calling process is not waiting for the daemon to = complete. In my case, the data was retrieved form a database by the = daemon so that the calling process only had to send a unique id for the = specific record. However, I have also used this approach to send email = and the calling process had to send the email text as well as the header = info. The text messages were fairly short so didn't run into any size = limits on the pipe. -- Doug