From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: tuhs-bounces@minnie.tuhs.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 46216072 for ; Sun, 4 Nov 2018 22:07:03 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 70341A21F6; Mon, 5 Nov 2018 08:07:02 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 92008A21D9; Mon, 5 Nov 2018 08:06:44 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id E7E76A2201; Mon, 5 Nov 2018 07:34:22 +1000 (AEST) Received: from bird.maple.relay.mailchannels.net (bird.maple.relay.mailchannels.net [23.83.214.17]) by minnie.tuhs.org (Postfix) with ESMTPS id C21F1A2202; Mon, 5 Nov 2018 07:34:15 +1000 (AEST) X-Sender-Id: dreamhost|x-authsender|cmhanson@eschatologist.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D78521239D0; Sun, 4 Nov 2018 21:34:14 +0000 (UTC) Received: from pdx1-sub0-mail-a57.g.dreamhost.com (unknown [100.96.36.160]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 92D7E123BA2; Sun, 4 Nov 2018 21:34:14 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|cmhanson@eschatologist.net Received: from pdx1-sub0-mail-a57.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Sun, 04 Nov 2018 21:34:14 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|cmhanson@eschatologist.net X-MailChannels-Auth-Id: dreamhost X-Grain-Army: 44450c8e61070eb2_1541367254707_920038672 X-MC-Loop-Signature: 1541367254707:105596248 X-MC-Ingress-Time: 1541367254706 Received: from pdx1-sub0-mail-a57.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a57.g.dreamhost.com (Postfix) with ESMTP id 4E746802C3; Sun, 4 Nov 2018 13:34:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=eschatologist.net; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s= eschatologist.net; bh=IarsfY/zXDr8udKfxNfpDLySu4A=; b=XFal0MI5z9 imL8i3EgBHnTQeDXTgBi2tso1fqo8tBr3WPQz9mRd5Lc81EdNXFK9xh0p/IDu02B o1VLtOZZgFc6cDX1WkxMpCUrQWNaYH2ur6cj/skC8lgTQMcOpnAvgidSZs6QMJuV tIzm57QMMu+O+Iojb1Z8B/d8aHknG1qaA= Received: from [10.0.1.13] (c-73-202-69-90.hsd1.ca.comcast.net [73.202.69.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: cmhanson@eschatologist.net) by pdx1-sub0-mail-a57.g.dreamhost.com (Postfix) with ESMTPSA id 7CAA98028F; Sun, 4 Nov 2018 13:34:13 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) X-DH-BACKEND: pdx1-sub0-mail-a57 From: Chris Hanson X-Mailer: iPad Mail (16B92) In-Reply-To: <201811041228.wA4CSMIA017639@freefriends.org> Date: Sun, 4 Nov 2018 13:34:10 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20181031043810.GA10775@minnie.tuhs.org> <7B5918F3-A65F-45FC-805A-07FE3FCE9253@eschatologist.net> <201811041228.wA4CSMIA017639@freefriends.org> To: arnold@skeeve.com X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrjeefgdduheefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpegtggfuhffojgffgffkfhfvsehtqhhmtdhhtdejnecuhfhrohhmpeevhhhrihhsucfjrghnshhonhcuoegtmhhhrghnshhonhesvghstghhrghtohhlohhgihhsthdrnhgvtheqnecukfhppeejfedrvddtvddrieelrdeltdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghloheplgdutddrtddruddrudefngdpihhnvghtpeejfedrvddtvddrieelrdeltddprhgvthhurhhnqdhprghthhepvehhrhhishcujfgrnhhsohhnuceotghmhhgrnhhsohhnsegvshgthhgrthholhhoghhishhtrdhnvghtqedpmhgrihhlfhhrohhmpegtmhhhrghnshhonhesvghstghhrghtohhlohhgihhsthdrnhgvthdpnhhrtghpthhtohepfihkthesthhuhhhsrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd Subject: Re: [TUHS] Unix APIs: elegant or not? X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tuhs@tuhs.org Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Nov 4, 2018, at 4:28 AM, arnold@skeeve.com wrote: >=20 > Chris Hanson wrote: >=20 >> If anyone ever asks me about the elegance of UNIX, there=E2=80=99s one wo= rd, or really term, that springs to mind: EINTR. >>=20 >> The fact that man pages on modern systems still describe calls as returni= ng -1 with errno set to EINTR baffles me. >=20 > Can you explain this some more? This sounds like a claim that UNIX > isn't elegant. But I'm not following whatever it is you're saying. Every piece of code that wants to call, say, read(2) needs to handle not onl= y real errors but also needs to special-case EINTR and retry the read. Thus y= ou should virtually never use read(2), only ever something like this: ssize_t safe_read(int fd, void *buf, size_t buf_size) { ssize_t rc; do { rc =3D read(fd, buf, buf_size); } while ((rc =3D=3D -1) && (errno =3D=3D EINTR)); return rc; } And do this for every classic system call, since virtually no client code sh= ould ever have to care about EINTR. It was early an implementation expedienc= y that became API and that everyone now has to just deal with because you ca= n=E2=80=99t expect the system call interface you use to do this for you. This is the sort of wart that should=E2=80=99ve been fixed by System V and/o= r BSD 4 at latest. =E2=80=94 Chris