Big commit: Added symlink support to the kernel.

- added needed syscalls to access symlink support from userland
- implemented lstat(), symlink(), and readlink()
- added dev_t to ktypes.h (for now - should be in a public header anyway)
- added symlink support to the "ls" command (now calls lstat() and shows the
  link target with the -l option)
- changed the sys_read_stat() call to support symlinks, and updated files
  using that function (it gets an extra argument: bool traverseLink)


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@560 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2002-08-03 02:03:27 +00:00
parent 409a1aeacd
commit ae372703ce
15 changed files with 336 additions and 366 deletions
+6 -4
View File
@@ -22,8 +22,8 @@ enum {
SYSCALL_CREATE,
SYSCALL_UNLINK,
SYSCALL_RENAME,
SYSCALL_RSTAT,
SYSCALL_WSTAT,
SYSCALL_READ_STAT,
SYSCALL_WRITE_STAT,
SYSCALL_SYSTEM_TIME,
SYSCALL_SNOOZE,
SYSCALL_SEM_CREATE,
@@ -82,7 +82,7 @@ enum {
SYSCALL_SYSCTL,
SYSCALL_SOCKET,
SYSCALL_GETDTABLESIZE,
SYSCALL_FSTAT,
SYSCALL_FD_STAT,
SYSCALL_READ_DIR,
SYSCALL_REWIND_DIR,
SYSCALL_OPEN_DIR,
@@ -93,7 +93,9 @@ enum {
SYSCALL_OPEN_DIR_ENTRY_REF,
SYSCALL_OPEN_DIR_NODE_REF,
SYSCALL_CREATE_ENTRY_REF,
SYSCALL_CREATE_DIR_ENTRY_REF
SYSCALL_CREATE_DIR_ENTRY_REF,
SYSCALL_CREATE_SYMLINK,
SYSCALL_READ_LINK,
};
int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret);
+2 -3
View File
@@ -20,15 +20,14 @@ typedef int team_id;
typedef int sem_id;
typedef int port_id;
typedef int image_id;
typedef uint32 dev_t;
typedef uint64 ino_t;
typedef uint64 vnode_id;
typedef uint32 fs_id;
typedef uint16 nlink_t;
typedef uint32 uid_t;
typedef uint32 gid_t;
/* compat with beos (was int32 on beos) */
typedef int status_t;
typedef int32 status_t;
#ifdef _OBOS_TIME_T_
+3
View File
@@ -41,6 +41,9 @@ extern int optreset;
extern char **environ;
int readlink(const char *path, char *buffer, size_t bufferSize);
int symlink(const char *path, const char *toPath);
off_t lseek(int, off_t, int);
ssize_t read(int, void *, size_t);
ssize_t pread(int, void *, size_t, off_t);
+8 -6
View File
@@ -158,10 +158,12 @@ int sys_create_entry_ref(dev_t device, ino_t inode, const char *uname, int omode
int sys_create(const char *path, int omode, int perms);
int sys_create_dir_entry_ref(dev_t device, ino_t inode, const char *name, int perms);
int sys_create_dir(const char *path, int perms);
int sys_symlink(const char *path, const char *toPath);
int sys_read_link(const char *path, char *buffer, size_t bufferSize);
int sys_create_symlink(const char *path, const char *toPath);
int sys_unlink(const char *path);
int sys_rename(const char *oldpath, const char *newpath);
int sys_write_stat(const char *path, struct stat *stat, int stat_mask);
int sys_read_stat(const char *path, bool traverseLink, struct stat *stat);
int sys_write_stat(const char *path, bool traverseLink, struct stat *stat, int statMask);
char *sys_getcwd(char *buf, size_t size);
int sys_setcwd(const char* path);
@@ -180,11 +182,12 @@ int user_create_entry_ref(dev_t device, ino_t inode, const char *uname, int omod
int user_create(const char *path, int omode, int perms);
int user_create_dir_entry_ref(dev_t device, ino_t inode, const char *name, int perms);
int user_create_dir(const char *path, int perms);
int user_symlink(const char *path, const char *toPath);
int user_read_link(const char *path, char *buffer, size_t bufferSize);
int user_create_symlink(const char *path, const char *toPath);
int user_unlink(const char *path);
int user_rename(const char *oldpath, const char *newpath);
int user_read_stat(const char *path, struct stat *stat);
int user_write_stat(const char *path, struct stat *stat, int stat_mask);
int user_read_stat(const char *path, bool traverseLink, struct stat *stat);
int user_write_stat(const char *path, bool traverseLink, struct stat *stat, int statMask);
int user_getcwd(char *buf, size_t size);
int user_setcwd(const char* path);
@@ -194,7 +197,6 @@ extern ssize_t sys_write(int fd, const void *buf, off_t pos, size_t len);
extern int sys_ioctl(int fd, ulong cmd, void *data, size_t length);
extern ssize_t sys_read_dir(int fd, struct dirent *buffer, size_t bufferSize, uint32 maxCount);
extern status_t sys_rewind_dir(int fd);
extern int sys_read_stat(const char *path, struct stat *stat);
extern int sys_close(int fd);
extern int sys_dup(int fd);
extern int sys_dup2(int ofd, int nfd);