Skip to content

Add close_range(3) function#56

Closed
ricardobranco777 wants to merge 2 commits intoNetBSD:trunkfrom
ricardobranco777:close_rangex
Closed

Add close_range(3) function#56
ricardobranco777 wants to merge 2 commits intoNetBSD:trunkfrom
ricardobranco777:close_rangex

Conversation

@ricardobranco777
Copy link

@ricardobranco777 ricardobranco777 commented Jul 19, 2025

Add close_range(3) function. This uses the fcntl approach suggested to me by Robert Elz to avoid adding a new system call like in #43

The manpage was adapted from FreeBSD using the Linux names for the parameters:
https://man.freebsd.org/cgi/man.cgi?query=close_range&sektion=2&n=1

Fixes kern/59081

@ricardobranco777 ricardobranco777 force-pushed the close_rangex branch 4 times, most recently from d97c3eb to c4dbf8c Compare July 19, 2025 19:17
@ricardobranco777
Copy link
Author

Tests passed.

$ cd /usr/tests/lib/libc/gen
$ atf-run t_close_range
...
tp-start: 1752952904.803727, t_close_range, 7
tc-start: 1752952904.803756, close_range_above
tc-end: 1752952904.808162, close_range_above, passed
tc-start: 1752952904.808253, close_range_basic
tc-end: 1752952904.809940, close_range_basic, passed
tc-start: 1752952904.810021, close_range_buffer
tc-end: 1752952904.811619, close_range_buffer, passed
tc-start: 1752952904.811699, close_range_cloexec
tc-end: 1752952904.813614, close_range_cloexec, passed
tc-start: 1752952904.813697, close_range_err
tc-end: 1752952904.815713, close_range_err, passed
tc-start: 1752952904.815836, close_range_invalid_flag
tc-end: 1752952904.817856, close_range_invalid_flag, passed
tc-start: 1752952904.817918, close_range_one
tc-end: 1752952904.819005, close_range_one, passed
tp-end: 1752952904.819145, t_close_range

@ricardobranco777
Copy link
Author

Closing as it's not thread-safe.

netbsd-srcmastr pushed a commit that referenced this pull request Oct 19, 2025
	tools/compat/configure.ac: revision 1.111
	tools/compat/compat_defs.h: revision 1.126
	tools/compat/compat_defs.h: revision 1.127
	tools/compat/nbtool_config.h.in: revision 1.60
	tools/compat/nbtool_config.h.in: revision 1.61
	lib/libc/stdio/mkstemps.c: revision 1.2
	tools/compat/configure: revision 1.108
	tools/compat/configure: revision 1.109
	tools/compat/nbtool_config.h.in: revision 1.59
	tools/compat/Makefile: revision 1.95
	tools/compat/configure.ac: revision 1.110

Add more functions needed by mandoc

regen

add vsyslog decl check

regen

Do the nbtool dance.
netbsd-srcmastr pushed a commit that referenced this pull request Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant