eik@os.is (Einar Kjartansson) (12/11/88)
================================ I have an application which consists of a filter ( stdin and stdout are pipes ) that buffers the data, that is it fill a buffer from input when intput data is available and writes from the buffer when the output is available. The HP-UX "Real Time Programming Manual" discusses three ways this could be done. A use of fstat O_NDELAY to do nonblocking io. B use of ioctl FIOSNBIO -- --- -- -- -- -- C use of select system call to wait until either stderr or stdout is ready. The first is a system V feature, and appearas to work as advertised, the other two are BSD featureks and do not work for output to pipes. ( select always returns true for pipe output on unit 1 and setting FIONSBIO make no difference for pipe output) Use of A or B implies polling, which requires some method for sleeping a few tens of milliseconds. The simplest and apparently the only reliable method uses the select call with timeout. The problem with method A is there is no way to tell, without blocking, when end of file is reached on the input. Does anyone know wether HP intends to fix this or correct the manuals ? Or is there a way to get FISNBIO and select to work without blocing for pipe output ? It is a huge waste to time to have to test every single feature before using it (none of the documentation can be trusted ). -- Einar Kjartansson | eik@os.is Orkustofnun (National Energy Authority) | eik@geysir.uucp Grensasvegi 9, IS-108 Reykjavik, Iceland | mcvax!hafro!geysir!eik Phone: 354-1-83600 Fax: 354-1-688896 Home: 354-1-16407