From mboxrd@z Thu Jan 1 00:00:00 1970 From: random832@fastmail.com (Random832) Date: Tue, 14 Feb 2017 10:48:13 -0500 Subject: [TUHS] Another odd comment in V6 In-Reply-To: <20170214141424.A5BC518C0A2@mercury.lcs.mit.edu> References: <20170214141424.A5BC518C0A2@mercury.lcs.mit.edu> Message-ID: <1487087293.1746007.880694176.29A6CC14@webmail.messagingengine.com> On Tue, Feb 14, 2017, at 09:14, Noel Chiappa wrote: > Without the proper design of the system call interface, this can be hard - how > does the system distinguish between the _first_ attempt at a system call (in > which the 'already done' count is 0), and a _later_ attempt? If the user passes > in the 'already done' count, it's pretty straightforward - otherwise, not so > much! You could return the address of the last character read, and let the user code do the math. I'm a bit confused though from a practical point of view where this comes up. If the terminal is in raw/cbreak mode, the user code must handle a "partial" read anyway, so returning five bytes is fine. If it's in canonical mode, the system call does not copy characters into the user buffer until they have pressed enter. Maybe there's some other case other than reading from a terminal that it makes sense for, but I couldn't think of any while writing this post.