Date: Tue, 8 Dec 2015 01:35:31 -0800 From: Maxim Sobolev <sobomax@FreeBSD.org> To: freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Cc: kib@freebsd.org, Kirk McKusick <mckusick@mckusick.com> Subject: posix_fallocate(2) && posix_fadvise(2) are somewhat broken Message-ID: <CAH7qZfvV-RepAc6N0UxFi2RBthxrd%2BqHD-Qh5dc-9v=NFGCy_w@mail.gmail.com>
index | next in thread | raw e-mail
[-- Attachment #1 --] Hi, while working on some unrelated feature I've noticed that at least those two system calls are not returning proper value (-1) on error. Instead actual errno value is returned from the syscall verbatim, i.e. posix_fadvise() returns 22 on EINVAL. Attached patch fixes that problem, however I am not sure if I need to assign td->td_retval[0] at all, those two operations by design never return anything but -1 on error and 0 on success. Can someone comment on this? Thanks! [-- Attachment #2 --] diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index e675b09..bdb1639 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -4528,7 +4528,7 @@ sys_posix_fallocate(struct thread *td, struct posix_fallocate_args *uap) td->td_retval[0] = kern_posix_fallocate(td, uap->fd, uap->offset, uap->len); - return (0); + return (td->td_retval[0]); } /* @@ -4665,5 +4665,5 @@ sys_posix_fadvise(struct thread *td, struct posix_fadvise_args *uap) td->td_retval[0] = kern_posix_fadvise(td, uap->fd, uap->offset, uap->len, uap->advice); - return (0); + return (td->td_retval[0]); }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfvV-RepAc6N0UxFi2RBthxrd%2BqHD-Qh5dc-9v=NFGCy_w>
