Path: utzoo!dptcdc!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!ka From: ka@june.cs.washington.edu (Kenneth Almquist) Newsgroups: comp.unix.wizards Subject: Re: getcwd() and friends. Summary: O_NDELAY means don't block *forever*. Message-ID: <7911@june.cs.washington.edu> Date: 18 Apr 89 23:51:49 GMT References: <7882@june.cs.washington.edu> <10671@bloom-beacon.MIT.EDU> Organization: U of Washington, Computer Science, Seattle Lines: 20 jfc@athena.mit.edu (John F Carr) writes: ] In article ] flee@shire.cs.psu.edu (Felix Lee) writes: ] ]> 2. The open may block. Kenneth Almquist suggests O_NDELAY, which is ]> fine. Another alternative is to say that O_TOKEN doesn't block; ]> blocking is only useful if you open for reading or writing. ] ] Suppose you are using NFS over a slow network? The directory lookups ] may take time, as will the actual open. The same problem exists with ] slow local media. You can't guarantee proper error reporting without ] blocking. The issue is not blocking temporarily while waiting for disk or network I/O to take place. The problem is that the open system call, rather than succeeding or reporting an error, can simply block forever. The O_NDELAY flag prevents this under both System V and BSD. If you run NFS (which is not part of either System V or BSD UNIX at this point), then the O_NDELAY flag won't help you. My suggestion: don't use NFS. Kenneth Almquist