Do we really need correct st_nlink count for directories?

Eric Blake ebb9@byu.net
Fri Apr 25 19:17:00 GMT 2008


According to Igor Peshansky on 4/25/2008 12:38 PM:
> 
> Would it make sense to use 0 as the link count on directories?  Unless I'm
> missing something, every directory has to have at least the '.' link,
> which makes 0 an obviously invalid value (that can be used to trigger the
> fallback code).

When link counts are accurate, every directory has a link count of at 
least 2 (. and ..) (in fact, the optimization is to abort the readdir() 
after discovering st_nlink-2 subdirs).  Therefore, a link count of 1 is 
sufficient to trigger the fallback code.

-- 
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net



More information about the Cygwin-developers mailing list