View Issue Details

IDProjectCategoryView StatusLast Update
00006761003.1(2013)/Issue7+TC1System Interfacespublic2019-06-10 08:55
Reporterphilip-guenther Assigned Toajosey  
PrioritynormalSeverityEditorialTypeClarification Requested
Status ClosedResolutionAccepted As Marked 
NamePhilip Guenther
OrganizationOpenBSD
User Reference
Sectionpread(), pwrite()
Page Number1754,2288
Line Number56422,72479
Interp Status---
Final Accepted TextSee 0000676:0001543.
Summary0000676: description of pread()/pwrite() on tty or socket inconsistent
DescriptionThe description of pread() says:
   An attempt to perform a pread() on a file that is incapable of
   seeking shall result in an error.

The ERRORS sections then says this:
  [ESPIPE] fildes is associated with a pipe or FIFO.

...but no error is given for using pread() on a socket or tty.

Testing indicates that Solaris 10 and FreeBSD 8.2 treat using pread() on a tty the same as doing a read() on it. For sockets, Solaris 10 treats pread() like read(), while FreeBSD fails with ESPIPE.

Linux 2.6.18 (RHEL 5.8) and OpenBSD 5.3 fail with ESPIPE for both ttys and sockets.

While the pwrite() DESCRIPTION doesn't make a statement about failing on unseekable file type, it does fail to describe ESPIPE as applying in the socket and tty cases. The four platforms tested (Solaris, FreeBSD, Linux, and OpenBSD) have the same behavior with pwrite() as they do with pread().
Desired ActionMy inclination is that given the description and the underlying reason for using pread(), it should be required to fail with ESPIPE for these, but I can understand a decision to make it a "may fail" instead. If the former, then change:
  [ESPIPE] fildes is associated with a pipe or FIFO.
to
  [ESPIPE] fildes is associated with a pipe, FIFO, socket, or tty.


Otherwise, if the "may fail" route is chosen, then change this:
   An attempt to perform a pread() on a file that is incapable of
   seeking shall result in an error.
to (something like) this:
   An attempt to perform a pread() on a pipe or FIFO shall result in
   an error; an attempt to perform a pread() on other types of files
   that are incapable of seeking may result in an error.

and add to ERRORS:

The pread() function may fail, and the file pointer shall remain unchanged, if:
  [ESPIPE] fildes is associated with a socket or tty.



And then, either way, the same changes should be made to the write()/pwrite() page.
Tagstc2-2008

Activities

geoffclare

2013-04-08 08:48

manager   bugnote:0001536

It appears that this largely duplicates bugs 0000215 and 0000218, which were applied in TC1.

philip-guenther

2013-04-08 16:23

reporter   bugnote:0001537

Yeah, the socket aspects were covered by those bugs; my apologies for the duplication. The tty aspects do still appear to apply, at least in my check of the preview of the 2013 HTML version (yay!) that was just posted.

Another tweak to make if the pread/pwrite of tty case is made a "shall fail" error: the [EIO] errors that are specific to a background process accessing its controlling terminal should be moved into the part of the ERRORS section which is specific to the read() or write() function.

Don Cragun

2013-04-21 00:23

manager   bugnote:0001543

Last edited: 2013-04-21 00:27

Change the ESPIPE error condition description for pread() on P1754, L56422 from:
    The file is a pipe, FIFO, or socket.

to:
    The file is incapable of seeking.


Make the same change to the ESPIPE error condition description for pwrite() on P2288, L72479.

Issue History

Date Modified Username Field Change
2013-04-08 04:57 philip-guenther New Issue
2013-04-08 04:57 philip-guenther Status New => Under Review
2013-04-08 04:57 philip-guenther Assigned To => ajosey
2013-04-08 04:57 philip-guenther Name => Philip Guenther
2013-04-08 04:57 philip-guenther Organization => OpenBSD
2013-04-08 04:57 philip-guenther Section => pread
2013-04-08 04:57 philip-guenther Page Number => 1739
2013-04-08 04:57 philip-guenther Line Number => 55479-55480,55525
2013-04-08 08:48 geoffclare Note Added: 0001536
2013-04-08 16:23 philip-guenther Note Added: 0001537
2013-04-18 16:00 Don Cragun Project 1003.1(2008)/Issue 7 => 1003.1(2013)/Issue7+TC1
2013-04-21 00:23 Don Cragun Page Number 1739 => 1754,2288
2013-04-21 00:23 Don Cragun Line Number 55479-55480,55525 => 56422,72479
2013-04-21 00:23 Don Cragun Interp Status => ---
2013-04-21 00:23 Don Cragun Note Added: 0001543
2013-04-21 00:27 Don Cragun Note Edited: 0001543
2013-04-21 00:27 Don Cragun Section pread => pread(), pwrite()
2013-04-25 15:51 Don Cragun Final Accepted Text => See 0000676:0001543.
2013-04-25 15:51 Don Cragun Status Under Review => Resolved
2013-04-25 15:51 Don Cragun Resolution Open => Accepted As Marked
2013-04-25 15:52 Don Cragun Tag Attached: tc2-2008
2019-06-10 08:55 agadmin Status Resolved => Closed