Changeset 437 for trunk/kernel/syscalls


Ignore:
Timestamp:
Mar 28, 2018, 2:40:29 PM (6 years ago)
Author:
alain
Message:

Fix various bugs

Location:
trunk/kernel/syscalls
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/shared_syscalls.h

    r435 r437  
    6161        SYS_CLOSEDIR       = 25,
    6262        SYS_GETCWD         = 26,
    63         SYS_UNDEFINED_27   = 27,   ///
     63        SYS_ISATTY         = 27,
    6464        SYS_ALARM          = 28,   
    6565        SYS_RMDIR          = 29,
  • trunk/kernel/syscalls/sys_munmap.c

    r410 r437  
    33 *
    44 * Authors       Ghassan Almaless (2008,2009,2010,2011,2012)
    5  *               Alain Greiner (2016,2017)
     5 *               Alain Greiner (2016,2017,2018)
    66 *
    77 * Copyright (c) UPMC Sorbonne Universites
     
    4040    error_t       error;
    4141
    42         uint32_t      tm_start;
    43         uint32_t      tm_end;
    44 
    45         tm_start = hal_get_cycles();
    46 
    4742        thread_t    * this    = CURRENT_THREAD;
    4843        process_t   * process = this->process;
     44
     45#if CONFIG_DEBUG_SYS_MUNMAP
     46uint64_t tm_start;
     47uint64_t tm_end;
     48tm_start = hal_get_cycles();
     49if( CONFIG_DEBUG_SYS_MUNMAP < tm_start )
     50printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
     51__FUNCTION__ , this, process->pid, (uint32_t)tm_start );
     52#endif
    4953
    5054    // call relevant kernel function
     
    5357    if ( error )
    5458    {
    55         printk("\n[ERROR] in %s : cannot remove mapping\n", __FUNCTION__ );
     59
     60#if CONFIG_DEBUG_SYSCALLS_ERROR
     61printk("\n[ERROR] in %s : cannot remove mapping\n", __FUNCTION__ );
     62#endif
    5663                this->errno = EINVAL;
    5764                return -1;
    5865    }
    5966
    60     tm_end = hal_get_cycles();
     67#if CONFIG_DEBUG_SYS_MUNMAP
     68tm_end = hal_get_cycles();
     69if( CONFIG_DEBUG_SYS_MUNMAP < tm_start )
     70printk("\n[DBG] %s : thread %x exit / process %x / cycle %d\n"
     71__FUNCTION__ , this, process->pid, (uint32_t)tm_end );
     72#endif
    6173
    62 syscall_dmsg("\n[DBG] %s : core[%x,%d] removed vseg in process %x / cycle %d\n"
    63 "      base = %x / size = %x / cost = %d\n",
    64 __FUNCTION__, local_cxy , this->core->lid , process->pid , tm_start ,
    65 vaddr , size , tm_end - tm_start );
     74    return 0;
    6675
    67         return 0;
     76}  // end sys_munmap()
    6877
    69 }  // end sys_mmap()
    70 
  • trunk/kernel/syscalls/sys_thread_create.c

    r407 r437  
    22 * sys_thread_create.c - creates a new user thread
    33 *
    4  * Author     Alain Greiner (2016,2017)
     4 * Author     Alain Greiner (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    5757        error_t          error;
    5858
    59         uint32_t         tm_start;
    60         uint32_t         tm_end;
    61 
    62         tm_start = hal_get_cycles();
    63 
    6459        // get parent thead pointer, extended pointer, and process
    6560        parent     = CURRENT_THREAD;
     
    6762        process    = parent->process;
    6863
     64#if CONFIG_DEBUG_SYS_THREAD_CREATE
     65uint64_t tm_start;
     66uint64_t tm_end;
     67tm_start = hal_get_cycles();
     68if( CONFIG_DEBUG_SYS_THREAD_CREATE < tm_start )
     69printk("\n[DBG] %s : thread %x enter / process %x / cycle %d\n"
     70__FUNCTION__ , parent , process->pid, (uint32_t)tm_start );
     71#endif
     72
    6973        // check user_attr in user space & copy to kernel space
    7074    if( user_attr != NULL )
     
    7478            if( error )
    7579            {
    76                     printk("\n[ERROR] in %s : user_attr unmapped\n", __FUNCTION__ );
     80
     81#if CONFIG_DEBUG_SYSCALLS_ERROR
     82printk("\n[ERROR] in %s : user_attr unmapped\n", __FUNCTION__ );
     83#endif
    7784                    parent->errno = EINVAL;
    7885                    return -1;
     
    8794        if( error )
    8895        {
    89                 printk("\n[ERROR] in %s : start_func unmapped\n", __FUNCTION__ );
     96
     97#if CONFIG_DEBUG_SYSCALLS_ERROR
     98printk("\n[ERROR] in %s : start_func unmapped\n", __FUNCTION__ );
     99#endif
    90100                parent->errno = EINVAL;
    91101                return -1;
     
    97107        if( error )
    98108        {
    99                 printk("\n[ERROR] in %s : start_arg unmapped\n", __FUNCTION__ );
     109
     110#if CONFIG_DEBUG_SYSCALLS_ERROR
     111printk("\n[ERROR] in %s : start_arg unmapped\n", __FUNCTION__ );
     112#endif
    100113                parent->errno = EINVAL;
    101114                return -1;
     
    110123                    if( cluster_is_undefined( kern_attr.cxy ) )
    111124                    {
    112                             printk("\n[ERROR] in %s : illegal target cluster = %x\n",
    113                             __FUNCTION__ , kern_attr.cxy );
     125
     126#if CONFIG_DEBUG_SYSCALLS_ERROR
     127printk("\n[ERROR] in %s : illegal target cluster = %x\n", __FUNCTION__ , kern_attr.cxy );
     128#endif
    114129                            parent->errno = EINVAL;
    115130                            return -1;
     
    158173        if( error )
    159174        {
    160                 printk("\n[ERROR] in %s : cannot create thread\n", __FUNCTION__ );
     175
     176#if CONFIG_DEBUG_SYSCALLS_ERROR
     177printk("\n[ERROR] in %s : cannot create thread\n", __FUNCTION__ );
     178#endif
    161179                return ENOMEM;
    162180        }
     
    178196    hal_fence();
    179197
    180         tm_end = hal_get_cycles();
    181 
    182 syscall_dmsg("\n[DBG] %s : core[%x,%d] created thread %x for process %x / cycle %d\n"
    183 "      cluster %x / cost = %d cycles\n",
    184 __FUNCTION__ , local_cxy , parent->core->lid , trdid , process->pid , tm_end ,
    185 target_cxy , tm_end - tm_start );
     198#if CONFIG_DEBUG_SYS_THREAD_CREATE
     199tm_end = hal_get_cycles();
     200if( CONFIG_DEBUG_SYS_THREAD_CREATE < tm_end )
     201printk("\n[DBG] %s : thread %x created thread %x for process %x in cluster %x / cycle %d\n"
     202__FUNCTION__, parent, child_ptr, process->pid, target_cxy, (uint32_t)tm_end );
     203#endif
    186204
    187205        return 0;
  • trunk/kernel/syscalls/syscalls.h

    r436 r437  
    356356
    357357/******************************************************************************************
    358  * [27] This slot is not used.
    359  *****************************************************************************************/
     358 * [27] This function tests whether a given file descriptor dentified by the <file_id>
     359 * argument is an open file descriptor referring to a terminal.
     360 ******************************************************************************************
     361 * @ file_id   : file descriptor index
     362 * @ return 1 if it is a TXT device / return 0 if it is not a TXT device.
     363 *****************************************************************************************/
     364int sys_isatty( uint32_t file_id );
    360365
    361366/******************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.