* Added missing AT_EACCESS.

* Implemented renameat(), faccessat(), fchownat(), fchmodat(), and mkfifoat().
* Added stub for mknodat().
* The kernel backend for faccessat() does not yet differentiate between
  effective and real user/group IDs, though.
* Removed B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT, as we now support everything
  (more or less). This also closes ticket #4928.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34288 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-11-26 16:17:17 +00:00
parent 880de4501c
commit fb2500da15
20 changed files with 136 additions and 122 deletions
+4 -7
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008, Haiku Inc. All Rights Reserved.
* Copyright 2002-2009, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _FCNTL_H
@@ -62,14 +62,13 @@
/* TODO: currently not implemented additions: */
#define O_TEMPORARY 0x00400000 /* used to avoid writing temporary files to disk */
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
#define AT_FDCWD (-1) /* CWD FD for the *at() functions */
#define AT_SYMLINK_NOFOLLOW 0x1 /* fstatat(), fchmodat(), fchownat(),
#define AT_SYMLINK_NOFOLLOW 0x01 /* fstatat(), fchmodat(), fchownat(),
utimensat() */
#define AT_SYMLINK_FOLLOW 0x2 /* linkat() */
#define AT_SYMLINK_FOLLOW 0x02 /* linkat() */
#define AT_REMOVEDIR 0x04 /* unlinkat() */
#endif
#define AT_EACCESS 0x08 /* faccessat() */
/* advisory file locking */
@@ -90,9 +89,7 @@ extern int creat(const char *path, mode_t mode);
extern int open(const char *path, int openMode, ...);
/* the third argument is the permissions of the created file when O_CREAT
is passed in oflags */
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern int openat(int fd, const char *path, int openMode, ...);
#endif
extern int fcntl(int fd, int op, ...);
+4 -2
View File
@@ -1,6 +1,7 @@
/*
** Distributed under the terms of the OpenBeOS License.
*/
* Copyright 2004-2009, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _STDIO_H_
#define _STDIO_H_
@@ -87,6 +88,7 @@ extern int ftrylockfile(FILE *stream);
extern int remove(const char *name);
extern int rename(const char *from, const char *to);
extern int renameat(int fromFD, const char *from, int toFD, const char *to);
/* pipes */
extern FILE *popen(const char *command, const char *mode);
+2 -6
View File
@@ -111,23 +111,19 @@ extern "C" {
extern int chmod(const char *path, mode_t mode);
extern int fchmod(int fd, mode_t mode);
extern int fchmodat(int fd, const char *path, mode_t mode, int flag);
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);
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern int fstatat(int fd, const char *path, struct stat *st, int flag);
#endif
extern int mkdir(const char *path, mode_t mode);
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern int mkdirat(int fd, const char *path, mode_t mode);
#endif
extern int mkfifo(const char *path, mode_t mode);
extern int mkfifoat(int fd, const char *path, mode_t mode);
extern mode_t umask(mode_t cmask);
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern int utimensat(int fd, const char *path,
const struct timespec times[2], int flag);
#endif
extern int futimens(int fd, const struct timespec times[2]);
#ifdef __cplusplus
+5 -7
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2008, Haiku Inc. All Rights Reserved.
* Copyright 2004-2009, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _UNISTD_H_
@@ -124,6 +124,7 @@ extern "C" {
/* file functions */
extern int access(const char *path, int accessMode);
extern int faccessat(int fd, const char *path, int accessMode, int flag);
extern int chdir(const char *path);
extern int fchdir(int fd);
@@ -135,20 +136,14 @@ extern int dup2(int fd1, int fd2);
extern int close(int fd);
extern int link(const char *name, const char *new_name);
extern int unlink(const char *name);
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern int unlinkat(int fd, const char *path, int flag);
#endif
extern int rmdir(const char *path);
extern ssize_t readlink(const char *path, char *buffer, size_t bufferSize);
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern ssize_t readlinkat(int fd, const char *path, char *buffer,
size_t bufferSize);
#endif
extern int symlink(const char *toPath, const char *symlinkPath);
#ifdef B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT
extern int symlinkat(const char *toPath, int fd, const char *symlinkPath);
#endif
extern int ftruncate(int fd, off_t newSize);
extern int truncate(const char *path, off_t newSize);
@@ -168,8 +163,11 @@ extern int fsync(int fd);
extern int chown(const char *path, uid_t owner, gid_t group);
extern int fchown(int fd, uid_t owner, gid_t group);
extern int lchown(const char *path, uid_t owner, gid_t group);
extern int fchownat(int fd, const char *path, uid_t owner, gid_t group,
int flag);
extern int mknod(const char *name, mode_t mode, dev_t dev);
extern int mknodat(int fd, const char *name, mode_t mode, dev_t dev);
extern int getpagesize(void);
extern int getdtablesize(void);
+3 -2
View File
@@ -194,9 +194,10 @@ status_t _user_create_link(const char *path, const char *toPath);
status_t _user_unlink(int fd, const char *path);
status_t _user_rename(int oldFD, const char *oldpath, int newFD,
const char *newpath);
status_t _user_create_fifo(const char *path, mode_t perms);
status_t _user_create_fifo(int fd, const char *path, mode_t perms);
status_t _user_create_pipe(int *fds);
status_t _user_access(const char *path, int mode);
status_t _user_access(int fd, const char *path, int mode,
bool effectiveUserGroup);
ssize_t _user_select(int numfds, fd_set *readSet, fd_set *writeSet,
fd_set *errorSet, bigtime_t timeout, const sigset_t *sigMask);
ssize_t _user_poll(struct pollfd *fds, int numfds, bigtime_t timeout);
+3 -2
View File
@@ -243,9 +243,10 @@ extern status_t _kern_create_link(const char *path, const char *toPath);
extern status_t _kern_unlink(int fd, const char *path);
extern status_t _kern_rename(int oldDir, const char *oldpath, int newDir,
const char *newpath);
extern status_t _kern_create_fifo(const char *path, mode_t perms);
extern status_t _kern_create_fifo(int fd, const char *path, mode_t perms);
extern status_t _kern_create_pipe(int *fds);
extern status_t _kern_access(const char *path, int mode);
extern status_t _kern_access(int fd, const char *path, int mode,
bool effectiveUserGroup);
extern ssize_t _kern_select(int numfds, struct fd_set *readSet,
struct fd_set *writeSet, struct fd_set *errorSet,
bigtime_t timeout, const sigset_t *sigMask);