Ignore:
Timestamp:
Nov 19, 2020, 11:45:52 PM (4 years ago)
Author:
alain
Message:

1) Introduce up to 4 command lines arguments in the KSH "load" command.
These arguments are transfered to the user process through the
argc/argv mechanism, using the user space "args" vseg.

2) Introduce the named and anonymous "pipes", for inter-process communication
through the pipe() and mkfifo() syscalls.

3) Introduce the "chat" application to validate the two above mechanisms.

4) Improve printk() and assert() fonctions in printk.c.

File:
1 edited

Legend:

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

    r637 r670  
    22 * sys_opendir.c - Open an user accessible VFS directory.
    33 *
    4  * Author        Alain Greiner (2016,2017,2018,2019)
     4 * Author        Alain Greiner (2016,2017,2018,2019,2020)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    5454        process_t    * process = this->process;   // client process
    5555
    56 #if (DEBUG_SYS_OPENDIR || CONFIG_INSTRUMENTATION_SYSCALLS)
     56#if DEBUG_SYS_OPENDIR || DEBUG_SYSCALLS_ERROR || CONFIG_INSTRUMENTATION_SYSCALLS
    5757uint64_t     tm_start = hal_get_cycles();
    5858#endif
     
    6565
    6666#if DEBUG_SYSCALLS_ERROR
    67 printk("\n[ERROR] in %s / thread[%x,%x] : DIR buffer %x unmapped\n",
     67if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start )
     68printk("\n[ERROR] in %s : thread[%x,%x] / DIR buffer %x unmapped\n",
    6869__FUNCTION__ , process->pid , this->trdid, dirp );
    6970#endif
     
    7273        }       
    7374
     75    // check pathname in user space
     76    error = vmm_get_vseg( process , (intptr_t)pathname, &vseg );
     77
     78        if( error )
     79        {
     80
     81#if DEBUG_SYSCALLS_ERROR
     82if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start )
     83printk("\n[ERROR] in %s : thread[%x,%x] / pathname %x unmapped\n",
     84__FUNCTION__ , process->pid , this->trdid, pathname );
     85#endif
     86                this->errno = EINVAL;
     87                return -1;
     88        }       
    7489    // check pathname length
    7590    if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH )
     
    7792
    7893#if DEBUG_SYSCALLS_ERROR
     94if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start )
    7995printk("\n[ERROR] in %s / thread[%x,%x] : pathname too long\n",
    8096 __FUNCTION__ , process->pid , this->trdid );
     
    90106
    91107#if DEBUG_SYS_OPENDIR
    92 if( DEBUG_SYS_OPENDIR < tm_start )
     108if( DEBUG_SYS_OPENDIR < (uint32_t)tm_start )
    93109printk("\n[%s] thread[%x,%x] enter for directory <%s> / cycle %d\n",
    94110__FUNCTION__, process->pid, this->trdid, kbuf, (uint32_t)tm_start );
     
    122138
    123139#if DEBUG_SYSCALLS_ERROR
    124 printk("\n[ERROR] in %s / thread[%x,%x] : cannot found directory <%s>\n",
     140if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start )
     141printk("\n[ERROR] in %s : thread[%x,%x] / cannot found directory <%s>\n",
    125142__FUNCTION__ , process->pid , this->trdid , kbuf );
    126143#endif
     
    134151    inode_type = hal_remote_l32( XPTR( inode_cxy , &inode_ptr->type ) );
    135152
    136     if( inode_type != INODE_TYPE_DIR )
    137         {
    138 
    139 #if DEBUG_SYSCALLS_ERROR
    140 printk("\n[ERROR] in %s / thread[%x,%x] : cannot found directory <%s>\n",
     153    if( inode_type != FILE_TYPE_DIR )
     154        {
     155
     156#if DEBUG_SYSCALLS_ERROR
     157if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start )
     158printk("\n[ERROR] in %s : thread[%x,%x] / <%s> is not a directory\n",
    141159__FUNCTION__ , process->pid , this->trdid , kbuf );
    142160#endif
     
    165183
    166184#if DEBUG_SYSCALLS_ERROR
    167 printk("\n[ERROR] in %s / thread[%x,%x] : cannot create user_dir for <%s>\n",
     185if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start )
     186printk("\n[ERROR] in %s : thread[%x,%x] / cannot create user_dir for <%s>\n",
    168187__FUNCTION__ , process->pid , this->trdid , kbuf );
    169188#endif
Note: See TracChangeset for help on using the changeset viewer.