* resource.cc (getrlimit): Return actual values on RLIMIT_STACK.

This commit is contained in:
Corinna Vinschen 2001-08-28 22:48:23 +00:00
parent a06a7fb451
commit e4a17c6d11
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Wed Aug 29 0:45:00 2001 Corinna Vinschen <corinna@vinschen.de>
* resource.cc (getrlimit): Return actual values on RLIMIT_STACK.
Tue Aug 28 16:37:17 2001 Christopher Faylor <cgf@cygnus.com>
* dir.cc (rmdir): Report ENOENT when file doesn't exist rather than

View File

@ -106,6 +106,8 @@ extern "C"
int
getrlimit (int resource, struct rlimit *rlp)
{
MEMORY_BASIC_INFORMATION m;
if (check_null_invalid_struct_errno (rlp))
return -1;
@ -117,7 +119,16 @@ getrlimit (int resource, struct rlimit *rlp)
case RLIMIT_CPU:
case RLIMIT_FSIZE:
case RLIMIT_DATA:
break;
case RLIMIT_STACK:
if (!VirtualQuery ((LPCVOID) &m, &m, sizeof m))
debug_printf ("couldn't get stack info, returning def.values. %E");
else
{
rlp->rlim_cur = (DWORD) &m - (DWORD) m.AllocationBase;
rlp->rlim_max = (DWORD) m.BaseAddress + m.RegionSize
- (DWORD) m.AllocationBase;
}
break;
case RLIMIT_NOFILE:
rlp->rlim_cur = getdtablesize ();