mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Wansink <andy@sharinga.com>
To: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: RLIM_INFINITY support for RLIMIT_NOFILE (patch)
Date: Fri, 13 Jul 2001 02:33:30 +0000	[thread overview]
Message-ID: <20010713023329.A7928@freeonline.com.au> (raw)

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;

                 reply	other threads:[~2001-07-13  2:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010713023329.A7928@freeonline.com.au \
    --to=andy@sharinga.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®