This is an archive of the discontinued LLVM Phabricator instance.

Add a new interceptor for getvfsstat(2) from NetBSD
ClosedPublic

Authored by krytarowski on Nov 28 2018, 11:39 AM.

Diff Detail

Event Timeline

krytarowski created this revision.Nov 28 2018, 11:39 AM
vitalybuka accepted this revision.Nov 29 2018, 3:25 PM
vitalybuka added inline comments.
test/sanitizer_common/TestCases/NetBSD/getvfsstat.cc
16

could you please declare vars were they used first time?

19

you can simplify the test with simple asserts here

This revision is now accepted and ready to land.Nov 29 2018, 3:25 PM
krytarowski marked an inline comment as done.Nov 29 2018, 7:10 PM
krytarowski added inline comments.
test/sanitizer_common/TestCases/NetBSD/getvfsstat.cc
19

Do you mean: assert(rv != -1) ? err(3) is already simple enough so I will keep it.

vitalybuka added inline comments.Nov 30 2018, 10:48 AM
test/sanitizer_common/TestCases/NetBSD/getvfsstat.cc
19

I see couple other tiny reasons, which are not strong enough to block the patch, but maybe you'll still consider them.

The only important lines here are 17 and 25. The rest is just necessary distruction from the test, so smaller is better.

Also I'd prefer assert report with line number, which can be used for quick jump to location than current printout of "getvfsstat".

"if (!buf)" is totally unneeded as it crash anyway, and we don't to that in other tests.

If you don't CHECK them maybe: printf("Filesystem %d %s %s %s\n", i, buf[i].f_fstypename, buf[i].f_mntonname, buf[i].f_mntfromname);

and consistency: compiler_rt tests never use err() in cases like this, mostly asserts

krytarowski marked an inline comment as done.Nov 30 2018, 10:52 AM
krytarowski added inline comments.
test/sanitizer_common/TestCases/NetBSD/getvfsstat.cc
19

err(3) is a BSD style. I will switch it to assert and land soon.

krytarowski marked an inline comment as done.Nov 30 2018, 10:53 AM
krytarowski added inline comments.
test/sanitizer_common/TestCases/NetBSD/getvfsstat.cc
19

I still have 2-3 APIs to submit to review and I will start addressing reported comments from review.

krytarowski marked an inline comment as done.Nov 30 2018, 11:42 AM
krytarowski added inline comments.
test/sanitizer_common/TestCases/NetBSD/getvfsstat.cc
19

I've replaced err(3) with assert(3). I will keep the current style of printf(3) and I will assert buf to be != NULL. It will certainly crash in the case of error.. but I feel that it's a little bit better programming style to check allocation for success.

This revision was automatically updated to reflect the committed changes.