History log of /freebsd-current/tests/sys/file/closefrom_test.c
Revision Date Author Comments
# 664812f7 31-Dec-2023 Yen-Cheng Chang <jonason2004@gmail.com>

Fix grammar error in test/sys/file/closefrom_test.c

Event: Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request: https://github.com/freebsd/freebsd-src/pull/973


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 3a01dcc9 05-Mar-2022 Mark Johnston <markj@FreeBSD.org>

tests: Fix the test plan for closefrom_test

Fixes: f3f3e3c44d3b ("fd: add close_range(..., CLOSE_RANGE_CLOEXEC)")
Reported by: Jenkins


# f3f3e3c4 03-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

fd: add close_range(..., CLOSE_RANGE_CLOEXEC)

For compatibility with Linux.

MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34424


# 605c4cda 13-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

close_range/closefrom: fix regression from close_range introduction

close_range will clamp the range between [0, fdp->fd_lastfile], but failed
to take into account that fdp->fd_lastfile can become -1 if all fds are
closed. =-( In this scenario, just return because there's nothing further we
can do at the moment.

Add a test case for this, fork() and simply closefrom(0) twice in the child;
on the second invocation, fdp->fd_lastfile == -1 and will trigger a panic
before this change.

X-MFC-With: r359836


# 472ced39 12-Apr-2020 Kyle Evans <kevans@FreeBSD.org>

Implement a close_range(2) syscall

close_range(min, max, flags) allows for a range of descriptors to be
closed. The Python folk have indicated that they would much prefer this
interface to closefrom(2), as the case may be that they/someone have special
fds dup'd to higher in the range and they can't necessarily closefrom(min)
because they don't want to hit the upper range, but relocating them to lower
isn't necessarily feasible.

sys_closefrom has been rewritten to use kern_close_range() using ~0U to
indicate closing to the end of the range. This was chosen rather than
requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the
call to kern_close_range for simplicity.

The flags argument of close_range(2) is currently unused, so any flags set
is currently EINVAL. It was added to the interface in Linux so that future
flags could be added for, e.g., "halt on first error" and things of this
nature.

This patch is based on a syscall of the same design that is expected to be
merged into Linux.

Reviewed by: kib, markj, vangyzen (all slightly earlier revisions)
Differential Revision: https://reviews.freebsd.org/D21627


# 3cedbec3 27-Apr-2015 Enji Cooper <ngie@FreeBSD.org>

Integrate tools/regression/fifo into the FreeBSD test suite as tests/sys/fifo
and tools/regression/file into the FreeBSD test suite as tests/sys/file

MFC after: 1 week