Changeset 440 for trunk/kernel/syscalls/sys_condvar.c
- Timestamp:
- May 3, 2018, 5:51:22 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_condvar.c
r23 r440 2 2 * sys_condvar.c - Access a POSIX condvar. 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 30 30 #include <syscalls.h> 31 31 #include <remote_condvar.h> 32 #include <remote_mutex.h> 32 33 33 34 //////////////////////////////////////// … … 36 37 void * mutex ) 37 38 { 38 error_t error;39 paddr_t paddr;39 error_t error; 40 vseg_t * vseg; 40 41 41 thread_t * this = CURRENT_THREAD; 42 thread_t * this = CURRENT_THREAD; 43 process_t * process = this->process; 42 44 43 45 // check condvar in user vspace 44 error = vmm_v2p_translate( false , condvar , &paddr ); 46 error = vmm_get_vseg( process , (intptr_t)condvar , &vseg ); 47 45 48 if( error ) 46 49 { 47 printk("\n[ERROR] in %s : illegal condvar virtual address = %x\n", 48 __FUNCTION__ , (intptr_t)condvar ); 50 51 #if DEBUG_SYSCALLS_ERROR 52 printk("\n[ERROR] in %s : unmapped condvar %x / thread %x / process %x\n", 53 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 54 vmm_display( process , false ); 55 #endif 49 56 this->errno = error; 50 57 return -1; … … 61 68 if( error ) 62 69 { 63 printk("\n[ERROR] in %s : cannot create condvar = %x\n", 64 __FUNCTION__ , (intptr_t)condvar ); 70 71 #if DEBUG_SYSCALLS_ERROR 72 printk("\n[ERROR] in %s : cannot create condvar %x / thread %x / process %x\n", 73 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 74 #endif 65 75 this->errno = error; 66 76 return -1; … … 72 82 { 73 83 // check mutex in user vspace 74 error = vmm_ v2p_translate( false , mutex , &paddr);84 error = vmm_get_vseg( process , (intptr_t)mutex , &vseg ); 75 85 76 86 if( error ) 77 87 { 78 printk("\n[ERROR] in %s : illegal condvar virtual address = %x\n", 79 __FUNCTION__ , (intptr_t)condvar ); 88 89 #if DEBUG_SYSCALLS_ERROR 90 printk("\n[ERROR] in %s : unmapped mutex %x / thread %x / process %x\n", 91 __FUNCTION__ , (intptr_t)mutex , this->trdid , process->pid ); 92 #endif 80 93 this->errno = error; 81 94 return -1; … … 86 99 if( condvar_xp == XPTR_NULL ) // user error 87 100 { 88 printk("\n[ERROR] in %s : condvar %x not registered\n", 89 __FUNCTION__ , (intptr_t)condvar ); 101 102 #if DEBUG_SYSCALLS_ERROR 103 printk("\n[ERROR] in %s : condvar %x not registered / thread %x / process %x\n", 104 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 105 #endif 90 106 this->errno = EINVAL; 91 107 return -1; 92 108 } 93 109 94 xptr_t mutex_xp = remote_condvar_from_ident( (intptr_t)condvar ); 110 xptr_t mutex_xp = remote_mutex_from_ident( (intptr_t)mutex ); 111 95 112 if( mutex_xp == XPTR_NULL ) // user error 96 113 { 97 printk("\n[ERROR] in %s : mutex %x not registered\n", 98 __FUNCTION__ , (intptr_t)condvar ); 114 115 #if DEBUG_SYSCALLS_ERROR 116 printk("\n[ERROR] in %s : mutex %x not registered / thread %x / process %x\n", 117 __FUNCTION__ , (intptr_t)mutex , this->trdid , process->pid ); 118 #endif 99 119 this->errno = EINVAL; 100 120 return -1; … … 112 132 if( condvar_xp == XPTR_NULL ) // user error 113 133 { 114 printk("\n[ERROR] in %s : condvar %x not registered\n", 115 __FUNCTION__ , (intptr_t)condvar ); 134 135 #if DEBUG_SYSCALLS_ERROR 136 printk("\n[ERROR] in %s : condvar %x not registered / thread %x / process %x\n", 137 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 138 #endif 116 139 this->errno = EINVAL; 117 140 return -1; … … 129 152 if( condvar_xp == XPTR_NULL ) // user error 130 153 { 131 printk("\n[ERROR] in %s : condvar %x not registered\n", 132 __FUNCTION__ , (intptr_t)condvar ); 154 155 #if DEBUG_SYSCALLS_ERROR 156 printk("\n[ERROR] in %s : condvar %x not registered / thread %x / process %x\n", 157 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 158 #endif 133 159 this->errno = EINVAL; 134 160 return -1; … … 146 172 if( condvar_xp == XPTR_NULL ) // user error 147 173 { 148 printk("\n[ERROR] in %s : condvar %x not registered\n", 149 __FUNCTION__ , (intptr_t)condvar ); 174 175 #if DEBUG_SYSCALLS_ERROR 176 printk("\n[ERROR] in %s : condvar %x not registered / thread %x / process %x\n", 177 __FUNCTION__ , (intptr_t)condvar , this->trdid , process->pid ); 178 #endif 150 179 this->errno = EINVAL; 151 180 return -1;
Note: See TracChangeset
for help on using the changeset viewer.