Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/d/dircntl.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/d/dircntl.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/d/dircntl.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/d/dircntl.html on line 8

dircntl()

Control an open directory

Synopsis:

#include <dirent.h>

int dircntl( DIR * dir,
             int cmd,
             ... );

Arguments:

dir
Provide control for this directory.
cmd
At least the following values are defined in <dirent.h>:

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The dircntl() function provides control over the open directory referenced by the dir argument. This function behaves in a manner similar to the file control function, fcntl().

Flag values

D_FLAG_FILTER
Filter out duplicate name entries that may occur due to the union filesystem during a readdir() operation.
D_FLAG_STAT
Indicate to servers that they should attempt to return extra stat() information as part of the readdir() operation.

Returns:

The return value depends on the value of cmd:

D_GETFLAG
The flags associated with the directory, or -1 if an error occurs (errno is set).
D_SETFLAG
0 for success, or -1 if an error occurs (errno is set).

Examples:

#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>

int main(int argc, char **argv) {
    DIR *dp;
    int ret;

    if(!(dp = opendir("/"))) {
        exit(EXIT_FAILURE);
    }

    /* Display the flags that are set on the
       directory by default*/
    if((ret = dircntl(dp, D_GETFLAG)) == -1) {
        exit(EXIT_FAILURE);
    }

    if(ret & D_FLAG_FILTER) {
        printf("Directory names are filtered\n");
    } else {
        printf("Directory names are not filtered\n");
    }

    if(ret & D_FLAG_STAT) {
        printf("Servers asked for extra stat information\n");
    } else {
        printf("Servers not asked for extra stat information\n");
    }

    closedir(dp);

    return 0;
}

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

fcntl(), opendir()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/d/dircntl.html on line 208

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/d/dircntl.html on line 208