[1] | 1 | /* |
---|
[407] | 2 | * syscalls.h - Kernel side services for syscall handling. |
---|
[1] | 3 | * |
---|
[657] | 4 | * Author Alain Greiner (2016,2017,2018,2019,2020) |
---|
[1] | 5 | * |
---|
| 6 | * Copyright (c) UPMC Sorbonne Universites |
---|
| 7 | * |
---|
| 8 | * This file is part of ALMOS-MKH. |
---|
| 9 | * |
---|
| 10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it |
---|
| 11 | * under the terms of the GNU General Public License as published by |
---|
| 12 | * the Free Software Foundation; version 2.0 of the License. |
---|
| 13 | * |
---|
| 14 | * ALMOS-MKH is distributed in the hope that it will be useful, but |
---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 17 | * General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation, |
---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 22 | */ |
---|
| 23 | |
---|
[16] | 24 | #ifndef _SYSCALLS_H_ |
---|
| 25 | #define _SYSCALLS_H_ |
---|
[1] | 26 | |
---|
[457] | 27 | #include <hal_kernel_types.h> |
---|
[407] | 28 | #include <shared_syscalls.h> |
---|
[23] | 29 | |
---|
[407] | 30 | /** Forward declarations *****/ |
---|
[23] | 31 | |
---|
| 32 | struct thread_s; // defined in thread.h |
---|
| 33 | struct pthread_attr_s; // defined in thread.h |
---|
| 34 | struct vfs_stat_s; // defined in vfs.h |
---|
| 35 | struct vfs_dirent_s; // defined in vfs.h |
---|
| 36 | struct mmap_attr_s; // defined in vmm.h |
---|
| 37 | |
---|
[407] | 38 | /****************************************************************************************** |
---|
[651] | 39 | * [0] This function terminates the execution of the calling user thread, and makes |
---|
| 40 | * the <exit_status> pointer available to any successful pthread_join() with the |
---|
[23] | 41 | * terminating thread. |
---|
[651] | 42 | * - If the calling thread is the main thread, it calls the sys_exit() function to delete |
---|
| 43 | * completely the user process. |
---|
| 44 | * - if the calling thread is not the main thread, it registers the <exit_status> pointer |
---|
| 45 | * in the thread descriptor, and calls the thread_delete() function, that will set the |
---|
| 46 | * THREAD_SIG_EXIT signal, set the THREAD_BLOCKED_GLOBAL bit in thread descriptor, and |
---|
| 47 | * deschedules. All memory allocated to the thread is released later by the scheduler. |
---|
| 48 | * If the thread is in "detached" mode, the thread_delete() function implements |
---|
| 49 | * the synchonisation with the joining thread. |
---|
[407] | 50 | ****************************************************************************************** |
---|
[651] | 51 | * @ exit_status : pointer to be returned to joining thread if thread is attached. |
---|
[409] | 52 | * @ return 0 if success / return -1 if all locks not released or illegal argument. |
---|
[407] | 53 | *****************************************************************************************/ |
---|
[651] | 54 | int sys_thread_exit( void * exit_status ); |
---|
[16] | 55 | |
---|
[407] | 56 | /****************************************************************************************** |
---|
| 57 | * [1] This function calls the scheduler for the core running the calling thread. |
---|
| 58 | ****************************************************************************************** |
---|
| 59 | * @ x_size : [out] number of clusters in a row. |
---|
| 60 | * @ y_size : [out] number of clusters in a column. |
---|
| 61 | * @ ncores : [out] number of cores per cluster. |
---|
| 62 | * @ return always 0. |
---|
| 63 | *****************************************************************************************/ |
---|
[479] | 64 | int sys_thread_yield( void ); |
---|
[16] | 65 | |
---|
[407] | 66 | /****************************************************************************************** |
---|
[23] | 67 | * [2] This function creates a new user thread. The <user_attr> argument is a pointer |
---|
| 68 | * on astructure containing the thread attributes, defined in thread.h file. |
---|
[407] | 69 | ****************************************************************************************** |
---|
[566] | 70 | * @ trdid_ptr : [out] pointer on buffer for created thread trdid. |
---|
[23] | 71 | * @ user_attr : [in] pointer on thread attributes structure. |
---|
| 72 | * @ start_func : [in] pointer on start function. |
---|
| 73 | * @ start_args : [in] pointer on start function arguments. |
---|
| 74 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 75 | *****************************************************************************************/ |
---|
[566] | 76 | int sys_thread_create( trdid_t * trdid_ptr, |
---|
| 77 | struct pthread_attr_s * user_attr, |
---|
| 78 | void * start_func, |
---|
| 79 | void * start_args ); |
---|
[16] | 80 | |
---|
[407] | 81 | /****************************************************************************************** |
---|
[23] | 82 | * [3] This blocking function suspend execution of the calling thread until completion |
---|
| 83 | * of another target thread identified by the <trdid> argument. |
---|
[421] | 84 | * The target thread must be joinable (running in ATTACHED mode), and must be different |
---|
| 85 | * from the calling thread. |
---|
[23] | 86 | * If the <exit_value> argument is not NULL, the value passed to pthread_exit() by the |
---|
| 87 | * target thread is stored in the location referenced by exit_value. |
---|
[407] | 88 | ****************************************************************************************** |
---|
[23] | 89 | * @ trdid : [in] target thread identifier. |
---|
| 90 | * @ thread : [out] buffer for exit_value returned by target thread. |
---|
| 91 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 92 | *****************************************************************************************/ |
---|
[23] | 93 | int sys_thread_join( trdid_t trdid, |
---|
| 94 | void ** exit_value ); |
---|
[16] | 95 | |
---|
[407] | 96 | /****************************************************************************************** |
---|
[23] | 97 | * [4] This function detach a joinable thread. |
---|
[407] | 98 | ****************************************************************************************** |
---|
[409] | 99 | * @ trdid : thread identifier. |
---|
[23] | 100 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 101 | *****************************************************************************************/ |
---|
[23] | 102 | int sys_thread_detach( trdid_t trdid ); |
---|
[16] | 103 | |
---|
[407] | 104 | /****************************************************************************************** |
---|
[409] | 105 | * [5] This function requests a target thread identified by its <trdid> argument |
---|
[436] | 106 | * to be cancelled. It calls the thread_kill() function to block the target thread |
---|
| 107 | * on the THREAD_BLOCKED_GLOBAL condition, and to set the THREAD_FLAG_REQ_DELETE. |
---|
[409] | 108 | * The thread will be detached from its process, and the memory allocated to the thread |
---|
[436] | 109 | * descriptor will be released by the scheduler at the next scheduling point. |
---|
[409] | 110 | ****************************************************************************************** |
---|
| 111 | * @ trdid : thread identifier. |
---|
| 112 | * @ return 0 if success / return -1 if illegal argument. |
---|
[407] | 113 | *****************************************************************************************/ |
---|
[409] | 114 | int sys_thread_cancel( trdid_t trdid ); |
---|
[16] | 115 | |
---|
[407] | 116 | /****************************************************************************************** |
---|
[23] | 117 | * [6] This function implement all operations on a POSIX unnamed semaphore, |
---|
| 118 | * that can be shared by threads running in different clusters. |
---|
| 119 | * The kernel structure representing a remote semaphore is in the remote_sem.h file, |
---|
| 120 | * and the code implementing the operations is in the remore_sem.c file. |
---|
[407] | 121 | ****************************************************************************************** |
---|
[457] | 122 | * @ vaddr : semaphore virtual address in user space == identifier. |
---|
| 123 | * @ operation : SEM_INIT / SEM_DESTROY / SEM_GETVALUE / SEM_POST / SEM_WAIT. |
---|
| 124 | * @ init_value : initial semaphore value. |
---|
| 125 | * @ current_value : pointer on buffer for current semaphore value. |
---|
[23] | 126 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 127 | *****************************************************************************************/ |
---|
[23] | 128 | int sys_sem( void * vaddr, |
---|
| 129 | uint32_t operation, |
---|
[457] | 130 | uint32_t init_value, |
---|
| 131 | uint32_t * current_value ); |
---|
[16] | 132 | |
---|
[407] | 133 | /****************************************************************************************** |
---|
[23] | 134 | * [7] This function implement all operations on a POSIX condition variable. |
---|
[566] | 135 | * The kernel structure representing a condvar is defined in the remote_condvar.h file, |
---|
| 136 | * The code implementing the operations is defined in the remote_condvar.c file. |
---|
[407] | 137 | ****************************************************************************************** |
---|
[23] | 138 | * @ vaddr : condvar virtual address in user space == identifier. |
---|
| 139 | * @ operation : operation type (see below). |
---|
| 140 | * @ attr : mutex virtual address in user space == identifier. |
---|
| 141 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 142 | *****************************************************************************************/ |
---|
[23] | 143 | int sys_condvar( void * condvar, |
---|
| 144 | uint32_t operation, |
---|
| 145 | void * mutex ); |
---|
[16] | 146 | |
---|
[407] | 147 | /****************************************************************************************** |
---|
[23] | 148 | * [8] This function implement all operations on a POSIX barrier. |
---|
| 149 | * The kernel structure representing a barrier is defined in the remote_barrier.h file. |
---|
| 150 | * The code implementting the operations is defined in the remote_barrier.c file. |
---|
[407] | 151 | ****************************************************************************************** |
---|
[619] | 152 | * @ vaddr : barrier address in user space == identifier. |
---|
[23] | 153 | * @ operation : BARRIER_INIT / BARRIER_DESTROY / BARRIER_WAIT. |
---|
[619] | 154 | * @ count : number of expected threads (only used by BARRIER_INIT). |
---|
| 155 | * @ attr : barrier attributes address in user space (only used by BARRIER_INIT). |
---|
[23] | 156 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 157 | *****************************************************************************************/ |
---|
[619] | 158 | int sys_barrier( intptr_t vaddr, |
---|
[23] | 159 | uint32_t operation, |
---|
[619] | 160 | uint32_t count, |
---|
| 161 | intptr_t attr ); |
---|
[16] | 162 | |
---|
[407] | 163 | /****************************************************************************************** |
---|
[23] | 164 | * [9] This function implement all operations on a POSIX mutex. |
---|
| 165 | * The kernel structure representing a barrier is defined in the remote_barrier.h file. |
---|
| 166 | * The code implementting the operations is defined in the remote_barrier.c file. |
---|
[407] | 167 | ****************************************************************************************** |
---|
[23] | 168 | * @ vaddr : mutex virtual address in user space == identifier. |
---|
| 169 | * @ operation : MUTEX_INIT / MUTEX_DESTROY / MUTEX_LOCK / MUTEX_UNLOCK |
---|
| 170 | * @ attr : mutex attributes (non supported yet => must be 0). |
---|
| 171 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 172 | *****************************************************************************************/ |
---|
[23] | 173 | int sys_mutex( void * vaddr, |
---|
| 174 | uint32_t operation, |
---|
| 175 | uint32_t count ); |
---|
[16] | 176 | |
---|
[407] | 177 | /****************************************************************************************** |
---|
[610] | 178 | * [10] This function causes the file named <old> to be renamed as <new>. |
---|
| 179 | * If new exists, it is first removed. Both old and new must be of the same type (both |
---|
| 180 | * must be either directories or non-directories) and must reside on the same file system. |
---|
| 181 | * It guarantees that an instance of <new> will always exist, even if the system should |
---|
| 182 | * crash in the middle of the operation. |
---|
[407] | 183 | ****************************************************************************************** |
---|
[610] | 184 | * @ old : old file name. |
---|
| 185 | * @ new : new file name. |
---|
| 186 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 187 | *****************************************************************************************/ |
---|
[610] | 188 | int sys_rename( char *old, |
---|
| 189 | char *new ); |
---|
[16] | 190 | |
---|
[407] | 191 | /****************************************************************************************** |
---|
[408] | 192 | * [11] This function remove an existing mapping defined by the <addr> and <size> |
---|
[640] | 193 | * arguments in user space. This can modify the number of vsegs: |
---|
| 194 | * (a) if the region is not entirely mapped in one existing vseg, it's an error. |
---|
| 195 | * (b) if the region has same base and size as an existing vseg, the vseg is removed. |
---|
| 196 | * (c) if the removed region cut the exiting vseg in two parts, it is resized. |
---|
| 197 | * (d) if the removed region cut the vseg in three parts, it is modified, and a new |
---|
| 198 | * vseg is created with same type. |
---|
| 199 | * All existing VSL copies are updated. |
---|
| 200 | ****************************************************************************************** |
---|
[407] | 201 | * @ addr : base address in user space. |
---|
[640] | 202 | * @ size : number of bytes. |
---|
[23] | 203 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 204 | *****************************************************************************************/ |
---|
| 205 | int sys_munmap( void * addr, |
---|
| 206 | uint32_t size ); |
---|
[16] | 207 | |
---|
[407] | 208 | /****************************************************************************************** |
---|
| 209 | * [12] This function open or create an open file descriptor. |
---|
| 210 | ****************************************************************************************** |
---|
[23] | 211 | * @ pathname : pathname (can be relative or absolute). |
---|
[445] | 212 | * @ flags : bit vector attributes (see in shared_fcntl.h file) |
---|
[23] | 213 | * @ mode : access rights. |
---|
| 214 | * @ return file descriptor index in fd_array if success / return -1 if failure. |
---|
[407] | 215 | *****************************************************************************************/ |
---|
[566] | 216 | int sys_open( char * pathname, |
---|
[506] | 217 | uint32_t flags, |
---|
| 218 | uint32_t mode ); |
---|
[16] | 219 | |
---|
[407] | 220 | /****************************************************************************************** |
---|
| 221 | * [13] This function map physical memory (or a file) in the calling thread virtual space. |
---|
[637] | 222 | * The <attr> argument is a pointer on a structure for arguments (see shared_mman.h). |
---|
[594] | 223 | * The user defined virtual address (MAP_FIXED flag) is not supported. |
---|
| 224 | * TODO : the access rights checking is not implemented yet [AG] |
---|
| 225 | * TODO : the Copy on Write for MAP_PRIVATE is not implemented yet [AG] |
---|
[407] | 226 | ****************************************************************************************** |
---|
| 227 | * @ attr : pointer on attributes structure. |
---|
[651] | 228 | * @ returns 0 if success / returns -1 if failure. |
---|
[407] | 229 | *****************************************************************************************/ |
---|
| 230 | int sys_mmap( mmap_attr_t * attr ); |
---|
[23] | 231 | |
---|
[407] | 232 | /****************************************************************************************** |
---|
[23] | 233 | * [14] This function read bytes from an open file identified by its file descriptor. |
---|
[407] | 234 | * The file can be a regular file or character oriented device. |
---|
[408] | 235 | * IRQs are enabled during this system call. |
---|
[407] | 236 | ****************************************************************************************** |
---|
[23] | 237 | * @ file_id : open file index in fd_array. |
---|
| 238 | * @ buf : buffer virtual address in user space. |
---|
| 239 | * @ count : number of bytes. |
---|
[651] | 240 | * @ returns number of bytes actually read if success / returns -1 if failure. |
---|
[407] | 241 | *****************************************************************************************/ |
---|
[23] | 242 | int sys_read( uint32_t file_id, |
---|
| 243 | void * buf, |
---|
| 244 | uint32_t count ); |
---|
[16] | 245 | |
---|
[407] | 246 | /****************************************************************************************** |
---|
[23] | 247 | * [15] This function writes bytes to an open file identified by its file descriptor. |
---|
[623] | 248 | * The file can be a regular file or character oriented device. For a regular file, |
---|
| 249 | * the target inode "size" field is updated if (offset + count) is larger than the |
---|
| 250 | * current "size" value. The size value registered in the mappers of the parent(s) |
---|
| 251 | * directory are not modified and will be asynchronously updated when the file is closed. |
---|
[408] | 252 | * IRQs are enabled during this system call. |
---|
[407] | 253 | ****************************************************************************************** |
---|
[23] | 254 | * @ file_id : open file index in fd_array. |
---|
| 255 | * @ buf : buffer virtual address in user space. |
---|
| 256 | * @ count : number of bytes. |
---|
[651] | 257 | * @ returns number of bytes actually written if success / returns -1 if failure. |
---|
[407] | 258 | *****************************************************************************************/ |
---|
[23] | 259 | int sys_write( uint32_t file_id, |
---|
| 260 | void * buf, |
---|
| 261 | uint32_t count ); |
---|
[16] | 262 | |
---|
[407] | 263 | /****************************************************************************************** |
---|
[651] | 264 | * [16] This function repositions the offset of the file descriptor identified by the |
---|
| 265 | * <file_id> argument, according to the operation type defined by the <whence> argument. |
---|
[407] | 266 | ****************************************************************************************** |
---|
[23] | 267 | * @ file_id : open file index in fd_array. |
---|
[407] | 268 | * @ offset : used to compute new offset value. |
---|
[23] | 269 | * @ whence : operation type (see below). |
---|
[651] | 270 | * @ returns new offset value if success / returns -1 if failure. |
---|
[407] | 271 | *****************************************************************************************/ |
---|
[23] | 272 | int sys_lseek( xptr_t file_id, |
---|
| 273 | uint32_t offset, |
---|
| 274 | uint32_t whence ); |
---|
[16] | 275 | |
---|
[407] | 276 | /****************************************************************************************** |
---|
[23] | 277 | * [17] This function release the memory allocated for the file descriptor identified by |
---|
| 278 | * the <file_id> argument, and remove the fd array_entry in all copies of the process |
---|
| 279 | * descriptor. |
---|
[407] | 280 | ****************************************************************************************** |
---|
[23] | 281 | file_id : file descriptor index in fd_array. |
---|
[651] | 282 | * @ returns 0 if success / returns -1 if failure. |
---|
[407] | 283 | *****************************************************************************************/ |
---|
[23] | 284 | int sys_close( uint32_t file_id ); |
---|
[16] | 285 | |
---|
[407] | 286 | /****************************************************************************************** |
---|
| 287 | * [18] This function removes a directory entry identified by the <pathname> from the |
---|
[23] | 288 | * directory, and decrement the link count of the file referenced by the link. |
---|
| 289 | * If the link count reduces to zero, and no process has the file open, then all resources |
---|
| 290 | * associated with the file are reclaimed. If one or more process have the file open when |
---|
| 291 | * the last link is removed, the link is removed, but the removal of the file is delayed |
---|
| 292 | * until all references to it have been closed. |
---|
[407] | 293 | ****************************************************************************************** |
---|
[23] | 294 | * @ pathname : pathname (can be relative or absolute). |
---|
[651] | 295 | * @ returns 0 if success / returns -1 if failure. |
---|
[407] | 296 | *****************************************************************************************/ |
---|
[566] | 297 | int sys_unlink( char * pathname ); |
---|
[16] | 298 | |
---|
[407] | 299 | /****************************************************************************************** |
---|
[23] | 300 | * [19] This function creates in the calling thread cluster an unnamed pipe, and two |
---|
| 301 | * (read and write) file descriptors. |
---|
[594] | 302 | * TODO not implemented yet [AG] |
---|
[407] | 303 | ****************************************************************************************** |
---|
[23] | 304 | * @ file_id[0] : [out] read only file descriptor index. |
---|
| 305 | * @ file_id[1] : [out] write only file descriptor index. |
---|
| 306 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 307 | *****************************************************************************************/ |
---|
[23] | 308 | int sys_pipe( uint32_t file_id[2] ); |
---|
[16] | 309 | |
---|
[407] | 310 | /****************************************************************************************** |
---|
[23] | 311 | * [20] This function change the current working directory in reference process descriptor. |
---|
[407] | 312 | ****************************************************************************************** |
---|
[23] | 313 | * @ pathname : pathname (can be relative or absolute). |
---|
| 314 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 315 | *****************************************************************************************/ |
---|
[566] | 316 | int sys_chdir( char * pathname ); |
---|
[16] | 317 | |
---|
[407] | 318 | /****************************************************************************************** |
---|
[610] | 319 | * [21] This function implements the "mkdir" system call, creating a new directory in |
---|
| 320 | * the file system, as defined by the <pathname> argument, with the access permission |
---|
| 321 | * defined by the <rights> argument. All nodes but the last in the pathname must exist. |
---|
| 322 | * It can be called by any thread running in any cluster. |
---|
[407] | 323 | ****************************************************************************************** |
---|
[610] | 324 | * @ pathname : pathname defining the new directory location in file system. |
---|
| 325 | * @ rights : access rights (non used yet). |
---|
| 326 | * @ return 0 if success / return -1 if failure. |
---|
[407] | 327 | *****************************************************************************************/ |
---|
[610] | 328 | int sys_mkdir( char * pathname, |
---|
| 329 | uint32_t rights ); |
---|
[16] | 330 | |
---|
[407] | 331 | /****************************************************************************************** |
---|
[23] | 332 | * [22] This function creates a named FIFO file in the calling thread cluster. |
---|
| 333 | * The associated read and write file descriptors mut be be explicitely created |
---|
[407] | 334 | * using the sys_open() function. |
---|
| 335 | ****************************************************************************************** |
---|
[23] | 336 | * @ pathname : pathname (can be relative or absolute). |
---|
| 337 | * @ mode : access rights (as defined in chmod). |
---|
| 338 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 339 | *****************************************************************************************/ |
---|
[23] | 340 | int sys_mkfifo( char * pathname, |
---|
| 341 | uint32_t mode ); |
---|
[16] | 342 | |
---|
[407] | 343 | /****************************************************************************************** |
---|
[623] | 344 | * [23] This function creates an user level directory descriptor (including the associated |
---|
| 345 | * array of user level dirents), and intialise it from the kernel directory mapper, that |
---|
| 346 | * contains all entries in this directory). The directory is identified by the <pathname> |
---|
| 347 | * argument. If the corresponding inode is missing in the Inode Tree, the inode is created, |
---|
| 348 | * but the directory must exist in the file system. |
---|
| 349 | * It returns a DIR pointer <dirp> on the dirent array in user space. |
---|
[664] | 350 | * The calling process fd_array is NOT modified. |
---|
[407] | 351 | ****************************************************************************************** |
---|
[611] | 352 | * @ pathname : [in] pathname (can be relative or absolute). |
---|
[407] | 353 | * @ dirp : [out] buffer for pointer on user directory (DIR). |
---|
[23] | 354 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 355 | *****************************************************************************************/ |
---|
| 356 | int sys_opendir( char * pathname, |
---|
| 357 | DIR ** dirp ); |
---|
[16] | 358 | |
---|
[407] | 359 | /****************************************************************************************** |
---|
| 360 | * [24] This function returns an user pointer on the dirent structure describing the |
---|
| 361 | * next directory entry in the directory identified by the <dirp> argument. |
---|
| 362 | ****************************************************************************************** |
---|
[611] | 363 | * @ dirp : [in] user pointer on dirent array identifying the open directory. |
---|
| 364 | * @ buffer : [out] pointer on user buffer for a pointer on dirent in user space. |
---|
[407] | 365 | * @ return O if success / returns -1 if failure. |
---|
| 366 | *****************************************************************************************/ |
---|
| 367 | int sys_readdir( DIR * dirp, |
---|
[611] | 368 | struct dirent ** buffer ); |
---|
[407] | 369 | |
---|
| 370 | /****************************************************************************************** |
---|
| 371 | * [25] This function closes the directory identified by the <dirp> argument, and releases |
---|
| 372 | * all structures associated with the <dirp> pointer. |
---|
| 373 | ****************************************************************************************** |
---|
[611] | 374 | * @ dirp : [in] user pointer on dirent array identifying the open directory. |
---|
[23] | 375 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 376 | *****************************************************************************************/ |
---|
| 377 | int sys_closedir( DIR * dirp ); |
---|
[16] | 378 | |
---|
[407] | 379 | /****************************************************************************************** |
---|
[23] | 380 | * [26] This function returns the pathname of the current working directory. |
---|
[407] | 381 | ****************************************************************************************** |
---|
[23] | 382 | * buf : buffer addres in user space. |
---|
| 383 | * nbytes : user buffer size in bytes. |
---|
| 384 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 385 | *****************************************************************************************/ |
---|
[23] | 386 | int sys_getcwd( char * buf, |
---|
| 387 | uint32_t nbytes ); |
---|
[16] | 388 | |
---|
[407] | 389 | /****************************************************************************************** |
---|
[437] | 390 | * [27] This function tests whether a given file descriptor dentified by the <file_id> |
---|
| 391 | * argument is an open file descriptor referring to a terminal. |
---|
| 392 | ****************************************************************************************** |
---|
| 393 | * @ file_id : file descriptor index |
---|
| 394 | * @ return 1 if it is a TXT device / return 0 if it is not a TXT device. |
---|
[407] | 395 | *****************************************************************************************/ |
---|
[437] | 396 | int sys_isatty( uint32_t file_id ); |
---|
[16] | 397 | |
---|
[407] | 398 | /****************************************************************************************** |
---|
[23] | 399 | * [28] This function forces the calling thread to sleep, for a fixed number of cycles. |
---|
[407] | 400 | ****************************************************************************************** |
---|
[23] | 401 | * cycles : number of cycles. |
---|
[407] | 402 | *****************************************************************************************/ |
---|
[23] | 403 | int sys_alarm( uint32_t cycles ); |
---|
[16] | 404 | |
---|
[407] | 405 | /****************************************************************************************** |
---|
| 406 | * [29] This function removes a directory file whose name is given by <pathname>. |
---|
| 407 | * The directory must not have any entries other than `.' and `..'. |
---|
| 408 | ****************************************************************************************** |
---|
[23] | 409 | * @ pathname : pathname (can be relative or absolute). |
---|
| 410 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 411 | *****************************************************************************************/ |
---|
[566] | 412 | int sys_rmdir( char * pathname ); |
---|
[16] | 413 | |
---|
[407] | 414 | /****************************************************************************************** |
---|
[23] | 415 | * [30] This function implement the operations related to User Thread Local Storage. |
---|
| 416 | * It is actually implemented as an uint32_t variable in the thread descriptor. |
---|
[407] | 417 | ****************************************************************************************** |
---|
[23] | 418 | * @ operation : UTLS operation type as defined below. |
---|
| 419 | * @ value : argument value for the UTLS_SET operation. |
---|
| 420 | * @ return value for the UTLS_GET and UTLS_GET_ERRNO / return -1 if failure. |
---|
[407] | 421 | *****************************************************************************************/ |
---|
[23] | 422 | int sys_utls( uint32_t operation, |
---|
| 423 | uint32_t value ); |
---|
[16] | 424 | |
---|
[407] | 425 | /****************************************************************************************** |
---|
[23] | 426 | * [31] This function change the acces rights for the file/dir identified by the |
---|
| 427 | * pathname argument. |
---|
[407] | 428 | ****************************************************************************************** |
---|
[23] | 429 | * @ pathname : pathname (can be relative or absolute). |
---|
| 430 | * @ rights : acces rights. |
---|
| 431 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 432 | *****************************************************************************************/ |
---|
[566] | 433 | int sys_chmod( char * pathname, |
---|
[506] | 434 | uint32_t rights ); |
---|
[16] | 435 | |
---|
[407] | 436 | /****************************************************************************************** |
---|
[23] | 437 | * [32] This function associate a specific signal handler to a given signal type. |
---|
[584] | 438 | * The handlers for the SIGKILL and SIGSTOP signals cannot be redefined. |
---|
[407] | 439 | ****************************************************************************************** |
---|
[23] | 440 | * @ sig_id : index defining signal type (from 1 to 31). |
---|
| 441 | * @ handler : pointer on fonction implementing the specific handler. |
---|
| 442 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 443 | *****************************************************************************************/ |
---|
[23] | 444 | int sys_signal( uint32_t sig_id, |
---|
| 445 | void * handler ); |
---|
[16] | 446 | |
---|
[407] | 447 | /****************************************************************************************** |
---|
[23] | 448 | * [33] This function returns in the structure <tv>, defined in the time.h file, |
---|
| 449 | * the current time (in seconds & micro-seconds). |
---|
| 450 | * It is computed from the calling core descriptor. |
---|
| 451 | * The timezone is not supported. |
---|
[407] | 452 | ****************************************************************************************** |
---|
[23] | 453 | * @ tv : pointer on the timeval structure. |
---|
| 454 | * @ tz : pointer on the timezone structure : must be NULL. |
---|
| 455 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 456 | *****************************************************************************************/ |
---|
[50] | 457 | int sys_timeofday( struct timeval * tv, |
---|
| 458 | struct timezone * tz ); |
---|
[16] | 459 | |
---|
[407] | 460 | /****************************************************************************************** |
---|
[433] | 461 | * [34] This function implements the "kill" system call on the kernel side. |
---|
[23] | 462 | * It register the signal defined by the <sig_id> argument in all thread descriptors |
---|
| 463 | * of a target process identified by the <pid> argument. This is done in all clusters |
---|
| 464 | * containing threads for the target process. |
---|
| 465 | * It can be executed by any thread running in any cluster, as this function uses |
---|
[407] | 466 | * remote access to traverse the list of process copies stored in the owner cluster, |
---|
[23] | 467 | * and the RPC_SIGNAL_RISE to signal the remote threads. |
---|
[421] | 468 | * This function does nothing for (sig_id == 0). This can be used to check process pid. |
---|
| 469 | * TODO : This first implementation supports only SIGKILL / SIGSTOP / SIGCONT values. |
---|
[407] | 470 | ****************************************************************************************** |
---|
[16] | 471 | * @ pid : target process identifier. |
---|
[433] | 472 | * @ sig_id : index defining the signal type. |
---|
[23] | 473 | * @ return 0 if success / returns -1 if failure. |
---|
[407] | 474 | *****************************************************************************************/ |
---|
[16] | 475 | int sys_kill( pid_t pid, |
---|
[23] | 476 | uint32_t sig_id ); |
---|
[16] | 477 | |
---|
[407] | 478 | /****************************************************************************************** |
---|
[433] | 479 | * [35] This function implements the "getpid" system call on the kernel side. |
---|
[407] | 480 | ****************************************************************************************** |
---|
| 481 | * @ returns the process PID for the calling thread. |
---|
| 482 | *****************************************************************************************/ |
---|
[479] | 483 | int sys_getpid( void ); |
---|
[1] | 484 | |
---|
[407] | 485 | /****************************************************************************************** |
---|
[433] | 486 | * [36] This function implement the "fork" system call on the kernel side. |
---|
| 487 | * The calling process descriptor (parent process), and the associated thread descriptor |
---|
| 488 | * are replicated in a - likely - remote cluster, that becomes the child process owner. |
---|
| 489 | * The child process get a new PID, and is linked to the parent PID. The child process |
---|
| 490 | * inherit from its parent the memory image, and all open files (including the TXT). |
---|
| 491 | * The child process becomes the TXT terminal owner. |
---|
[1] | 492 | * The target cluster depends on the "fork_user" flag and "fork_cxy" variable that can be |
---|
| 493 | * stored in the calling thread descriptor by the specific fork_place() system call. |
---|
[433] | 494 | * If not, the kernel function makes a query to the DQDT to select the target cluster. |
---|
[407] | 495 | ****************************************************************************************** |
---|
| 496 | * @ if success, returns child process PID to parent, and return O to child. |
---|
| 497 | * @ if failure, returns -1 to parent / no child process is created. |
---|
| 498 | *****************************************************************************************/ |
---|
[479] | 499 | int sys_fork( void ); |
---|
[1] | 500 | |
---|
[407] | 501 | /****************************************************************************************** |
---|
[433] | 502 | * [37] This function implement the "exec" system call on the kernel side. |
---|
| 503 | * It creates, in the same cluster as the calling thread, a new process descriptor, |
---|
| 504 | * and a new associated main thread descriptor, executing a new memory image defined |
---|
| 505 | * by the <filename> argument. This new process inherit from the old process the PID |
---|
| 506 | * and the PPID, as well as all open files (including the TXT). |
---|
| 507 | * The old process descriptor, and all its threads are blocked, and marked for deletion. |
---|
| 508 | * Therefore the exec syscall does not return to the calling thread in case of success. |
---|
| 509 | * This function build an exec_info_t structure containing the new process arguments, |
---|
| 510 | * as defined by the <arv> argument, and the new process environment variables, |
---|
| 511 | * as defined by the <envp> argument. |
---|
| 512 | * TODO : the <argv> and <envp> arguments are not supported yet (both must be NULL). |
---|
[407] | 513 | ****************************************************************************************** |
---|
| 514 | * @ filename : string pointer on .elf filename (pointer in user space) |
---|
| 515 | * @ argv : array of strings on process arguments (pointers in user space) |
---|
| 516 | * @ envp : array of strings on environment variables (pointers in user space) |
---|
[433] | 517 | * @ does not return if success / returns -1 if failure. |
---|
[407] | 518 | *****************************************************************************************/ |
---|
[566] | 519 | int sys_exec( char * filename, |
---|
| 520 | char ** argv, |
---|
| 521 | char ** envp ); |
---|
[1] | 522 | |
---|
[407] | 523 | /****************************************************************************************** |
---|
| 524 | * [38] This function returns in the <stat> structure, defined in the "shared_syscalls.h" |
---|
| 525 | * file, various informations on the file/directory identified by the <pathname> argument. |
---|
[594] | 526 | * TODO only the <st_ino>, <st_mode>,<st_uid>,<st_gid>,<st_size> are set. |
---|
[407] | 527 | ****************************************************************************************** |
---|
| 528 | * @ pathname : user pointer on file pathname. |
---|
| 529 | * @ stat : user pointer on the stat structure. |
---|
[23] | 530 | * @ returns O if success / returns -1 if failure. |
---|
[407] | 531 | *****************************************************************************************/ |
---|
[566] | 532 | int sys_stat( char * pathname, |
---|
[407] | 533 | struct stat * stat ); |
---|
[1] | 534 | |
---|
[407] | 535 | /****************************************************************************************** |
---|
[433] | 536 | * [39] This blocking function waits a change of a child process state, that can be: |
---|
| 537 | * - a termination of child following a process_make_exit(). |
---|
| 538 | * - a termination of child following a process_make_kill(). |
---|
[421] | 539 | * - a blocking of child following a SIGSTOP signal. |
---|
[433] | 540 | * In case of a multi-thread process, this function must be called by the main thread |
---|
| 541 | * runningin the reference cluster. |
---|
| 542 | * When a change has been observed, it returns the PID of the child process, and stores |
---|
| 543 | * in the <status> argument relevant information on the child state change. |
---|
[421] | 544 | * The following macros can be used to extract information from status: |
---|
| 545 | * - WIFEXITED(status) : is true if the child process terminated with an exit(). |
---|
[435] | 546 | * - WIFSIGNALED(status) : is true if the child process killed by a signal. |
---|
[421] | 547 | * - WIFSTOPPED(status) : is true if the child process is stopped by a signal. |
---|
| 548 | * - WEXITSTATUS(status) : returns the low-order 8 bits of the exit() argument. |
---|
| 549 | * If a parent process terminates without waiting for all child processes to terminate, |
---|
| 550 | * the remaining child processes are attached to the init process. |
---|
[433] | 551 | * WARNING: negative values for the <pid> argument are not supported. |
---|
[421] | 552 | ****************************************************************************************** |
---|
[433] | 553 | * @ searched_pid : searched child process identifier. |
---|
| 554 | * @ status : [out] child termination status. |
---|
| 555 | * @ return child PID if success / return -1 if searched PID not found. |
---|
[407] | 556 | *****************************************************************************************/ |
---|
[421] | 557 | int sys_wait( uint32_t * status ); |
---|
[1] | 558 | |
---|
[407] | 559 | /****************************************************************************************** |
---|
[584] | 560 | * [40] This function implement the non-standard get_config() syscall. |
---|
[664] | 561 | * It returns the global hardware platform parameters in the <config> shared structure, |
---|
| 562 | * that is defined in the shared_almos.h file. |
---|
[407] | 563 | ****************************************************************************************** |
---|
[664] | 564 | * @ config : [out] pointer on the hard_config_t structure in user space. |
---|
| 565 | * @ return 0 if success / return -1 if illegal argument |
---|
[407] | 566 | *****************************************************************************************/ |
---|
[664] | 567 | int sys_get_config( struct hard_config_s * config ); |
---|
[1] | 568 | |
---|
[407] | 569 | /****************************************************************************************** |
---|
[637] | 570 | * [41] This function implements the non-standard get_core_id() syscall. |
---|
[584] | 571 | * It returns in <cxy> and <lid> the calling core cluster and local index. |
---|
[407] | 572 | ****************************************************************************************** |
---|
| 573 | * @ cxy : [out] cluster identifier (fixed format) |
---|
| 574 | * @ lid : [out] core local index in cluster. |
---|
| 575 | * @ return 0 if success / return -1 if illegal arguments |
---|
| 576 | *****************************************************************************************/ |
---|
[637] | 577 | int sys_get_core_id( uint32_t * cxy, |
---|
| 578 | uint32_t * lid ); |
---|
[1] | 579 | |
---|
[407] | 580 | /****************************************************************************************** |
---|
[584] | 581 | * [42] This function implements the non-standard get_cycle() syscall. |
---|
| 582 | * It returns in a 64 bits user buffer the calling core cycles count. |
---|
[407] | 583 | * It uses both the hardware register and the core descriptor cycles count to take |
---|
| 584 | * into account a possible harware register overflow in 32 bits architectures. |
---|
| 585 | ****************************************************************************************** |
---|
| 586 | * cycle : [out] address of buffer in user space. |
---|
| 587 | * @ return 0 if success / return -1 if illegal arguments |
---|
| 588 | *****************************************************************************************/ |
---|
| 589 | int sys_get_cycle( uint64_t * cycle ); |
---|
| 590 | |
---|
| 591 | /****************************************************************************************** |
---|
[421] | 592 | * [43] This debug function displays on the kernel terminal TXT0 an user defined string, |
---|
| 593 | * or the current state of a kernel structure, identified by the <type> argument. |
---|
[626] | 594 | * The <arg0>, <arg1>, and <arg2> arguments depends on the structure type. |
---|
[407] | 595 | ****************************************************************************************** |
---|
[435] | 596 | * type : [in] type of display |
---|
[421] | 597 | * arg0 : [in] type dependant argument. |
---|
| 598 | * arg1 : [in] type dependant argument. |
---|
[611] | 599 | * arg2 : [in] type dependant argument. |
---|
[407] | 600 | * @ return 0 if success / return -1 if illegal arguments |
---|
| 601 | *****************************************************************************************/ |
---|
[421] | 602 | int sys_display( reg_t type, |
---|
| 603 | reg_t arg0, |
---|
[611] | 604 | reg_t arg1, |
---|
| 605 | reg_t arg2 ); |
---|
[407] | 606 | |
---|
| 607 | /****************************************************************************************** |
---|
[584] | 608 | * [44] This function implements the non-standard place_fork() syscall. |
---|
| 609 | * It can be used to specify the target cluster <cxy> for a new process created |
---|
| 610 | * by a subsequent fork() syscall. |
---|
| 611 | * WARNING: it must be called before each fork() syscall, as the placement specification |
---|
| 612 | * is reset by the fork syscall. |
---|
[457] | 613 | ****************************************************************************************** |
---|
| 614 | * @ cxy : cluster identifier. |
---|
| 615 | * @ return 0 if success / return -1 if failure. |
---|
| 616 | *****************************************************************************************/ |
---|
[584] | 617 | int sys_place_fork( uint32_t cxy ); |
---|
[457] | 618 | |
---|
| 619 | /****************************************************************************************** |
---|
[407] | 620 | * [45] This function block the calling thread on the THREAD_BLOCKED_GLOBAL condition, |
---|
| 621 | * and deschedule. |
---|
| 622 | ****************************************************************************************** |
---|
| 623 | * @ return 0 if success / returns -1 if failure. |
---|
| 624 | *****************************************************************************************/ |
---|
[479] | 625 | int sys_thread_sleep( void ); |
---|
[407] | 626 | |
---|
| 627 | /****************************************************************************************** |
---|
| 628 | * [46] This function unblock the thread identified by its <trdid> from the |
---|
| 629 | * THREAD_BLOCKED_GLOBAL condition. |
---|
| 630 | ****************************************************************************************** |
---|
| 631 | * @ trdid : target thread identifier. |
---|
| 632 | * @ return 0 if success / return -1 if failure. |
---|
| 633 | *****************************************************************************************/ |
---|
[506] | 634 | int sys_thread_wakeup( trdid_t trdid ); |
---|
[407] | 635 | |
---|
[421] | 636 | /****************************************************************************************** |
---|
[443] | 637 | * [47] This debug function is used to activate / desactivate the context switches trace |
---|
| 638 | * for a core identified by the <cxy> and <lid> arguments. |
---|
[421] | 639 | * It can be called by any other thread in the same process. |
---|
| 640 | ****************************************************************************************** |
---|
[443] | 641 | * @ active : activate trace if true / desactivate trace if false. |
---|
| 642 | * @ cxy : cluster identifier. |
---|
| 643 | * @ lid : core local index. |
---|
[421] | 644 | * @ returns O if success / returns -1 if failure. |
---|
| 645 | *****************************************************************************************/ |
---|
[443] | 646 | int sys_trace( bool_t active, |
---|
| 647 | cxy_t cxy, |
---|
| 648 | lid_t lid ); |
---|
[407] | 649 | |
---|
[421] | 650 | /****************************************************************************************** |
---|
| 651 | * [48] This function gives the process identified by the <pid> argument |
---|
| 652 | * the exclusive ownership of its TXT_TX terminal (put it in foreground). |
---|
| 653 | ****************************************************************************************** |
---|
| 654 | * @ pid : process identifier. |
---|
| 655 | * @ return 0 if success / return -1 if failure. |
---|
| 656 | *****************************************************************************************/ |
---|
| 657 | int sys_fg( pid_t pid ); |
---|
| 658 | |
---|
[445] | 659 | /****************************************************************************************** |
---|
[457] | 660 | * [49] This function returns a non-zero value in the <is_fg> buffer when the process |
---|
| 661 | * identified by the <pid> argument is the current TXT owner. |
---|
[445] | 662 | ****************************************************************************************** |
---|
[457] | 663 | * @ pid : process identifier. |
---|
| 664 | * @ is_fg : pointer on buffer. |
---|
[445] | 665 | * @ return 0 if success / return -1 if failure. |
---|
| 666 | *****************************************************************************************/ |
---|
[457] | 667 | int sys_is_fg( pid_t pid, |
---|
| 668 | uint32_t * is_fg ); |
---|
[421] | 669 | |
---|
[610] | 670 | /****************************************************************************************** |
---|
[626] | 671 | * [50] This function implements the "exit" system call terminating a POSIX process. |
---|
[610] | 672 | * It can be called by any thread running in any cluster. |
---|
| 673 | * It uses both remote accesses to access the owner process descriptor, and the |
---|
[626] | 674 | * RPC_PROCESS_SIGACTION to delete remote process copies and thread descriptors. |
---|
[610] | 675 | * In the present implementation, this function implements actually the _exit(): |
---|
| 676 | * - it does not flush open output streams. |
---|
| 677 | * - it does not close open streams. |
---|
| 678 | ****************************************************************************************** |
---|
[626] | 679 | * @ status : terminaison status returned to parent process. |
---|
| 680 | * @ return 0 if success / return -1 if failure. |
---|
[610] | 681 | *****************************************************************************************/ |
---|
| 682 | int sys_exit( uint32_t status ); |
---|
| 683 | |
---|
[626] | 684 | /****************************************************************************************** |
---|
| 685 | * [51] This function implements the "sync" system call. |
---|
| 686 | * It forces all modified pages in all kernel mappers to be copied to the IOC device. |
---|
| 687 | * It can be called by any thread running in any cluster. |
---|
| 688 | * TODO not implemented yet. |
---|
| 689 | ****************************************************************************************** |
---|
| 690 | * @ return 0 if success / return -1 if failure. |
---|
| 691 | *****************************************************************************************/ |
---|
| 692 | int sys_sync( void ); |
---|
| 693 | |
---|
| 694 | /****************************************************************************************** |
---|
| 695 | * [52] This function implements the "fsync" system call. |
---|
| 696 | * It forces all modified pages of the file mapper identified by the <fd> argument |
---|
| 697 | * to be copied to the IOC device. |
---|
| 698 | * It can be called by any thread running in any cluster. |
---|
| 699 | * TODO not implemented yet. |
---|
| 700 | ****************************************************************************************** |
---|
| 701 | * @ file_id : file descriptor index in fd_array. |
---|
| 702 | * @ return 0 if success / return -1 if failure. |
---|
| 703 | *****************************************************************************************/ |
---|
| 704 | int sys_fsync( uint32_t file_id ); |
---|
| 705 | |
---|
[637] | 706 | /****************************************************************************************** |
---|
| 707 | * [53] This function implements the non-standard "get_best_core" syscall. |
---|
| 708 | * It selects, in a macro-cluster specified by the <base_cxy> and <level> arguments, |
---|
| 709 | * the core that has the lowest load. |
---|
| 710 | * When an active core has been found in the target macro-cluster, it writes into the |
---|
| 711 | * <cxy> and <lid> buffers the cluster identifier and the core local index, and return 0. |
---|
| 712 | * It returns -1 in case of illegal arguments (level / cxy / lid). |
---|
| 713 | * It returns +1 if there is no active core in specified macro-cluster. |
---|
| 714 | ****************************************************************************************** |
---|
| 715 | * @ base_cxy : [in] any cluster identifier in macro-cluster. |
---|
| 716 | * @ level : [in] macro-cluster level in [1,2,3,4,5]. |
---|
| 717 | * @ cxy : [out] selected core cluster identifier. |
---|
| 718 | * @ lid : [out] selected core local index in cluster. |
---|
| 719 | * @ return 0 if success / -1 if illegal arguments / +1 if no core in macro-clusters. |
---|
| 720 | *****************************************************************************************/ |
---|
| 721 | int sys_get_best_core( uint32_t base_cxy, |
---|
| 722 | uint32_t level, |
---|
| 723 | uint32_t * cxy, |
---|
| 724 | uint32_t * lid ); |
---|
| 725 | |
---|
| 726 | /****************************************************************************************** |
---|
| 727 | * [54] This function implements the non-standard "get_nb_cores" syscall. |
---|
| 728 | * It writes in the <ncores> buffer the number of cores in the target cluster <cxy>. |
---|
| 729 | ****************************************************************************************** |
---|
| 730 | * @ cxy : [in] target cluster identifier. |
---|
| 731 | * @ ncores : [out] number of cores / 0 if cluster cxy undefined in architecture. |
---|
| 732 | * @ return 0 if success / return -1 if illegal "ncores" arguments. |
---|
| 733 | *****************************************************************************************/ |
---|
| 734 | int sys_get_nb_cores( uint32_t cxy, |
---|
| 735 | uint32_t * ncores ); |
---|
| 736 | |
---|
[641] | 737 | /****************************************************************************************** |
---|
| 738 | * [55] This function implements the non-standard "get_thread_info" syscall. |
---|
| 739 | * It copies in the user structure defined by the <info> argument the values registered |
---|
| 740 | * in the calling thread "thread_info_t" kernel structure. |
---|
| 741 | ****************************************************************************************** |
---|
| 742 | * @ info : [out] pointer on thread_info_t structure in user space. |
---|
| 743 | * @ return 0 if success / return -1 if illegal argument. |
---|
| 744 | *****************************************************************************************/ |
---|
| 745 | int sys_get_thread_info( thread_info_t * info ); |
---|
| 746 | |
---|
[642] | 747 | /****************************************************************************************** |
---|
[657] | 748 | * [56] This generic function implements the non-standard FBF related syscalls. |
---|
| 749 | * The operation types mnemonics are defined in the <shared_fbf> file. |
---|
| 750 | * The supported operations are defined in the <almosmkh.h> & <almosmkh.c> files. |
---|
| 751 | * This function ckecks the syscall arguments, and call the relevant kernel function. |
---|
[642] | 752 | ****************************************************************************************** |
---|
[657] | 753 | * @ arg0 : operation type (mnemonics defined in shared_fbf.h) |
---|
| 754 | * @ arg1 : depends on operation type |
---|
| 755 | * @ arg2 : depends on operation type |
---|
| 756 | * @ arg3 : depends on operation type |
---|
[642] | 757 | * @ return 0 if success / return -1 if illegal argument. |
---|
| 758 | *****************************************************************************************/ |
---|
[657] | 759 | int sys_fbf( reg_t arg0, |
---|
| 760 | reg_t arg1, |
---|
| 761 | reg_t arg2, |
---|
| 762 | reg_t arg3 ); |
---|
[642] | 763 | |
---|
[657] | 764 | /****************************************************************************************** |
---|
| 765 | * [57] This generic function implements the socket related syscalls. |
---|
| 766 | * The operation types mnemonics are defined in the <shared_socket> file. |
---|
| 767 | * The supported operations are defined in the <socket.h> & <socket.c> files. |
---|
| 768 | * This function ckecks the syscall arguments, and call the relevant kernel function. |
---|
| 769 | ****************************************************************************************** |
---|
| 770 | * @ arg0 : operation type (mnemonics defined in shared_socket.h) |
---|
| 771 | * @ arg1 : depends on operation type |
---|
| 772 | * @ arg2 : depends on operation type |
---|
| 773 | * @ arg3 : depends on operation type |
---|
| 774 | * @ return 0 if success / return -1 if illegal argument. |
---|
| 775 | *****************************************************************************************/ |
---|
| 776 | int sys_socket( reg_t arg0, |
---|
| 777 | reg_t arg1, |
---|
| 778 | reg_t arg2, |
---|
| 779 | reg_t arg3 ); |
---|
| 780 | |
---|
[16] | 781 | #endif // _SYSCALLS_H_ |
---|