From 633275adeee85c38ce4e79be5eec4d7511188482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 23 Sep 2002 02:41:52 +0000 Subject: [PATCH] Fixed some int/int32/status_t issues. Also kernel/module.h was hidden by os/drivers/module.h - fixed; kernel/module.h is now called kmodule.h and only contains the module_init() function for the kernel. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1122 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/elf.c | 12 ++++++------ src/kernel/core/lock.c | 4 ++-- src/kernel/core/main.c | 6 +++--- src/kernel/core/module.c | 20 ++++++++++++-------- src/kernel/core/scheduler.c | 4 ++-- src/kernel/core/syscalls.c | 10 +++++----- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/kernel/core/elf.c b/src/kernel/core/elf.c index 313a1abef4..09a89906a1 100644 --- a/src/kernel/core/elf.c +++ b/src/kernel/core/elf.c @@ -42,7 +42,7 @@ struct elf_image_info { struct elf_image_info *next; char *name; image_id id; - int ref_count; + int32 ref_count; void *vnode; struct elf_region regions[2]; // describes the text and data regions addr dynamic_ptr; // pointer to the dynamic section @@ -280,9 +280,9 @@ dump_image_info(struct elf_image_info *image) dprintf("elf_image_info at %p:\n", image); dprintf(" next %p\n", image->next); - dprintf(" id 0x%x\n", image->id); + dprintf(" id 0x%lx\n", image->id); for (i = 0; i < 2; i++) { - dprintf(" regions[%d].id 0x%x\n", i, image->regions[i].id); + dprintf(" regions[%d].id 0x%lx\n", i, image->regions[i].id); dprintf(" regions[%d].start 0x%lx\n", i, image->regions[i].start); dprintf(" regions[%d].size 0x%lx\n", i, image->regions[i].size); dprintf(" regions[%d].delta %ld\n", i, image->regions[i].delta); @@ -662,7 +662,7 @@ elf_load_uspace(const char *path, struct team *p, int flags, addr *entry) goto error; } - dprintf("reading in program headers at 0x%x, len 0x%x\n", eheader.e_phoff, eheader.e_phnum * eheader.e_phentsize); + 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); if (len < 0) { err = len; @@ -880,7 +880,7 @@ elf_load_kspace(const char *path, const char *sym_prepend) image->dynamic_ptr = pheaders[i].p_vaddr; continue; default: - dprintf("unhandled pheader type 0x%x\n", pheaders[i].p_type); + dprintf("unhandled pheader type 0x%lx\n", pheaders[i].p_type); continue; } @@ -907,7 +907,7 @@ elf_load_kspace(const char *path, const char *sym_prepend) lock = LOCK_RW|LOCK_KERNEL; sprintf(region_name, "%s_ro", path); } else { - dprintf("weird program header flags 0x%x\n", pheaders[i].p_flags); + dprintf("weird program header flags 0x%lx\n", pheaders[i].p_flags); continue; } diff --git a/src/kernel/core/lock.c b/src/kernel/core/lock.c index 24ae1667df..ec38335bf6 100644 --- a/src/kernel/core/lock.c +++ b/src/kernel/core/lock.c @@ -131,7 +131,7 @@ mutex_lock(mutex *mutex) thread_id me = thread_get_current_thread_id(); if (me == mutex->holder) - panic("mutex_lock failure: mutex %p acquired twice by thread 0x%x\n", mutex, me); + panic("mutex_lock failure: mutex %p acquired twice by thread 0x%lx\n", mutex, me); acquire_sem(mutex->sem); mutex->holder = me; @@ -144,7 +144,7 @@ mutex_unlock(mutex *mutex) thread_id me = thread_get_current_thread_id(); if (me != mutex->holder) - panic("mutex_unlock failure: thread 0x%x is trying to release mutex %p (current holder 0x%x)\n", + panic("mutex_unlock failure: thread 0x%lx is trying to release mutex %p (current holder 0x%lx)\n", me, mutex, mutex->holder); mutex->holder = -1; diff --git a/src/kernel/core/main.c b/src/kernel/core/main.c index fb7f28b69c..2ea73eb8bf 100644 --- a/src/kernel/core/main.c +++ b/src/kernel/core/main.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -150,8 +150,8 @@ static int main2(void *unused) { team_id pid; pid = team_create_team("/boot/bin/init", "init", NULL, 0, NULL, 0, 5); - if(pid < 0) - kprintf("error starting 'init' error = %d \n",pid); + if (pid < 0) + kprintf("error starting 'init' error = %ld \n", pid); } return 0; diff --git a/src/kernel/core/module.c b/src/kernel/core/module.c index 9b70f248c5..4d35f39ee6 100644 --- a/src/kernel/core/module.c +++ b/src/kernel/core/module.c @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include @@ -216,7 +216,7 @@ load_module_file(const char *path) if (file_image < 0 ) { SHOW_FLOW( 3, "couldn't load image %s (%s)\n", path, strerror(file_image)); - dprintf("load_module_file failed! returned %d\n", file_image); + dprintf("load_module_file failed! returned %ld\n", file_image); return NULL; } @@ -880,7 +880,7 @@ open_module_list(const char *prefix) * Returns 0 if a module was available. */ -int +status_t read_next_module_name(void *cookie, char *buf, size_t *bufsize) { module_iterator *iter = (module_iterator *)cookie; @@ -920,7 +920,8 @@ read_next_module_name(void *cookie, char *buf, size_t *bufsize) } -int close_module_list(void *cookie) +status_t +close_module_list(void *cookie) { module_iterator *iter = (module_iterator *)cookie; @@ -941,7 +942,8 @@ int close_module_list(void *cookie) /* module_init * setup module structures and data for use */ -int module_init( kernel_args *ka, module_info **sys_module_headers ) +status_t +module_init(kernel_args *ka, module_info **sys_module_headers) { SHOW_FLOW0( 0, "\n" ); recursive_lock_create( &modules_lock ); @@ -966,8 +968,8 @@ int module_init( kernel_args *ka, module_info **sys_module_headers ) } -/* BeOS Compatibility... */ -int get_module(const char *path, module_info **vec) +status_t +get_module(const char *path, module_info **vec) { module *m = (module *)hash_get(modules_list, path, strlen(path)); loaded_module *lm; @@ -1031,7 +1033,9 @@ int get_module(const char *path, module_info **vec) return res; } -int put_module(const char *path) + +status_t +put_module(const char *path) { module *m = (module *)hash_get(modules_list, path, strlen(path)); diff --git a/src/kernel/core/scheduler.c b/src/kernel/core/scheduler.c index 55f270cf69..50be485a69 100644 --- a/src/kernel/core/scheduler.c +++ b/src/kernel/core/scheduler.c @@ -171,7 +171,7 @@ context_switch(struct thread *t_from, struct thread *t_to) } -static int +static int32 reschedule_event(timer *unused) { // this function is called as a result of the timer event set by the scheduler @@ -213,7 +213,7 @@ resched(void) break; case B_THREAD_SUSPENDED: #ifndef NEW_SCHEDULER - dprintf("suspending thread 0x%x\n", old_thread->id); + dprintf("suspending thread 0x%lx\n", old_thread->id); #else /* NEW_SCHEDULER */ dprintf("resched(): suspending thread 0x%x\n", old_thread->id); #endif /* NEW_SCHEDULER */ diff --git a/src/kernel/core/syscalls.c b/src/kernel/core/syscalls.c index 2b657bde5a..1d3aae8221 100644 --- a/src/kernel/core/syscalls.c +++ b/src/kernel/core/syscalls.c @@ -313,19 +313,19 @@ int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_re *call_ret = user_setrlimit((int)arg0, (const struct rlimit *)arg1); break; case SYSCALL_ATOMIC_ADD: - *call_ret = user_atomic_add((int *)arg0, (int)arg1); + *call_ret = user_atomic_add((int32 *)arg0, (int32)arg1); break; case SYSCALL_ATOMIC_AND: - *call_ret = user_atomic_and((int *)arg0, (int)arg1); + *call_ret = user_atomic_and((int32 *)arg0, (int32)arg1); break; case SYSCALL_ATOMIC_OR: - *call_ret = user_atomic_or((int *)arg0, (int)arg1); + *call_ret = user_atomic_or((int32 *)arg0, (int32)arg1); break; case SYSCALL_ATOMIC_SET: - *call_ret = user_atomic_set((int *)arg0, (int)arg1); + *call_ret = user_atomic_set((int32 *)arg0, (int32)arg1); break; case SYSCALL_TEST_AND_SET: - *call_ret = user_test_and_set((int *)arg0, (int)arg1, (int)arg2); + *call_ret = user_test_and_set((int32 *)arg0, (int32)arg1, (int32)arg2); break; case SYSCALL_SYSCTL: *call_ret = user_sysctl((int *)arg0, (uint)arg1, (void *)arg2,