Ignore:
Timestamp:
Mar 6, 2019, 4:37:15 PM (5 years ago)
Author:
alain
Message:

Introduce three new types of vsegs (KCODE,KDATA,KDEV)
to map the kernel vsegs in the process VSL and GPT.
This now used by both the TSAR and the I86 architectures.

File:
1 edited

Legend:

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

    r610 r623  
    3535////////////////////////////////////////////////////////////////////////////////////////
    3636
     37// This user space array registers all FILE descriptors open by a given process
    3738FILE open_file_array[MAX_OPEN_FILE_PER_PROCESS];  // array of open files structures
    3839
     
    340341    if( mode != NULL )
    341342    {
    342         printf("\n[ERROR] in %s : the mode argument must be NULL\n", __FUNCTION__ );
     343        printf("\n[%s] error : the mode argument must be NULL\n", __FUNCTION__ );
    343344        return NULL;
    344345    }
     
    351352    if( fd < 0 )
    352353    {
    353         printf("\n[ERROR] in %s : file %s not found\n", __FUNCTION__ , pathname );
     354        printf("\n[%s] error : file <%s> not found\n", __FUNCTION__ , pathname );
    354355        return NULL;
    355356    }
    356357    if( fd > MAX_OPEN_FILE_PER_PROCESS )
    357358    {
    358         printf("\n[ERROR] in %s : not enough space for file %s\n", __FUNCTION__ , pathname );
     359        printf("\n[%s] error : not enough space for file <%s>\n", __FUNCTION__ , pathname );
    359360        return NULL;
    360361    }
     
    365366
    366367    return &open_file_array[fd];
     368
    367369}  // end fopen()
    368370
     
    376378    int fd = stream->fd;
    377379
    378     // remove stream from open_file_array[]
     380    // remove stream from user open_file_array[]
    379381    open_file_array[fd].key = 0;
    380382   
    381     return close( fd );
     383    // close the kernel file descriptor
     384    if( close( fd ) )
     385    {
     386        printf("\n[%s] error : cannot close file %d\n", __FUNCTION__ , fd );
     387        return -1;
     388    }
     389
     390    return 0;
     391
    382392}  // end fclose()
    383393
     
    407417        // get file descriptor from file pointer
    408418        fd = stream->fd;
    409        
     419
     420        // set terminating NUL
    410421        string[count] = 0;
    411422
     423printf("\n[%s] fd = %d for string :\n", __FUNCTION__, fd, string );
     424
    412425        return write( fd , &string , count );
    413426    }
Note: See TracChangeset for help on using the changeset viewer.