Changeset 23 for trunk/kernel/syscalls/sys_utls.c
- Timestamp:
- Jun 18, 2017, 10:06:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/syscalls/sys_utls.c
r1 r23 2 2 * kern/sys_utls.c - User Thread Local Storage 3 3 * 4 * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless5 * Copyright (c) 2011,2012 UPMC Sorbonne Universites4 * Author Ghassan Almaless (2008,2009,2010,2011,2012) 5 * Alain Greiner (2016,2017) 6 6 * 7 * This file is part of ALMOS-kernel.7 * Copyright (c) UPMC Sorbonne Universites 8 8 * 9 * ALMOS-kernel is free software; you can redistribute it and/or modify it 9 * This file is part of ALMOS-MKH. 10 * 11 * ALMOS-MKH is free software; you can redistribute it and/or modify it 10 12 * under the terms of the GNU General Public License as published by 11 13 * the Free Software Foundation; version 2.0 of the License. 12 14 * 13 * ALMOS- kernelis distributed in the hope that it will be useful, but15 * ALMOS-MKH is distributed in the hope that it will be useful, but 14 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU … … 17 19 * 18 20 * 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,21 * along with ALMOS-MKH; if not, write to the Free Software Foundation, 20 22 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 23 */ 22 24 23 #include < types.h>25 #include <hal_types.h> 24 26 #include <errno.h> 25 27 #include <thread.h> 26 #include <kmem.h> 27 #include <kmagics.h> 28 #include <semaphore.h> 28 #include <printk.h> 29 #include <syscalls.h> 29 30 30 #define UTLS_SET 1 31 #define UTLS_GET 2 32 #define UTLS_GET_ERRNO 3 33 34 int sys_utls(uint_t operation, uint_t value) 31 ///////////////////////////////// 32 int sys_utls( uint32_t operation, 33 uint32_t value ) 35 34 { 36 struct thread_s *this = current_thread;35 thread_t * this = CURRENT_THREAD; 37 36 38 37 switch(operation) 39 38 { 40 case UTLS_SET:41 this-> info.usr_tls = value;39 case UTLS_SET: 40 this->utls = value; 42 41 return 0; 43 42 44 case UTLS_GET:45 return this-> info.usr_tls;43 case UTLS_GET: 44 return this->utls; 46 45 47 case UTLS_GET_ERRNO:48 return this-> info.errno;46 case UTLS_GET_ERRNO: 47 return this->errno; 49 48 50 default: 51 this->info.errno = EINVAL; 49 default: 50 printk("\n[ERROR] in %s : illegal utls operation\n", __FUNCTION__ ); 51 this->errno = EINVAL; 52 52 return -1; 53 53 } 54 } 54 55 } // end sys_utls()
Note: See TracChangeset
for help on using the changeset viewer.