Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • backup/alex-27
  • Test/file-system
  • Test/syscall-test-branch
  • josh/miscellaneous-improvements
  • alex/exit-system-call
  • josh/backup-alex-6
  • backup/Alex
8 results

syscall_exit.c

Blame
  • syscall_exit.c 574 B
    #include "system_calls.h"
    #include "threads/interrupt.h" // Dependency for intr_frame struct
    #include "threads/thread.h" // Dependency for thread struct
    
    void syscall_exit(struct intr_frame *f) {
    	struct thread *current_thread;	// creates thread struct from thread.h
    	current_thread = thread_current(); // Sets current thread
    
    	// pop off first int argument from interrupt frame
    	int exit_code = *((int*)f->esp + 1);
    	current_thread->exit_code = exit_code; // Returns exit code to kernel
    
    	thread_exit(); // Exiting current thread
    	f->eax = -1; // Returning -1 for success
    }