From: Christopher Yeoh <cyeoh@samba.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: torvalds@transmeta.com (Linus Torvalds),
marcelo@conectiva.com.br (Marcelo Tosatti),
linux-kernel@vger.kernel.org, trivial@rustcorp.com.au
Subject: Re: [PATCH] fcntl returns wrong error code
Date: Fri, 22 Mar 2002 00:58:33 +1100 [thread overview]
Message-ID: <15513.59145.678790.431319@gargle.gargle.HOWL> (raw)
In-Reply-To: <E16o2cX-0005At-00@the-village.bc.nu>
At 2002/3/21 13:28+0000 Alan Cox writes:
> > When fcntl(fd, F_DUPFD, b) is called where 'b' is greater than the
> > maximum allowable value EINVAL should be returned. From POSIX:
> >
> > "[EINVAL] The cmd argument is invalid, or the cmd argument is F_DUPFD and
> > arg is negative or greater than or equal to {OPEN_MAX}, or ..."
>
> Where does it mention rlimit ? Also we sort of have a problem since
> OPEN_MAX is not a constant on Linux x86. I guess that means a libc enforced
> behaviour or something for that bit
In this case OPEN_MAX is defined as:
"3.167 File descriptor
A per-process unique, non negative integer used to identify an open
file for the purpose of file access. The value of a file descriptor
is from zero to {OPEN_MAX}. A process can have no more than {OPEN_MAX} file
descriptors open simultaneously. File descriptors may also be used ...."
Also from the limit.h page in Headers section it mentions that "many
of the listed limits are not invariant, and at runtime, the value of
the limit may differ from those given in the header ..... <snip> ..
.. For these reasons an application may use the fpathconf(),
pathconf() and sysconf() functions to determine the actual value of a
limit at runtime."
So the standard does take into account that the value may not be
constant and (I think) that in the fcntl case the OPEN_MAX refers to
the actual runtime value, which is not necessarily the same as the
definition in limits.h.
This problem was picked up by the POSIX.1-1990 test suite which
does a sysconf(_SC_OPEN_MAX) to determine OPEN_MAX.
btw Stephen Rothwell pointed out that there is a much neater way to
achieve the same change. I'll post a new patch in the morning.
Chris
--
cyeoh@au.ibm.com
IBM OzLabs Linux Development Group
Canberra, Australia
next prev parent reply other threads:[~2002-03-21 14:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-21 6:09 Christopher Yeoh
2002-03-21 13:28 ` Alan Cox
2002-03-21 13:58 ` Christopher Yeoh [this message]
2002-03-22 2:56 ` [PATCH] fcntl returns wrong error code (Updated) Christopher Yeoh
2002-03-26 23:50 [PATCH] fcntl returns wrong error code Andries.Brouwer
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=15513.59145.678790.431319@gargle.gargle.HOWL \
--to=cyeoh@samba.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
--cc=torvalds@transmeta.com \
--cc=trivial@rustcorp.com.au \
/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®