* Why does get_lim_data ignore RLIM_INFINITY?
@ 2013-03-20 3:03 Ken Brown
2013-03-20 5:36 ` Paul Eggert
0 siblings, 1 reply; 2+ messages in thread
From: Ken Brown @ 2013-03-20 3:03 UTC (permalink / raw)
To: Paul Eggert; +Cc: Emacs
Paul,
I'm puzzled by one of the changes you made to vm-limit.c:get_lim_data()
in bzr revision 111152. Specifically, it doesn't seem right to ignore
RLIM_INFINITY as in the following comment:
+ /* Set LIM_DATA to the minimum of the maximum object size and the
+ maximum address space. Don't bother to check for values like
+ RLIM_INFINITY since in practice they are not much less than
SIZE_MAX. */
According to POSIX, "If a call to getrlimit() returns RLIM_INFINITY for
a resource, it means the implementation shall not enforce limits on that
resource."
So I think this fragment of the original code shouldn't have been removed:
if (rlimit.rlim_cur == RLIM_INFINITY)
lim_data = -1;
Ken
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Why does get_lim_data ignore RLIM_INFINITY?
2013-03-20 3:03 Why does get_lim_data ignore RLIM_INFINITY? Ken Brown
@ 2013-03-20 5:36 ` Paul Eggert
0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2013-03-20 5:36 UTC (permalink / raw)
To: Ken Brown; +Cc: Emacs
On 03/19/2013 08:03 PM, Ken Brown wrote:
> So I think this fragment of the original code shouldn't have been removed:
>
> if (rlimit.rlim_cur == RLIM_INFINITY)
> lim_data = -1;
If rlim_cur == RLIM_INFINITY, then in practice rlim_cur is either
greater than SIZE_MAX (in which case the surrounding code will
treat it as if it were SIZE_MAX, which is the same as (size_t) -1),
or it is so close to SIZE_MAX that Emacs won't care about the difference.
In either case, the above if-statement isn't needed.
It's true that POSIX doesn't guarantee this practical property of RLIM_INFINITY,
but it's also true that various POSIX implementations have squirrelly
nearly-RLIM_INFINITY values such as RLIM_SAVED_MAX that the code needs
to work with, and the hassle of dealing with this variation
"correctly" is probably more trouble than it's worth, since (unless
I'm missing something) the code works as-is.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-03-20 5:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20 3:03 Why does get_lim_data ignore RLIM_INFINITY? Ken Brown
2013-03-20 5:36 ` Paul Eggert
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.