| #
9521b0b9
|
| 04-Nov-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
exterr: add exterr_db_print(), to be used by several ddb dumpers
Sponsored by: The FreeBSD Foundation
|
| #
069e2fb5
|
| 25-Oct-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
exterror(9): add two helpers
The exterr_set_from() function sets current thread extended error from the pre-filled struct kexterr.
The exterr_clear() function clears some struct kexterr.
Reviewed
exterror(9): add two helpers
The exterr_set_from() function sets current thread extended error from the pre-filled struct kexterr.
The exterr_clear() function clears some struct kexterr.
Reviewed by: mckusick Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D53351
show more ...
|
| #
dfd7d161
|
| 03-Oct-2025 |
John Baldwin <jhb@FreeBSD.org> |
filedesc: Close race between fcntl(F_SETFL) and ioctl(FIONBIO/FIOASYNC)
- Use the recently-added fsetfl_lock/unlock API to synchronize direct FIONBIO and FIOASYNC ioctls with fcntl(F_SETFL).
- Wh
filedesc: Close race between fcntl(F_SETFL) and ioctl(FIONBIO/FIOASYNC)
- Use the recently-added fsetfl_lock/unlock API to synchronize direct FIONBIO and FIOASYNC ioctls with fcntl(F_SETFL).
- While here, skip calling the underlying ioctl if the flag's current state matches the requested state.
- Also while here, only update the flag state if the underlying ioctl succeeds. This fixes a bug where the flags represented the new state even if the underlying ioctl failed. A test is added for this last case that a failing FIOASYNC on /dev/null doesn't result in setting O_ASYNC in the file flags.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D52721
show more ...
|
| #
73e3f094
|
| 28-Jul-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
exterr: enqueue ktrace event on syscall exit instead of at EXTERROR() call
This restores the feature of EXTERROR() being allowed at any context except the interrupt handlers.
Reviewed by: emaste Sp
exterr: enqueue ktrace event on syscall exit instead of at EXTERROR() call
This restores the feature of EXTERROR() being allowed at any context except the interrupt handlers.
Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D51595
show more ...
|
| #
874385b0
|
| 03-Jul-2025 |
Alan Somers <asomers@FreeBSD.org> |
uexterr_gettext: add tests
Add tests for the new extended errno feature.
Sponsored by: ConnectWise MFC after: 2 weeks Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51184
|
| #
3b1c4cb1
|
| 04-Jul-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
sys_generic.c: convert EINVALs to EXTERROR(EINVAL)
Sponsored by: The FreeBSD Foundation
|
| #
f1f23043
|
| 03-Jul-2025 |
Mark Johnston <markj@FreeBSD.org> |
vfs: Initial revision of inotify
Add an implementation of inotify_init(), inotify_add_watch(), inotify_rm_watch(), source-compatible with Linux. This provides functionality similar to kevent(2)'s E
vfs: Initial revision of inotify
Add an implementation of inotify_init(), inotify_add_watch(), inotify_rm_watch(), source-compatible with Linux. This provides functionality similar to kevent(2)'s EVFILT_VNODE, i.e., it lets applications monitor filesystem files for accesses. Compared to inotify, however, EVFILT_VNODE has the limitation of requiring the application to open the file to be monitored. This means that activity on a newly created file cannot be monitored reliably, and that a file descriptor per file in the hierarchy is required.
inotify on the other hand allows a directory and its entries to be monitored at once. It introduces a new file descriptor type to which "watches" can be attached; a watch is a pseudo-file descriptor associated with a file or directory and a set of events to watch for. When a watched vnode is accessed, a description of the event is queued to the inotify descriptor, readable with read(2). Events for files in a watched directory include the file name.
A watched vnode has its usecount bumped, so name cache entries originating from a watched directory are not evicted. Name cache entries are used to populate inotify events for files with a link in a watched directory. In particular, if a file is accessed with, say, read(2), an IN_ACCESS event will be generated for any watched hard link of the file.
The inotify_add_watch_at() variant is included so that this functionality is available in capability mode; plain inotify_add_watch() is disallowed in capability mode.
When a file in a nullfs mount is watched, the watch is attached to the lower vnode, such that accesses via either layer generate inotify events.
Many thanks to Gleb Popov for testing this patch and finding lots of bugs.
PR: 258010, 215011 Reviewed by: kib Tested by: arrowd MFC after: 3 months Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D50315
show more ...
|
| #
4e207e38
|
| 13-Jun-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
exterr: make SET_ERRORX() macros an expression evaluating to the errno
And move the actual td_kexterr fill code into the function, saving some text.
Suggested and reviewed by: markj Sponsored by: T
exterr: make SET_ERRORX() macros an expression evaluating to the errno
And move the actual td_kexterr fill code into the function, saving some text.
Suggested and reviewed by: markj Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D50836
show more ...
|
| #
b3a93154
|
| 31-May-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
Extract exterr_to_ue()
Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D50633
|
| #
09dfe066
|
| 23-May-2025 |
Konstantin Belousov <kib@FreeBSD.org> |
kernel: copyout extended errors to userspace and add exterrctl(2) to control it
Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.fre
kernel: copyout extended errors to userspace and add exterrctl(2) to control it
Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D50483
show more ...
|
| #
b0580c7a
|
| 03-Feb-2025 |
Gleb Smirnoff <glebius@FreeBSD.org> |
sockets: remove empty shim function sopoll()
|
| #
815f2a61
|
| 03-Feb-2025 |
Gleb Smirnoff <glebius@FreeBSD.org> |
sockets: removed unused argument from sopoll()
|
| #
ccb973da
|
| 26-Nov-2024 |
Kyle Evans <kevans@FreeBSD.org> |
kern: restore signal mask before ast() for pselect/ppoll
It's possible to take a signal after pselect/ppoll have set their return value, but before we actually return to userland. This results in t
kern: restore signal mask before ast() for pselect/ppoll
It's possible to take a signal after pselect/ppoll have set their return value, but before we actually return to userland. This results in taking a signal without reflecting it in the return value, which weakens the guarantees provided by these functions.
Switch both to restore the signal mask before we would deliver signals on return to userland. If a signal was received after the wait was over, then we'll just have the signal queued up for the next time it comes unblocked. The modified signal mask is retained if we were interrupted so that ast() actually handles the signal, at which point the signal mask is restored.
des@ has a test case demonstrating the issue in D47738 which will follow.
Note for MFC: TDA_PSELECT is a KBI break, we should just inline ast_sigsuspend() in pselect/ppoll for stable branches. It's not exactly the same, but it will be close enough.
Reported by: des Reviewed by: des (earlier version), kib Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D47741
show more ...
|
| #
5b3e5c6c
|
| 29-Apr-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
kcmp_pget(): do not accept TIDs
Otherwise pget() might still look up and hold the current process.
Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days
|
| #
1e01650a
|
| 29-Apr-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
kcmp_pget(): add an assert that we did not hold the current process
Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 days
|
| #
47ad4f2d
|
| 05-Mar-2024 |
Kyle Evans <kevans@FreeBSD.org> |
ktrace: log genio events on failed write
Visibility into the contents of the buffer when a write(2) has failed can be immensely useful in debugging IPC issues -- pushing this to discuss the idea, or
ktrace: log genio events on failed write
Visibility into the contents of the buffer when a write(2) has failed can be immensely useful in debugging IPC issues -- pushing this to discuss the idea, or maybe an alternative where we can set a flag like KTRFAC_ERRIO to enable it.
When a genio event is potentially raised after an error, currently we'll just free the uio and return. However, such data can be useful when debugging communication between processes to, e.g., understand what the remote side should have grabbed before closing a pipe. Tap out the entire buffer on failure rather than simply discarding it.
Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D43799
show more ...
|
| #
b5d2165b
|
| 05-Mar-2024 |
Kyle Evans <kevans@FreeBSD.org> |
kern: poll: tap out the pollfd array on successful return
We do this in kern_poll() to include freebsd32 but exclude the linux compat layer. The ABI should be the same, but the POLL constants are p
kern: poll: tap out the pollfd array on successful return
We do this in kern_poll() to include freebsd32 but exclude the linux compat layer. The ABI should be the same, but the POLL constants are probably different or should be assumed so.
Reviewed by: bapt, jhb Differential Revision: https://reviews.freebsd.org/D44158
show more ...
|
| #
61cc4830
|
| 18-Jan-2024 |
Alfredo Mazzinghi <am2419@cl.cam.ac.uk> |
Abstract UIO allocation and deallocation.
Introduce the allocuio() and freeuio() functions to allocate and deallocate struct uio. This hides the actual allocator interface, so it is easier to modify
Abstract UIO allocation and deallocation.
Introduce the allocuio() and freeuio() functions to allocate and deallocate struct uio. This hides the actual allocator interface, so it is easier to modify the sub-allocation layout of struct uio and the corresponding iovec array.
Obtained from: CheriBSD Reviewed by: kib, markj MFC after: 2 weeks Sponsored by: CHaOS, EPSRC grant EP/V000292/1 Differential Revision: https://reviews.freebsd.org/D43711
show more ...
|
| #
f28526e9
|
| 19-Jan-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
kcmp(2): implement for generic file types
Reviewed by: brooks, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43518
|
| #
d8decc9a
|
| 19-Jan-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
Add kcmp(2) kernel bits
This is based purely on reading the Linux kcmp(2) man page. In addition to the Linux set of comparators, I also added KCMP_FILEOBJ to compare underlying file' objects.
Teste
Add kcmp(2) kernel bits
This is based purely on reading the Linux kcmp(2) man page. In addition to the Linux set of comparators, I also added KCMP_FILEOBJ to compare underlying file' objects.
Tested by: manu Reviewed by: brooks, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43518
show more ...
|
| #
29363fb4
|
| 23-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl s
sys: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script.
Sponsored by: Netflix
show more ...
|
| #
685dc743
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
7a2c93b8
|
| 14-Dec-2022 |
Gleb Smirnoff <glebius@FreeBSD.org> |
sockets: provide sousrsend() that does socket specific error handling
Sockets have special handling for EPIPE on a write, that was spread out into several places. Treating transient errors is also
sockets: provide sousrsend() that does socket specific error handling
Sockets have special handling for EPIPE on a write, that was spread out into several places. Treating transient errors is also special - if protocol is atomic, than we should ignore any changes to uio_resid, a transient error means the write had completely failed (see d2b3a0ed31e).
- Provide sousrsend() that expects a valid uio, and leave sosend() for kernel consumers only. Do all special error handling right here. - In dofilewrite() don't do special handling of error for DTYPE_SOCKET. - For send(2), write(2) and aio_write(2) call into sousrsend() and remove error handling for kern_sendit(), soo_write() and soaio_process_job().
PR: 265087 Reported by: rz-rpi03 at h-ka.de Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35863
show more ...
|
| #
c6d31b83
|
| 18-Jul-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
AST: rework
Make most AST handlers dynamically registered. This allows to have subsystem-specific handler source located in the subsystem files, instead of making subr_trap.c aware of it. For inst
AST: rework
Make most AST handlers dynamically registered. This allows to have subsystem-specific handler source located in the subsystem files, instead of making subr_trap.c aware of it. For instance, signal delivery code on return to userspace is now moved to kern_sig.c.
Also, it allows to have some handlers designated as the cleanup (kclear) type, which are called both at AST and on thread/process exit. For instance, ast(), exit1(), and NFS server no longer need to be aware about UFS softdep processing.
The dynamic registration also allows third-party modules to register AST handlers if needed. There is one caveat with loadable modules: the code does not make any effort to ensure that the module is not unloaded before all threads processed through AST handler in it. In fact, this is already present behavior for hwpmc.ko and ufs.ko. I do not think it is worth the efforts and the runtime overhead to try to fix it.
Reviewed by: markj Tested by: emaste (arm64), pho Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35888
show more ...
|
| #
91e7bdcd
|
| 25-Apr-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
Add timespecvalid_interval macro and use it.
Reviewed by: jhb, imp (early rev) Differential revision: https://reviews.freebsd.org/D34848 MFC after: 2 weeks
|