diff options
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/getdtsz.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/getdtsz.c b/sysdeps/mach/hurd/getdtsz.c index 572ac5fd0e..f99f0c11ea 100644 --- a/sysdeps/mach/hurd/getdtsz.c +++ b/sysdeps/mach/hurd/getdtsz.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,94,95,97,2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -27,13 +27,18 @@ int __getdtablesize () { - int size; + rlim_t limit; + HURD_CRITICAL_BEGIN; __mutex_lock (&_hurd_rlimit_lock); - size = _hurd_rlimits[RLIMIT_NOFILE].rlim_cur; + limit = _hurd_rlimits[RLIMIT_NOFILE].rlim_cur; __mutex_unlock (&_hurd_rlimit_lock); HURD_CRITICAL_END; - return size; + + /* RLIM_INFINITY is not meaningful to our caller. -1 is a good choice + because `sysconf (_SC_OPEN_MAX)' calls us, and -1 from sysconf means + "no determinable limit". */ + return limit == RLIM_INFINITY ? -1 : (int) limit; } weak_alias (__getdtablesize, getdtablesize) |