For compatibility with Linux.
Details
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Seems ok. It would be nice to have a simple regression test in tests/sys/file/closefrom_test.c to ensure this code gets exercised.
lib/libc/sys/closefrom.2 | ||
---|---|---|
63 | ||
sys/kern/kern_descrip.c | ||
1410 | This error path leaks the lock. | |
1494 | This comment can be deleted. | |
sys/sys/unistd.h | ||
206 | Hmm but then you have to update the pattern used in libsysdecode. Alternately just write 0x4 since that's a more common style for flag definitions. |
sys/sys/unistd.h | ||
---|---|---|
206 | The above is copy-pasted from rfork. I had manually typed this off but it failed to patter-match, I don't think touching this is worth any effort. |
How do you suggest to sensibly test this though? To my surprise I found procstat does not report CLOEXEC, so as is I would have to actually exec.
Thanks for adding the test.
tests/sys/file/closefrom_test.c | ||
---|---|---|
333 โ | (On Diff #103447) | I'd check for an error from close_range(), though I see that the pre-existing tests do not for some reason. |
343 โ | (On Diff #103447) | This test will pass if fcntl() fails. It'd be more rigourous to check for failure before testing FD_CLOEXEC. |