FAT | RFS | XFS
stat_set()
PROTOTYPE
#include <posix.h>
int stat_set(const char *path, struct stat *info);
DESCRIPTION
stat_set() is a non-standard routine that sets the data access and modification timestamps and mode for the file specified by path. Paths starting with ‘/’ are absolute. Otherwise they are relative to the CWD. info points to a stat structure, defined in “posix.h”, whose st_atime, st_mtime, and st_mode fields contain the new values.
The caller must own the file and have search access to the path prefix.
If successful, stat_set() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EACCES | No execute access to a directory in the path prefix. |
| EFAULT | path or info equals NULL. |
| ENAMETOOLONG | A name in path exceeds the effective maximum file name length. |
| ENOENT | path is the empty string or includes a file that was not found. |
| ENOTDIR | One of the non-leaf path components is not a directory. |
| EPERM | The caller is not the file’s owner (per FsGetId()). |
| EROFS | The volume is read-only. |
EXAMPLE
struct stat info;
/*-----------------------------------------------------------------*/
/* Set the file's permission to all read|write|execute. */
/*-----------------------------------------------------------------*/
info.st_atime = info.st_mtime = OsSecCount;
info.st_mode = 0777;
if (stat_set(fname2, &info))
return error("stat_set() failed");