From b1753651c6321f8943f9abfcee685bdfa4e61513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 15 Jun 2004 15:42:17 +0000 Subject: [PATCH] Renamed VFS syscalls to the new style. Improved returned types. Removed dup2.c. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7976 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/Jamfile | 2 -- src/kernel/libroot/posix/unistd/access.c | 4 ++-- src/kernel/libroot/posix/unistd/close.c | 8 +++++--- src/kernel/libroot/posix/unistd/directory.c | 20 +++++++++----------- src/kernel/libroot/posix/unistd/ioctl.c | 2 +- src/kernel/libroot/posix/unistd/link.c | 10 +++++----- src/kernel/libroot/posix/unistd/lseek.c | 2 +- src/kernel/libroot/posix/unistd/mount.c | 8 ++++---- src/kernel/libroot/posix/unistd/open.c | 9 ++++++--- src/kernel/libroot/posix/unistd/read.c | 6 +++--- src/kernel/libroot/posix/unistd/write.c | 13 ++++++------- 11 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/kernel/libroot/posix/unistd/Jamfile b/src/kernel/libroot/posix/unistd/Jamfile index b0e7da586e..5c6282cbc4 100644 --- a/src/kernel/libroot/posix/unistd/Jamfile +++ b/src/kernel/libroot/posix/unistd/Jamfile @@ -7,7 +7,6 @@ KernelMergeObject posix_unistd.o : <$(SOURCE_GRIST)>conf.c <$(SOURCE_GRIST)>directory.c <$(SOURCE_GRIST)>dup.c - <$(SOURCE_GRIST)>dup2.c <$(SOURCE_GRIST)>fcntl.c <$(SOURCE_GRIST)>getopt.c <$(SOURCE_GRIST)>hostname.c @@ -37,7 +36,6 @@ MergeObjectFromObjects kernel_posix_unistd.o : <$(SOURCE_GRIST)>conf.o <$(SOURCE_GRIST)>directory.o <$(SOURCE_GRIST)>dup.o - <$(SOURCE_GRIST)>dup2.o <$(SOURCE_GRIST)>fcntl.o <$(SOURCE_GRIST)>hostname.o <$(SOURCE_GRIST)>ioctl.o diff --git a/src/kernel/libroot/posix/unistd/access.c b/src/kernel/libroot/posix/unistd/access.c index c03b041581..a932a3dbbf 100644 --- a/src/kernel/libroot/posix/unistd/access.c +++ b/src/kernel/libroot/posix/unistd/access.c @@ -1,5 +1,5 @@ /* -** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -20,7 +20,7 @@ int access(const char *path, int accessMode) { - status_t status = sys_access(path, accessMode); + status_t status = _kern_access(path, accessMode); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/unistd/close.c b/src/kernel/libroot/posix/unistd/close.c index 2ed3277022..2cee9a8b0a 100644 --- a/src/kernel/libroot/posix/unistd/close.c +++ b/src/kernel/libroot/posix/unistd/close.c @@ -3,14 +3,16 @@ ** Distributed under the terms of the NewOS License. */ + #include #include #include -int close(int fd) -{ - int retval = sys_close(fd); +int +close(int fd) +{ + int retval = _kern_close(fd); if (retval < 0) { errno = retval; retval = -1; diff --git a/src/kernel/libroot/posix/unistd/directory.c b/src/kernel/libroot/posix/unistd/directory.c index d57dfc70c4..26487b2d7e 100644 --- a/src/kernel/libroot/posix/unistd/directory.c +++ b/src/kernel/libroot/posix/unistd/directory.c @@ -29,7 +29,7 @@ opendir(const char *path) { DIR *dir; - int fd = sys_open_dir(path); + int fd = _kern_open_dir(path); if (fd < 0) { errno = fd; return NULL; @@ -38,7 +38,7 @@ opendir(const char *path) /* allocate the memory for the DIR structure */ if ((dir = (DIR *)malloc(sizeof(DIR) + BUFFER_SIZE)) == NULL) { errno = B_NO_MEMORY; - sys_close(fd); + _kern_close(fd); return NULL; } @@ -51,7 +51,7 @@ opendir(const char *path) int closedir(DIR *dir) { - int status = sys_close(dir->fd); + int status = _kern_close(dir->fd); free(dir); @@ -66,7 +66,7 @@ readdir(DIR *dir) * containing the data */ - ssize_t count = sys_read_dir(dir->fd, &dir->ent, BUFFER_SIZE, 1); + ssize_t count = _kern_read_dir(dir->fd, &dir->ent, BUFFER_SIZE, 1); if (count <= 0) { if (count < 0) errno = count; @@ -81,9 +81,7 @@ readdir(DIR *dir) void rewinddir(DIR *dirp) { - status_t status; - - status = sys_rewind_dir(dirp->fd); + status_t status = _kern_rewind_dir(dirp->fd); if (status < 0) errno = status; } @@ -92,7 +90,7 @@ rewinddir(DIR *dirp) int chdir(const char *path) { - int status = sys_setcwd(-1, path); + int status = _kern_setcwd(-1, path); RETURN_AND_SET_ERRNO(status); } @@ -101,7 +99,7 @@ chdir(const char *path) int fchdir(int fd) { - int status = sys_setcwd(fd, NULL); + int status = _kern_setcwd(fd, NULL); RETURN_AND_SET_ERRNO(status); } @@ -110,7 +108,7 @@ fchdir(int fd) char * getcwd(char *buffer, size_t size) { - int status = sys_getcwd(buffer, size); + int status = _kern_getcwd(buffer, size); if (status < B_OK) { errno = status; return NULL; @@ -122,7 +120,7 @@ getcwd(char *buffer, size_t size) int rmdir(const char *path) { - int status = sys_remove_dir(path); + int status = _kern_remove_dir(path); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/unistd/ioctl.c b/src/kernel/libroot/posix/unistd/ioctl.c index 3f2493933c..2a0c08b482 100644 --- a/src/kernel/libroot/posix/unistd/ioctl.c +++ b/src/kernel/libroot/posix/unistd/ioctl.c @@ -31,7 +31,7 @@ ioctl(int fd, ulong cmd, ...) size = va_arg(args, size_t); va_end(args); - status = sys_ioctl(fd, cmd, argument, size); + status = _kern_ioctl(fd, cmd, argument, size); RETURN_AND_SET_ERRNO(status) } diff --git a/src/kernel/libroot/posix/unistd/link.c b/src/kernel/libroot/posix/unistd/link.c index 851b0ab67e..a7c1e5027f 100644 --- a/src/kernel/libroot/posix/unistd/link.c +++ b/src/kernel/libroot/posix/unistd/link.c @@ -1,5 +1,5 @@ /* -** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -20,7 +20,7 @@ ssize_t readlink(const char *path, char *buffer, size_t bufferSize) { - int status = sys_read_link(path, buffer, bufferSize); + int status = _kern_read_link(path, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); } @@ -29,7 +29,7 @@ readlink(const char *path, char *buffer, size_t bufferSize) int symlink(const char *path, const char *toPath) { - int status = sys_create_symlink(path, toPath, 0); + int status = _kern_create_symlink(path, toPath, 0); RETURN_AND_SET_ERRNO(status); } @@ -38,7 +38,7 @@ symlink(const char *path, const char *toPath) int unlink(const char *path) { - int status = sys_unlink(path); + int status = _kern_unlink(path); RETURN_AND_SET_ERRNO(status); } @@ -47,7 +47,7 @@ unlink(const char *path) int link(const char *path, const char *toPath) { - int status = sys_create_link(path, toPath); + int status = _kern_create_link(path, toPath); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/unistd/lseek.c b/src/kernel/libroot/posix/unistd/lseek.c index d991f48025..a871bfd510 100644 --- a/src/kernel/libroot/posix/unistd/lseek.c +++ b/src/kernel/libroot/posix/unistd/lseek.c @@ -10,5 +10,5 @@ off_t lseek(int fd, off_t pos, int whence) { - return sys_seek(fd, pos, whence); + return _kern_seek(fd, pos, whence); } diff --git a/src/kernel/libroot/posix/unistd/mount.c b/src/kernel/libroot/posix/unistd/mount.c index d21b24bb15..70504f3af6 100644 --- a/src/kernel/libroot/posix/unistd/mount.c +++ b/src/kernel/libroot/posix/unistd/mount.c @@ -1,5 +1,5 @@ /* -** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. ** Distributed under the terms of the OpenBeOS License. */ @@ -21,7 +21,7 @@ int mount(const char *filesystem, const char *where, const char *device, ulong flags, void *parms, int len) { // ToDo: consider parsing "parms" string in userland - int status = sys_mount(where, device, filesystem/*, flags*/, parms); + int status = _kern_mount(where, device, filesystem/*, flags*/, parms); (void)len; @@ -32,8 +32,8 @@ mount(const char *filesystem, const char *where, const char *device, ulong flags int unmount(const char *path) { - int status = sys_unmount(path); - + int status = _kern_unmount(path); + RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/unistd/open.c b/src/kernel/libroot/posix/unistd/open.c index 6104b40743..5af8ff9963 100644 --- a/src/kernel/libroot/posix/unistd/open.c +++ b/src/kernel/libroot/posix/unistd/open.c @@ -1,4 +1,7 @@ /* +** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +** ** Copyright 2001, Manuel J. Petit. All rights reserved. ** Distributed under the terms of the NewOS License. */ @@ -14,7 +17,7 @@ int creat(const char *path, mode_t mode) { - int status = sys_create(path, O_CREAT | O_TRUNC | O_WRONLY, mode); + int status = _kern_create(path, O_CREAT | O_TRUNC | O_WRONLY, mode); if (status < 0) { errno = status; @@ -36,9 +39,9 @@ open(const char *path, int oflags, ...) va_end(args); if (oflags & O_CREAT) - status = sys_create(path, oflags, perms); + status = _kern_create(path, oflags, perms); else - status = sys_open(path, oflags); + status = _kern_open(path, oflags); if (status < 0) { errno = status; diff --git a/src/kernel/libroot/posix/unistd/read.c b/src/kernel/libroot/posix/unistd/read.c index 9596c5e718..60dcec7c81 100644 --- a/src/kernel/libroot/posix/unistd/read.c +++ b/src/kernel/libroot/posix/unistd/read.c @@ -25,7 +25,7 @@ ssize_t read(int fd, void *buffer, size_t bufferSize) { - int status = sys_read(fd, -1, buffer, bufferSize); + ssize_t status = _kern_read(fd, -1, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); } @@ -34,7 +34,7 @@ read(int fd, void *buffer, size_t bufferSize) ssize_t read_pos(int fd, off_t pos, void *buffer, size_t bufferSize) { - int status = sys_read(fd, pos, buffer, bufferSize); + ssize_t status = _kern_read(fd, pos, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); } @@ -43,7 +43,7 @@ read_pos(int fd, off_t pos, void *buffer, size_t bufferSize) ssize_t pread(int fd, void *buffer, size_t bufferSize, off_t pos) { - int status = sys_read(fd, pos, buffer, bufferSize); + ssize_t status = _kern_read(fd, pos, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/unistd/write.c b/src/kernel/libroot/posix/unistd/write.c index bb7606d220..9d0c54a044 100644 --- a/src/kernel/libroot/posix/unistd/write.c +++ b/src/kernel/libroot/posix/unistd/write.c @@ -1,12 +1,11 @@ /* +** Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +** ** Copyright 2001, Manuel J. Petit. All rights reserved. ** Distributed under the terms of the NewOS License. */ -/* -** Copyright 2002, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -*/ #include #include @@ -24,7 +23,7 @@ ssize_t write(int fd, void const *buffer, size_t bufferSize) { - int status = sys_write(fd, -1, buffer, bufferSize); + int status = _kern_write(fd, -1, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); } @@ -33,7 +32,7 @@ write(int fd, void const *buffer, size_t bufferSize) ssize_t write_pos(int fd, off_t pos, const void *buffer, size_t bufferSize) { - int status = sys_write(fd, pos, buffer, bufferSize); + int status = _kern_write(fd, pos, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); } @@ -42,7 +41,7 @@ write_pos(int fd, off_t pos, const void *buffer, size_t bufferSize) ssize_t pwrite(int fd, const void *buffer, size_t bufferSize, off_t pos) { - int status = sys_write(fd, pos, buffer, bufferSize); + int status = _kern_write(fd, pos, buffer, bufferSize); RETURN_AND_SET_ERRNO(status); }