Changeset 2748
- Timestamp:
- Jul 26, 2006, 10:57:05 PM (19 years ago)
- Location:
- trunk/libc
- Files:
-
- 5 added
- 2 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/include/emx/syscalls.h
r2742 r2748 209 209 int __swchar (int flag, int new_char); 210 210 int __uflags (int mask, int new_flags); 211 long __ulimit (int cmd, long new_limit);211 //long __ulimit (int cmd, long new_limit); 212 212 //dead int __umask (int pmode); 213 213 void __unwind2 (void *xcpt_reg_ptr); -
trunk/libc/include/sys/resource.h
r2747 r2748 97 97 #define RLIMIT_VMEM 10 /* virtual process size (inclusive of mmap) */ 98 98 #define RLIMIT_AS RLIMIT_VMEM /* standard name for RLIMIT_VMEM */ 99 #define RLIMIT_OBJREST 11 /* bird: size left in the top heap object. kLIBC specific. */ 99 100 100 #define RLIM_NLIMITS 1 1 /* number of resource limits*/101 #define RLIM_NLIMITS 12 /* number of resource limits */ /* bird: was 11 */ 101 102 102 103 #define RLIM_INFINITY ((rlim_t)(((u_quad_t)1 << 63) - 1)) -
trunk/libc/src/kNIX/Makefile.kmk
r2742 r2748 43 43 $(PATH_LIBC_SRC)/kNIX/b_mmanSBrkGetModel.c \ 44 44 $(PATH_LIBC_SRC)/kNIX/b_mmanSBrkSetModel.c \ 45 $(PATH_LIBC_SRC)/kNIX/b_processGetResourceLimit.c \ 46 $(PATH_LIBC_SRC)/kNIX/b_processSetResourceLimit.c \ 45 47 $(PATH_LIBC_SRC)/kNIX/b_signalSendPid.c \ 46 48 $(PATH_LIBC_SRC)/kNIX/filehandles.c \ … … 187 189 $(PATH_LIBC_SRC)/kNIX/os2/__swchar.c \ 188 190 $(PATH_LIBC_SRC)/kNIX/os2/__ttyname.c \ 189 $(PATH_LIBC_SRC)/kNIX/os2/__ulimit.c \190 191 $(PATH_LIBC_SRC)/kNIX/os2/__wait.c \ 191 192 $(PATH_LIBC_SRC)/kNIX/os2/__waitpid.c \ -
trunk/libc/src/kNIX/kNIX.h
r2739 r2748 86 86 87 87 88 /** @name ?? 89 * @{ 90 */ 91 int __libc_back_sys_processGetResourceLimit(int iResId, struct rlimit *pLimit); 92 /** @} */ 93 88 94 __END_DECLS 89 95 -
trunk/libc/src/kNIX/os2/resource.c
r2732 r2748 30 30 * Header Files * 31 31 *******************************************************************************/ 32 #include " libc-alias.h"32 #include "../kNIX.h" 33 33 #define INCL_FSMACROS 34 34 #define INCL_DOSFILEMGR … … 37 37 #define INCL_DOSERRORS 38 38 #include <os2.h> 39 #include < sys/errno.h>39 #include <errno.h> 40 40 #include <sys/types.h> 41 41 #include <sys/time.h> 42 42 #include <sys/resource.h> 43 #include "syscalls.h"44 43 45 44 46 /* getrlimit: Get resource limits * 47 * for documentation see: 48 * http://www.opengroup.org/onlinepubs/009695399/functions/getrlimit.html 45 46 /** 47 * The Platform dependent part of the __libc_Back_processGetResourceLimit() API. 48 * 49 * @returns 0 on success and pLimit filled in. 50 * @returns negated errno on failure. 51 * @param iResId The resource id. 52 * @param pLimit Where to put the limit. 49 53 */ 50 51 int _STD(getrlimit)(int iResId, struct rlimit * pLimit) 54 int __libc_back_sys_processGetResourceLimit(int iResId, struct rlimit *pLimit) 52 55 { 53 int rcRet = 0;54 55 56 switch (iResId) 56 57 { … … 76 77 case RLIMIT_NOFILE: 77 78 { 78 ULONG ulCurMax = 0; 79 LONG lReqCount = 0; 80 APIRET rc; 81 FS_VAR(); 82 83 FS_SAVE_LOAD(); 84 rc = DosSetRelMaxFH(&lReqCount, &ulCurMax); 79 ULONG ulCurMax = 0; 80 LONG lReqCount = 0; 81 FS_VAR_SAVE_LOAD(); 82 if ( DosSetRelMaxFH(&lReqCount, &ulCurMax) 83 || ulCurMax < CFG_KNIX_MAX_FHS) 84 ulCurMax = CFG_KNIX_MAX_FHS; 85 85 FS_RESTORE(); 86 if (rc == NO_ERROR) 87 { 88 if (ulCurMax < 10000) 89 ulCurMax = 10000; 90 pLimit->rlim_cur = ulCurMax; 91 pLimit->rlim_max = ulCurMax; 92 } 93 else 94 { 95 _sys_set_errno(rc); 96 rcRet = -1; 97 } 86 pLimit->rlim_cur = ulCurMax; 87 pLimit->rlim_max = ulCurMax; 98 88 break; 99 89 } 100 90 91 /* 92 * Not supported. 93 */ 101 94 case RLIMIT_CPU: 102 95 case RLIMIT_SBSIZE: 103 96 case RLIMIT_MEMLOCK: 104 errno = ENOSYS; 105 rcRet = -1; 106 break; 97 return -EINVAL; 107 98 108 99 /* … … 111 102 case RLIMIT_STACK: 112 103 { 113 PTIB pTib; 114 PPIB pPib; 104 PTIB pTib; 105 PPIB pPib; 106 FS_VAR_SAVE_LOAD(); 115 107 DosGetInfoBlocks(&pTib, &pPib); 108 FS_RESTORE(); 116 109 pLimit->rlim_cur = (uintptr_t)pTib->tib_pstacklimit - (uintptr_t)pTib->tib_pstack; 117 110 pLimit->rlim_max = (uintptr_t)pTib->tib_pstacklimit - (uintptr_t)pTib->tib_pstack; … … 119 112 } 120 113 121 /*122 * Limit of the data segment.123 * In OS/2 limit of private memory.124 */125 114 case RLIMIT_DATA: 126 { 127 ULONG cbPrivateLow; 128 ULONG cbPrivateHigh; 129 if (DosQuerySysInfo(QSV_MAXPRMEM, QSV_MAXPRMEM, &cbPrivateLow, sizeof(cbPrivateLow))) 130 cbPrivateLow = 64*1024*1024; /* 64MB is always secured by OS/2. */ 131 if (DosQuerySysInfo(QSV_MAXPRMEM, QSV_MAXPRMEM, &cbPrivateHigh, sizeof(cbPrivateHigh))) 132 cbPrivateHigh = 0; 133 pLimit->rlim_cur = cbPrivateLow + cbPrivateHigh; 134 pLimit->rlim_max = pLimit->rlim_cur; 135 break; 136 } 115 LIBC 137 116 138 117 /* … … 142 121 { 143 122 ULONG cMaxProcesses; 123 FS_VAR_SAVE_LOAD(); 144 124 if (DosQuerySysInfo(QSV_MAXPROCESSES, QSV_MAXPROCESSES, &cMaxProcesses, sizeof(cMaxProcesses))) 145 125 cMaxProcesses = 256; 126 FS_RESTORE(); 146 127 pLimit->rlim_cur = cMaxProcesses; 147 128 pLimit->rlim_max = cMaxProcesses; … … 155 136 { 156 137 ULONG cMBUserVirtualMem = 0; 138 FS_VAR_SAVE_LOAD(); 157 139 if (DosQuerySysInfo(QSV_VIRTUALADDRESSLIMIT, QSV_VIRTUALADDRESSLIMIT, &cMBUserVirtualMem, sizeof(cMBUserVirtualMem))) 158 140 cMBUserVirtualMem = 512; 141 FS_RESTORE(); 159 142 pLimit->rlim_cur = cMBUserVirtualMem * (1 << 20); 160 143 pLimit->rlim_max = pLimit->rlim_cur; … … 163 146 164 147 default: 165 errno = EINVAL; 166 rcRet = -1; 167 break; 148 return -EINVAL; 168 149 }; 169 150 170 return rcRet;151 return 0; 171 152 } 172 153 173 int _STD(setrlimit)(int iResId, const struct rlimit *pLimit)174 {175 errno = ENOSYS;176 return -1;177 } -
trunk/libc/src/libc/misc/Makefile.kmk
r2739 r2748 137 137 $(PATH_LIBC_SRC)/libc/misc/sysctl_mib.c \ 138 138 $(PATH_LIBC_SRC)/libc/misc/syserr.c \ 139 $(PATH_LIBC_SRC)/libc/misc/ulimit.c \140 139 $(PATH_LIBC_SRC)/libc/misc/uname.c \ 141 140 $(PATH_LIBC_SRC)/libc/misc/wildcard.c \ -
trunk/libc/src/libc/process/Makefile.kmk
r2739 r2748 46 46 $(PATH_LIBC_SRC)/libc/process/fork.c \ 47 47 $(PATH_LIBC_SRC)/libc/process/getitimer.c \ 48 $(PATH_LIBC_SRC)/libc/process/getrlimit.c \ 48 49 $(PATH_LIBC_SRC)/libc/process/getpid.c \ 49 50 $(PATH_LIBC_SRC)/libc/process/getpriority.c \ … … 59 60 $(PATH_LIBC_SRC)/libc/process/semop.c \ 60 61 $(PATH_LIBC_SRC)/libc/process/setitimer.c \ 62 $(PATH_LIBC_SRC)/libc/process/setrlimit.c \ 61 63 $(PATH_LIBC_SRC)/libc/process/setpriority.c \ 62 64 $(PATH_LIBC_SRC)/libc/process/shmat.c \ … … 103 105 $(PATH_LIBC_SRC)/libc/process/thread_internals.c \ 104 106 $(PATH_LIBC_SRC)/libc/process/tls.c \ 107 $(PATH_LIBC_SRC)/libc/process/ulimit.c \ 105 108 $(PATH_LIBC_SRC)/libc/process/wait.c \ 106 109 $(PATH_LIBC_SRC)/libc/process/wait3.c \
Note:
See TracChangeset
for help on using the changeset viewer.