aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/core/idt.c2
-rw-r--r--src/kernel/fs/iso9660.c16
-rw-r--r--src/kernel/user/process.c21
3 files changed, 28 insertions, 11 deletions
diff --git a/src/kernel/core/idt.c b/src/kernel/core/idt.c
index eef3ca6..b94695f 100644
--- a/src/kernel/core/idt.c
+++ b/src/kernel/core/idt.c
@@ -122,7 +122,7 @@ void idt_irq_handler(registers_t *regs) {
if (regs->err_code == 0) {
irq0_handler(regs, st);
} else {
- dbg_printf("IRQ%d\n", regs->err_code);
+ dbg_printf("irq%d.", regs->err_code);
if (irq_handlers[regs->err_code] != 0) {
irq_handlers[regs->err_code](regs);
diff --git a/src/kernel/fs/iso9660.c b/src/kernel/fs/iso9660.c
index 4c1bdd2..4de6f2b 100644
--- a/src/kernel/fs/iso9660.c
+++ b/src/kernel/fs/iso9660.c
@@ -186,8 +186,6 @@ bool iso9660_dir_walk(fs_node_t *n, const char* search_for, struct fs_node *node
size_t filename_len = strlen(search_for);
- dbg_printf("Looking up %s...\n", search_for);
-
size_t dr_len = 0;
for (size_t pos = 0; pos < node->dr.size.lsb; pos += dr_len) {
union {
@@ -206,11 +204,13 @@ bool iso9660_dir_walk(fs_node_t *n, const char* search_for, struct fs_node *node
if (node->fs->use_lowercase) convert_dr_to_lowercase(dr);
char* name = dr->name;
- size_t len = dr->name_len - 2;
+ size_t len = dr->name_len;
+ if (!(dr->flags & ISO9660_DR_FLAG_DIR)) len -= 2;
+
+ if (!(dr->flags & ISO9660_DR_FLAG_DIR) && name[len] != ';') continue;
+ if (name[len-1] == '.') len--; // file with no extension
- if (name[len] != ';') continue;
if (len != filename_len) continue;
-
if (strncmp(name, search_for, len) == 0) {
// Found it !
iso9660_node_t *n = (iso9660_node_t*)malloc(sizeof(iso9660_node_t));
@@ -309,9 +309,11 @@ bool iso9660_dir_readdir(fs_handle_t *h, size_t ent_no, dirent_t *d) {
if (node->fs->use_lowercase) convert_dr_to_lowercase(dr);
char* name = dr->name;
- size_t len = dr->name_len - 2;
+ size_t len = dr->name_len;
+ if (!(dr->flags & ISO9660_DR_FLAG_DIR)) len -= 2;
- if (name[len] != ';') continue;
+ if (!(dr->flags & ISO9660_DR_FLAG_DIR) && name[len] != ';') continue;
+ if (name[len-1] == '.') len--; // file with no extension
if (idx == ent_no) {
// Found the node we are interested in
diff --git a/src/kernel/user/process.c b/src/kernel/user/process.c
index 18b4255..63b568a 100644
--- a/src/kernel/user/process.c
+++ b/src/kernel/user/process.c
@@ -161,13 +161,26 @@ void current_process_exit(int status, int exit_code) {
free(d);
}
+ process_t *p = current_process();
+
+ mutex_lock(&p->lock);
+ if (p->status == PS_EXITING) {
+ mutex_unlock(&p->lock);
+ exit();
+ }
+
+ p->status = PS_EXITING;
+
exit_data_t *d = (exit_data_t*)malloc(sizeof(exit_data_t));
- d->proc = current_process();;
+ d->proc = p;
d->status = status;
d->exit_code = exit_code;
- worker_push(process_exit_v, d);
+ while (!worker_push(process_exit_v, d)) yield();
+
+ mutex_unlock(&p->lock);
+
exit();
}
@@ -184,7 +197,7 @@ void process_exit(process_t *p, int status, int exit_code) {
mutex_lock(&p->lock);
- ASSERT(p->status == PS_RUNNING || p->status == PS_LOADING);
+ ASSERT(p->status == PS_RUNNING || p->status == PS_LOADING || p->status == PS_EXITING);
p->status = status;
p->exit_code = exit_code;
@@ -450,6 +463,8 @@ int proc_add_fd(process_t *p, fs_handle_t *f) {
}
bool proc_add_fd_as(process_t *p, fs_handle_t *f, int fd) {
+ if (fd <= 0) return false;
+
if (hashtbl_find(p->files, (void*)fd) != 0) return false;
if (fd >= p->next_fd) p->next_fd = fd + 1;