Date: Wed, 26 Jul 1995 00:06:04 +1000 From: Bruce Evans <bde@zeta.org.au> To: ache@astral.msk.su, terry@cs.weber.edu Cc: bde@zeta.org.au, hackers@freebsd.org, harry@hgac.com, jkh@violet.berkeley.edu Subject: Re: dial up at > 9600 baud Message-ID: <199507251406.AAA32521@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>> >>Does EAGAIN allowed on open by POSIX? >> >> >No. "... opening a terminal device file with the O_NONBLOCK flag clear >> >shall cause the process to block until the terminal device is ready and >> >available. The CLOCAL flag can also affect open()." [Opening terminal >> >device files with O_NONBLOCK set is supposed to always work if the file >> >permissions allow it. We probably break this by returning EBUSY for >> >some exclusive access and bidirectional cases.] >A non-blocking open of the regular device when the calling unit >device is in use is to return EWOULDBLOCK. Not allowed by POSIX (apart from EWOULDBLOCK not existing in POSIX), but better than EBUSY. >A blocking open is to block until the calling unit is not busy Except blocking opens of the calling unit should block unit the non-calling unit is not busy. We currently return EBUSY. >It seems the interpretation of POSIX above is being used incorrectly. >The flag in question is on the tty struct, *not* on the open. The >O_NONBLOCK flag on the open is in a different section of the standard. No. No. Yesbut. :-) The flag is on the open and lives in the file struct, *not* in the tty struct. The 2 sections of the standard say much the same thing. The section on open() says that for cdevs that "support nonblocking opens": (1) O_NONBLOCK shall cause permissible opens to succeed immediately. (2) !O_NONBLOCK shall cause permissible opens to block. The section on opening "Terminal Devices Files" says (2). Apparently "Terminal Device Files" "support nonblocking opens" (although I don't know where if anywhere that is specified explicitly) so (1) should apply too. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199507251406.AAA32521>