From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <315ec4b482e28037d3755647ba24145b@quintile.net> From: "Steve Simon" Date: Fri, 6 Jul 2007 22:58:33 +0100 To: 9fans@cse.psu.edu Subject: Re: [9fans] implementing 9p read In-Reply-To: <13426df10707060754j553a6a70v4d50633d3afe2917@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 928caf1a-ead2-11e9-9d60-3106f5b1d025 > > You cannot do this, the usual idiom is that if read returns less > > than the app expected this is treated as EOF. > > Oh not, that's not at all true. Any program that behaves this way is > broken. Unless I totally misunderstand your point. > Ok, You are probably right, its an assumption I have seen in code in the past, though not in plan9: while((n = fread(buf, 1, sizeof(buf), fp)) != sizeof(buf)) if(fwrite(buf, 1, n, out) != n) sysfatal("write failed"); I have always tried to code defensively around it when writing fileservers by returning full buffers, it seems I have been fleeing a mere spectre. -Steve