Changeset 619 for trunk/libs


Ignore:
Timestamp:
Feb 12, 2019, 1:15:47 PM (3 years ago)
Author:
alain
Message:

1) Fix a bug in KSH : after the "load" command,

the [ksh] prompt is now printed after completion
of the loaded application.

2) Fix a bug in vmm_handle_cow() : the copy-on-write

use now a hal_remote_memcpy() to replicate the page content.


Location:
trunk/libs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/libpthread/pthread.c

    r609 r619  
    22 * pthread.c - User level <pthread> library implementation.
    33 *
    4  * Author     Alain Greiner (2016,2017,2018)
     4 * Author     Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    202202                          unsigned int                  count )
    203203{
    204     if ( attr )
    205     {
    206         printf("[ERROR] in %s ; <attr> argument must be NULL\n", __FUNCTION__ );
    207         return -1;
    208     }
    209 
    210204    return hal_user_syscall( SYS_BARRIER,
    211205                             (reg_t)barrier,
    212206                             BARRIER_INIT,
    213207                             (reg_t)count,
    214                              0 );
     208                             (reg_t)attr );
    215209}
    216210
     
    362356    }
    363357
    364     // check attributes
     358    // check attributes / count
    365359    if( (x_size * y_size * nthreads) != count )
    366360    {
  • trunk/libs/libsemaphore/semaphore.h

    r573 r619  
    2727//////////////////////////////////////////////////////////////////////////////////////////////
    2828//             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.
    2938//////////////////////////////////////////////////////////////////////////////////////////////
    3039
     
    3746 * @ sem         : [in]  pointer on semaphore.
    3847 * @ pshared     : [in]  unsupported => must be zero.
    39  * @ value       : [in]  initial semaphore value.
     48 * @ count       : [in]  initial semaphore value.
    4049 * @ return 0 if success / return -1 if failure.
    4150 ********************************************************************************************/
    4251int sem_init( sem_t        * sem,
    4352              int            pshared,
    44               unsigned int   value );
     53              unsigned int   count );
    4554
    4655/*********************************************************************************************
  • trunk/libs/mini-libc/string.c

    r473 r619  
    8080
    8181
    82 ///////////////////////////
    83 char * strcpy (char * dest,
     82//////////////////////////
     83char * strcpy (char * dst,
    8484               char * src )
    8585{
    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///////////////////////////////////
     100char * strncpy( char         * dst,
    97101                char         * src,
    98                 unsigned int   n )
     102                unsigned int   count )
    99103{
    100104        unsigned int i;
    101105
    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;
    107113}
    108114
  • trunk/libs/mini-libc/string.h

    r445 r619  
    7070 * @ return 0 if s1 == s2 / return 1 if s1 > s2 / return -1 if s1 < s2
    7171 *******************************************************************************************/
    72 int strncmp ( const char * s1,
    73               const char * s2,
     72int strncmp ( const char     * s1,
     73              const char     * s2,
    7474              unsigned int     n );
    7575
     
    8484
    8585/********************************************************************************************
    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.
    8787 ********************************************************************************************
    8888 * @ dst   : pointer on destination buffer.
    8989 * @ src   : pointer on source buffer.
    90  * @ n    : number of characters to be copied.
     90 * @ count : number of characters to be copied.
    9191 *******************************************************************************************/
    9292char * strncpy ( char         * dst,
    9393                 char         * src,
    94                  unsigned int   n );
     94                 unsigned int   count );
    9595
    9696/********************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.