Changeset 604 for trunk/kernel/syscalls/sys_unlink.c
- Timestamp:
- Dec 3, 2018, 12:18:40 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_unlink.c
r566 r604 1 1 /* 2 * sys_unlink.c - file unlink 2 * sys_unlink.c - file unlink a file 3 3 * 4 * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless 5 * Copyright (c) 2011,2012 UPMC Sorbonne Universites 4 * Author Alain Greiner (2016,2017,2018) 5 * 6 * Copyright (c) UPMC Sorbonne Universites 6 7 * 7 8 * This file is part of ALMOS-kernel. 8 9 * 9 * ALMOS- kernelis free software; you can redistribute it and/or modify it10 * ALMOS-MKH is free software; you can redistribute it and/or modify it 10 11 * under the terms of the GNU General Public License as published by 11 12 * the Free Software Foundation; version 2.0 of the License. 12 13 * 13 * ALMOS- kernelis distributed in the hope that it will be useful, but14 * ALMOS-MKH is distributed in the hope that it will be useful, but 14 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 17 18 * 18 19 * You should have received a copy of the GNU General Public License 19 * along with ALMOS- kernel; if not, write to the Free Software Foundation,20 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 20 21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 22 */ 22 23 24 #include <kernel_config.h> 23 25 #include <hal_kernel_types.h> 24 26 #include <hal_uspace.h> 27 #include <errno.h> 25 28 #include <vfs.h> 26 29 #include <process.h> … … 39 42 process_t * process = this->process; 40 43 44 #if (DEBUG_SYS_UNLINK || CONFIG_INSTRUMENTATION_SYSCALLS) 45 uint64_t tm_start = hal_get_cycles(); 46 #endif 47 41 48 // check pathname length 42 49 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) 43 50 { 44 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 51 52 #if DEBUG_SYSCALLS_ERROR 53 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 54 #endif 45 55 this->errno = ENFILE; 46 56 return -1; … … 50 60 hal_strcpy_from_uspace( kbuf , pathname , CONFIG_VFS_MAX_PATH_LENGTH ); 51 61 62 #if DEBUG_SYS_UNLINK 63 if( DEBUG_SYS_UNLINK < tm_start ) 64 printk("\n[%s] thread[%x,%x] enter for <%s> / cycle %d\n", 65 __FUNCTION__, process->pid, this->trdid, kbuf, (uint32_t)tm_start ); 66 #endif 67 52 68 // get cluster and local pointer on reference process 53 69 xptr_t ref_xp = process->ref_xp; … … 69 85 if( error ) 70 86 { 71 printk("\n[ERROR] in %s : cannot unlink file/dir %s\n", 72 __FUNCTION__ , pathname ); 87 88 #if DEBUG_SYSCALLS_ERROR 89 printk("\n[ERROR] in %s : cannot unlink file/dir %s\n", __FUNCTION__, kbuf ); 90 #endif 73 91 this->errno = ENFILE; 74 92 return -1; 75 93 } 76 94 95 #if (DEBUG_SYS_UNLINK || CONFIG_INSTRUMENTATION_SYSCALLS) 96 uint64_t tm_end = hal_get_cycles(); 97 #endif 98 99 #if DEBUG_SYS_UNLINK 100 if( DEBUG_SYS_UNLINK < tm_end ) 101 printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n", 102 __FUNCTION__, process->pid, this->trdid, kbuf, (uint32_t)tm_end ); 103 #endif 104 105 #if CONFIG_INSTRUMENTATION_SYSCALLS 106 hal_atomic_add( &syscalls_cumul_cost[SYS_UNLINK] , tm_end - tm_start ); 107 hal_atomic_add( &syscalls_occurences[SYS_UNLINK] , 1 ); 108 #endif 109 77 110 return 0; 78 111
Note: See TracChangeset
for help on using the changeset viewer.