os/ossrv/genericopenlibs/openenvcore/include/ftw.dosc
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /** @file  ../include/ftw.h
     2 @internalComponent
     3 */
     4 
     5 /** @fn  ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int nfds)
     6 @param path
     7 @param fn
     8 @param nfds
     9 @return   If the tree is exhausted, ftw() shall return 0.
    10 If the function pointed to by fn returns a non-zero value, ftw() shall stop its tree traversal and 
    11 return whatever value was returned by the function pointed to by fn. 
    12 If ftw() detects an error, it shall return -1 and set errno to indicate the error.
    13 
    14 The ftw() function shall recursively descend the directory hierarchy rooted in path.
    15 For each object in the hierarchy, ftw() shall call the function pointed to by fn,
    16 passing it a pointer to a null-terminated character string containing the name of the object,
    17 a pointer to a stat structure containing information about the object, and an integer.Possible values of the integer are:
    18 FTW_D
    19     For a directory.
    20 FTW_DNR
    21     For a directory that cannot be read.
    22 FTW_F
    23     For a file.
    24 FTW_SL
    25     For a symbolic link (but see also FTW_NS below).
    26 FTW_NS
    27     For an object other than a symbolic link on which stat() could not successfully be executed.
    28     If the object is a symbolic link and stat() failed,
    29     it is unspecified whether ftw() passes FTW_SL or FTW_NS to the user-supplied function. 
    30     
    31 The argument nfds should be in the range [1, {OPEN_MAX}].
    32 
    33 Errors:
    34 [EACCES]
    35     Search permission is denied for any component of path or read permission is denied for path.
    36 [ELOOP]
    37     A loop exists in symbolic links encountered during resolution of the path argument.
    38 [ENAMETOOLONG]
    39     The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
    40 [ENOENT]
    41     A component of path does not name an existing file or path is an empty string.
    42 [ENOTDIR]
    43     A component of path is not a directory.
    44 [EOVERFLOW]
    45     A field in the stat structure cannot be represented correctly in the current programming environment
    46     for one or more files found in the file hierarchy. 
    47     
    48 Examples:
    49 @code
    50 /*  Detailed description:  Sample usage of ftw system call
    51  *  Preconditions:  Function fn with the specified prototype should be defined and
    52  *  should have atleast two objects in the current working directory. 
    53  */
    54 #include <ftw.h>
    55 #include <stdlib.h>
    56 #include <stdio.h>
    57 
    58 if (ftw(".", fn, 2) != 0) {
    59     perror("ftw"); exit(2);
    60 }
    61 else
    62 {
    63 	printf("ftw call succeded");
    64 }
    65 
    66 @endcode
    67  Output
    68 @code
    69 ftw call succeded
    70 
    71 @endcode
    72 @see stat()
    73 
    74 
    75 @capability Deferred @ref RFs::Entry(const TDesC16&, TEntry&)
    76 
    77 @publishedAll
    78 @externallyDefinedApi
    79 */
    80 
    81 /** @fn  ftw64(const char *path, int (*fn)(const char *, const struct stat64 *, int), int nfds)
    82 @param path
    83 @param fn
    84 @param nfds
    85 @return   If the tree is exhausted, ftw64() shall return 0.
    86 If the function pointed to by fn returns a non-zero value, ftw64() shall stop its tree traversal and 
    87 return whatever value was returned by the function pointed to by fn. 
    88 If ftw64() detects an error, it shall return -1 and set errno to indicate the error.
    89 
    90 For full documentation see: http://www.unix.org/version2/whatsnew/lfs20mar.html#3.0
    91 
    92 @see ftw()
    93 
    94 @publishedAll
    95 @externallyDefinedApi
    96 */
    97 
    98 /** @def FTW_F
    99 
   100 Regular File. Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   101 
   102 @publishedAll
   103 @externallyDefinedApi
   104 */
   105 
   106 /** @def FTW_D
   107 
   108 Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   109 Directory.
   110 
   111 @publishedAll
   112 @externallyDefinedApi
   113 */
   114 
   115 /** @def FTW_DNR
   116 
   117 Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   118 Directory without read permission.
   119 
   120 @publishedAll
   121 @externallyDefinedApi
   122 */
   123 
   124 /** @def FTW_DP
   125 
   126 Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   127 Directory with subdirectories visited. A file on which stat could not successfully be
   128 executed.
   129 
   130 
   131 @publishedAll
   132 @externallyDefinedApi
   133 */
   134 
   135 /** @def FTW_NS
   136 
   137 Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   138 A file on which stat could not successfully be executed.
   139 
   140 
   141 @publishedAll
   142 @externallyDefinedApi
   143 */
   144 
   145 /** @def FTW_SL
   146 
   147 Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   148 Symbolic link.
   149 
   150 @publishedAll
   151 @externallyDefinedApi
   152 */
   153 
   154 /** @def FTW_SLN
   155 
   156 Valid flags for the 3rd argument to the function that is passed as the second argument to ftw(3) and nftw(3).
   157 Sym link that names a nonexistent file. 
   158 
   159 @publishedAll
   160 @externallyDefinedApi
   161 */
   162 
   163 /** @def FTW_PHYS	
   164 
   165 Flags for use as the 4th argument to nftw(3).  These may be ORed together.
   166 Physical walk, don't follow sym links.
   167 		
   168 @publishedAll
   169 @released
   170 */
   171 
   172 /** @def FTW_MOUNT			
   173 
   174 Flags for use as the 4th argument to nftw(3).  These may be ORed together.
   175 The walk does not cross a mount point.
   176 
   177 @publishedAll
   178 @released
   179 */
   180 
   181 /** @def FTW_DEPTH			
   182 
   183 Flags for use as the 4th argument to nftw(3).  These may be ORed together.
   184 Subdirs visited before the dir itself. 
   185 
   186 @publishedAll
   187 @released
   188 */
   189 
   190 /** @def FTW_CHDIR			
   191 
   192 Flags for use as the 4th argument to nftw(3).  These may be ORed together.
   193 Change to a directory before reading it.
   194 
   195 @publishedAll
   196 @released
   197 */
   198