Re: syscall() with SYS_posix_fallocate and simillar

Paul Floyd <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <CALUVJ=CBOdCYPrWBrHqbDBn1bScfQdYDvZfYtcsv=xA=D-Gt3A@mail.gmail.com>
On Thu, 26 Feb 2026 at 08:31, Paul Floyd <[email protected]> wrote:

>
> Can anyone confirm that not setting the carry flag is the correct thing
> to do for syscalls like this?


Just after sending this I figured out what was happening. It's all down to
RAM and has nothing to do with 16.0-CURRENT.

The 16 machine that I'm using is a VM with 4Gbytes of RAM. As a consequence
the rlimit for nofiles is relatively low.  Low enough that ML_(fd_allowed)
returns false because the fd is above the hard limit that Valgrind is
enforcing.So the code takes the  SET_STATUS_Failed path which was
incorrectly setting the carry flag.

On my main 14.3 workstation (with 32Gb RAM) rlimit nofiles is a lot higher
and the bogus fd is less than the hard limit so   ML_(fd_allowed) returns
true (meaning that the fd is not obviously incorrect). In that case the
syscall proceeds to the kernel which returns EBADF but does not set the
carry flag.

Mystery resolved. Now I have to check for other syscalls that are in the
same boat.

A+
Paul
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.