tasking: continue fixing task_kill

This commit is contained in:
2025-06-23 23:41:01 +03:00
parent 29de6e6f43
commit b769ac0a58
6 changed files with 125 additions and 73 deletions
+11 -10
View File
@@ -79,9 +79,9 @@ int sys_write(TrapFrame *tf)
//stdin, stdout or stderr
if(tf->ebx == STDOUT_FILENO)
{
debug_log("\n=================SYS_WRITE output to stdout=====================\n");
//debug_log("\n=================SYS_WRITE output to stdout=====================\n");
print((char*)tf->ecx, tf->edx);
debug_log("\n=================END OF THAT SHIT=====================\n");
//debug_log("\n=================END OF THAT SHIT=====================\n");
return tf->edx;
}
}
@@ -103,16 +103,16 @@ int sys_open(TrapFrame *tf)
int fd = -1;
const char* mode_str = flags_to_mode_str(flags);
debug_log("\n====filename: %s\n", filename);
debug_log("\n====mode_str: %s\n", mode_str);
//debug_log("\n====filename: %s\n", filename);
//debug_log("\n====mode_str: %s\n", mode_str);
for(int i = 3; i < MAX_OPEN_FILES; i++)
{
debug_log("\n====i: %X\n", i);
//debug_log("\n====i: %X\n", i);
if(current->file_descriptors[i] == NULL)
{
current->file_descriptors[i] = malloc(sizeof(file_t)); // Kernel malloc
debug_log("\n====FILE_DESCRIPTOR: %X\n", i);
//debug_log("\n====FILE_DESCRIPTOR: %X\n", i);
int result = fat_fopen(current->file_descriptors[i], filename, mode_str);
if (result < 0) {
free(current->file_descriptors[i]); // Free on failure
@@ -130,12 +130,12 @@ int sys_open(TrapFrame *tf)
int sys_close(TrapFrame *tf)
{
int fd = tf->ebx;
debug_log("SYS_CLOSE: fd = 0x%X", fd);
//debug_log("SYS_CLOSE: fd = 0x%X", fd);
if(current->file_descriptors[fd] != NULL)
{
debug_log("SYS_CLOSE: current->file_descriptors[fd] != NULL");
//debug_log("SYS_CLOSE: current->file_descriptors[fd] != NULL");
int result = fat_fclose(current->file_descriptors[fd]);
debug_log("SYS_CLOSE: fat_fclose result: 0x%X", result);
//debug_log("SYS_CLOSE: fat_fclose result: 0x%X", result);
free(current->file_descriptors[fd]);
current->file_descriptors[fd] = NULL;
return result;
@@ -145,11 +145,12 @@ int sys_close(TrapFrame *tf)
void handle_syscall(TrapFrame *tf)
{
/*
debug_log("EAX: %X ", tf->eax);
debug_log("EBX: %X ", tf->ebx);
debug_log("ECX: %s ", tf->ecx);
debug_log("EDX: %X\n", tf->edx);
*/
if(tf->eax == 1)//exit
{