public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: Ulrich Drepper <drepper@redhat.com>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: process file descriptor limit handling
Date: Wed, 9 Mar 2005 15:28:37 -0800	[thread overview]
Message-ID: <20050309232837.GI5389@shell0.pdx.osdl.net> (raw)
In-Reply-To: <3FBD1BD2.908@redhat.com>

* Ulrich Drepper (drepper@redhat.com) wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> The current kernel (and all before as far as I can see) have a problem
> with the file system limit handling.  The behavior does not conform to
> the current POSIX spec.
<snip>
> It might also be that some wording is getting in the specification which
> will allow the current kernel behavior to continue to exist.  More
> through a loophole, but still.

This seems the case.  SuS v3 says:

setrlimit
RLIMIT_NOFILE
    This is a number one greater than the maximum value that the system
    may assign to a newly-created descriptor. If this limit is exceeded,
    functions that allocate a file descriptor shall fail with errno set
    to [EMFILE]. This limit constrains the number of file descriptors
    that a process may allocate.

open
[EMFILE]
    {OPEN_MAX} file descriptors are currently open in the calling process.
 
limits.h
{OPEN_MAX}
    Maximum number of files that one process can have open at any one time.
    Minimum Acceptable Value: {_POSIX_OPEN_MAX}

So, one view says your test program is within the spec, since the new fd
is still one less than the current rlimit.

Anyway, here's a simple patch that would fail the second setrlimit, as you
suggested.

thanks,
-chris
-- 
Linux Security Modules     http://lsm.immunix.org     http://lsm.bkbits.net

      reply	other threads:[~2005-03-09 23:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-20 19:53 process file descriptor limit handling Ulrich Drepper
2005-03-09 23:28 ` Chris Wright [this message]

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=20050309232837.GI5389@shell0.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=drepper@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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