diff options
| author | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2012-03-27 11:51:08 +0200 |
| commit | 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b (patch) | |
| tree | 868c52e06f207b5ec8a3cc141f4b8b2bdfcc165c /userprog/process.h | |
| parent | eae0bd57f0a26314a94785061888d193d186944a (diff) | |
| download | progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.gz progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.tar.bz2 progos-4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b.zip | |
reorganize file structure to match the upstream requirements
Diffstat (limited to 'userprog/process.h')
| -rw-r--r-- | userprog/process.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/userprog/process.h b/userprog/process.h new file mode 100644 index 0000000..1609801 --- /dev/null +++ b/userprog/process.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | #ifndef USERPROG_PROCESS_H | ||
| 2 | #define USERPROG_PROCESS_H | ||
| 3 | |||
| 4 | #include "threads/thread.h" | ||
| 5 | |||
| 6 | /* In the current implementation, the capacity is fixed to 1024 (PGSIZE/4) */ | ||
| 7 | struct fd_table { | ||
| 8 | struct file** fds; | ||
| 9 | int fd_free; /* lowest-index free FD table entry */ | ||
| 10 | int fd_max; /* highest-index used FD table entry */ | ||
| 11 | int fd_cap; /* FD table capacity */ | ||
| 12 | }; | ||
| 13 | |||
| 14 | struct process { | ||
| 15 | /* process tree */ | ||
| 16 | tid_t thread_id; | ||
| 17 | tid_t parent_tid; | ||
| 18 | struct list_elem parentelem; /* Owned by parent */ | ||
| 19 | |||
| 20 | /* communication with parent process */ | ||
| 21 | struct semaphore exit_sem; | ||
| 22 | struct lock exit_lock; | ||
| 23 | int exit_status; | ||
| 24 | |||
| 25 | /* files */ | ||
| 26 | struct file *executable; /* Loaded executable, if any. */ | ||
| 27 | struct fd_table fd_table; /* File descriptor table */ | ||
| 28 | |||
| 29 | /* Owned by syscall.c */ | ||
| 30 | void* syscall_buffer; | ||
| 31 | size_t syscall_buffer_page_cnt; | ||
| 32 | }; | ||
| 33 | |||
| 34 | void process_init (void); | ||
| 35 | struct process* process_current (void); | ||
| 36 | tid_t process_execute (const char *file_name); | ||
| 37 | int process_wait (tid_t); | ||
| 38 | void process_exit (void); | ||
| 39 | void process_activate (void); | ||
| 40 | |||
| 41 | int process_open_file(const char* fname); | ||
| 42 | struct file* process_get_file(int fd); | ||
| 43 | void process_lock_filesys (void); | ||
| 44 | void process_unlock_filesys (void); | ||
| 45 | bool process_close_file(int fd); | ||
| 46 | |||
| 47 | #endif /* userprog/process.h */ | ||
