Commit graph

6 commits

Author SHA1 Message Date
Jake Freeland
918966a274 timerfd: Relocate 32-bit compat code
32-bit compatibility code is conventionally stored in
sys/compat/freebsd32. Move freebsd32_timerfd_gettime() and
freebsd32_timerfd_settime() from sys/kern/sys_timerfd.c to
sys/compat/freebsd32/freebsd32_misc.c.

MFC After: 3 days
Reviewed by: imp, markj
Differential Revision; https://reviews.freebsd.org/D41640
2023-09-05 16:25:07 -06:00
Jake Freeland
a1f506156c timerfd: Define a locking regime
Define a locking regime for the members of struct timerfd and document
    it so future code can follow the standard. The lock legend can be found
    in a comment above struct timerfd.

    Additionally,
    * Add assertions based on locking regime.
    * Fill kn_data with the expiration count when EVFILT_READ is triggered.
    * Report st_ctim for stat(2).
    * Check if file has f_type == DTYPE_TIMERFD before assigning timerfd
      pointer to f_data.

MFC After: 3 days
Reviewed by:	imp, kib, markj
Differential Revision:	https://reviews.freebsd.org/D41600
2023-09-05 16:24:41 -06:00
Mateusz Guzik
f4296cfb40 timerfd: convert timerfd_list_lock from sx to mtx
There was no good reason to use the former. This should prevent some
head-scratching by an interested and qualified reader.
2023-09-02 09:55:50 +00:00
Mateusz Guzik
5eab523053 timerfd: compute fflags before calling falloc
While here dodge list locking in timerfd_adjust if empty.
2023-08-25 15:09:21 +00:00
Mateusz Guzik
02f534b57f timerfd: fix up a memory leak and missing locking
timerfd01 from ltp passes (and some other don't), but none of the tests
crash the kernel.

This is a bare minimum patch to fix up the immediate regression.

Reported by:	yasu
2023-08-25 14:46:48 +00:00
Jake Freeland
af93fea710 timerfd: Move implementation from linux compat to sys/kern
Move the timerfd impelemntation from linux compat code to sys/kern. Use
it to implement the new system calls for timerfd. Add a hook to kern_tc
to allow timerfd to know when the system time has stepped. Add kqueue
support to timerfd. Adjust a few names to be less Linux centric.

RelNotes: YES
Reviewed by: markj (on irc), imp, kib (with reservations), jhb (slack)
Differential Revision: https://reviews.freebsd.org/D38459
2023-08-24 14:28:56 -06:00