aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2016-07-14 11:45:11 +0200
committerAlex Auvolat <alex@adnab.me>2016-07-14 11:45:11 +0200
commit2f13288a23da4dfaf6c40e1e943f83d8fa43145a (patch)
tree3b550ad22a00676470ceb2815afd21f42dfd8aae /src/kernel/user
parent477911553e0443fcafad5bd96c97314aa2f8d9ea (diff)
downloadkogata-2f13288a23da4dfaf6c40e1e943f83d8fa43145a.tar.gz
kogata-2f13288a23da4dfaf6c40e1e943f83d8fa43145a.zip
Fix sme warnings...
Diffstat (limited to 'src/kernel/user')
-rw-r--r--src/kernel/user/ipc.c14
-rw-r--r--src/kernel/user/process.c18
-rw-r--r--src/kernel/user/syscall.c8
3 files changed, 20 insertions, 20 deletions
diff --git a/src/kernel/user/ipc.c b/src/kernel/user/ipc.c
index 3643eb2..54122e3 100644
--- a/src/kernel/user/ipc.c
+++ b/src/kernel/user/ipc.c
@@ -357,19 +357,19 @@ typedef struct {
static token_table_entry_t *expired_token = 0;
+void _find_expired_token(void* k, void* x) {
+ token_table_entry_t *e = (token_table_entry_t*)x;
+ if (e->time + TOKEN_LIFETIME < get_kernel_time()) {
+ expired_token = e;
+ }
+}
void token_expiration_check(void* x) {
mutex_lock(&token_table_mutex);
do {
expired_token = 0;
- void find_expired_token(void* k, void* x) {
- token_table_entry_t *e = (token_table_entry_t*)x;
- if (e->time + TOKEN_LIFETIME < get_kernel_time()) {
- expired_token = e;
- }
- }
- hashtbl_iter(token_table, find_expired_token);
+ hashtbl_iter(token_table, _find_expired_token);
if (expired_token != 0) {
hashtbl_remove(token_table, &expired_token->tok);
diff --git a/src/kernel/user/process.c b/src/kernel/user/process.c
index 43294ce..5c057e7 100644
--- a/src/kernel/user/process.c
+++ b/src/kernel/user/process.c
@@ -34,7 +34,7 @@ typedef struct {
// ============================== //
process_t *new_process(process_t *parent) {
- process_t *proc = (process_t*)malloc(sizeof(process_t));
+ process_t *proc = (process_t*)calloc(1, sizeof(process_t));
if (proc == 0) goto error;
proc->filesystems = create_hashtbl(str_key_eq_fun, str_hash_fun, free_key);
@@ -175,6 +175,12 @@ void current_process_exit(int status, int exit_code) {
exit();
}
+void _process_exit_release_fd(void* a, void* fd) {
+ unref_file((fs_handle_t*)fd);
+}
+void _process_exit_release_fs(void* a, void* fs) {
+ unref_fs((fs_t*)fs);
+}
void process_exit(process_t *p, int status, int exit_code) {
// --- Make sure we are not running in a thread we are about to kill
ASSERT(current_process() != p);
@@ -217,10 +223,7 @@ void process_exit(process_t *p, int status, int exit_code) {
}
// release file descriptors
- void release_fd(void* a, void* fd) {
- unref_file((fs_handle_t*)fd);
- }
- hashtbl_iter(p->files, release_fd);
+ hashtbl_iter(p->files, _process_exit_release_fd);
delete_hashtbl(p->files);
p->files = 0;
@@ -233,10 +236,7 @@ void process_exit(process_t *p, int status, int exit_code) {
p->regions_idx = 0;
// release filesystems
- void release_fs(void* a, void* fs) {
- unref_fs((fs_t*)fs);
- }
- hashtbl_iter(p->filesystems, release_fs);
+ hashtbl_iter(p->filesystems, _process_exit_release_fs);
delete_hashtbl(p->filesystems);
p->filesystems = 0;
diff --git a/src/kernel/user/syscall.c b/src/kernel/user/syscall.c
index 42b06eb..9497bf2 100644
--- a/src/kernel/user/syscall.c
+++ b/src/kernel/user/syscall.c
@@ -297,6 +297,9 @@ uint32_t fctl_sc(sc_args_t args) {
}
}
+void _select_sc_resume_on_v(void*x) {
+ resume_on(x);
+}
uint32_t select_sc(sc_args_t args) {
sel_fd_t *fds = (sel_fd_t*)args.a;
size_t n = args.b;
@@ -336,10 +339,7 @@ uint32_t select_sc(sc_args_t args) {
if (timeout >= 0 && time - select_begin_time >= (uint64_t)timeout) break;
// ---- Do a wait, if interrupted (killed or whatever) return false
- void resume_on_v(void*x) {
- resume_on(x);
- }
- if (timeout > 0) worker_push_in(time - select_begin_time - timeout, resume_on_v, current_thread);
+ if (timeout > 0) worker_push_in(time - select_begin_time - timeout, _select_sc_resume_on_v, current_thread);
if (!wait_on_many(wait_objs, n_wait_objs)) break;
}