static void asmlinkage call_wrapper(void *unused) { struct thread *current = current_thread(); current->entry(current->entry_arg); terminate_thread(current); }
/* Block the current state transitions until thread is complete. */ static void asmlinkage call_wrapper_block_current(void *unused) { struct thread *current = current_thread(); boot_state_current_block(); current->entry(current->entry_arg); boot_state_current_unblock(); terminate_thread(current); }
/* Block the provided state until thread is complete. */ static void asmlinkage call_wrapper_block_state(void *arg) { struct block_boot_state *bbs = arg; struct thread *current = current_thread(); boot_state_block(bbs->state, bbs->seq); current->entry(current->entry_arg); boot_state_unblock(bbs->state, bbs->seq); terminate_thread(current); }
asmlinkage void thread_exit_handler(struct kernel_msg_handler_arg *arg) { //kprintf("To terminate user thread: %p, process: %s\n", arg->sender_thread, arg->sender_thread->proc->name); terminate_thread(arg->sender_thread); // Clean up terminate_thread_self(arg->handler_thread); sfree(arg); // Wait for this thread to be terminated kernel_unreachable(); }
asmlinkage void thread_kill_handler(struct kernel_msg_handler_arg *arg) { kprintf("To terminate 3rd user thread: %p, process: %s\n", arg->sender_thread, arg->sender_thread->proc->name); ulong thread_id = arg->msg->params[0].value; struct thread *t = gen_thread_by_thread_id(thread_id); assert(t); terminate_thread(t); // Clean up terminate_thread_self(arg->handler_thread); sfree(arg); // Wait for this thread to be terminated kernel_unreachable(); }
void scan_for_fs_entry(void *tag) { /* worker thread - scan for file systems on this device */ struct StorageDevice *storage_device = (struct StorageDevice *)tag; /* loop over each file system and find one for this device, */ struct FileSystem *fs = file_systems; bool success = false; while(!success && fs != 0) { success = fs->scan_handler(storage_device); fs = fs->next; } #if 1 if(!success) { /* print out the device that was added */ print_string("Couldn't mount "); switch(storage_device->type) { case STORAGE_DEVICE_TYPE_UNKNOWN: default: print_string("Unknown Drive"); break; case STORAGE_DEVICE_TYPE_OPTICAL: print_string("Optical Drive"); break; case STORAGE_DEVICE_TYPE_FLOPPY: print_string("Floppy Drive"); break; case STORAGE_DEVICE_TYPE_HARDDRIVE: print_string("Hard Drive"); break; case STORAGE_DEVICE_TYPE_FLASH: print_string("Flash Drive"); break; } if(!storage_device->inserted) print_string(" - Not Inserted"); if(storage_device->size > 0) { print_string(" -"); print_size(storage_device->size); } print_char('\n'); } #endif terminate_thread(); }