_NutFastStat(), _NutFastStat64()

limited but faster version of stat 

Function


SYNOPSIS

#include <nutc.h>

int _NutFastStat(const char *path, struct _NutFastStat *buf, size_t sizbuf);

struct _NutFastStat {
	off_t st_size;
	st_atime;
	time_t st_mtime;
	time_t st_ctime;
	int nut_st_flags;
};

int _NutFastStat64(const char *path, struct _NutFastStat64 *buf, size_t sizbuf);

struct _NutFastStat64 {
	off64_t st_size;
	st_atime;
	time_t st_mtime;
	time_t st_ctime;
	int nut_st_flags;
};

DESCRIPTION

The _NutFastStat() function is an alternative to the stat() function and can be used in those instances where the application is performance-sensitive and requires only limited information about a file or directory.

The _NutFastStat structure contains the following fields:

st_size 

File size in bytes (if the file is a regular file).

st_atime 

Time of last access.

st_mtime 

Time of last data modification.

st_ctime 

Time of last file status change.

nut_st_flags 

File type. 0 if the file is a directory; 1 otherwise.

The _NutFastStat64() function is the 64-bit version of _NutFastStat(). It is identical to _NutFastStat() except that instead of a _NutFastStat structure, it uses a _NutFastStat64 structure which has a st_size member that is 64 bits long instead of 32.


PARAMETERS

path 

Points to a null-terminated string that specifies a valid path to a directory or file.

buf 

Points to the _NutFastStat structure that receives the information about the directory or file.

sizbuf 

A size_t that is equal to sizeof(struct _NutFastStat) for _NutFastStat() and sizeof(struct _NutFastStat64) for _NutFastStat64(). This parameter is provided to assure forward-compatibility with future versions that may extend the interface.


RETURN VALUES

On success, _NutFastStat() and _NutFastStat64() return 0. On error, they return -1 and set errno to one of the following values:

EACCES 

The permissions that a mode specified are denied or search permission is denied on a component of the path name prefix.

EFAULT 

buf or path is an invalid pointer.

EINTR 

A signal interrupted the call.

EINVAL 

The file time returned by the system cannot be represented.

ENAMETOOLONG 

The length of the pathname parameter exceeds PATH_MAX or a path name component is longer than NAME_MAX.

ENOENT 

pathname points to an empty string or to the name of a file that does not exist.

ENOTDIR 

A component of the path name prefix is not a directory.


CONFORMANCE

PTC MKS Toolkit UNIX APIs extension.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The _NutFastStat() and _NutFastStat64() functions may be useful when only limited file information is required. This provides a useful workaround for the possible delays involved in obtaining full file security information.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
fstat(), lstat(), stat()

Miscellaneous:
struct stat


PTC MKS Toolkit 10.4 Documentation Build 39.