Changeset 670 for trunk/kernel/syscalls/sys_chmod.c
- Timestamp:
- Nov 19, 2020, 11:45:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_chmod.c
r637 r670 2 2 * sys_chmod.c - Change file access rights. 3 3 * 4 * Author Alain Greiner (2016,2017,2018,2019)4 * Author Alain Greiner (2016,2017,2018,2019,2020) 5 5 * 6 6 * Copyright (c) 2015 UPMC Sorbonne Universites … … 29 29 #include <thread.h> 30 30 #include <process.h> 31 32 31 #include <syscalls.h> 33 32 … … 36 35 uint32_t rights __attribute__((unused)) ) 37 36 { 38 error_t error;39 37 char kbuf[CONFIG_VFS_MAX_PATH_LENGTH]; 40 38 41 39 thread_t * this = CURRENT_THREAD; 42 process_t * process = this->process; 40 41 #if DEBUG_SYS_CHMOD || DEBUG_SYSCALLS_ERROR || CONFIG_INSTRUMENTATION_SYSCALLS 42 process_t * process = this->process; 43 uint64_t tm_start = hal_get_cycles(); 44 #endif 43 45 44 46 // check pathname length … … 47 49 48 50 #if DEBUG_SYSCALLS_ERROR 49 printk("\n[ERROR] in %s : pathname too long / thread %x in process %x\n", 51 if( DEBUG_SYSCALLS_ERROR < (uint32_t)tm_start ) 52 printk("\n[ERROR] in %s : thread[%x,%x] / pathname too long\n", 50 53 __FUNCTION__, this->trdid, process->pid ); 51 54 #endif … … 59 62 CONFIG_VFS_MAX_PATH_LENGTH ); 60 63 64 65 66 61 67 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 62 68 return -1; 63 69 64 // get cluster and local pointer on reference process65 // xptr_t ref_xp = process->ref_xp;66 // process_t * ref_ptr = (process_t *)GET_PTR( ref_xp );67 // cxy_t ref_cxy = GET_CXY( ref_xp );68 70 69 // call the relevant VFS function70 // error = vfs_chmod( cwd_xp,71 // kbuf,72 // rights );73 71 74 if( error ) 75 { 76 printk("\n[ERROR] in %s : cannot remove directory %s\n", 77 __FUNCTION__ , kbuf ); 78 this->errno = error; 79 return -1; 80 } 72 73 hal_fence(); 74 75 #if (DEBUG_SYS_CHMOD || CONFIG_INSTRUMENTATION_SYSCALLS) 76 uint64_t tm_end = hal_get_cycles(); 77 #endif 78 79 #if DEBUG_SYS_CHMOD 80 if( DEBUG_SYS_CHMOD < tm_end ) 81 printk("\n[%s] thread[%x,%x] exit for / cycle %d\n", 82 __FUNCTION__, process->pid, this->trdid, (uint32_t)tm_end ); 83 #endif 84 85 #if CONFIG_INSTRUMENTATION_SYSCALLS 86 hal_atomic_add( &syscalls_cumul_cost[SYS_CHMOD] , tm_end - tm_start ); 87 hal_atomic_add( &syscalls_occurences[SYS_CHMOD] , 1 ); 88 #endif 81 89 82 90 return 0;
Note: See TracChangeset
for help on using the changeset viewer.