Ignore:
Timestamp:
Oct 4, 2018, 11:50:21 PM (6 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

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

    r506 r566  
    3030#include <vfs.h>
    3131#include <process.h>
    32 #include <remote_spinlock.h>
    3332#include <remote_rwlock.h>
    3433
     
    3635
    3736///////////////////////////////////
    38 int sys_open ( const char * pathname,
    39                uint32_t     flags,
    40                uint32_t     mode )
     37int sys_open ( char    * pathname,
     38               uint32_t   flags,
     39               uint32_t   mode )
    4140{
    4241    error_t        error;
     
    5756    if( process_fd_array_full() )
    5857    {
    59         printk("\n[ERROR] in %s : file descriptor array full for process %x\n",
    60                __FUNCTION__ , process->pid );
     58
     59#if DEBUG_SYSCALLS_ERROR
     60printk("\n[ERROR] in %s : file descriptor array full for process %x\n",
     61__FUNCTION__ , process->pid );
     62#endif
    6163        this->errno = ENFILE;
    6264        return -1;
     
    6668    if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH )
    6769    {
    68         printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ );
     70
     71#if DEBUG_SYSCALLS_ERROR
     72printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ );
     73#endif
    6974        this->errno = ENFILE;
    7075        return -1;
     
    8691
    8792    // get the cwd lock in read mode from reference process
    88     remote_rwlock_rd_lock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );
     93    remote_rwlock_rd_acquire( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );
    8994
    9095    // call the relevant VFS function
     
    97102
    98103    // release the cwd lock
    99     remote_rwlock_rd_unlock( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );
     104    remote_rwlock_rd_release( XPTR( ref_cxy , &ref_ptr->cwd_lock ) );
    100105
    101106    if( error )
     
    106111        return -1;
    107112    }
    108 
    109     // update local fd_array
    110     remote_spinlock_lock( XPTR( local_cxy , &process->fd_array.lock ) );
    111     process->fd_array.array[file_id] = file_xp;
    112     remote_spinlock_unlock( XPTR( local_cxy , &process->fd_array.lock ) );
    113 
    114     hal_fence();
    115113
    116114#if DEBUG_SYS_OPEN
Note: See TracChangeset for help on using the changeset viewer.