[squeak-dev] Re: Strange Unix file behavior?

Tony Garnock-Jones tonyg at lshift.net
Thu Aug 7 14:26:03 UTC 2008


Paolo Bonzini wrote:
> They don't allow reading, but they do allow opening for reading.  The 
> resulting descriptor is meant to be used with openat() and other similar 
> system calls suffixed "at". openat() allows an application to avoid race 
> conditions that could occur when using open(2) to open files in 
> directories other than the current working directory. These race 
> conditions result from the fact that some component of the directory 
> prefix given to open() could be changed in parallel with the call to 
> open(). Such races can be avoided by opening a file descriptor for the 
> target directory, and then specifying that file descriptor as the dirfd 
> argument of openat().


Wow. I mean... wow. Well, I suppose fds are Unix's equivalent to object 
pointers, so it kind of makes sense. Still... wow.

(Looking at the openat manpage, I note it's linux-specific, and that a 
similar operation exists on Solaris.)

Tony



More information about the Squeak-dev mailing list