Changeset 440 for trunk/kernel/syscalls/sys_sem.c
- Timestamp:
- May 3, 2018, 5:51:22 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_sem.c
r23 r440 2 2 * sys_sem.c - Acces a POSIX unamed semaphore. 3 3 * 4 * Authors Alain Greiner (2016,2017 )4 * Authors Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 36 36 uint32_t * value ) // pointer on in/out argument 37 37 { 38 uint32_t 39 paddr_t paddr;40 error_t 38 uint32_t data; 39 vseg_t * vseg; 40 error_t error; 41 41 42 thread_t * this = CURRENT_THREAD; 42 thread_t * this = CURRENT_THREAD; 43 process_t * process = this->process; 43 44 44 45 // check vaddr in user vspace 45 error = vmm_ v2p_translate( false , vaddr , &paddr);46 error = vmm_get_vseg( process , (intptr_t)vaddr , &vseg ); 46 47 if( error ) 47 48 { 48 printk("\n[ERROR] in %s : illegal semaphore virtual address = %x\n", 49 __FUNCTION__ , (intptr_t)vaddr ); 50 this->errno = error; 49 50 #if DEBUG_SYSCALLS_ERROR 51 printk("\n[ERROR] in %s : unmapped semaphore %x / thread %x / process %x\n", 52 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid ); 53 vmm_display( process , false ); 54 #endif 55 this->errno = EINVAL; 51 56 return -1; 52 57 } 53 58 54 59 // check value in user vspace 55 error = vmm_ v2p_translate( false , value , &paddr);60 error = vmm_get_vseg( process , (intptr_t)value , &vseg ); 56 61 if( error ) 57 62 { 58 printk("\n[ERROR] in %s : illegal argument virtual address = %x\n", 59 __FUNCTION__ , (intptr_t)value ); 60 this->errno = error; 61 return -1; 63 64 #if DEBUG_SYSCALLS_ERROR 65 printk("\n[ERROR] in %s : unmapped value %x / thread %x / process %x\n", 66 __FUNCTION__ , (intptr_t)vaddr, this->trdid, process->pid ); 67 vmm_display( process , false ); 68 #endif 69 this->errno = EINVAL; 70 return -1; 62 71 } 63 72 64 73 // execute requested operation 65 74 switch( operation ) … … 91 100 if( sem_xp == XPTR_NULL ) // user error 92 101 { 93 printk("\n[ERROR] in %s : semaphore %x not registered\n", 94 __FUNCTION__ , (intptr_t)value ); 102 103 #if DEBUG_SYSCALLS_ERROR 104 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n", 105 __FUNCTION__ , (intptr_t)value, this->trdid, process->pid ); 106 #endif 95 107 this->errno = EINVAL; 96 108 return -1; … … 114 126 if( sem_xp == XPTR_NULL ) // user error 115 127 { 116 printk("\n[ERROR] in %s : semaphore %x not registered\n", 117 __FUNCTION__ , (intptr_t)value ); 128 129 #if DEBUG_SYSCALLS_ERROR 130 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n", 131 __FUNCTION__ , (intptr_t)value, this->trdid, process->pid ); 132 #endif 118 133 this->errno = EINVAL; 119 134 return -1; … … 134 149 if( sem_xp == XPTR_NULL ) // user error 135 150 { 136 printk("\n[ERROR] in %s : semaphore %x not registered\n", 137 __FUNCTION__ , (intptr_t)value ); 151 152 #if DEBUG_SYSCALLS_ERROR 153 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n", 154 __FUNCTION__ , (intptr_t)value, this->trdid, process->pid ); 155 #endif 138 156 this->errno = EINVAL; 139 157 return -1; … … 154 172 if( sem_xp == XPTR_NULL ) // user error 155 173 { 156 printk("\n[ERROR] in %s : semaphore %x not registered\n", 157 __FUNCTION__ , (intptr_t)value ); 174 175 #if DEBUG_SYSCALLS_ERROR 176 printk("\n[ERROR] in %s : semaphore %x not registered / thread %x / process %x\n", 177 __FUNCTION__ , (intptr_t)value, this->trdid, process->pid ); 178 #endif 158 179 this->errno = EINVAL; 159 180 return -1;
Note: See TracChangeset
for help on using the changeset viewer.