title: Do any POSIX functions or glibc extensions implement a breadth-first file tree walk?
body: <p>I am writing a daemon that utilizes inotify to monitor file access and it is critical that I don't miss anything on a recursive search. I found <a href="http://mail.gnome.org/archives/dashboard-hackers/2004-October/msg00022.html" rel="nofollow noreferrer">this interesting idea</a> and have begun to implement it.</p>
  
  <p>ftw() and ftw64() do not use a breadth-first algorithm, its more "pre-order". nftw() gives me the option of depth-first, but I'm worried about races in upper leaves.</p>
  
  <p>I'm hoping that I'm missing something, perhaps a GNU extension? Or am I just looking at implementing my own with type safe call backs (something I'd really rather not do) ?</p>
  
  <p>Or, is my understanding of the advantages of breadth-first over depth-first erroneous for this type of application?</p>