| #
108de784
|
| 31-May-2024 |
Val Packett <val@packett.cool> |
Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not CLOCK_UPTIME
The suspend-awareness situation with monotonic clocks across platforms is kind of a mess, let's try not making it worse.
On Linux,
Redefine CLOCK_BOOTTIME to alias CLOCK_MONOTONIC, not CLOCK_UPTIME
The suspend-awareness situation with monotonic clocks across platforms is kind of a mess, let's try not making it worse.
On Linux, CLOCK_MONOTONIC does NOT count suspended time, and CLOCK_BOOTTIME was introduced to INCLUDE suspended time.
On OpenBSD, CLOCK_MONOTONIC DOES count suspended time, and CLOCK_UPTIME was introduced to EXCLUDE suspended time.
On macOS, it's the same as OpenBSD, but with CLOCK_UPTIME_RAW.
Right now, we do not have a monotonic clock that counts suspended time. We have CLOCK_UPTIME as a distinct ID alias, and CLOCK_BOOTTIME as a preprocessor alias, both being effectively `CLOCK_MONOTONIC` for now.
When we introduce a suspend-aware clock in the future, it would make a lot more sense to do it the OpenBSD/macOS way, i.e. to make CLOCK_MONOTONIC include suspended time and make CLOCK_UPTIME exclude it, because that's what the name CLOCK_UPTIME implies: a deviation from the default intended for the uptime command to allow it to only show the time the system was actually up and not suspended.
Let's change the define right now to make sure software using the define would not end up using the ID of the wrong clock in the future, and fix the IDs in the Linux compat code to match the expected changes too.
See https://bugzilla.mozilla.org/show_bug.cgi?id=1824084 for more discussion.
Fixes: 155f15118a77 ("clock_gettime: Add Linux aliases for CLOCK_*") Fixes: 25ada637362d ("Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.") Sponsored by: https://www.patreon.com/valpackett Reviewed by: kib, imp Differential Revision: https://reviews.freebsd.org/D39270
show more ...
|
| #
685dc743
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
b61a5730
|
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BS
spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
| #
c8a79231
|
| 14-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Rename linux_timer.h to linux_time.h
To avoid confusing people, rename linux_timer.h to linux_time.h, as linux_timer.c is the implementation of timer syscalls only, while linux_time.c cont
linux(4): Rename linux_timer.h to linux_time.h
To avoid confusing people, rename linux_timer.h to linux_time.h, as linux_timer.c is the implementation of timer syscalls only, while linux_time.c contains implementation of all stuff declared in linux_time.h.
MFC after: 2 weeks
show more ...
|
| #
d8e53d94
|
| 14-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Cleanup includes under compat/linux
Cleanup unneeded includes, sort the rest according to style(9). No functional changes.
MFC after: 2 weeks
|
| #
10d16789
|
| 12-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Get rid of the opt_compat.h include.
Since e013e369 COMPAT_LINUX, COMPAT_LINUX32 build options are removed, so include of opt_compat.h is no more needed.
MFC after: 2 weeks
|
| #
539fadb4
|
| 31-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Return EINVAL when the clockid has invalid bits are set
Linux forbids PERTHREAD bit set for CLOCKFD clock.
MFC after: 2 weeks
|
| #
452f4636
|
| 31-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Return ENOTSUP for unsupported clockid
It's much better from the user perspective to get a sane error code.
MFC after: 2 weeks
|
| #
707e567a
|
| 08-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Add a helper intended for copying timespec's from the userspace.
There are many places where we copyin Linux timespec from the userspace and then convert it to the kernel timespec. To avoi
linux(4): Add a helper intended for copying timespec's from the userspace.
There are many places where we copyin Linux timespec from the userspace and then convert it to the kernel timespec. To avoid code duplication add a tiny halper for doing this.
MFC after: 2 weeks
show more ...
|
| #
3dc2a067
|
| 08-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Prevent time_t overflows on i386.
As native i386 time_t is still 32-bit, check that the user-provided 64-bit tv_sec value fits to the kernel time_t, return EOVERFLOW if not.
MFC after: 2
linux(4): Prevent time_t overflows on i386.
As native i386 time_t is still 32-bit, check that the user-provided 64-bit tv_sec value fits to the kernel time_t, return EOVERFLOW if not.
MFC after: 2 weeks
show more ...
|
| #
1579b320
|
| 08-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Zero out high order bits of nanoseconds in the compat mode.
Assuming the kernel would use random data, the 64-bit Linux kernel ignores upper 32 bits of tv_nsec of struct timespec64 for 32-
linux(4): Zero out high order bits of nanoseconds in the compat mode.
Assuming the kernel would use random data, the 64-bit Linux kernel ignores upper 32 bits of tv_nsec of struct timespec64 for 32-bit binaries.
MFC after: 2 weeks
show more ...
|
| #
9a9482f8
|
| 08-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Add a helper intended for copying timespec's to the userspace.
There are many places where we convert natvie timespec and copyout it to the userspace. To avoid code duplication add a tiny
linux(4): Add a helper intended for copying timespec's to the userspace.
There are many places where we convert natvie timespec and copyout it to the userspace. To avoid code duplication add a tiny halper for doing this.
MFC after: 2 weeks
show more ...
|
| #
783c1bd8
|
| 04-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Implement timer_gettime64 syscall.
MFC after: 2 weeks
|
| #
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
|
| #
0938d04a
|
| 06-Apr-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Fix a typo in itimerspec conversion routine.
MFC after: 3 days
|
| #
66e73ce7
|
| 07-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Fix clock_nanosleep return value for unsupported clockid.
The Linux clock_nanosleep() returns ENOTSUP for CLOCK_THREAD_CPUTIME_ID. This silence one of the LTP clock_nanosleep tests.
MFC a
linux(4): Fix clock_nanosleep return value for unsupported clockid.
The Linux clock_nanosleep() returns ENOTSUP for CLOCK_THREAD_CPUTIME_ID. This silence one of the LTP clock_nanosleep tests.
MFC after: 2 weeks
show more ...
|
| #
6501370a
|
| 07-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Implement clock_nanosleep_time64 system call.
MFC after: 2 weeks
|
| #
187715a4
|
| 07-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Implement clock_getres_time64 system call.
MFC after: 2 weeks
|
| #
19f9a0e4
|
| 07-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Implement clock_settime64 system call.
MFC after: 2 weeks
|
| #
99b6f430
|
| 07-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Implement clock_gettime64 system call.
MFC after: 2 weeks
|
| #
bfcce1a9
|
| 07-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): add struct timespec64 definition and conversion routine for future use.
MFC after: 2 weeks
|
| #
5e8caee2
|
| 05-May-2021 |
Edward Tomasz Napierala <trasz@FreeBSD.org> |
linux: remove redundant SDT tracepoints
Remove all the 'entry' and 'return' probes; they clutter up the source and are redundant to FBT.
Reviewed By: dchagin Sponsored By: EPSRC Differential Revisi
linux: remove redundant SDT tracepoints
Remove all the 'entry' and 'return' probes; they clutter up the source and are redundant to FBT.
Reviewed By: dchagin Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30040
show more ...
|
| #
1a180032
|
| 01-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
compat: clean up empty lines in .c and .h files
|
| #
e37db348
|
| 12-Jul-2020 |
Alexander Leidinger <netchild@FreeBSD.org> |
Fix r363125 (Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28)), by realy using the MONOTONIC version and not the REALTIME version.
Noticed by: myfreeweb at github
|
| #
8c2602f3
|
| 12-Jul-2020 |
Alexander Leidinger <netchild@FreeBSD.org> |
Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28).
It is documented as a raw hardware-based clock not subject to NTP or incremental adjustments. With this "not as precise as CLOCK_MONOTONIC" descripti
Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28).
It is documented as a raw hardware-based clock not subject to NTP or incremental adjustments. With this "not as precise as CLOCK_MONOTONIC" description in mind, map it to our CLOCK_MONOTNIC_FAST (the same mapping as for the linux CLOCK_MONOTONIC_COARSE).
This is needed for the webcomponent of steam (chromium) and some other steam component or game.
The linux-steam-utils port contains a LD_PRELOAD based fix for this. There this is mapped to CLOCK_MONOTONIC. As an untrained ear/eye (= the majority of people) is normaly not noticing a difference of jitter in the 10-20 ms range, specially if you don't pay attention like for example in a browser session while watching a video stream, the mapping to CLOCK_MONOTONIC_FAST seems more appropriate than to CLOCK_MONOTONIC.
show more ...
|