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
Control an open directory
#include <dirent.h>
int dircntl( DIR * dir,
int cmd,
... );
- dir
- Provide control for this directory.
- cmd
- At least the following values are defined in <dirent.h>:
- D_GETFLAG
— retrieve the flags associated with the directory referenced by dir.
For more information, see
“Flag values,”
below.
- D_SETFLAG
— set the flags associated with the directory referenced by
dir to the value given as an additional argument.
The new value can be any combination of the flags described in
“Flag values,”
below.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
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().
- 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.
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).
#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;
}
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
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