Changeset 625 for trunk/libs/mini-libc


Ignore:
Timestamp:
Apr 10, 2019, 10:09:39 AM (6 years ago)
Author:
alain
Message:

Fix a bug in the vmm_remove_vseg() function: the physical pages
associated to an user DATA vseg were released to the kernel when
the target process descriptor was in the reference cluster.
This physical pages release should be done only when the page
forks counter value is zero.
All other modifications are cosmetic.

Location:
trunk/libs/mini-libc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/mini-libc/stdio.c

    r624 r625  
    403403   
    404404    // check stream valid
    405     if( stream->key != VALID_OPEN_FILE ) return EOF;
     405    if( stream->key != VALID_OPEN_FILE )
     406    {
     407        printf("\n[error in %s] stream %x non registered\n", __FUNCTION__, stream );
     408        return -1;
     409    }
    406410
    407411    va_start( args, format );
     
    409413    va_end( args );
    410414
     415    // check format
    411416    if ( count < 0 )
    412417    {
    413         display_string( "fprintf : xprintf failure" );
     418        printf("\n[error in %s] unsupported format %s\n", __FUNCTION__, format );
    414419        return -1;
    415420    }
    416     else
    417     {
    418         // get file descriptor from file pointer
    419         fd = stream->fd;
    420 
    421         // set terminating NUL
    422         string[count] = 0;
    423 
    424 printf("\n[%s] fd = %d for string : %s\n", __FUNCTION__, fd, string );
    425 
    426 idbg();
    427 
    428         // copy string to file
    429         writen = write( fd , &string , count );
    430 
    431         if( writen != count )
    432         {
    433             display_string( "fprintf : write failure" );
    434             return -1;
    435         }
    436 
    437 idbg();
    438 
    439         return writen;
    440     }
     421
     422    // get file descriptor from file pointer
     423    fd = stream->fd;
     424
     425    // set terminating NUL
     426    string[count] = 0;
     427
     428    // copy string to file
     429    writen = write( fd , &string , count );
     430
     431    // check write
     432    if(writen != count )
     433    {
     434        printf("\n[error in %s] cannot write to stream %s\n", __FUNCTION__, stream );
     435        return -1;
     436    }
     437
     438    return writen;
     439
    441440}  // end fprintf()
    442441
  • trunk/libs/mini-libc/unistd.c

    r589 r625  
    22 * unistd.c - User level <unistd> 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
Note: See TracChangeset for help on using the changeset viewer.