Ignore:
Timestamp:
May 16, 2018, 4:15:22 PM (6 years ago)
Author:
alain
Message:

Fix few bugs whike debugging the sort multi-thread application.

File:
1 edited

Legend:

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

    r441 r443  
    103103    }
    104104
    105     // enable IRQs
    106     hal_enable_irq( &save_sr );
    107 
    108105    // get extended pointer on remote file descriptor
    109106    file_xp = process_fd_get_xptr( process , file_id );
     
    128125    vfs_inode_type_t type = hal_remote_lw( XPTR( file_cxy , &file_ptr->type ) );
    129126
    130     // action depend on file type
     127    // enable IRQs
     128    hal_enable_irq( &save_sr );
     129
     130   // action depend on file type
    131131    if( type == INODE_TYPE_FILE )  // check file writable & write to mapper
    132132    {
     
    152152    else if( type == INODE_TYPE_DEV )  // check ownership & write to device
    153153    {
     154        // check user buffer size for TXT_TX
     155        if( (type == INODE_TYPE_DEV) && (count >= CONFIG_TXT_KBUF_SIZE) )
     156        {
     157
     158#if DEBUG_SYSCALLS_ERROR
     159printk("\n[ERROR] in %s : user buffer size %x too large / thread %x / process %x\n",
     160__FUNCTION__ , count, this->trdid, process->pid );
     161#endif
     162                    this->errno = EINVAL;
     163                    return -1;
     164        }
     165
    154166        // move count bytes to device
    155167        nbytes = devfs_user_move( false,             // from buffer to device
     
    158170                                 count );
    159171    }
    160     else
     172    else  // not FILE and not DEV
    161173    {
    162174        nbytes = 0;
     
    192204exit_sys_write = (uint32_t)tm_end;
    193205
    194 printk("\n@@@@@@@@@@@@ timing to write\n"
     206printk("\n***** timing to write a string *****\n"
    195207" - enter_sys_write          = %d / delta %d\n"
    196208" - enter_devfs_write        = %d / delta %d\n"
Note: See TracChangeset for help on using the changeset viewer.