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>
next in thread | raw e-mail | index | archive | help
--089e013c6214e43b4c05265fb14e Content-Type: text/plain; charset=UTF-8 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! --089e013c6214e43b4c05265fb14e Content-Type: text/plain; charset=US-ASCII; name="vfs_syscalls.diff" Content-Disposition: attachment; filename="vfs_syscalls.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ihx6qlod0 ZGlmZiAtLWdpdCBhL3N5cy9rZXJuL3Zmc19zeXNjYWxscy5jIGIvc3lzL2tlcm4vdmZzX3N5c2Nh bGxzLmMKaW5kZXggZTY3NWIwOS4uYmRiMTYzOSAxMDA2NDQKLS0tIGEvc3lzL2tlcm4vdmZzX3N5 c2NhbGxzLmMKKysrIGIvc3lzL2tlcm4vdmZzX3N5c2NhbGxzLmMKQEAgLTQ1MjgsNyArNDUyOCw3 IEBAIHN5c19wb3NpeF9mYWxsb2NhdGUoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCBwb3NpeF9m YWxsb2NhdGVfYXJncyAqdWFwKQogCiAJdGQtPnRkX3JldHZhbFswXSA9IGtlcm5fcG9zaXhfZmFs bG9jYXRlKHRkLCB1YXAtPmZkLCB1YXAtPm9mZnNldCwKIAkgICAgdWFwLT5sZW4pOwotCXJldHVy biAoMCk7CisJcmV0dXJuICh0ZC0+dGRfcmV0dmFsWzBdKTsKIH0KIAogLyoKQEAgLTQ2NjUsNSAr NDY2NSw1IEBAIHN5c19wb3NpeF9mYWR2aXNlKHN0cnVjdCB0aHJlYWQgKnRkLCBzdHJ1Y3QgcG9z aXhfZmFkdmlzZV9hcmdzICp1YXApCiAKIAl0ZC0+dGRfcmV0dmFsWzBdID0ga2Vybl9wb3NpeF9m YWR2aXNlKHRkLCB1YXAtPmZkLCB1YXAtPm9mZnNldCwKIAkgICAgdWFwLT5sZW4sIHVhcC0+YWR2 aWNlKTsKLQlyZXR1cm4gKDApOworCXJldHVybiAodGQtPnRkX3JldHZhbFswXSk7CiB9Cg== --089e013c6214e43b4c05265fb14e--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfvV-RepAc6N0UxFi2RBthxrd%2BqHD-Qh5dc-9v=NFGCy_w>