Changeset 566 for trunk/kernel/syscalls/sys_open.c
- Timestamp:
- Oct 4, 2018, 11:50:21 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_open.c
r506 r566 30 30 #include <vfs.h> 31 31 #include <process.h> 32 #include <remote_spinlock.h>33 32 #include <remote_rwlock.h> 34 33 … … 36 35 37 36 /////////////////////////////////// 38 int sys_open ( c onst char* pathname,39 uint32_t 40 uint32_t 37 int sys_open ( char * pathname, 38 uint32_t flags, 39 uint32_t mode ) 41 40 { 42 41 error_t error; … … 57 56 if( process_fd_array_full() ) 58 57 { 59 printk("\n[ERROR] in %s : file descriptor array full for process %x\n", 60 __FUNCTION__ , process->pid ); 58 59 #if DEBUG_SYSCALLS_ERROR 60 printk("\n[ERROR] in %s : file descriptor array full for process %x\n", 61 __FUNCTION__ , process->pid ); 62 #endif 61 63 this->errno = ENFILE; 62 64 return -1; … … 66 68 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) 67 69 { 68 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 70 71 #if DEBUG_SYSCALLS_ERROR 72 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 73 #endif 69 74 this->errno = ENFILE; 70 75 return -1; … … 86 91 87 92 // 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 ) ); 89 94 90 95 // call the relevant VFS function … … 97 102 98 103 // 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 ) ); 100 105 101 106 if( error ) … … 106 111 return -1; 107 112 } 108 109 // update local fd_array110 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();115 113 116 114 #if DEBUG_SYS_OPEN
Note: See TracChangeset
for help on using the changeset viewer.