|
From: Julian S. <js...@ac...> - 2005-10-02 19:04:31
|
I've been looking a little at ML_(fd_allowed), in syswrap-generic.c.
This function decides which fds syscalls are allowed to create/use,
so that V's own fds don't get trashed.
This is a good thing; however I'm not sure I understand the logic.
- the first conditional reads
if ( (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd))
&& VG_(showing_core_errors)() ) {
... stuff ...
return False;
}
which seems to imply that some part of the decision rests on
what VG_(showing_core_errors)() produces, iow on what sounds
like a setting in the error-displaying options. That seems a
little odd.
- what does the "Bool soft" parameter mean?
Can anyone clarify?
J
|
|
From: Nicholas N. <nj...@cs...> - 2005-10-03 03:01:22
|
On Fri, 30 Sep 2005, Julian Seward wrote:
> I've been looking a little at ML_(fd_allowed), in syswrap-generic.c.
> This function decides which fds syscalls are allowed to create/use,
> so that V's own fds don't get trashed.
>
> This is a good thing; however I'm not sure I understand the logic.
>
> - the first conditional reads
>
> if ( (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd))
> && VG_(showing_core_errors)() ) {
> ... stuff ...
> return False;
> }
>
> which seems to imply that some part of the decision rests on
> what VG_(showing_core_errors)() produces, iow on what sounds
> like a setting in the error-displaying options. That seems a
> little odd.
It does look odd. Some of the subsequent "else if" cases cover some of
these cases, but not all. I think it should really be something like
this:
if (some conditions) {
if (showing_core_erros && more specific conditions) {
print error msg
}
return False;
} else {
return True;
}
> - what does the "Bool soft" parameter mean?
There are two fd limits, the soft and hard limits. I think the client can
only access those below the soft limit, and Valgrind can access those
below the hard limit? Something like that.
Nick
|
|
From: Tom H. <to...@co...> - 2005-10-03 09:21:08
|
In message <200...@ac...>
Julian Seward <js...@ac...> wrote:
> This is a good thing; however I'm not sure I understand the logic.
>
> - the first conditional reads
>
> if ( (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd))
> && VG_(showing_core_errors)() ) {
> ... stuff ...
> return False;
> }
>
> which seems to imply that some part of the decision rests on
> what VG_(showing_core_errors)() produces, iow on what sounds
> like a setting in the error-displaying options. That seems a
> little odd.
I guess it does that test so that it doesn't print the message if
it is not supposed to be showing errors, but it should probably still
return false and it doesn't at the moment.
> - what does the "Bool soft" parameter mean?
Whether or not to consider a file descriptor invalid if it is above
the current soft limit.
Basically if we are testing whether a newly created file descriptor is
valid (in a post handler) then we set soft to true, and if we are
testing whether a file descriptor that is about to be used (in a pre
handler) is valid then we set it to false.
The point is that if the (virtual) soft limit is lowered then any
existing descriptors can still be read/written/closed etc (so long as
they are below the valgrind reserved descriptors) but no new
descriptors can be created above the new soft limit.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|