Changeset 625 for trunk/kernel/syscalls
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (6 years ago)
- Location:
- trunk/kernel/syscalls
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_barrier.c
r624 r625 2 2 * sys_barrier.c - Access a POSIX barrier. 3 3 * 4 * authors Alain Greiner (2016,2017,2018 )4 * authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 25 25 #include <hal_special.h> 26 26 #include <hal_uspace.h> 27 #include <hal_vmm.h> 27 28 #include <errno.h> 28 29 #include <thread.h> … … 56 57 process_t * process = this->process; 57 58 59 #if (DEBUG_SYS_BARRIER || CONFIG_INSTRUMENTATION_SYSCALLS) 60 uint64_t tm_start = hal_get_cycles(); 61 #endif 62 58 63 #if DEBUG_SYS_BARRIER 59 uint64_t tm_start;60 uint64_t tm_end;61 tm_start = hal_get_cycles();62 64 if( DEBUG_SYS_BARRIER < tm_start ) 63 65 printk("\n[%s] thread[%x,%x] enters for %s / count %d / cycle %d\n", … … 184 186 } // end switch 185 187 188 hal_fence(); 189 190 #if (DEBUG_SYS_BARRIER || CONFIG_INSTRUMENTATION_SYSCALLS) 191 uint64_t tm_end = hal_get_cycles(); 192 #endif 193 186 194 #if DEBUG_SYS_BARRIER 187 tm_end = hal_get_cycles();188 195 if( DEBUG_SYS_BARRIER < tm_end ) 189 printk("\n[%s] thread[%x,%x] exit for %s / cost %d / cycle %d\n", 190 __FUNCTION__, process->pid, this->trdid, sys_barrier_op_str(operation), 191 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 196 printk("\n[%s] thread[%x,%x] exit for %s / cycle %d\n", 197 __FUNCTION__, process->pid, this->trdid, sys_barrier_op_str(operation), (uint32_t)tm_end ); 198 #endif 199 200 #if CONFIG_INSTRUMENTATION_SYSCALLS 201 hal_atomic_add( &syscalls_cumul_cost[SYS_BARRIER] , tm_end - tm_start ); 202 hal_atomic_add( &syscalls_occurences[SYS_BARRIER] , 1 ); 192 203 #endif 193 204 -
trunk/kernel/syscalls/sys_close.c
r594 r625 35 35 int sys_close ( uint32_t file_id ) 36 36 { 37 error_t error; 38 xptr_t file_xp; 37 error_t error; 38 xptr_t file_xp; 39 cxy_t file_cxy; 40 vfs_file_t * file_ptr; 41 vfs_inode_type_t file_type; 39 42 40 43 thread_t * this = CURRENT_THREAD; … … 54 57 if( file_id >= CONFIG_PROCESS_FILE_MAX_NR ) 55 58 { 56 printk("\n[ERROR] in %s : illegal file descriptor index = %d\n", 57 __FUNCTION__ , file_id ); 59 60 #if DEBUG_SYSCALLS_ERROR 61 printk("\n[ERROR] in %s : illegal file descriptor index = %d\n", 62 __FUNCTION__ , file_id ); 63 #endif 58 64 this->errno = EBADFD; 59 65 return -1; … … 73 79 return -1; 74 80 } 81 82 // get file type 83 file_cxy = GET_CXY( file_xp ); 84 file_ptr = GET_PTR( file_xp ); 85 file_type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) ); 86 87 if( file_type == INODE_TYPE_DIR ) 88 { 89 90 #if DEBUG_SYSCALLS_ERROR 91 printk("\n[ERROR] in %s : file descriptor %d is a directory\n", 92 __FUNCTION__ , file_id ); 93 #endif 94 this->errno = EBADFD; 95 return -1; 96 } 75 97 76 98 // call the relevant VFS function -
trunk/kernel/syscalls/sys_display.c
r624 r625 96 96 // check string in user space 97 97 error = vmm_get_vseg( process , (intptr_t)arg0 , &vseg ); 98 99 98 if( error ) 100 99 { … … 110 109 // ckeck string length 111 110 length = hal_strlen_from_uspace( string ); 112 113 111 if( length >= 512 ) 114 112 { … … 150 148 // get extended pointer on process PID in cluster CXY 151 149 xptr_t process_xp = cluster_get_process_from_pid_in_cxy( cxy , pid ); 152 153 150 if( process_xp == XPTR_NULL ) 154 151 { -
trunk/kernel/syscalls/sys_exec.c
r584 r625 2 2 * sys_exec.c - Kernel function implementing the "exec" system call. 3 3 * 4 * Authors Alain Greiner (2016,2017 )4 * Authors Alain Greiner (2016,2017,2017,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 208 208 #if DEBUG_SYS_EXEC 209 209 if( DEBUG_SYS_EXEC < tm_start ) 210 printk("\n[ DBG] %s :thread[%x,%x] enter for path <%s> / cycle = %d\n",210 printk("\n[%s] thread[%x,%x] enter for path <%s> / cycle = %d\n", 211 211 __FUNCTION__, pid, this->trdid, exec_info.path, (uint32_t)tm_start ); 212 212 #endif … … 256 256 } 257 257 258 assert( false , "we should n otexecute this code" );258 assert( false , "we should never execute this code" ); 259 259 260 260 return 0; -
trunk/kernel/syscalls/sys_exit.c
r619 r625 2 2 * sys_exit.c - Kernel function implementing the "exit" system call. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 53 53 pid_t pid = process->pid; 54 54 55 #if (DEBUG_SYS_EXIT || CONFIG_INSTRUMENTATION_SYSCALLS) 56 uint64_t tm_start = hal_get_cycles(); 57 #endif 58 55 59 #if DEBUG_SYS_EXIT 56 uint64_t tm_start;57 uint64_t tm_end;58 tm_start = hal_get_cycles();59 60 if( DEBUG_SYS_EXIT < tm_start ) 60 61 printk("\n[%s] thread[%x,%x] enter / status %x / cycle %d\n", 61 __FUNCTION__, p rocess->pid, this->trdid , status , (uint32_t)tm_start );62 __FUNCTION__, pid, this->trdid , status , (uint32_t)tm_start ); 62 63 #endif 63 64 … … 66 67 owner_cxy = GET_CXY( owner_xp ); 67 68 owner_ptr = GET_PTR( owner_xp ); 68 69 #if (DEBUG_SYS_EXIT & 1)70 if( DEBUG_SYS_EXIT < tm_start )71 printk("\n[%s] thread[%x,%x] get owner process in cluster %x\n",72 __FUNCTION__, process->pid, this->trdid, owner_cxy );73 #endif74 69 75 70 // get local pointer on the main thread … … 80 75 parent_cxy = GET_CXY( parent_xp ); 81 76 parent_ptr = GET_PTR( parent_xp ); 82 83 #if (DEBUG_SYS_EXIT & 1)84 if( DEBUG_SYS_EXIT < tm_start )85 printk("\n[%s] thread[%x,%x] get parent process in cluster %x\n",86 __FUNCTION__, process->pid, this->trdid, parent_cxy );87 #endif88 77 89 78 // get pointers on the parent process main thread … … 96 85 #if( DEBUG_SYS_EXIT & 1) 97 86 if( DEBUG_SYS_EXIT < tm_start ) 98 printk("\n[%s] thread[%x,%x] detached process from TXT\n",99 __FUNCTION__, p rocess->pid, this->trdid );87 printk("\n[%s] thread[%x,%x] detached process %x from TXT\n", 88 __FUNCTION__, pid, this->trdid, pid ); 100 89 #endif 101 90 102 91 // mark for delete all process threads in all clusters, 103 92 // but the main thread and this calling thread 104 process_sigaction( p rocess->pid , DELETE_ALL_THREADS );93 process_sigaction( pid , DELETE_ALL_THREADS ); 105 94 106 95 #if( DEBUG_SYS_EXIT & 1) 107 96 if( DEBUG_SYS_EXIT < tm_start ) 108 printk("\n[%s] thread[%x,%x] deleted all threads but itself\n",109 __FUNCTION__, p rocess->pid, this->trdid );97 printk("\n[%s] thread[%x,%x] deleted all threads in process %x (but itself)\n", 98 __FUNCTION__, pid, this->trdid, pid ); 110 99 #endif 111 100 … … 116 105 #if( DEBUG_SYS_EXIT & 1) 117 106 if( tm_start > DEBUG_SYS_EXIT ) 118 printk("\n[% u] thread[%x,%x] marked iself for delete\n",119 __FUNCTION__, p rocess->pid, this->trdid );107 printk("\n[%s] thread[%x,%x] marked iself for delete\n", 108 __FUNCTION__, pid, this->trdid ); 120 109 #endif 121 110 thread_delete( XPTR( local_cxy , this ) , pid , true ); 122 111 } 123 112 124 // block th ismain thread113 // block the main thread 125 114 thread_block( XPTR( owner_cxy , main_ptr ) , THREAD_BLOCKED_GLOBAL ); 126 115 127 116 #if( DEBUG_SYS_EXIT & 1) 117 trdid_t main_trdid = hal_remote_l32( XPTR( owner_cxy , &main_ptr->trdid ) ); 128 118 if( tm_start > DEBUG_SYS_EXIT ) 129 printk("\n[%s] thread[%x,%x] blocked main thread \n",130 __FUNCTION__, p rocess->pid, this->trdid );119 printk("\n[%s] thread[%x,%x] blocked main thread[%x,%x]\n", 120 __FUNCTION__, pid, this->trdid, pid, main_trdid ); 131 121 #endif 132 122 133 // atomically update owner process descriptor term_stateto ask134 // the parent process sys_wait() function to delete the main thread123 // update term_state in owner process descriptor to ask 124 // the parent process sys_wait() function to delete the process 135 125 term_state = (status & 0xFF) | PROCESS_TERM_EXIT; 136 126 hal_remote_atomic_or( XPTR( owner_cxy , &owner_ptr->term_state ) , term_state ); … … 139 129 if( tm_start > DEBUG_SYS_EXIT ) 140 130 printk("\n[%s] thread[%x,%x] set exit status %x in owner process\n", 141 __FUNCTION__, p rocess->pid, this->trdid, term_state );131 __FUNCTION__, pid, this->trdid, term_state ); 142 132 #endif 143 133 … … 148 138 if( tm_start > DEBUG_SYS_EXIT ) 149 139 printk("\n[%s] thread[%x,%x] unblocked parent main thread in process %x\n", 150 __FUNCTION__ , p rocess->pid, this->trdid,140 __FUNCTION__ , pid, this->trdid, 151 141 hal_remote_l32( XPTR( parent_cxy , &parent_ptr->pid) ) ); 152 142 #endif … … 154 144 hal_fence(); 155 145 146 #if (DEBUG_SYS_EXIT || CONFIG_INSTRUMENTATION_SYSCALLS) 147 uint64_t tm_end = hal_get_cycles(); 148 #endif 149 156 150 #if DEBUG_SYS_EXIT 157 tm_end = hal_get_cycles();158 151 if( DEBUG_SYS_EXIT < tm_end ) 159 printk("\n[%s] thread[%x,%x] exit / status %x / cost = %d / cycle %d\n", 160 __FUNCTION__, process->pid, this->trdid, status, 161 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 152 printk("\n[%s] thread[%x,%x] exit / term_state %x / cycle %d\n", 153 __FUNCTION__, pid, this->trdid, term_state, (uint32_t)tm_end ); 154 #endif 155 156 #if CONFIG_INSTRUMENTATION_SYSCALLS 157 hal_atomic_add( &syscalls_cumul_cost[SYS_EXIT] , tm_end - tm_start ); 158 hal_atomic_add( &syscalls_occurences[SYS_EXIT] , 1 ); 162 159 #endif 163 160 -
trunk/kernel/syscalls/sys_fork.c
r594 r625 2 2 * sys_fork.c - Kernel function implementing the "fork" system call. 3 3 * 4 * Authors Alain Greiner (2016,2017 )4 * Authors Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 73 73 #if DEBUG_SYS_FORK 74 74 if( DEBUG_SYS_FORK < tm_start ) 75 printk("\n[ DBG] %s :thread[%x,%x] enter / cycle = %d\n",75 printk("\n[%s] thread[%x,%x] enter / cycle = %d\n", 76 76 __FUNCTION__, parent_pid, parent_thread_ptr->trdid, (uint32_t)tm_start ); 77 77 #endif … … 151 151 152 152 // set remote child CPU context from parent_thread register values 153 // replicates the parent thread kernel stack to the child thread descriptor, 154 // and finally unblock the child thread. 153 155 hal_cpu_context_fork( XPTR( child_cxy , child_thread_ptr ) ); 154 156 155 157 // From this point, both parent and child threads execute the following code, 156 // but they can be distinguished by the (CURRENT_THREAD,local_cxy) values.157 // - parent unblock child, and return child PID to user application.158 // - child thread does nothing, and return 0 to user pplication159 // The child thread will only execute it when it is unblocked by parent thread.158 // but child thread will only execute it after being unblocked by parent thread. 159 // They can be distinguished by the (CURRENT_THREAD,local_cxy) values. 160 // - parent return child PID to user application. 161 // - child return 0 to user application 160 162 161 163 thread_t * current = CURRENT_THREAD; … … 165 167 #endif 166 168 169 if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) ) // parent thread 170 { 171 167 172 #if DEBUG_SYS_FORK 168 173 if( DEBUG_SYS_FORK < tm_end ) 169 printk("\n[%s] thread[%x,%x] exit/ cycle %d\n",170 __FUNCTION__, current->process->pid, current->trdid, (uint32_t)tm_end );174 printk("\n[%s] parent thread[%x,%x] exit / child_pid %x / cycle %d\n", 175 __FUNCTION__, current->process->pid, current->trdid, child_pid, (uint32_t)tm_end ); 171 176 #endif 172 177 173 if( (current == parent_thread_ptr) && (local_cxy == parent_cxy) ) // parent thread 174 { 175 // parent_thread unblock child_thread 176 thread_unblock( XPTR( child_cxy , child_thread_ptr ) , THREAD_BLOCKED_GLOBAL ); 177 178 // only parent contribute to instrumentation 179 178 // only parent contribute to instrumentation 180 179 #if CONFIG_INSTRUMENTATION_SYSCALLS 181 180 hal_atomic_add( &syscalls_cumul_cost[SYS_FORK] , tm_end - tm_start ); … … 186 185 else // child_thread 187 186 { 187 188 #if DEBUG_SYS_FORK 189 if( DEBUG_SYS_FORK < tm_end ) 190 printk("\n[%s] child thread[%x,%x] exit / child_pid %x / cycle %d\n", 191 __FUNCTION__, current->process->pid, current->trdid, child_pid, (uint32_t)tm_end ); 192 #endif 193 188 194 return 0; 189 195 } -
trunk/kernel/syscalls/sys_get_config.c
r624 r625 2 2 * sys_get_config.c - get hardware platform parameters. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <hal_special.h> 27 28 #include <errno.h> … … 48 49 process_t * process = this->process; 49 50 51 #if (DEBUG_SYS_GET_CONFIG || CONFIG_INSTRUMENTATION_SYSCALLS) 52 uint64_t tm_start = hal_get_cycles(); 53 #endif 54 50 55 #if DEBUG_SYS_GET_CONFIG 51 uint64_t tm_start;52 uint64_t tm_end;53 56 tm_start = hal_get_cycles(); 54 57 if( DEBUG_SYS_GET_CONFIG < tm_start ) … … 114 117 hal_fence(); 115 118 119 #if (DEBUG_SYS_GET_CONFIG || CONFIG_INSTRUMENTATION_SYSCALLS) 120 uint64_t tm_end = hal_get_cycles(); 121 #endif 122 116 123 #if DEBUG_SYS_GET_CONFIG 117 tm_end = hal_get_cycles();118 124 if( DEBUG_SYS_GET_CONFIG < tm_end ) 119 125 printk("\n[DBG] %s : thread %x exit / process %x / cost %d / cycle %d\n", … … 121 127 #endif 122 128 129 #if CONFIG_INSTRUMENTATION_SYSCALLS 130 hal_atomic_add( &syscalls_cumul_cost[SYS_GET_CONFIG] , tm_end - tm_start ); 131 hal_atomic_add( &syscalls_occurences[SYS_GET_CONFIG] , 1 ); 132 #endif 133 123 134 return 0; 124 135 -
trunk/kernel/syscalls/sys_get_core.c
r624 r625 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <hal_special.h> 27 28 #include <errno.h> -
trunk/kernel/syscalls/sys_get_cycle.c
r624 r625 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 26 27 #include <hal_special.h> 27 28 #include <errno.h> -
trunk/kernel/syscalls/sys_is_fg.c
r624 r625 2 2 * sys_fg.c - Kernel function implementing the "is_fg" system call. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 25 25 #include <hal_kernel_types.h> 26 26 #include <hal_uspace.h> 27 #include <hal_vmm.h> 27 28 #include <hal_special.h> 28 29 #include <errno.h> -
trunk/kernel/syscalls/sys_mmap.c
r624 r625 2 2 * sys_mmap.c - map files, memory or devices into process virtual address space 3 3 * 4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 * Alain Greiner (2016,2017,2018) 4 * Authors Alain Greiner (2016,2017,2018,2019) 6 5 * 7 6 * Copyright (c) UPMC Sorbonne Universites … … 25 24 #include <hal_kernel_types.h> 26 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 27 27 #include <hal_irqmask.h> 28 28 #include <shared_syscalls.h> -
trunk/kernel/syscalls/sys_munmap.c
r624 r625 2 2 * sys_munmap.c - unmap a mapping from process virtual address space 3 3 * 4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 * Alain Greiner (2016,2017,2018) 4 * Authors Alain Greiner (2016,2017,2018,2019) 6 5 * 7 6 * Copyright (c) UPMC Sorbonne Universites … … 25 24 #include <hal_kernel_types.h> 26 25 #include <hal_uspace.h> 26 #include <hal_vmm.h> 27 27 #include <hal_irqmask.h> 28 28 #include <shared_syscalls.h> -
trunk/kernel/syscalls/sys_mutex.c
r624 r625 2 2 * sys_mutex.c - Access a POSIX mutex. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <hal_kernel_types.h> 25 25 #include <hal_special.h> 26 #include <hal_vmm.h> 26 27 #include <errno.h> 27 28 #include <thread.h> … … 56 57 process_t * process = this->process; 57 58 59 #if (DEBUG_SYS_MUTEX || CONFIG_INSTRUMENTATION_SYSCALLS) 60 uint64_t tm_start = hal_get_cycles(); 61 #endif 62 58 63 #if DEBUG_SYS_MUTEX 59 uint64_t tm_start;60 uint64_t tm_end;61 tm_start = hal_get_cycles();62 64 if( DEBUG_SYS_MUTEX < tm_start ) 63 printk("\n[ DBG] %s : thread %x in process %xenter for %s / cycle %d\n",65 printk("\n[%s] thread[%x,%x] enter for %s / cycle %d\n", 64 66 __FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), (uint32_t)tm_start ); 65 67 #endif … … 221 223 hal_fence(); 222 224 225 #if (DEBUG_SYS_MUTEX || CONFIG_INSTRUMENTATION_SYSCALLS) 226 uint64_t tm_end = hal_get_cycles(); 227 #endif 228 223 229 #if DEBUG_SYS_MUTEX 224 tm_end = hal_get_cycles(); 225 if( DEBUG_SYS_MUTEX < tm_start ) 226 printk("\n[DBG] %s : thread %x in process %x exit for %s / cost %d / cycle %d\n", 227 __FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), 228 (uint32_t)(tm_end - tm_start), (uint32_t)tm_end ); 230 if( DEBUG_SYS_MUTEX < tm_end ) 231 printk("\n[%s] thread[%x,%x] exit for %s / cycle %d\n", 232 __FUNCTION__, this->trdid, process->pid, sys_mutex_op_str( operation ), (uint32_t)tm_end ); 233 #endif 234 235 #if CONFIG_INSTRUMENTATION_SYSCALLS 236 hal_atomic_add( &syscalls_cumul_cost[SYS_MUTEX] , tm_end - tm_start ); 237 hal_atomic_add( &syscalls_occurences[SYS_MUTEX] , 1 ); 229 238 #endif 230 239 -
trunk/kernel/syscalls/sys_open.c
r610 r625 2 2 * sys_open.c - open a file. 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/kernel/syscalls/sys_opendir.c
r624 r625 2 2 * sys_opendir.c - Open an user accessible VFS directory. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 25 25 #include <hal_kernel_types.h> 26 26 #include <hal_uspace.h> 27 #include <hal_vmm.h> 27 28 #include <thread.h> 28 29 #include <process.h> -
trunk/kernel/syscalls/sys_read.c
r624 r625 1 1 /* 2 * sys_read.c - read bytes from a file2 * sys_read.c - Kernel function implementing the "read" system call. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 24 24 #include <kernel_config.h> 25 25 #include <hal_kernel_types.h> 26 #include <hal_vmm.h> 26 27 #include <hal_uspace.h> 27 28 #include <hal_irqmask.h> -
trunk/kernel/syscalls/sys_readdir.c
r624 r625 25 25 #include <hal_kernel_types.h> 26 26 #include <hal_uspace.h> 27 #include <hal_vmm.h> 27 28 #include <errno.h> 28 29 #include <thread.h> -
trunk/kernel/syscalls/sys_thread_exit.c
r619 r625 64 64 uint64_t tm_start = hal_get_cycles(); 65 65 if( DEBUG_SYS_THREAD_EXIT < tm_start ) 66 printk("\n[%s] thread[%x,%x] /main => delete process / cycle %d\n",66 printk("\n[%s] thread[%x,%x] is main => delete process / cycle %d\n", 67 67 __FUNCTION__ , pid , trdid , (uint32_t)tm_start ); 68 68 #endif … … 76 76 uint64_t tm_start = hal_get_cycles(); 77 77 if( DEBUG_SYS_THREAD_EXIT < tm_start ) 78 printk("\n[%s] thread[%x,%x] /not main => delete thread / cycle %d\n",78 printk("\n[%s] thread[%x,%x] is not main => delete thread / cycle %d\n", 79 79 __FUNCTION__ , pid , trdid , (uint32_t)tm_start ); 80 80 #endif -
trunk/kernel/syscalls/sys_wait.c
r624 r625 2 2 * sys_wait.c - wait termination or blocking of a child process. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 56 56 uint64_t cycle = hal_get_cycles(); 57 57 if( DEBUG_SYS_WAIT < cycle ) 58 printk("\n[ DBG] %s : thread %x in process %xenter / cycle %d\n",59 __FUNCTION__, this, process->pid, (uint32_t)cycle );58 printk("\n[%s] thread[%x,%x] enter / cycle %d\n", 59 __FUNCTION__, pid, this->trdid, (uint32_t)cycle ); 60 60 #endif 61 61 … … 67 67 68 68 #if DEBUG_SYSCALLS_ERROR 69 printk("\n[ERROR] in %s : status buffer %x unmapped for thread %x in process %x\n",70 __FUNCTION__ , (intptr_t)status, this->trdid , process->pid );69 printk("\n[ERROR] in %s : status buffer %x unmapped for thread[%x,%x]\n", 70 __FUNCTION__ , (intptr_t)status, pid, this->trdid ); 71 71 hal_vmm_display( process , false ); 72 72 #endif … … 86 86 87 87 #if DEBUG_SYSCALLS_ERROR 88 printk("\n[ERROR] in %s : calling thread %xis not thread 0 in owner cluster %x\n",89 __FUNCTION__ , trdid , owner_cxy );88 printk("\n[ERROR] in %s : calling thread[%x,%x] is not thread 0 in owner cluster %x\n", 89 __FUNCTION__ , pid, this->trdid , owner_cxy ); 90 90 #endif 91 91 this->errno = EINVAL; … … 119 119 child_thread = hal_remote_lpt(XPTR( child_cxy , &child_ptr->th_tbl[0] )); 120 120 121 #if (DEBUG_SYS_WAIT & 1)122 cycle = hal_get_cycles();123 if( DEBUG_SYS_WAIT < cycle )124 printk("\n[DBG] %s : thread %x in process %x check child %x / state %x\n",125 __FUNCTION__, this, process->pid, child_pid, child_state );126 #endif127 121 // test if this child process is terminated, 128 122 // but termination not yet reported to parent process … … 148 142 if( DEBUG_SYS_WAIT < cycle ) 149 143 { 150 if 151 printk("\n[ DBG] %s : thread %x in process %x exit / child %x exit/ cycle %d\n",152 __FUNCTION__, this, process->pid, child_pid, (uint32_t)cycle );144 if( child_state & PROCESS_TERM_EXIT ) 145 printk("\n[%s] thread[%x,%x] exit : child process %x terminated / cycle %d\n", 146 __FUNCTION__, pid, this->trdid, child_pid, (uint32_t)cycle ); 153 147 if( child_state & PROCESS_TERM_KILL ) 154 printk("\n[ DBG] %s : thread %x in process %x exit / child%x killed / cycle %d\n",155 __FUNCTION__, this, process->pid, child_pid, (uint32_t)cycle );148 printk("\n[%s] thread[%x,%x] exit : child process %x killed / cycle %d\n", 149 __FUNCTION__, pid, this->trdid, child_pid, (uint32_t)cycle ); 156 150 if( child_state & PROCESS_TERM_STOP ) 157 printk("\n[ DBG] %s : thread %x in process %x exit / child%x stopped / cycle %d\n",158 __FUNCTION__, this, process->pid, child_pid, (uint32_t)cycle );151 printk("\n[%s] thread[%x,%x] exit : child process %x stopped / cycle %d\n", 152 __FUNCTION__, pid, this->trdid, child_pid, (uint32_t)cycle ); 159 153 } 160 154 #endif … … 165 159 } // end loop on children 166 160 167 // we execute this code when no child terminated:161 // we execute this code when no child change detected 168 162 // - release the lock protecting children list, 169 163 // - block on the WAIT condition … … 179 173 cycle = hal_get_cycles(); 180 174 if( DEBUG_SYS_WAIT < cycle ) 181 printk("\n[ DBG] %s : thread %x in process %xblock & deschedule / cycle %d\n",182 __FUNCTION__, this, process->pid, (uint32_t)cycle );175 printk("\n[%s] thread[%x,%x] block & deschedule / cycle %d\n", 176 __FUNCTION__, pid, this->trdid, (uint32_t)cycle ); 183 177 #endif 184 178 … … 189 183 cycle = hal_get_cycles(); 190 184 if( DEBUG_SYS_WAIT < cycle ) 191 printk("\n[ DBG] %s : thread %x in process %x unblock &resume / cycle %d\n",192 __FUNCTION__, this, process->pid, (uint32_t)cycle );185 printk("\n[%s] thread[%x,%x] resume / cycle %d\n", 186 __FUNCTION__, pid, this->trdid, (uint32_t)cycle ); 193 187 #endif 194 188 -
trunk/kernel/syscalls/sys_write.c
r624 r625 2 2 * sys_write.c - Kernel function implementing the "write" system call. 3 3 * 4 * Author Alain Greiner (2016,2017,2018 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 76 76 77 77 #if DEBUG_SYS_WRITE 78 tm_start = hal_get_cycles();79 78 if( DEBUG_SYS_WRITE < tm_start ) 80 printk("\n[%s] thread[%x,%x] enter / vaddr %x / count %d/ cycle %d\n",79 printk("\n[%s] thread[%x,%x] enter / vaddr %x / %d bytes / cycle %d\n", 81 80 __FUNCTION__, process->pid, this->trdid, vaddr, count, (uint32_t)tm_start ); 82 81 #endif … … 140 139 hal_enable_irq( &save_sr ); 141 140 142 // action depend on file type143 if( file_type == INODE_TYPE_FILE ) // write to file mapper141 // action depend on file type 142 if( file_type == INODE_TYPE_FILE ) // write to a file mapper 144 143 { 145 144 // check file writable … … 180 179 xptr_t inode_xp = XPTR( file_cxy , inode_ptr ); 181 180 vfs_inode_update_size( inode_xp , file_offset + count ); 182 183 181 } 184 182 else if( file_type == INODE_TYPE_DEV ) // write to TXT device
Note: See TracChangeset
for help on using the changeset viewer.