Ignore:
Timestamp:
Apr 10, 2019, 10:09:39 AM (5 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_close.c

    r594 r625  
    3535int sys_close ( uint32_t file_id )
    3636{
    37     error_t     error;
    38     xptr_t      file_xp;
     37    error_t            error;
     38    xptr_t             file_xp;
     39    cxy_t              file_cxy;
     40    vfs_file_t       * file_ptr;
     41    vfs_inode_type_t   file_type;
    3942
    4043        thread_t  * this    = CURRENT_THREAD;
     
    5457        if( file_id >= CONFIG_PROCESS_FILE_MAX_NR )
    5558        {
    56         printk("\n[ERROR] in %s : illegal file descriptor index = %d\n",
    57                __FUNCTION__ , file_id );
     59
     60#if DEBUG_SYSCALLS_ERROR
     61printk("\n[ERROR] in %s : illegal file descriptor index = %d\n",
     62__FUNCTION__ , file_id );
     63#endif
    5864                this->errno = EBADFD;
    5965                return -1;
     
    7379                return -1;
    7480    }
     81
     82    // get file type
     83    file_cxy  = GET_CXY( file_xp );
     84    file_ptr  = GET_PTR( file_xp );
     85    file_type = hal_remote_l32( XPTR( file_cxy , &file_ptr->type ) );
     86
     87    if( file_type == INODE_TYPE_DIR )
     88        {
     89
     90#if DEBUG_SYSCALLS_ERROR
     91printk("\n[ERROR] in %s : file descriptor %d is a directory\n",
     92__FUNCTION__ , file_id );
     93#endif
     94                this->errno = EBADFD;
     95                return -1;
     96        }
    7597
    7698    // call the relevant VFS function
Note: See TracChangeset for help on using the changeset viewer.