Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!apple!vsi1!wyse!mips!synthesis!len From: len@synthesis.Synthesis.COM (Len Lattanzi) Newsgroups: comp.unix.wizards Subject: Re: Write calls which do partial writes Keywords: write select poll SIGIO connect Message-ID: <18735@mips.mips.COM> Date: 3 May 89 19:00:27 GMT References: <103@matrix.UUCP> <10198@smoke.BRL.MIL> Sender: news@mips.COM Reply-To: len@synthesis.synthesis.com (Len Lattanzi) Organization: Synthesis Software Solutions Inc, Sunnyvale, CA Lines: 24 In article <10198@smoke.BRL.MIL> gwyn@brl.arpa (Doug Gwyn) writes: :In article <103@matrix.UUCP> neeraj@matrix.UUCP (neeraj sangal) writes: :> n = write(fd, buf, len); :> 1. Can n be less than len if fd is NOT set to non-blocking? : :Certainly; if only some but not all bytes were transferred, :for example due to the system call being interrupted by a signal, :then the best thing for write() to report is the number of bytes :successfully transferred. (I forget whether IEEE 1003.1 ended up :permitting this or not; it was hotly debated.) Robust stdio :implementations have to loop on the write() call until all bytes :are transferred or an error occurs. Does anyone know for sure about IEEE 1003.1? A (-1,EINTR) return from write is worthless if some bytes were written. And you'll have to depend on your signal handler to not smash errno. Do any of these OS/C library standards define useful schemes for handling system call error returns in a multi-threaded process besides every signal handler doing a save and restore of errno? -Len Len Lattanzi (len@Synthesis.com) <{ames,pyramid,decwrl}!mips!synthesis!len> Synthesis Software Solutions, Inc. The RISC Software Company I would have put a disclaimer here but I already posted the article.