mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RLIM_INFINITY support for RLIMIT_NOFILE (patch)
@ 2001-07-13  2:33 Andrew Wansink
  0 siblings, 0 replies; only message in thread
From: Andrew Wansink @ 2001-07-13  2:33 UTC (permalink / raw)
  To: torvalds, linux-kernel

Good day all, I recently found that the linux kernel does not support setting
a process' RLIMIT_NOFILE limits to the #define RLIM_INFINITY.  My patch will
add such support by setting the limit to the maximum supported by the kernel
when a call to set a limit to RLIM_INFINITY is made.

I understand that the semantics do not match exactly but all kernels are limited
by real hard limits and/or available memory, I think that it is therefore 
acceptable to have a call to set a limit to RLIM_INFINITY actually set the 
limit to the maximum extent supported by the kernel.

Patch by: Andrew Wansink & Chris Leishman
Against:  Linux 2.4.6
Date:     (Friday the 13th) 13th July 2001
File:     kernel/sys.c

--- sys.c.orig	Fri Jul 13 02:03:19 2001
+++ sys.c	Fri Jul 13 01:41:57 2001
@@ -1119,6 +1119,10 @@
 		return -EINVAL;
 	if(copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
 		return -EFAULT;
+	if (new_rlim.rlim_cur == RLIM_INFINITY)
+		new_rlim.rlim_cur = NR_OPEN;
+	if (new_rlim.rlim_max == RLIM_INFINITY)
+		new_rlim.rlim_max = NR_OPEN;
 	if (new_rlim.rlim_cur < 0 || new_rlim.rlim_max < 0)
 		return -EINVAL;
 	old_rlim = current->rlim + resource;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-07-13  2:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-13  2:33 RLIM_INFINITY support for RLIMIT_NOFILE (patch) Andrew Wansink

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®