www.delorie.com/djgpp/doc/libc/libc_151.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]



#include <sys/stat.h>

extern unsigned short   _djstat_flags;

This variable contains bits for some fields of struct stat which are expensive to compute under DOS. Any such computation is only done by stat (see section stat) or fstat (see section fstat) if the corresponding bit in _djstat_flags is cleared. By default, all the bits are cleared, so applications which don't care, automagically get a full version, possibly at a price of performance. To get the fastest possible version for your application, clear only the bits which you need and set all the others.

The following bits are currently defined:


Causes stat and fstat to compute the st_ino (inode number) field.


Tells stat and fstat to compute the execute access bit from the file-name extension. stat and fstat know about many popular file-name extensions, to speed up the computation of the execute access bit.


Tells stat and fstat to compute the execute access bit from magic signature (the first two bytes of the file). Use _is_executable (see section _is_executable), if the file-name extension is not enough for this.

Computing the execute access bit from the magic signature is by far the most expensive part of stat and fstat (because it requires to read the first two bytes of every file). If your application doesn't care about execute access bit, setting _STAT_EXEC_MAGIC will significantly speed it up.

Note that if _STAT_EXEC_MAGIC is set, but _STAT_EXEC_EXT is not, some files which shouldn't be flagged as executables (e.g., COFF `*.o' object files) will have their execute bit set, because they have the magic number signature at their beginning. Therefore, only use the above combination if you want to debug the list of extensions provided in `is_exec.c' file.


Causes stat to compute directory size by counting the number of its entries (unless some friendly network redirector brought a true directory size with it). Also computes the number of subdirectories and sets the number of links st_nlink field.

This computation is also quite expensive, especially for directories with large sub-directories. If your application doesn't care about size of directories and the st_nlink member, you should set the _STAT_DIRSIZE bit in _djstat_flags.


Causes stat to try to get time stamp of root directory from its volume label entry, if there is one.


Tells fstat that file's write access bit is required (this needs special treatment only under some versions of Novell Netware).

Note that if you set a bit, some failure bits in _djstat_fail_bits (see section _djstat_fail_bits) might not be set, because some computations which report failures are only done when they are required.



[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004