[illumos-Developer] nftw(3c) question

Joerg Schilling Joerg.Schilling at fokus.fraunhofer.de
Fri Jan 14 02:18:10 PST 2011


Jason King <jason.brian.king at gmail.com> wrote:

> Having a need to use nftw(3c), I also needed a way to have it not
> descend certain directories.  Looking at the source, it appears if you
> set the quit field of the FTW struct passed into the callback to
> FTW_PRUNE, this accomplishes this.  For example:

> int
> walker(const char *path, const struct stat *sp, int flag, struct FTW *state)
> {
>       if (ignore_subtree(path)) {
>            state->quit = FTW_PRUNE;
>            return (0);
>       }

> This works, but it's completely undocumented.  However, looking at the
> source, it strongly suggests that the 'quit' field was intended to be
> used in that manner (and is not merely some internal state being used
> by the implementation).  Which if correct, just points to a
> documentation issue.  Can anyone perhaps offer any historical insight?

The related feature is not part of the standard and thus not granted to exist.

It may be that the Sun manpage handles the feature as a non-public extension 
that exists for the find(1) program only.

Jörg

-- 
 EMail:joerg at schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js at cs.tu-berlin.de                (uni)  
       joerg.schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily



More information about the Developer mailing list