From 383cdedbd2f1de98851f38bf12d8edef67346ffd Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 28 Aug 2004 20:45:00 +0000 Subject: [PATCH] Several follow-up changes required by the changes either to the VFS syscalls or to the syscall mechanism (which exposed naming and parameter inconsistencies). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8703 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/ksignal.h | 6 ++--- headers/private/kernel/port.h | 24 +++++++++--------- headers/private/kernel/sem.h | 22 ++++++++-------- headers/private/kernel/sysctl.h | 2 +- headers/private/kernel/team.h | 4 +-- headers/private/kernel/vm.h | 2 +- src/kernel/core/vm/vm.c | 2 +- src/kernel/libroot/os/fs_attr.c | 2 +- src/kernel/libroot/os/fs_info.c | 2 +- src/kernel/libroot/os/port.c | 28 ++++++++++----------- src/kernel/libroot/os/sem.c | 2 +- src/kernel/libroot/posix/stdio/remove.c | 2 +- src/kernel/libroot/posix/stdio/rename.c | 2 +- src/kernel/libroot/posix/sys/chmod.c | 6 +++-- src/kernel/libroot/posix/sys/mkdir.c | 2 +- src/kernel/libroot/posix/sys/stat.c | 6 ++--- src/kernel/libroot/posix/unistd/chown.c | 6 ++--- src/kernel/libroot/posix/unistd/directory.c | 2 +- src/kernel/libroot/posix/unistd/link.c | 6 ++--- src/kernel/libroot/posix/unistd/open.c | 2 +- src/kernel/libroot/posix/unistd/truncate.c | 6 +++-- src/kernel/libroot/posix/utime.c | 2 +- 22 files changed, 71 insertions(+), 67 deletions(-) diff --git a/headers/private/kernel/ksignal.h b/headers/private/kernel/ksignal.h index 212e274f3b..24e61d573c 100644 --- a/headers/private/kernel/ksignal.h +++ b/headers/private/kernel/ksignal.h @@ -12,8 +12,8 @@ extern int handle_signals(struct thread *t, int state); -extern int user_send_signal(pid_t tid, uint sig); -extern int user_sigaction(int sig, const struct sigaction *act, struct sigaction *oact); -extern bigtime_t user_set_alarm(bigtime_t time, uint32 mode); +extern int _user_send_signal(pid_t tid, uint sig); +extern int _user_sigaction(int sig, const struct sigaction *act, struct sigaction *oact); +extern bigtime_t _user_set_alarm(bigtime_t time, uint32 mode); #endif /* _KERNEL_SIGNAL_H */ diff --git a/headers/private/kernel/port.h b/headers/private/kernel/port.h index a99c1dc5e5..7cc467e6fe 100755 --- a/headers/private/kernel/port.h +++ b/headers/private/kernel/port.h @@ -19,28 +19,28 @@ int32 port_used_ports(void); void port_test(void); // user-level API -port_id user_create_port(int32 queue_length, const char *name); -status_t user_close_port(port_id id); -status_t user_delete_port(port_id id); -port_id user_find_port(const char *port_name); -status_t user_get_port_info(port_id id, struct port_info *info); -status_t user_get_next_port_info(team_id team, +port_id _user_create_port(int32 queue_length, const char *name); +status_t _user_close_port(port_id id); +status_t _user_delete_port(port_id id); +port_id _user_find_port(const char *port_name); +status_t _user_get_port_info(port_id id, struct port_info *info); +status_t _user_get_next_port_info(team_id team, int32 *cookie, struct port_info *info); -ssize_t user_port_buffer_size_etc(port_id port, +ssize_t _user_port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout); -ssize_t user_port_count(port_id port); -status_t user_read_port_etc(port_id port, +ssize_t _user_port_count(port_id port); +status_t _user_read_port_etc(port_id port, int32 *msg_code, void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout); -status_t user_set_port_owner(port_id port, team_id team); -status_t user_write_port_etc(port_id port, +status_t _user_set_port_owner(port_id port, team_id team); +status_t _user_write_port_etc(port_id port, int32 msg_code, - void *msg_buffer, + const void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout); diff --git a/headers/private/kernel/sem.h b/headers/private/kernel/sem.h index 4e9dc4bdff..ce81be4636 100755 --- a/headers/private/kernel/sem.h +++ b/headers/private/kernel/sem.h @@ -13,17 +13,17 @@ struct kernel_args; /* user calls */ -sem_id user_create_sem(int32 count, const char *name); -status_t user_delete_sem(sem_id id); -status_t user_delete_sem_etc(sem_id id, status_t return_code, bool interrupted); -status_t user_acquire_sem(sem_id id); -status_t user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout); -status_t user_release_sem(sem_id id); -status_t user_release_sem_etc(sem_id id, int32 count, uint32 flags); -status_t user_get_sem_count(sem_id id, int32* thread_count); -status_t user_get_sem_info(sem_id, struct sem_info *, size_t); -status_t user_get_next_sem_info(team_id, int32 *, struct sem_info *, size_t); -status_t user_set_sem_owner(sem_id id, team_id team); +sem_id _user_create_sem(int32 count, const char *name); +status_t _user_delete_sem(sem_id id); +status_t _user_delete_sem_etc(sem_id id, status_t return_code, bool interrupted); +status_t _user_acquire_sem(sem_id id); +status_t _user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout); +status_t _user_release_sem(sem_id id); +status_t _user_release_sem_etc(sem_id id, int32 count, uint32 flags); +status_t _user_get_sem_count(sem_id id, int32* thread_count); +status_t _user_get_sem_info(sem_id, struct sem_info *, size_t); +status_t _user_get_next_sem_info(team_id, int32 *, struct sem_info *, size_t); +status_t _user_set_sem_owner(sem_id id, team_id team); /* kernel calls */ extern sem_id create_sem_etc(int32 count, const char *name, team_id owner); diff --git a/headers/private/kernel/sysctl.h b/headers/private/kernel/sysctl.h index 5b89739975..eca100b43c 100644 --- a/headers/private/kernel/sysctl.h +++ b/headers/private/kernel/sysctl.h @@ -108,7 +108,7 @@ extern "C" { #endif #ifdef _KERNEL_MODE -int user_sysctl(int *, uint, void *, size_t *, void *, size_t); +int _user_sysctl(int *, uint, void *, size_t *, void *, size_t); #endif int sysctl(int *, uint, void *, size_t *, void *, size_t); diff --git a/headers/private/kernel/team.h b/headers/private/kernel/team.h index a3e485f5cd..7b1006aefd 100644 --- a/headers/private/kernel/team.h +++ b/headers/private/kernel/team.h @@ -38,8 +38,8 @@ status_t _user_get_team_info(team_id id, team_info *info); status_t _user_get_next_team_info(int32 *cookie, team_info *info); // ToDo: please move the "env" setter/getter out of the kernel! -int user_setenv(const char *name, const char *value, int overwrite); -int user_getenv(const char *name, char **value); +int _user_setenv(const char *name, const char *value, int overwrite); +int _user_getenv(const char *name, char **value); #ifdef __cplusplus } diff --git a/headers/private/kernel/vm.h b/headers/private/kernel/vm.h index cd5632f9a0..bf8ee21aa0 100755 --- a/headers/private/kernel/vm.h +++ b/headers/private/kernel/vm.h @@ -67,7 +67,7 @@ int user_memset(void *s, char c, size_t count); area_id _user_create_area(const char *name, void **address, uint32 addressSpec, size_t size, uint32 lock, uint32 protection); status_t _user_delete_area(area_id area); -region_id user_vm_map_file(char *uname, void **uaddress, int addr_type, +region_id _user_vm_map_file(const char *uname, void **uaddress, int addr_type, addr size, int lock, int mapping, const char *upath, off_t offset); area_id _user_area_for(void *address); area_id _user_find_area(const char *name); diff --git a/src/kernel/core/vm/vm.c b/src/kernel/core/vm/vm.c index f647002c64..5702a45de9 100755 --- a/src/kernel/core/vm/vm.c +++ b/src/kernel/core/vm/vm.c @@ -1083,7 +1083,7 @@ vm_map_file(aspace_id aid, char *name, void **address, int addr_type, region_id -user_vm_map_file(char *uname, void **uaddress, int addr_type, +_user_vm_map_file(const char *uname, void **uaddress, int addr_type, addr_t size, int lock, int mapping, const char *upath, off_t offset) { char name[B_OS_NAME_LENGTH]; diff --git a/src/kernel/libroot/os/fs_attr.c b/src/kernel/libroot/os/fs_attr.c index 0dc30c2e17..f5d4f44dd1 100644 --- a/src/kernel/libroot/os/fs_attr.c +++ b/src/kernel/libroot/os/fs_attr.c @@ -80,7 +80,7 @@ fs_stat_attr(int fd, const char *attribute, struct attr_info *attrInfo) if (attr < 0) RETURN_AND_SET_ERRNO(attr); - status = _kern_read_stat(attr, &stat, sizeof(struct stat)); + status = _kern_read_stat(attr, NULL, false, &stat, sizeof(struct stat)); if (status == B_OK) { attrInfo->type = stat.st_type; attrInfo->size = stat.st_size; diff --git a/src/kernel/libroot/os/fs_info.c b/src/kernel/libroot/os/fs_info.c index 6aecab52b3..80dca93b89 100644 --- a/src/kernel/libroot/os/fs_info.c +++ b/src/kernel/libroot/os/fs_info.c @@ -27,7 +27,7 @@ dev_t dev_for_path(const char *path) { struct stat stat; - int status = _kern_read_path_stat(path, false, &stat, sizeof(struct stat)); + int status = _kern_read_stat(-1, path, false, &stat, sizeof(struct stat)); if (status == B_OK) return stat.st_dev; diff --git a/src/kernel/libroot/os/port.c b/src/kernel/libroot/os/port.c index 338f03b61a..f309976c49 100644 --- a/src/kernel/libroot/os/port.c +++ b/src/kernel/libroot/os/port.c @@ -11,28 +11,28 @@ port_id create_port(int32 capacity, const char *name) { - return sys_port_create(capacity, name); + return _kern_create_port(capacity, name); } port_id find_port(const char *name) { - return sys_port_find(name); + return _kern_find_port(name); } status_t write_port(port_id port, int32 code, const void *buffer, size_t bufferSize) { - return sys_port_write(port, code, buffer, bufferSize); + return _kern_write_port_etc(port, code, buffer, bufferSize, 0, 0); } status_t read_port(port_id port, int32 *code, void *buffer, size_t bufferSize) { - return sys_port_read(port, code, buffer, bufferSize); + return _kern_read_port_etc(port, code, buffer, bufferSize, 0, 0); } @@ -40,7 +40,7 @@ status_t write_port_etc(port_id port, int32 code, const void *buffer, size_t bufferSize, uint32 flags, bigtime_t timeout) { - return sys_port_write_etc(port, code, buffer, bufferSize, flags, timeout); + return _kern_write_port_etc(port, code, buffer, bufferSize, flags, timeout); } @@ -48,49 +48,49 @@ status_t read_port_etc(port_id port, int32 *code, void *buffer, size_t bufferSize, uint32 flags, bigtime_t timeout) { - return sys_port_read_etc(port, code, buffer, bufferSize, flags, timeout); + return _kern_read_port_etc(port, code, buffer, bufferSize, flags, timeout); } ssize_t port_buffer_size(port_id port) { - return sys_port_buffer_size(port); + return _kern_port_buffer_size_etc(port, 0, 0); } ssize_t port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout) { - return sys_port_buffer_size_etc(port, flags, timeout); + return _kern_port_buffer_size_etc(port, flags, timeout); } ssize_t port_count(port_id port) { - return sys_port_count(port); + return _kern_port_count(port); } status_t set_port_owner(port_id port, team_id team) { - return sys_port_set_owner(port, team); + return _kern_set_port_owner(port, team); } status_t close_port(port_id port) { - return sys_port_close(port); + return _kern_close_port(port); } status_t delete_port(port_id port) { - return sys_port_delete(port); + return _kern_delete_port(port); } @@ -100,13 +100,13 @@ _get_next_port_info(team_id team, int32 *cookie, port_info *info, size_t size) // size is not yet used, but may, if port_info changes (void)size; - return sys_port_get_next_port_info(team, cookie, info); + return _kern_get_next_port_info(team, cookie, info); } status_t _get_port_info(port_id port, port_info *info, size_t size) { - return sys_port_get_info(port, info); + return _kern_get_port_info(port, info); } diff --git a/src/kernel/libroot/os/sem.c b/src/kernel/libroot/os/sem.c index c6b2cf986f..5f999afda3 100644 --- a/src/kernel/libroot/os/sem.c +++ b/src/kernel/libroot/os/sem.c @@ -53,7 +53,7 @@ release_sem_etc(sem_id id, int32 count, uint32 flags) status_t get_sem_count(sem_id sem, int32 *count) { - return sys_sem_get_count(sem, count); + return sys_get_sem_count(sem, count); } diff --git a/src/kernel/libroot/posix/stdio/remove.c b/src/kernel/libroot/posix/stdio/remove.c index 55805db807..fbb7a5c16b 100644 --- a/src/kernel/libroot/posix/stdio/remove.c +++ b/src/kernel/libroot/posix/stdio/remove.c @@ -12,7 +12,7 @@ int remove(const char *path) { - int status = _kern_unlink(path); + int status = _kern_unlink(-1, path); if (status < B_OK) { errno = status; return -1; diff --git a/src/kernel/libroot/posix/stdio/rename.c b/src/kernel/libroot/posix/stdio/rename.c index df6b7080d6..6e73cc789b 100644 --- a/src/kernel/libroot/posix/stdio/rename.c +++ b/src/kernel/libroot/posix/stdio/rename.c @@ -12,7 +12,7 @@ int rename(const char *from, const char *to) { - int status = _kern_rename(from, to); + int status = _kern_rename(-1, from, -1, to); if (status < B_OK) { errno = status; return -1; diff --git a/src/kernel/libroot/posix/sys/chmod.c b/src/kernel/libroot/posix/sys/chmod.c index 2df379dd1d..5039d132bb 100644 --- a/src/kernel/libroot/posix/sys/chmod.c +++ b/src/kernel/libroot/posix/sys/chmod.c @@ -26,7 +26,8 @@ chmod(const char *path, mode_t mode) status_t status; stat.st_mode = mode; - status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat), FS_WRITE_STAT_MODE); + status = _kern_write_stat(-1, path, true, &stat, sizeof(struct stat), + FS_WRITE_STAT_MODE); RETURN_AND_SET_ERRNO(status); } @@ -39,7 +40,8 @@ fchmod(int fd, mode_t mode) status_t status; stat.st_mode = mode; - status = _kern_write_stat(fd, &stat, sizeof(struct stat), FS_WRITE_STAT_MODE); + status = _kern_write_stat(fd, NULL, false, &stat, sizeof(struct stat), + FS_WRITE_STAT_MODE); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/sys/mkdir.c b/src/kernel/libroot/posix/sys/mkdir.c index c204ea4ac4..6ce3cb2784 100644 --- a/src/kernel/libroot/posix/sys/mkdir.c +++ b/src/kernel/libroot/posix/sys/mkdir.c @@ -20,7 +20,7 @@ int mkdir(const char *path, mode_t mode) { - status_t status = _kern_create_dir(path, mode); + status_t status = _kern_create_dir(-1, path, mode); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/sys/stat.c b/src/kernel/libroot/posix/sys/stat.c index 47ea57faa9..821ad60452 100644 --- a/src/kernel/libroot/posix/sys/stat.c +++ b/src/kernel/libroot/posix/sys/stat.c @@ -56,7 +56,7 @@ lstat(const char *path, struct stat *stat) int _stat(const char *path, struct stat *stat, size_t statSize) { - int status = _kern_read_path_stat(path, true, stat, statSize); + int status = _kern_read_stat(-1, path, true, stat, statSize); RETURN_AND_SET_ERRNO(status); } @@ -65,7 +65,7 @@ _stat(const char *path, struct stat *stat, size_t statSize) int _lstat(const char *path, struct stat *stat, size_t statSize) { - int status = _kern_read_path_stat(path, false, stat, statSize); + int status = _kern_read_stat(-1, path, false, stat, statSize); RETURN_AND_SET_ERRNO(status); } @@ -74,7 +74,7 @@ _lstat(const char *path, struct stat *stat, size_t statSize) int _fstat(int fd, struct stat *stat, size_t statSize) { - int status = _kern_read_stat(fd, stat, statSize); + int status = _kern_read_stat(fd, NULL, false, stat, statSize); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/unistd/chown.c b/src/kernel/libroot/posix/unistd/chown.c index c291e761a4..3c69081e3b 100644 --- a/src/kernel/libroot/posix/unistd/chown.c +++ b/src/kernel/libroot/posix/unistd/chown.c @@ -27,7 +27,7 @@ chown(const char *path, uid_t owner, gid_t group) stat.st_uid = owner; stat.st_gid = group; - status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat), + status = _kern_write_stat(-1, path, true, &stat, sizeof(struct stat), FS_WRITE_STAT_UID | FS_WRITE_STAT_GID); RETURN_AND_SET_ERRNO(status); @@ -42,7 +42,7 @@ lchown(const char *path, uid_t owner, gid_t group) stat.st_uid = owner; stat.st_gid = group; - status = _kern_write_path_stat(path, false, &stat, sizeof(struct stat), + status = _kern_write_stat(-1, path, false, &stat, sizeof(struct stat), FS_WRITE_STAT_UID | FS_WRITE_STAT_GID); RETURN_AND_SET_ERRNO(status); @@ -57,7 +57,7 @@ fchown(int fd, uid_t owner, gid_t group) stat.st_uid = owner; stat.st_gid = group; - status = _kern_write_stat(fd, &stat, sizeof(struct stat), + status = _kern_write_stat(fd, NULL, false, &stat, sizeof(struct stat), FS_WRITE_STAT_UID | FS_WRITE_STAT_GID); RETURN_AND_SET_ERRNO(status); diff --git a/src/kernel/libroot/posix/unistd/directory.c b/src/kernel/libroot/posix/unistd/directory.c index 26487b2d7e..eade87b77b 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 = _kern_open_dir(path); + int fd = _kern_open_dir(-1, path); if (fd < 0) { errno = fd; return NULL; diff --git a/src/kernel/libroot/posix/unistd/link.c b/src/kernel/libroot/posix/unistd/link.c index a7c1e5027f..a7caaaca7e 100644 --- a/src/kernel/libroot/posix/unistd/link.c +++ b/src/kernel/libroot/posix/unistd/link.c @@ -20,7 +20,7 @@ ssize_t readlink(const char *path, char *buffer, size_t bufferSize) { - int status = _kern_read_link(path, buffer, bufferSize); + int status = _kern_read_link(-1, 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 = _kern_create_symlink(path, toPath, 0); + int status = _kern_create_symlink(-1, 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 = _kern_unlink(path); + int status = _kern_unlink(-1, 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 5af8ff9963..001b4abb59 100644 --- a/src/kernel/libroot/posix/unistd/open.c +++ b/src/kernel/libroot/posix/unistd/open.c @@ -41,7 +41,7 @@ open(const char *path, int oflags, ...) if (oflags & O_CREAT) status = _kern_create(path, oflags, perms); else - status = _kern_open(path, oflags); + status = _kern_open(-1, path, oflags); if (status < 0) { errno = status; diff --git a/src/kernel/libroot/posix/unistd/truncate.c b/src/kernel/libroot/posix/unistd/truncate.c index 349b761d29..f12d65720a 100644 --- a/src/kernel/libroot/posix/unistd/truncate.c +++ b/src/kernel/libroot/posix/unistd/truncate.c @@ -26,7 +26,8 @@ truncate(const char *path, off_t newSize) status_t status; stat.st_size = newSize; - status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat), FS_WRITE_STAT_SIZE); + status = _kern_write_stat(-1, path, true, &stat, sizeof(struct stat), + FS_WRITE_STAT_SIZE); RETURN_AND_SET_ERRNO(status); } @@ -39,7 +40,8 @@ ftruncate(int fd, off_t newSize) status_t status; stat.st_size = newSize; - status = _kern_write_stat(fd, &stat, sizeof(struct stat), FS_WRITE_STAT_SIZE); + status = _kern_write_stat(fd, NULL, false, &stat, sizeof(struct stat), + FS_WRITE_STAT_SIZE); RETURN_AND_SET_ERRNO(status); } diff --git a/src/kernel/libroot/posix/utime.c b/src/kernel/libroot/posix/utime.c index 837a5bf113..5e01a7aaac 100644 --- a/src/kernel/libroot/posix/utime.c +++ b/src/kernel/libroot/posix/utime.c @@ -32,7 +32,7 @@ utime(const char *path, const struct utimbuf *times) } else stat.st_atime = stat.st_mtime = time(NULL); - status = _kern_write_path_stat(path, true, &stat, sizeof(struct stat), + status = _kern_write_stat(-1, path, true, &stat, sizeof(struct stat), FS_WRITE_STAT_MTIME | FS_WRITE_STAT_ATIME); RETURN_AND_SET_ERRNO(status);