Changeset 637 for trunk/kernel/syscalls/sys_mkfifo.c
- Timestamp:
- Jul 18, 2019, 2:06:55 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_mkfifo.c
r566 r637 2 2 * sys_mkfifo.c - creates a named FIFO file. 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 33 33 uint32_t mode __attribute__((unused)) ) 34 34 { 35 error_t error;36 35 char kbuf[CONFIG_VFS_MAX_PATH_LENGTH]; 37 36 … … 39 38 process_t * process = this->process; 40 39 40 #if (DEBUG_SYS_MKFIFO || CONFIG_INSTRUMENTATION_SYSCALLS) 41 uint64_t tm_start = hal_get_cycles(); 42 #endif 43 44 #if DEBUG_SYS_MKFIFO 45 if( DEBUG_SYS_MKFIFO < tm_end ) 46 printk("\n[%s] thread[%x,%x] enter for <%s> / cycle %d\n", 47 __FUNCTION__, process->pid, this->trdid, pathname, (uint32_t)tm_end ); 48 #endif 49 41 50 // check fd_array not full 42 51 if( process_fd_array_full() ) 43 52 { 44 printk("\n[ERROR] in %s : file descriptor array full for process %x\n", 45 __FUNCTION__ , process->pid ); 53 54 #if DEBUG_SYSCALLS_ERROR 55 printk("\n[ERROR] in %s : file descriptor array full for process %x\n", 56 __FUNCTION__ , process->pid ); 57 #endif 46 58 this->errno = ENFILE; 47 59 return -1; … … 51 63 if( hal_strlen_from_uspace( pathname ) >= CONFIG_VFS_MAX_PATH_LENGTH ) 52 64 { 53 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 65 66 #if DEBUG_SYSCALLS_ERROR 67 printk("\n[ERROR] in %s : pathname too long\n", __FUNCTION__ ); 68 #endif 54 69 this->errno = ENFILE; 55 70 return -1; … … 57 72 58 73 // copy pathname in kernel space 59 hal_strcpy_from_uspace( kbuf , pathname , CONFIG_VFS_MAX_PATH_LENGTH ); 74 hal_strcpy_from_uspace( XPTR( local_cxy , kbuf ), 75 pathname, 76 CONFIG_VFS_MAX_PATH_LENGTH ); 60 77 61 78 printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ ); 62 79 return -1; 63 80 64 if( error ) 65 { 66 printk("\n[ERROR] in %s : cannot create named FIFO %s\n", 67 __FUNCTION__ , kbuf ); 68 this->errno = error; 69 return -1; 70 } 81 #if (DEBUG_SYS_MKFIFO || CONFIG_INSTRUMENTATION_SYSCALLS) 82 uint64_t tm_end = hal_get_cycles(); 83 #endif 71 84 72 return 0; 85 #if DEBUG_SYS_MKFIFO 86 if( DEBUG_SYS_MKFIFO < tm_end ) 87 printk("\n[%s] thread[%x,%x] exit for <%s> / cycle %d\n", 88 __FUNCTION__, process->pid, this->trdid, pathname, (uint32_t)tm_end ); 89 #endif 90 91 #if CONFIG_INSTRUMENTATION_SYSCALLS 92 hal_atomic_add( &syscalls_cumul_cost[SYS_MKFIFO] , tm_end - tm_start ); 93 hal_atomic_add( &syscalls_occurences[SYS_MKFIFO] , 1 ); 94 #endif 73 95 74 96 } // end sys_mkfifo()
Note: See TracChangeset
for help on using the changeset viewer.