Ignore:
Timestamp:
Jan 29, 2018, 5:40:34 PM (6 years ago)
Author:
alain
Message:

Introduce sys_fg() , sys_display() , sys_wait() syscalls.

File:
1 edited

Legend:

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

    r418 r421  
    9292    cxy_t        file_cxy = GET_CXY( file_xp );
    9393
    94     // check file writable
    95     uint32_t attr = hal_remote_lw( XPTR( file_cxy , &file_ptr->attr ) );
    96     if( (attr & FD_ATTR_WRITE_ENABLE) == 0 )
    97         {
    98         printk("\n[ERROR] in %s : file %d not writable in process %x\n",
    99         __FUNCTION__ , file_id , process->pid );
    100                 this->errno = EBADFD;
    101                 return -1;
    102         }
    103    
     94 
    10495    // get file type
    10596    vfs_inode_type_t type = hal_remote_lw( XPTR( file_cxy , &file_ptr->type ) );
    10697
    10798    // action depend on file type
    108     if( type == INODE_TYPE_FILE )      // transfer count bytes to file mapper
     99    if( type == INODE_TYPE_FILE )  // check file writable & write to mapper
    109100    {
     101        // check file writable
     102        uint32_t attr = hal_remote_lw( XPTR( file_cxy , &file_ptr->attr ) );
     103        if( (attr & FD_ATTR_WRITE_ENABLE) == 0 )
     104            {
     105            printk("\n[ERROR] in %s : file %d not writable in process %x\n",
     106            __FUNCTION__ , file_id , process->pid );
     107                    this->errno = EBADFD;
     108                    return -1;
     109            }
     110
     111        // move count bytes to mapper
    110112        nbytes = vfs_user_move( false,               // from buffer to mapper
    111113                                file_xp,
     
    113115                                count );
    114116    }
    115     else if( type == INODE_TYPE_DEV )  // transfer count bytes to device
     117    else if( type == INODE_TYPE_DEV )  // check ownership & write to device
    116118    {
     119        // move count bytes to device
    117120        nbytes = devfs_user_move( false,             // from buffer to device
    118121                                 file_xp,
     
    123126    {
    124127        nbytes = 0;
    125         panic("file type %d non supported", type );
     128        assert( false , __FUNCTION__ , "file type %d non supported\n", type );
    126129    }
    127130
     
    148151#endif
    149152 
    150 #if CONFIG_WRITE_DEBUG
     153#if (CONFIG_WRITE_DEBUG & 0x1)
    151154printk("\n@@@@@@@@@@@@ timing to write character %c\n"
    152155" - enter_sys_write    = %d\n"
Note: See TracChangeset for help on using the changeset viewer.