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

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

_djstat_flags

Syntax

 
#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:

_STAT_INODE

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

_STAT_EXEC_EXT

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.

_STAT_EXEC_MAGIC

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.

_STAT_DIRSIZE

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.

_STAT_ROOT_TIME

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

_STAT_WRITEBIT

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.

Portability

ANSI/ISO C No
POSIX No


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

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004