Path: utzoo!mnetor!uunet!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.sys.hp Subject: Re: FIONREAD under HP/UX ioctl Message-ID: <16710002@hpisod2.HP.COM> Date: 18 Dec 87 01:19:57 GMT References: <839@louie.udel.EDU> Organization: Hewlett Packard, Cupertino Lines: 32 > Trying to convert this code we have is really starting to look pretty > dismal. We seem to have fixed up the AF_UNIX problem with sockets, but > are now stuck on several ioctl calls. We need to make a call similar to > the BSD FIONREAD which returns the number of characters in the input > buffer of the given file descriptor. Unfortunately, according to the > HP/UX docs (in parenthesized fine print at the end of the termio > section, I might add) this call is not available. Would anyone know of > a work-around for this or is it time to punt? > > Joel J. Garrett FIONREAD is supported in HP-UX on the Series 800. I assume from your comment that you are using a Series 300. In this case, you may be able to accomplish your purpose using the O_NDELAY flag, which is described on open(2) and read(2). A read() call on a tty file descriptor with O_NDELAY set will not block if no data is available; it will simply return 0 bytes. If there is any data available, the read call will read and return as many bytes as are present or were requested, whichever is less. Depending on what the purpose of the ioctl() call you are porting was, this may be undesirable, tolerable, appropriate, or even desirable. See also select(2). Dave Decot Hewlett-Packard Company hpda!decot