home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / posix / sys / stat / djbits.txh < prev    next >
Encoding:
Text File  |  1996-09-11  |  5.6 KB  |  169 lines

  1. @node _djstat_flags, stdio
  2. @subheading Syntax
  3.  
  4. @example
  5. #include <sys/stat.h>
  6.  
  7. extern unsigned short   _djstat_flags;
  8. @end example
  9.  
  10. This variable contains bits for some fields of struct stat which are
  11. expensive to compute under DOS.  Any such computation is only done by
  12. @ref{stat} or @ref{fstat} if the corresponding bit in
  13. @code{_djstat_flags} is @emph{cleared}.  By default, all the bits are
  14. cleared, so applications which don't care, automagically get a full
  15. version, possibly at a price of performance.  To get the fastest
  16. possible @code{f?stat()} for your application, clear only the bits
  17. which you need and set all the others.
  18.  
  19. The following bits are currently defined:
  20.  
  21. @table @code
  22.  
  23. @item _STAT_INODE
  24.  
  25. Causes @code{f?stat()} to compute the @code{st_ino} (inode number) field.
  26.  
  27. @item _STAT_EXEC_EXT
  28.  
  29. Tells @code{f?stat()} to compute the execute access bit from extension.
  30.  
  31. @item _STAT_EXEC_MAGIC
  32.  
  33. Tells @code{f?stat()} to compute the execute access bit from magic
  34. signature (the first two bytes of the file, see @ref{_is_executable}.
  35. Note that if _STAT_EXEC_MAGIC is set, but _STAT_EXEC_EXT is not, some
  36. files which shouldn't be flagged as executables (e.g., COFF *.o object
  37. files) will have their execute bit set, because they have the magic
  38. number signature at their beginning.  Therefore, only use the above
  39. combination if you want to debug the list of extensions provided in
  40. is_exec.c file.
  41.  
  42. @item _STAT_DIRSIZE
  43.  
  44. Causes @code{stat} to compute directory size by counting the number of its
  45. entries (unless some friendly network redirector brought a true directory
  46. size with it).  Also computes the number of subdirectories and sets the
  47. number of links @code{st_nlink} field.
  48.  
  49. @item _STAT_ROOT_TIME
  50.  
  51. Causes @code{stat()} to try to get time stamp of root directory from its
  52. volume label entry, if there is one.
  53.  
  54. @item _STAT_WRITEBIT
  55.  
  56. Tells @code{fstat()} that file's write access bit is required (this could
  57. be a problem only under some versions of Novell Netware).
  58.  
  59. @end table
  60.  
  61. Note that if you set a bit, some failure bits in @ref{_djstat_fail_bits}
  62. might not be set, because some computations which report failures are only
  63. done when they are required.
  64.  
  65. @node _djstat_fail_bits, stdio
  66. @subheading Syntax
  67.  
  68. @example
  69. #include <sys/stat.h>
  70.  
  71. extern unsigned short   _djstat_fail_bits;
  72. @end example
  73.  
  74. As proper operation of @ref{stat} and @ref{fstat} depend on
  75. undocumented DOS features, they could fail in some incompatible
  76. environment or a future DOS version.  If they do, the
  77. @code{_djstat_fail_bits} variable will have some of its bits set.
  78. Each bit describes a single feature which was used and failed.  The
  79. function @ref{_djstat_describe_lossage} may be called to print a
  80. human-readable description of the bits which were set by the last call
  81. to @code{f?stat()}.  This should make debugging @code{f?stat()}
  82. failures in an unanticipated environment a lot easier.
  83.  
  84. The following bits are currently defined:
  85.  
  86. @table @code
  87.  
  88. @item _STFAIL_SDA
  89.  
  90. Indicates that Get SDA call failed.
  91.  
  92. @item _STFAIL_OSVER
  93.  
  94. Indicates an unsupported DOS version (less than 3.10 for @code{stat()} or
  95. less than 2.0 for @code{fstat()}).
  96.  
  97. @item _STFAIL_BADSDA
  98.  
  99. The pointer to SDA was found to be bogus.
  100.  
  101. @item _STFAIL_TRUENAME
  102.  
  103. Indicates that @ref{_truename} function call failed.
  104.  
  105. @item _STFAIL_HASH
  106.  
  107. Indicates that the starting cluster of the file is unavailable, and inode
  108. number was computed by hashing its name.
  109.  
  110. @item _STFAIL_LABEL
  111.  
  112. The application requested the time stamp of a root dir, but no volume
  113. label was found.
  114.  
  115. @item _STFAIL_DCOUNT
  116.  
  117. The number of SDA reported is ridiculously large (probbaly an unsupported
  118. DOS clone).
  119.  
  120. @item _STFAIL_WRITEBIT
  121.  
  122. @code{fstat()} was asked to get write access bit of a file, but couldn't.
  123.  
  124. @item _STFAIL_DEVNO
  125.  
  126. @code{fstat()} failed to get device number.
  127.  
  128. @item _STFAIL_BADSFT
  129.  
  130. An SFT entry for this file was found by @code{fstat()}, but its contents
  131. can't be trusted because it didn't match file size and time stamp as
  132. reported by DOS.
  133.  
  134. @item _STFAIL_SFTIDX
  135.  
  136. The SFT index in Job File Table in program's PSP is negative.
  137.  
  138. @item _STFAIL_SFTNF
  139.  
  140. The file entry was not found in the SFT array.
  141.  
  142. @end table
  143.  
  144. Below are some explanations of terminology and abbreviations used by the
  145. printed messages, which will further clarify the meaning of the above bits
  146. and their descriptions printed by @ref{_djstat_describe_lossage}.
  147.  
  148.   SDA (Swappable Data Area) -- this is an internal DOS structure.
  149. @code{stat()} uses it to get the full directory entry (including the
  150. starting cluster number) of a file.  The pointer to SDA found by
  151. @code{stat()} is trusted only if we find the pathname of our file at a
  152. specific offset in that SDA.
  153.  
  154.   SFT (System File Table) -- another internal DOS structure, used in file
  155. operations.  @code{fstat()} uses it to get full information on a file
  156. given its handle.  An SFT entry which is found by @code{fstat()} is only
  157. trusted if it contains files size and time stamp like those returned by
  158. DOS functions 57h and 42h.  Novell NetWare 3.x traps DOS file operations
  159. in such a way they never get to SFT, so some failure messages refer
  160. specifically to Novell.
  161.  
  162.   Hashing -- the fall-back method of returning a unique inode number for
  163. each file.  It is used whenever the starting cluster of a file couldn't be
  164. reliably determined.  The full pathname of the file is looked up in a
  165. table of files seen earlier (hashing is used to speed the lookup
  166. process).  If found, the inode from the table is returned; this ensures
  167. that a given file will get the same inode number.  Otherwise a new inode
  168. number is invented, recorded in the table and returned to caller.
  169.