summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_time.c
Commit message (Collapse)AuthorAgeFilesLines
* compat: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365080
* Fix r363125 (Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28)),Alexander Leidinger2020-07-121-1/+1
| | | | | | | | | by realy using the MONOTONIC version and not the REALTIME version. Noticed by: myfreeweb at github Notes: svn path=/head/; revision=363130
* Implement CLOCK_MONOTONIC_RAW (linux >= 2.6.28).Alexander Leidinger2020-07-121-1/+1
| | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=363125
* Add warnings for unsupported Linux clockids.Edward Tomasz Napierala2020-06-191-0/+9
| | | | | | | | | MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25322 Notes: svn path=/head/; revision=362416
* Fix clock_gettime() and clock_getres() for cpu clocks:Dmitry Chagin2020-02-041-35/+62
| | | | | | | | | | | | | | | | | - handle the CLOCK_{PROCESS,THREAD}_CPUTIME_ID specified directly; - fix thread id calculation as in the Linuxulator we should convert the user supplied thread id to struct thread * by linux_tdfind(); - fix CPUCLOCK_SCHED case by using kern_{process,thread}_cputime() directly as native get_cputime() used by kern_clock_gettime() uses native tdfind()/pfind() to find proccess/thread. PR: 240990 Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23341 MFC after: 2 weeks Notes: svn path=/head/; revision=357493
* linux_to_native_clockid() properly initializes nwhich variable (or return ↵Dmitry Chagin2020-02-041-3/+3
| | | | | | | | | | | | | error), so don't initialize nwhich in declaration and remove stale comment from r161304. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D23339 MFC after: 2 weeks Notes: svn path=/head/; revision=357491
* Linuxolator whitespace cleanupEd Maste2018-02-051-2/+2
| | | | | | | | | | | | | A version of each of the MD files by necessity exists for each CPU architecture supported by the Linuxolator. Clean these up so that new architectures do not inherit whitespace issues. Clean up shared Linuxolator files while here. Sponsored by: Turing Robotic Industries Inc. Notes: svn path=/head/; revision=328890
* sys/compat: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326266
* Map Linux CLOCK_BOOTTIME to native CLOCK_UPTIME.Dmitry Chagin2017-04-231-1/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=317324
* Use the kern_clock_nanosleep() to implement Linux clock_nanosleep() withDmitry Chagin2017-04-021-11/+25
| | | | | | | | | | | the proper handling of the TIMER_ABSTIME flag. XMFC after: r315526 MFC after: 1 month Notes: svn path=/head/; revision=316426
* The value in the tv_nsec field should be in the range 0 to 999999999.Dmitry Chagin2017-04-021-1/+1
| | | | | | | | | Pointed out by: bde@ MFC after: 1 week Notes: svn path=/head/; revision=316394
* As noted by bde@ negative tv_sec values are not checked for overflow,Dmitry Chagin2017-04-021-2/+1
| | | | | | | | | | | | so overflow can still occur. Fix that. Also remove the extra check for tv_sec size as under COMPAT_LINUX32 it is always true. Pointed out by: bde@ MFC after: 1 week Notes: svn path=/head/; revision=316393
* nanosleep: plug a kernel memory disclosureEric van Gyzen2017-03-181-2/+2
| | | | | | | | | | | | | | | | | nanosleep() updates rmtp on EINVAL. In that case, kern_nanosleep() has not updated rmt, so sys_nanosleep() updates the user-space rmtp by copying garbage from its stack frame. This is not only a kernel memory disclosure, it's also not POSIX-compliant. Fix it to update rmtp only on EINTR. Reviewed by: jilles (via D10020), dchagin MFC after: 3 days Security: possibly Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10044 Notes: svn path=/head/; revision=315510
* Check for negative nanoseconds.Dmitry Chagin2017-03-181-1/+1
| | | | | | | | | | Linux do that in timespec_valid(). Reported by: vangyzen@ MFC after: 1 week Notes: svn path=/head/; revision=315498
* Implement timerfd family syscalls.Dmitry Chagin2017-02-261-0/+22
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=314295
* Return EOVERFLOW error in case then the size of tv_sec field of struct timespecDmitry Chagin2017-02-261-8/+20
| | | | | | | | | in COMPAT_LINUX32 Linuxulator's not equal to the size of native tv_sec. MFC after: 1 month Notes: svn path=/head/; revision=314293
* Linux nanosleep() and clock_nanosleep() system calls alwaysDmitry Chagin2015-05-241-37/+24
| | | | | | | | | | | | | | | writes the remaining time into the structure pointed to by rmtp unless rmtp is NULL. The value of *rmtp can then be used to call nanosleep() again and complete the specified pause if the previous call was interrupted. Note. clock_nanosleep() with an absolute time value does not write the remaining time. While here fix whitespaces and typo in SDT_PROBE. Notes: svn path=/head/; revision=283498
* Delete the duplicate of linux_to_native_clockid() function.Dmitry Chagin2015-05-241-3/+1
| | | | | | | | Differential Revision: https://reviews.freebsd.org/D1521 Reviewed by: trasz Notes: svn path=/head/; revision=283464
* Do not use struct l_timespec without conversion. While here moveDmitry Chagin2015-05-241-6/+3
| | | | | | | | | | args->timeout handling before acquiring the futex key at FUTEX_WAIT path. Differential Revision: https://reviews.freebsd.org/D1520 Reviewed by: trasz Notes: svn path=/head/; revision=283463
* Add some clock mappings used in glibc 2.20.Dmitry Chagin2015-05-241-17/+188
| | | | | | | | Differential Revision: https://reviews.freebsd.org/D1465 Reviewd by: trasz Notes: svn path=/head/; revision=283459
* - For kernel compiled only with KDTRACE_HOOKS and not any lock debuggingAttilio Rao2013-11-251-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | option, unbreak the lock tracing release semantic by embedding calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined version of the releasing functions for mutex, rwlock and sxlock. Failing to do so skips the lockstat_probe_func invokation for unlocking. - As part of the LOCKSTAT support is inlined in mutex operation, for kernel compiled without lock debugging options, potentially every consumer must be compiled including opt_kdtrace.h. Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES is linked there and it is only used as a compile-time stub [0]. [0] immediately shows some new bug as DTRACE-derived support for debug in sfxge is broken and it was never really tested. As it was not including correctly opt_kdtrace.h before it was never enabled so it was kept broken for a while. Fix this by using a protection stub, leaving sfxge driver authors the responsibility for fixing it appropriately [1]. Sponsored by: EMC / Isilon storage division Discussed with: rstone [0] Reported by: rstone [1] Discussed with: philip Notes: svn path=/head/; revision=258541
* Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.hJohn Baldwin2013-01-291-0/+1
| | | | | | | | | | by moving bits that are MI out into headers in compat/linux. Reviewed by: Chagin Dmitry dmitry | gmail MFC after: 2 weeks Notes: svn path=/head/; revision=246085
* - >500 static DTrace probes for the linuxulatorAlexander Leidinger2012-05-051-22/+199
| | | | | | | | | | | | | | | | | | | | | - DTrace scripts to check for errors, performance, ... they serve mostly as examples of what you can do with the static probe;s with moderate load the scripts may be overwhelmed, excessive lock-tracing may influence program behavior (see the last design decission) Design decissions: - use "linuxulator" as the provider for the native bitsize; add the bitsize for the non-native emulation (e.g. "linuxuator32" on amd64) - Add probes only for locks which are acquired in one function and released in another function. Locks which are aquired and released in the same function should be easy to pair in the code, inter-function locking is more easy to verify in DTrace. - Probes for locks should be fired after locking and before releasing to prevent races (to provide data/function stability in DTrace, see the man-page of "dtrace -v ..." and the corresponding DTrace docs). Notes: svn path=/head/; revision=235063
* The NetBSD Foundation has granted permission to remove clause 3 and 4 fromJoel Dahl2010-03-011-7/+0
| | | | | | | | | their software. Obtained from: NetBSD Notes: svn path=/head/; revision=204523
* MFP4: 109655Jung-uk Kim2006-12-201-30/+68
| | | | | | | | | | | - Move linux_nanosleep() from src/sys/amd64/linux32/linux32_machdep.c to src/sys/compat/linux/linux_time.c. - Validate timespec ranges before use as Linux kernel does. - Fix l_timespec structure. - Clean up style(9) nits. Notes: svn path=/head/; revision=165408
* Add some new files needed for linux 2.6.x compatibility.Alexander Leidinger2006-08-151-0/+208
Please don't style(9) the NetBSD code, we want to stay in sync. Not imported on a vendor branch since we need local changes. Sponsored by: Google SoC 2006 Submitted by: rdivacky With help from: manu@NetBSD.org Obtained from: NetBSD (linux_{futex,time}.*) Notes: svn path=/head/; revision=161304