Changeset 416 for trunk/kernel/syscalls
- Timestamp:
- Jan 4, 2018, 10:05:47 AM (7 years ago)
- Location:
- trunk/kernel/syscalls
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/shared_syscalls.h
r410 r416 86 86 SYSCALLS_NR = 47, 87 87 }; 88 89 /******************************************************************************************* 90 * This defines the signal type mnemonics for the kill() syscall. 91 * WARNING : Only the three SIGKILL / SIGSTOP / SIGCONT are supported (december 2017) 92 ******************************************************************************************/ 93 94 #define SIGHUP 1 /*! hangup */ 95 #define SIGINT 2 /*! interrupt */ 96 #define SIGQUIT 3 /*! quit */ 97 #define SIGILL 4 /*! illegal instruction (not reset when caught) */ 98 #define SIGTRAP 5 /*! trace trap (not reset when caught) */ 99 #define SIGABRT 6 /*! used by abort, replace SIGIOT in the future */ 100 #define SIGEMT 7 /*! EMT instruction */ 101 #define SIGFPE 8 /*! floating point exception */ 102 #define SIGKILL 9 /*! kill (cannot be caught or ignored) */ 103 #define SIGBUS 10 /*! bus error */ 104 #define SIGSEGV 11 /*! segmentation violation */ 105 #define SIGSYS 12 /*! bad argument to system call */ 106 #define SIGPIPE 13 /*! write on a pipe with no one to read it */ 107 #define SIGALRM 14 /*! alarm clock */ 108 #define SIGTERM 15 /*! software termination signal from kill */ 109 #define SIGURG 16 /*! urgent condition on IO channel */ 110 #define SIGSTOP 17 /*! sendable stop signal not from tty */ 111 #define SIGTSTP 18 /*! stop signal from tty */ 112 #define SIGCONT 19 /*! continue a stopped process */ 113 #define SIGCHLD 20 /*! to parent on child stop or exit */ 114 #define SIGTTIN 21 /*! to readers pgrp upon background tty read */ 115 #define SIGTTOU 22 /*! like TTIN for output if (tp->t_local<OSTOP) */ 116 #define SIGIO 23 /*! input/output possible signal */ 117 #define SIGXCPU 24 /*! exceeded CPU time limit */ 118 #define SIGXFSZ 25 /*! exceeded file size limit */ 119 #define SIGVTALRM 26 /*! virtual time alarm */ 120 #define SIGPROF 27 /*! profiling time alarm */ 121 #define SIGWINCH 28 /*! window changed */ 122 #define SIGLOST 29 /*! resource lost (eg, record-lock lost) */ 123 #define SIGUSR1 30 /*! user defined signal 1 */ 124 #define SIGUSR2 31 /*! user defined signal 2 */ 88 125 89 126 /******************************************************************************************* -
trunk/kernel/syscalls/sys_exec.c
r408 r416 160 160 // and this sys_exec() function uses a RPC to access the owner cluster if required. 161 161 // 162 // TODO : the args & envs arguments are not supported yet : both must be NULL 162 // TODO : the args & envs arguments are not supported yet : both must be NULL [AG] 163 163 ///////////////////////////////////////////////////////////////////////////////////////// 164 164 int sys_exec( char * pathname, // .elf file pathname … … 169 169 error_t error; 170 170 171 uint64_t tm_start;172 uint64_t tm_end;173 174 tm_start = hal_get_cycles();175 176 171 // get parent process pid 177 172 thread_t * this = CURRENT_THREAD; … … 179 174 pid_t pid = process->pid; 180 175 181 exec_dmsg("\n[DBG] %s : core[%x,%d] enters for process %x / cycle %d\n", 182 __FUNCTION__, local_cxy, this->core->lid, pid, (uint32_t)hal_get_cycles() ); 176 #if CONFIG_SYSCALL_DEBUG 177 uint64_t tm_start; 178 uint64_t tm_end; 179 tm_start = hal_get_cycles(); 180 printk("\n[DBG] %s : core[%x,%d] enter / process %x / path = %s / cycle = %d\n", 181 __FUNCTION__, local_cxy, this->core->lid, pid, exec_info.path, (uint32_t)tm_start ); 182 #endif 183 183 184 184 // get owner cluster … … 249 249 } 250 250 251 tm_end = hal_get_cycles(); 252 253 exec_dmsg("\n[DBG] %s : core[%x,%d] exit for process %x / cycle %d\n" 254 " pathname = %s / cost = %d\n", 255 __FUNCTION__, local_cxy, this->core->lid, pid, (uint32_t)tm_start, 256 exec_info.path , (uint32_t)(tm_end - tm_start) ); 251 #if CONFIG_SYSCALL_DEBUG 252 tm_end = hal_get_cycles(); 253 printk("\n[DBG] %s : core[%x,%d] exit / process %x / path = %s / cost = %d\n", 254 __FUNCTION__, local_cxy, this->core->lid, pid, exec_info.path, (uint32_t)(tm_end - tm_start) ); 255 #endif 257 256 258 257 return 0; -
trunk/kernel/syscalls/sys_exit.c
r410 r416 1 1 /* 2 * sys_exit.c : Terminate the calling process.2 * sys_exit.c - Kernel function implementing the "exit" system call. 3 3 * 4 4 * Author Alain Greiner (2016,2017) … … 38 38 uint32_t save_sr; // required to enable IRQs 39 39 40 thread_t * this = CURRENT_THREAD; 41 pid_t pid = this->process->pid; 42 40 43 #if CONFIG_SYSCALL_DEBUG 41 44 uint64_t tm_start; 42 45 uint64_t tm_end; 43 46 tm_start = hal_get_cycles(); 47 printk("\n[DBG] %s : core[%x,%d] enter / process %x / status %x / cycle %d\n", 48 __FUNCTION__ , local_cxy , this->core->lid , pid , status , (uint32_t)tm_start ); 44 49 #endif 45 50 46 thread_t * this = CURRENT_THREAD;47 process_t * process = this->process;48 49 51 // get owner process cluster 50 cxy_t owner_cxy = CXY_FROM_PID( p rocess->pid );52 cxy_t owner_cxy = CXY_FROM_PID( pid ); 51 53 52 54 // enable IRQs … … 56 58 if( local_cxy == owner_cxy ) // owner is local 57 59 { 58 process_make_exit( p rocess, status );60 process_make_exit( pid , status ); 59 61 } 60 62 else // owner is remote 61 63 { 62 rpc_process_make_exit_client( owner_cxy, p rocess, status );64 rpc_process_make_exit_client( owner_cxy, pid , status ); 63 65 } 64 66 … … 70 72 #if CONFIG_SYSCALL_DEBUG 71 73 tm_end = hal_get_cycles(); 72 syscall_dmsg("\n[DBG] %s exit : core[%x,%d] / thread %x in process %x / cycle %d\n" 73 "process %x killed / cost = %d\n", 74 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid , 75 tm_start , pid , (uint32_t)(tm_end - tm_start) ); 74 printk("\n[DBG] %s : core[%x,%d] exit / process %x / status %x / cost = %d\n", 75 __FUNCTION__ , local_cxy , this->core->lid , pid , status , (uint32_t)(tm_end - tm_start) ); 76 76 #endif 77 77 -
trunk/kernel/syscalls/sys_fork.c
r409 r416 56 56 error_t error; 57 57 58 uint64_t tm_start;59 uint64_t tm_end;60 61 tm_start = hal_get_cycles();62 58 63 59 // get pointers on local parent process and thread … … 67 63 parent_pid = parent_process_ptr->pid; 68 64 69 fork_dmsg("\n[DBG] %s : core[%x,%d] parent process %x enters / cycle %d\n", 70 __FUNCTION__, local_cxy, parent_thread_ptr->core->lid, parent_pid, (uint32_t)tm_start ); 65 #if CONFIG_SYSCALL_DEBUG 66 uint64_t tm_start; 67 uint64_t tm_end; 68 tm_start = hal_get_cycles(); 69 printk("\n[DBG] %s : core[%x,%d] enter / process %x / cycle = %d\n", 70 __FUNCTION__, local_cxy, parent_thread_ptr->core->lid, parent_pid, 71 (uint32_t)tm_start ); 72 #endif 71 73 72 74 // get infos on reference process … … 146 148 thread_unblock( XPTR( target_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL ); 147 149 148 tm_end = hal_get_cycles(); 149 150 fork_dmsg("\n[DBG] %s : core[%x,%d] parent_process %x exit / cycle %d\n" 151 " child_process %x / child_thread = %x / cost = %d\n", 152 __FUNCTION__, local_cxy, parent_thread_ptr->core->lid, parent_pid, (uint32_t)tm_end, 153 child_pid, child_thread_ptr->trdid , (uint32_t)(tm_end - tm_start) ); 150 #if CONFIG_SYSCALL_DEBUG 151 tm_end = hal_get_cycles(); 152 printk("\n[DBG] %s : core[%x,%d] parent_process %x exit / cost = %d\n", 153 __FUNCTION__, local_cxy, parent_thread_ptr->core->lid, parent_pid, 154 (uint32_t)(tm_end - tm_start) ); 155 #endif 154 156 155 157 return child_pid; … … 158 160 { 159 161 160 tm_end = hal_get_cycles(); 161 162 fork_dmsg("\n[DBG] %s : core[%x,%d] child process %x exit / cycle %d\n", 163 __FUNCTION__, local_cxy, parent_thread_ptr->core->lid, child_pid, (uint32_t)tm_end ); 162 #if CONFIG_SYSCALL_DEBUG 163 tm_end = hal_get_cycles(); 164 printk("\n[DBG] %s : core[%x,%d] child process %x exit / cost = %d\n", 165 __FUNCTION__, local_cxy, parent_thread_ptr->core->lid, child_pid, 166 (uint32_t)(tm_end - tm_start) ); 167 #endif 164 168 165 169 return 0; -
trunk/kernel/syscalls/sys_kill.c
r409 r416 1 1 /* 2 * sys_kill.c - Send a signal to a given process.2 * sys_kill.c - Kernel function implementing the "kill" system call. 3 3 * 4 4 * Author Alain Greiner (2016,2017) … … 29 29 #include <printk.h> 30 30 #include <process.h> 31 #include <s ignal.h>31 #include <shared_syscalls.h> 32 32 #include <cluster.h> 33 33 #include <rpc.h> … … 39 39 uint32_t save_sr; // required to enable IRQs 40 40 41 thread_t * this = CURRENT_THREAD; 42 41 43 #if CONFIG_SYSCALL_DEBUG 42 44 uint64_t tm_start; 43 45 uint64_t tm_end; 44 46 tm_start = hal_get_cycles(); 47 printk("\n[DBG] %s : core[%x,%d] enter / process %x / sig %d / cycle %d\n", 48 __FUNCTION__ , local_cxy , this->core->lid , pid, sig_id, (uint32_t)tm_start ); 45 49 #endif 46 47 thread_t * this = CURRENT_THREAD;48 process_t * process = this->process;49 50 50 51 // get owner process cluster and lpid … … 76 77 if( local_cxy == owner_cxy ) // owner is local 77 78 { 78 process_make_kill( p rocess, sig_id );79 process_make_kill( pid , sig_id ); 79 80 } 80 81 else // owner is remote 81 82 { 82 rpc_process_make_kill_client( owner_cxy , p rocess, sig_id );83 rpc_process_make_kill_client( owner_cxy , pid , sig_id ); 83 84 } 84 85 … … 90 91 #if CONFIG_SYSCALL_DEBUG 91 92 tm_end = hal_get_cycles(); 92 syscall_dmsg("\n[DBG] %s exit : core[%x,%d] / thread %x in process %x / cycle %d\n" 93 "process %x killed / cost = %d\n", 94 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid , 95 tm_start , pid , (uint32_t)(tm_end - tm_start) ); 93 printk("\n[DBG] %s : core[%x,%d] exit / process %x / sig %d / cost = %d\n", 94 __FUNCTION__ , local_cxy , this->core->lid , pid, sig_id, (uint32_t)(tm_end - tm_start) ); 96 95 #endif 97 96 -
trunk/kernel/syscalls/sys_read.c
r409 r416 164 164 #if CONFIG_SYSCALL_DEBUG 165 165 tm_end = hal_get_cycles(); 166 syscall_dmsg("\n[DBG] %s exit: core[%x,%d] / thread %x in process %x / cycle %d\n"166 printk("\n[DBG] %s : core[%x,%d] / thread %x in process %x / cycle %d\n" 167 167 "nbytes = %d / first byte = %c / file_id = %d / cost = %d\n", 168 168 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid , 169 tm_start , nbytes , *((char *)(intptr_t)paddr) , file_id , tm_end - tm_start ); 169 (uint32_t)tm_start , nbytes , *((char *)(intptr_t)paddr) , file_id , 170 (uint32_t)(tm_end - tm_start) ); 170 171 #endif 171 172 -
trunk/kernel/syscalls/sys_write.c
r409 r416 141 141 #if CONFIG_SYSCALL_DEBUG 142 142 tm_end = hal_get_cycles(); 143 syscall_dmsg("\n[DBG] %s : core[%x,%d] / thread %x in process %x / cycle %d\n"143 printk("\n[DBG] %s : core[%x,%d] / thread %x in process %x / cycle %d\n" 144 144 "nbytes = %d / first byte = %c / file_id = %d / cost = %d\n", 145 145 __FUNCTION__ , local_cxy , this->core->lid , this->trdid , this->process->pid , 146 tm_start , nbytes , *((char *)(intptr_t)paddr) , file_id , tm_end - tm_start ); 146 (uint32_t)tm_start , nbytes , *((char *)(intptr_t)paddr) , file_id , 147 (uint32_t)(tm_end - tm_start) ); 147 148 #endif 148 149
Note: See TracChangeset
for help on using the changeset viewer.