1 /* 2 * Copyright 2005-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 // TODO: temporary measurement to fix the build with GCC 4 - in the end, these 7 // private syscalls shouldn't be used anywhere in the Haiku tree, at the very 8 // least they should only be used when compiling for GCC 2.95.3, though. 9 #if __GNUC__ < 30 10 11 // This file includes some known R5 syscalls 12 // ToDo: maybe they should indeed do something... 13 14 #include <SupportDefs.h> 15 16 #include <sys/resource.h> 17 #include <syscalls.h> 18 #include <errno.h> 19 20 21 int _kset_mon_limit_(int num); 22 int _kset_fd_limit_(int num); 23 int _klock_node_(int fd); 24 int _kget_cpu_state_(int cpuNum); 25 int _kset_cpu_state_(int cpuNum, int state); 26 27 28 int 29 _kset_mon_limit_(int num) 30 { 31 struct rlimit rl; 32 if (num < 1) 33 return EINVAL; 34 rl.rlim_cur = num; 35 if (setrlimit(RLIMIT_NOVMON, &rl) < 0) 36 return errno; 37 return B_OK; 38 } 39 40 41 int 42 _kset_fd_limit_(int num) 43 { 44 struct rlimit rl; 45 if (num < 1) 46 return EINVAL; 47 rl.rlim_cur = num; 48 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) 49 return errno; 50 return B_OK; 51 } 52 53 54 int 55 _klock_node_(int fd) 56 { 57 return B_ERROR; 58 } 59 60 61 int 62 _kget_cpu_state_(int cpuNum) 63 { 64 return _kern_cpu_enabled(cpuNum); 65 } 66 67 68 int 69 _kset_cpu_state_(int cpuNum, int state) 70 { 71 return _kern_set_cpu_enabled(cpuNum, state != 0); 72 } 73 74 #endif // __GNUC__ < 3 75