Changeset 619 for trunk/libs
- Timestamp:
- Feb 12, 2019, 1:15:47 PM (6 years ago)
- Location:
- trunk/libs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libpthread/pthread.c
r609 r619 2 2 * pthread.c - User level <pthread> library implementation. 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 … … 202 202 unsigned int count ) 203 203 { 204 if ( attr )205 {206 printf("[ERROR] in %s ; <attr> argument must be NULL\n", __FUNCTION__ );207 return -1;208 }209 210 204 return hal_user_syscall( SYS_BARRIER, 211 205 (reg_t)barrier, 212 206 BARRIER_INIT, 213 207 (reg_t)count, 214 0);208 (reg_t)attr ); 215 209 } 216 210 … … 362 356 } 363 357 364 // check attributes 358 // check attributes / count 365 359 if( (x_size * y_size * nthreads) != count ) 366 360 { -
trunk/libs/libsemaphore/semaphore.h
r573 r619 27 27 ////////////////////////////////////////////////////////////////////////////////////////////// 28 28 // POSIX unnamed semaphores related functions 29 // 30 // This synchonisation object allows several thread in a given process to share one 31 // (or several) shared resource(s). 32 // - The sem_wait() function allows a thread to take one resource and atomically 33 // decrement the semaphore count. If the count value is zero, the calling thread 34 // blocks and deschedules. It is unblocked by another thread when it becomes possible 35 // to make the decrement. 36 // - the sem_post() functions allows a thread to release a resource and atomicalli 37 // increment the semaphore count. 29 38 ////////////////////////////////////////////////////////////////////////////////////////////// 30 39 … … 37 46 * @ sem : [in] pointer on semaphore. 38 47 * @ pshared : [in] unsupported => must be zero. 39 * @ value: [in] initial semaphore value.48 * @ count : [in] initial semaphore value. 40 49 * @ return 0 if success / return -1 if failure. 41 50 ********************************************************************************************/ 42 51 int sem_init( sem_t * sem, 43 52 int pshared, 44 unsigned int value);53 unsigned int count ); 45 54 46 55 /********************************************************************************************* -
trunk/libs/mini-libc/string.c
r473 r619 80 80 81 81 82 ////////////////////////// /83 char * strcpy (char * d est,82 ////////////////////////// 83 char * strcpy (char * dst, 84 84 char * src ) 85 85 { 86 char *src_ptr = src; 87 char *dst_ptr = dest; 88 89 while(*src_ptr) *(dst_ptr++) = *(src_ptr++); 90 91 *dst_ptr = 0; 92 return dest; 93 } 94 95 //////////////////////////////////// 96 char * strncpy( char * dest, 86 while( *src ) 87 { 88 *(dst) = *(src); 89 dst++; 90 src++; 91 } 92 93 // set NUL terminating character 94 *dst = 0; 95 96 return dst; 97 } 98 99 /////////////////////////////////// 100 char * strncpy( char * dst, 97 101 char * src, 98 unsigned int n)102 unsigned int count ) 99 103 { 100 104 unsigned int i; 101 105 102 for (i = 0; (i < n) && (src[i] != '\0') ; i++) dest[i] = src[i]; 103 104 for (; i < n; i++) dest[i] = '\0'; 105 106 return dest; 106 // copy at most count characters 107 for (i = 0 ; (i < count) && (src[i] != '\0') ; i++) dst[i] = src[i]; 108 109 // complete with NUL characters 110 for ( ; i < count ; i++) dst[i] = '\0'; 111 112 return dst; 107 113 } 108 114 -
trunk/libs/mini-libc/string.h
r445 r619 70 70 * @ return 0 if s1 == s2 / return 1 if s1 > s2 / return -1 if s1 < s2 71 71 *******************************************************************************************/ 72 int strncmp ( const char * s1,73 const char * s2,72 int strncmp ( const char * s1, 73 const char * s2, 74 74 unsigned int n ); 75 75 … … 84 84 85 85 /******************************************************************************************** 86 * This function copies < n> characters from the <sr> buffer to the <dst> buffer.86 * This function copies <count> characters from the <src> buffer to the <dst> buffer. 87 87 ******************************************************************************************** 88 88 * @ dst : pointer on destination buffer. 89 89 * @ src : pointer on source buffer. 90 * @ n: number of characters to be copied.90 * @ count : number of characters to be copied. 91 91 *******************************************************************************************/ 92 92 char * strncpy ( char * dst, 93 93 char * src, 94 unsigned int n);94 unsigned int count ); 95 95 96 96 /********************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.