Linux utimensat 函数声明及使用说明
Linux 中 utimensat 函数的声明位于'<sys/stat.h>'头文件中。
utimensat 函数用于修改指定路径的文件的访问时间和修改时间。它的声明如下:
int utimensat(int dirfd, const char *pathname, const struct timespec times[2], int flags);
其中,dirfd 是指定路径的文件描述符,pathname 是指定路径的字符串,times 是一个包含两个 timespec 结构的数组,flags 是控制操作的标志位。
需要注意的是,utimensat 函数在 Linux 2.6.22 版本引入,如果要在较早的版本上使用该函数,可能需要进行相应的兼容性处理。
原文地址: http://www.cveoy.top/t/topic/bp36 著作权归作者所有。请勿转载和采集!