一、函数声明
https://man7.org/linux/man-pages/man2/access.2.html中的定义
#include <unistd.h>
int access(const char *pathname, int mode);
#include <fcntl.h> /* Definition of AT_* constants */
#include <unistd.h>
int faccessat(int dirfd, const char *pathname, int mode, int flags);
gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0 unistd.h中的定义
/* Values for the second argument to access.
These may be OR'd together. */
#define R_OK 4 /* Test for read permission. */
#define W_OK 2 /* Test for write permission. */
#define X_OK 1 /* Test for execute permission. */
#define F_OK 0 /* Test for existence. 测试文件是否存在 */
/* Test for access to NAME using the real UID and real GID. */
extern int access (const char *__name, int __type) __THROW __nonnull ((1));
#ifdef __USE_GNU
/* Test for access to NAME using the effective UID and GID
(as normal file operations use). */
extern int euidaccess (const char *__name, int __type)
__THROW __nonnull