Linux stat获取文件类型

博客介绍了在Linux中如何通过open函数结合O_PATH和O_NOFOLLOW标志来获取符号链接文件本身,而非其指向的文件,从而避免跟随链接。这种方法在某些场景下优于直接使用lstat。此外,还提到了Unix高级环境编程中关于POSIX标准定义的额外文件类型,但Ubuntu 20.4并未实现这些标准。
摘要由CSDN通过智能技术生成

一、函数声明

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int stat(const char *pathname, struct stat *statbuf);
int fstat(int fd, struct stat *statbuf);
int lstat(const char *pathname, struct stat *statbuf);

#include <fcntl.h>           /* Definition of AT_* constants */
#include <sys/stat.h>

int fstatat(int dirfd, const char *pathname, struct stat *statb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值