diff --git a/src/kernel/core/console.c b/src/kernel/core/console.c index 433b374685..aaf88e0503 100644 --- a/src/kernel/core/console.c +++ b/src/kernel/core/console.c @@ -43,7 +43,7 @@ kprintf(const char *fmt, ...) ret = vsprintf(temp,fmt,args); va_end(args); - sys_write(console_fd, 0, temp, ret); + _kern_write(console_fd, 0, temp, ret); } } @@ -62,7 +62,7 @@ kprintf_xy(int x, int y, const char *fmt, ...) buf.x = x; buf.y = y; - sys_ioctl(console_fd, CONSOLE_OP_WRITEXY, &buf, ret + sizeof(buf.x) + sizeof(buf.y)); + _kern_ioctl(console_fd, CONSOLE_OP_WRITEXY, &buf, ret + sizeof(buf.x) + sizeof(buf.y)); } } @@ -72,7 +72,7 @@ con_init(kernel_args *ka) { dprintf("con_init: entry\n"); - console_fd = sys_open("/dev/console", 0); + console_fd = _kern_open("/dev/console", 0); dprintf("console_fd = %d\n", console_fd); return 0; diff --git a/src/kernel/core/elf.c b/src/kernel/core/elf.c index c254a9896a..5596bed9be 100644 --- a/src/kernel/core/elf.c +++ b/src/kernel/core/elf.c @@ -1012,13 +1012,13 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry) dprintf("elf_load: entry path '%s', team %p\n", path, p); - fd = sys_open(path, 0); + fd = _kern_open(path, 0); if (fd < 0) return fd; // read and verify the ELF header - len = sys_read(fd, 0, &eheader, sizeof(eheader)); + len = _kern_read(fd, 0, &eheader, sizeof(eheader)); if (len < 0) { err = len; goto error; @@ -1043,7 +1043,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry) } dprintf("reading in program headers at 0x%lx, len 0x%x\n", eheader.e_phoff, eheader.e_phnum * eheader.e_phentsize); - len = sys_read(fd, eheader.e_phoff, pheaders, eheader.e_phnum * eheader.e_phentsize); + len = _kern_read(fd, eheader.e_phoff, pheaders, eheader.e_phnum * eheader.e_phentsize); if (len < 0) { err = len; dprintf("error reading in program headers\n"); @@ -1154,7 +1154,7 @@ elf_load_user_image(const char *path, struct team *p, int flags, addr_t *entry) error: if (pheaders) free(pheaders); - sys_close(fd); + _kern_close(fd); return err; } @@ -1179,7 +1179,7 @@ load_kernel_add_on(const char *path) TRACE(("elf_load_kspace: entry path '%s'\n", path)); - fd = sys_open(path, 0); + fd = _kern_open(path, 0); if (fd < 0) return fd; @@ -1205,7 +1205,7 @@ load_kernel_add_on(const char *path) goto error; } - len = sys_read(fd, 0, eheader, sizeof(*eheader)); + len = _kern_read(fd, 0, eheader, sizeof(*eheader)); if (len < 0) { err = len; goto error1; @@ -1236,7 +1236,7 @@ load_kernel_add_on(const char *path) } TRACE(("reading in program headers at 0x%lx, len 0x%x\n", eheader->e_phoff, eheader->e_phnum * eheader->e_phentsize)); - len = sys_read(fd, eheader->e_phoff, pheaders, eheader->e_phnum * eheader->e_phentsize); + len = _kern_read(fd, eheader->e_phoff, pheaders, eheader->e_phnum * eheader->e_phentsize); if (len < 0) { err = len; TRACE(("error reading in program headers\n")); @@ -1325,7 +1325,7 @@ load_kernel_add_on(const char *path) TRACE(("elf_load_kspace: created a region at %p\n", (void *)region->start)); - len = sys_read(fd, pheaders[i].p_offset, + len = _kern_read(fd, pheaders[i].p_offset, (void *)(region->start + (pheaders[i].p_vaddr % PAGE_SIZE)), pheaders[i].p_filesz); if (len < 0) { @@ -1363,7 +1363,7 @@ load_kernel_add_on(const char *path) load_elf_symbol_table(fd, image); free(pheaders); - sys_close(fd); + _kern_close(fd); register_elf_image(image); @@ -1388,7 +1388,7 @@ error: error0: if (vnode) vfs_put_vnode_ptr(vnode); - sys_close(fd); + _kern_close(fd); return err; } diff --git a/src/kernel/core/syscalls.c b/src/kernel/core/syscalls.c index 9fef5f2d49..33b68680f1 100644 --- a/src/kernel/core/syscalls.c +++ b/src/kernel/core/syscalls.c @@ -62,82 +62,82 @@ syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret) *call_ret = 0; break; case SYSCALL_MOUNT: - *call_ret = user_mount((const char *)arg0, (const char *)arg1, (const char *)arg2, (void *)arg3); + *call_ret = _user_mount((const char *)arg0, (const char *)arg1, (const char *)arg2, (void *)arg3); break; case SYSCALL_UNMOUNT: - *call_ret = user_unmount((const char *)arg0); + *call_ret = _user_unmount((const char *)arg0); break; case SYSCALL_SYNC: - *call_ret = user_sync(); + *call_ret = _user_sync(); break; case SYSCALL_OPEN_ENTRY_REF: - *call_ret = user_open_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1, arg2), (const char *)arg3, (int)arg4); + *call_ret = _user_open_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1, arg2), (const char *)arg3, (int)arg4); break; case SYSCALL_OPEN: - *call_ret = user_open((const char *)arg0, (int)arg1); + *call_ret = _user_open((const char *)arg0, (int)arg1); break; case SYSCALL_CLOSE: - *call_ret = user_close((int)arg0); + *call_ret = _user_close((int)arg0); break; case SYSCALL_FSYNC: - *call_ret = user_fsync((int)arg0); + *call_ret = _user_fsync((int)arg0); break; case SYSCALL_READ: - *call_ret = user_read((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (void *)arg3, (ssize_t)arg4); + *call_ret = _user_read((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (void *)arg3, (ssize_t)arg4); break; case SYSCALL_WRITE: - *call_ret = user_write((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (const void *)arg3, (ssize_t)arg4); + *call_ret = _user_write((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (const void *)arg3, (ssize_t)arg4); break; case SYSCALL_SEEK: - *call_ret = user_seek((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (int)arg3); + *call_ret = _user_seek((int)arg0, (off_t)INT32TOINT64(arg1, arg2), (int)arg3); break; case SYSCALL_OPEN_DIR_ENTRY_REF: - *call_ret = user_open_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3); + *call_ret = _user_open_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3); break; case SYSCALL_OPEN_DIR_NODE_REF: - *call_ret = user_open_dir_node_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2)); + *call_ret = _user_open_dir_node_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2)); break; case SYSCALL_OPEN_DIR: - *call_ret = user_open_dir((const char *)arg0); + *call_ret = _user_open_dir((const char *)arg0); break; case SYSCALL_READ_DIR: - *call_ret = user_read_dir((int)arg0, (struct dirent *)arg1, (size_t)arg2, (uint32)arg3); + *call_ret = _user_read_dir((int)arg0, (struct dirent *)arg1, (size_t)arg2, (uint32)arg3); break; case SYSCALL_REWIND_DIR: - *call_ret = user_rewind_dir((int)arg0); + *call_ret = _user_rewind_dir((int)arg0); break; case SYSCALL_IOCTL: - *call_ret = user_ioctl((int)arg0, (ulong)arg1, (void *)arg2, (size_t)arg3); + *call_ret = _user_ioctl((int)arg0, (ulong)arg1, (void *)arg2, (size_t)arg3); break; case SYSCALL_CREATE_ENTRY_REF: - *call_ret = user_create_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3, (int)arg4, (int)arg5); + *call_ret = _user_create_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3, (int)arg4, (int)arg5); break; case SYSCALL_CREATE: - *call_ret = user_create((const char *)arg0, (int)arg1, (int)arg2); + *call_ret = _user_create((const char *)arg0, (int)arg1, (int)arg2); break; case SYSCALL_CREATE_DIR_ENTRY_REF: - *call_ret = user_create_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3, (int)arg4); + *call_ret = _user_create_dir_entry_ref((dev_t)arg0, (ino_t)INT32TOINT64(arg1,arg2), (const char *)arg3, (int)arg4); break; case SYSCALL_CREATE_DIR: - *call_ret = user_create_dir((const char *)arg0, (int)arg1); + *call_ret = _user_create_dir((const char *)arg0, (int)arg1); break; case SYSCALL_CREATE_SYMLINK: - *call_ret = user_create_symlink((const char *)arg0, (const char *)arg1, (int)arg2); + *call_ret = _user_create_symlink((const char *)arg0, (const char *)arg1, (int)arg2); break; case SYSCALL_CREATE_LINK: - *call_ret = user_create_link((const char *)arg0, (const char *)arg1); + *call_ret = _user_create_link((const char *)arg0, (const char *)arg1); break; case SYSCALL_READ_LINK: - *call_ret = user_read_link((const char *)arg0, (char *)arg1, (size_t)arg2); + *call_ret = _user_read_link((const char *)arg0, (char *)arg1, (size_t)arg2); break; case SYSCALL_REMOVE_DIR: - *call_ret = user_remove_dir((const char *)arg0); + *call_ret = _user_remove_dir((const char *)arg0); break; case SYSCALL_UNLINK: - *call_ret = user_unlink((const char *)arg0); + *call_ret = _user_unlink((const char *)arg0); break; case SYSCALL_RENAME: - *call_ret = user_rename((const char *)arg0, (const char *)arg1); + *call_ret = _user_rename((const char *)arg0, (const char *)arg1); break; case SYSCALL_READ_PATH_STAT: *call_ret = _user_read_path_stat((const char *)arg0, (bool)arg1, (struct stat *)arg2, (size_t)arg3); @@ -152,41 +152,54 @@ syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret) *call_ret = _user_write_stat((int)arg0, (const struct stat *)arg1, (size_t)arg2, (int)arg3); break; case SYSCALL_ACCESS: - *call_ret = user_access((const char *)arg0, (int)arg1); + *call_ret = _user_access((const char *)arg0, (int)arg1); break; case SYSCALL_SELECT: - *call_ret = user_select((int)arg0, (fd_set *)arg1, (fd_set *)arg2, (fd_set *)arg3, (bigtime_t)INT32TOINT64(arg4, arg5), (sigset_t *)arg6); + *call_ret = _user_select((int)arg0, (fd_set *)arg1, (fd_set *)arg2, (fd_set *)arg3, (bigtime_t)INT32TOINT64(arg4, arg5), (sigset_t *)arg6); break; case SYSCALL_POLL: - *call_ret = user_poll((struct pollfd *)arg0, (int)arg1, (bigtime_t)INT32TOINT64(arg2, arg3)); + *call_ret = _user_poll((struct pollfd *)arg0, (int)arg1, (bigtime_t)INT32TOINT64(arg2, arg3)); break; case SYSCALL_OPEN_ATTR_DIR: - *call_ret = user_open_attr_dir((int)arg0, (const char *)arg1); + *call_ret = _user_open_attr_dir((int)arg0, (const char *)arg1); break; case SYSCALL_CREATE_ATTR: - *call_ret = user_create_attr((int)arg0, (const char *)arg1, (uint32)arg2, (int)arg3); + *call_ret = _user_create_attr((int)arg0, (const char *)arg1, (uint32)arg2, (int)arg3); break; case SYSCALL_OPEN_ATTR: - *call_ret = user_open_attr((int)arg0, (const char *)arg1, (int)arg2); + *call_ret = _user_open_attr((int)arg0, (const char *)arg1, (int)arg2); break; case SYSCALL_REMOVE_ATTR: - *call_ret = user_remove_attr((int)arg0, (const char *)arg1); + *call_ret = _user_remove_attr((int)arg0, (const char *)arg1); break; case SYSCALL_RENAME_ATTR: - *call_ret = user_rename_attr((int)arg0, (const char *)arg1, (int)arg2, (const char *)arg3); + *call_ret = _user_rename_attr((int)arg0, (const char *)arg1, (int)arg2, (const char *)arg3); break; case SYSCALL_OPEN_INDEX_DIR: - *call_ret = user_open_index_dir((dev_t)arg0); + *call_ret = _user_open_index_dir((dev_t)arg0); break; case SYSCALL_CREATE_INDEX: - *call_ret = user_create_index((dev_t)arg0, (const char *)arg1, (uint32)arg2, (uint32)arg3); + *call_ret = _user_create_index((dev_t)arg0, (const char *)arg1, (uint32)arg2, (uint32)arg3); break; case SYSCALL_READ_INDEX_STAT: - *call_ret = user_read_index_stat((dev_t)arg0, (const char *)arg1, (struct stat *)arg2); + *call_ret = _user_read_index_stat((dev_t)arg0, (const char *)arg1, (struct stat *)arg2); break; case SYSCALL_REMOVE_INDEX: - *call_ret = user_remove_index((dev_t)arg0, (const char *)arg1); + *call_ret = _user_remove_index((dev_t)arg0, (const char *)arg1); break; + case SYSCALL_FDDUP: + *call_ret = _user_dup(arg0); + break; + case SYSCALL_FDDUP2: + *call_ret = _user_dup2(arg0, arg1); + break; + case SYSCALL_GETCWD: + *call_ret = _user_getcwd((char*)arg0, (size_t)arg1); + break; + case SYSCALL_SETCWD: + *call_ret = _user_setcwd((int)arg0, (const char *)arg1); + break; + case SYSCALL_SYSTEM_TIME: *call_ret = system_time(); break; @@ -313,12 +326,6 @@ syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret) case SYSCALL_GET_CURRENT_TEAM_ID: *call_ret = _user_get_current_team(); break; - case SYSCALL_GETCWD: - *call_ret = user_getcwd((char*)arg0, (size_t)arg1); - break; - case SYSCALL_SETCWD: - *call_ret = user_setcwd((int)arg0, (const char *)arg1); - break; case SYSCALL_PORT_CREATE: *call_ret = user_create_port((int32)arg0, (const char *)arg1); break; @@ -374,12 +381,6 @@ syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret) case SYSCALL_SEM_SET_SEM_OWNER: *call_ret = user_set_sem_owner((sem_id)arg0, (team_id)arg1); break; - case SYSCALL_FDDUP: - *call_ret = user_dup(arg0); - break; - case SYSCALL_FDDUP2: - *call_ret = user_dup2(arg0, arg1); - break; /* obsolete; replaced by get_next_team_info case SYSCALL_GET_PROC_TABLE: *call_ret = user_team_get_table((struct team_info *)arg0, (size_t)arg1); diff --git a/src/kernel/core/vm/vm_tests.c b/src/kernel/core/vm/vm_tests.c index a15a7840d0..f3686b7828 100755 --- a/src/kernel/core/vm/vm_tests.c +++ b/src/kernel/core/vm/vm_tests.c @@ -192,7 +192,7 @@ vm_test() panic("vm_test 6: error deleting cloned region\n"); } #endif -#if 1 +#if 0 dprintf("vm_test 7: mmaping a known file a few times and verifying they see the same data\n"); { void *ptr, *ptr2; @@ -200,7 +200,7 @@ vm_test() // char *blah; int fd; - fd = sys_open("/boot/kernel", 0); + fd = _kern_open("/boot/beos/system/kernel_" OBOS_ARCH, 0); rid = vm_map_file(vm_get_kernel_aspace_id(), "mmap_test", &ptr, B_ANY_KERNEL_ADDRESS, PAGE_SIZE, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA, REGION_NO_PRIVATE_MAP, "/boot/kernel", 0); @@ -217,7 +217,7 @@ vm_test() dprintf("regions deleted\n"); - sys_close(fd); + _kern_close(fd); dprintf("vm_test 7: passed\n"); }