Added AT_SYMLINK_[NO]FOLLOW constants and fstatat(). Fixes the findutils
gnulib build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33987 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -66,6 +66,9 @@
|
||||
|
||||
#define AT_FDCWD (-1) /* CWD FD for the *at() functions */
|
||||
|
||||
#define AT_SYMLINK_NOFOLLOW 0x1 /* fstatat(), fchmodat(), fchownat(),
|
||||
utimensat() */
|
||||
#define AT_SYMLINK_FOLLOW 0x2 /* linkat() */
|
||||
|
||||
/* advisory file locking */
|
||||
|
||||
|
||||
@@ -105,14 +105,15 @@ struct stat {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int chmod(const char *path, mode_t mode);
|
||||
extern int fchmod(int fd, mode_t mode);
|
||||
extern int stat(const char *path, struct stat *st);
|
||||
extern int fstat(int fd, struct stat *st);
|
||||
extern int lstat(const char *path, struct stat *st);
|
||||
extern int mkdir(const char *path, mode_t mode);
|
||||
extern int mkfifo(const char *path, mode_t mode);
|
||||
extern mode_t umask(mode_t cmask);
|
||||
extern int chmod(const char *path, mode_t mode);
|
||||
extern int fchmod(int fd, mode_t mode);
|
||||
extern int stat(const char *path, struct stat *st);
|
||||
extern int fstat(int fd, struct stat *st);
|
||||
extern int lstat(const char *path, struct stat *st);
|
||||
extern int fstatat(int fd, const char *path, struct stat *st, int flag);
|
||||
extern int mkdir(const char *path, mode_t mode);
|
||||
extern int mkfifo(const char *path, mode_t mode);
|
||||
extern mode_t umask(mode_t cmask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -51,6 +51,16 @@ _lstat_current(const char* path, struct stat* stat)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fstatat(int fd, const char *path, struct stat *st, int flag)
|
||||
{
|
||||
int status = _kern_read_stat(fd, path, (flag & AT_SYMLINK_NOFOLLOW) != 0,
|
||||
st, sizeof(struct stat));
|
||||
|
||||
RETURN_AND_SET_ERRNO(status);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - BeOS compatibility
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user