summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_time.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove almost unused `flags' argument of suser().mpi2018-02-191-5/+5
| | | | | | | The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
* Add the CLOCK_BOOTTIME clockid for use with clock_gettime(2)cheloha2017-12-181-1/+3
| | | | | | | | | | | | | | | | | and put it to use in userspace in lieu of the kern.boottime sysctl. Its absolute value is the time that has elapsed since the system booted, i.e., the system uptime. Use in top(1), w(1), and snmpd(8) eliminates a race with settimeofday(2), adjtime(2), etc. inherent to deriving the system uptime via the kern.boottime sysctl. Product of a great deal of discussion/revision with jca@, tb@, and guenther@. ok tb@ jca@ guenther@ dlg@ mlarkin@ tom@
* Rename pfind(9) into tfind(9) to reflect that it deals with threads.mpi2017-01-241-3/+3
| | | | | | While here document prfind(9. with and ok guenther@
* Write the system time back to the RTC every 30 minutes.naddy2016-09-031-1/+37
| | | | | | | This fixes the problem that long-running machines which were not shut down properly would reboot with a badly offset system time. hints and ok kettenis@
* careful study of the holy scrolls reveals that for pselect (and ppoll)tedu2016-04-281-2/+4
| | | | | oversized timespecs should be clamped, not rejected. ok millert
* remove stale lint annotationstedu2015-12-051-10/+1
|
* refactor pledge_*_check and pledge_fail functionssemarie2015-11-011-3/+4
| | | | | | | | | | | | | | - rename _check function without suffix: a "pledge" function called from anywhere is a "check" function. - makes pledge_fail call the responsability to the _check function. remove it from caller. - make proper use of (potential) returned error of _check() functions. - adds pledge_kill() and pledge_protexec() with and OK deraadt@
* Rename tame() to pledge(). This fairly interface has evolved to be morederaadt2015-10-091-3/+3
| | | | | | strict than anticipated. It allows a programmer to pledge/promise/covenant that their program will operate within an easily defined subset of the Unix environment, or it pays the price.
* Only include <sys/tame.h> in the .c files that need itguenther2015-09-111-1/+2
| | | | ok deraadt@ miod@
* Move to tame(int flags, char *paths[]) API/ABI.deraadt2015-08-221-2/+1
| | | | | | | | | | | | The pathlist is a whitelist of dirs and files; anything else returns ENOENT. Recommendation is to use a narrowly defined list. Also add TAME_FATTR, which permits explicit change operations against "struct stat" fields. Some other TAME_ flags are refined slightly. Not cranking libc now, since nothing commited in base uses this and the timing is uncomfortable for others. Discussed with many; thanks for a few bug fixes from semarie, doug, guenther. ok guenther
* tame(2) is a subsystem which restricts programs into a "reduced featurederaadt2015-07-191-1/+5
| | | | | | operating model". This is the kernel component; various changes should proceed in-tree for a while before userland programs start using it. ok miod, discussions and help from many
* Protect the per-process itimerval structs with a mutex. We update thesekettenis2015-04-281-10/+13
| | | | | | | | | | | from hardclock() which runs without grabbing the kernel lock. This means that two threads could concurrently update the struct which could lead to corruption of the value which in turn could stop the timer. It could also result in getitimer(2) returning a non-normalized value. With help from guenther@. ok deraadt@, guenther@
* typo; fix from Kaspars Bankovskisderaadt2014-12-071-2/+2
|
* Prefer prsignal() to send process signalsguenther2014-05-151-2/+2
|
* Simplyfy adjtime(2) by keeping track of the adjustment as a number ofkettenis2014-01-301-22/+19
| | | | | | | | microsecond in a 64-bit integer. Fixes the issue where ntpd loses sync because the struct timeval currently used to hold the adjustment is not properly normalized after the changes guenther@ made. ok guenther@, millert@
* timeval, timespec, and itimerval have padding on many archs. If we'reguenther2014-01-221-12/+24
| | | | | | | | going to copyout one, memset the structure and then set it member by member. sys_adjtime() does that on copyin instead, as it already has to munge the members as it goes. ok deraadt@
* Move the declarations for dogetrusage(), itimerround(), and dowait4()guenther2013-10-251-3/+1
| | | | | | | | | | to sys/*.h headers so that the compat/linux code can use them. Change dowait4() to not copyout() the status value, but rather leave that for its caller, as compat/linux has to translate it, with the side benefit of simplifying the native code. Originally written months ago as part of the time_t work; long memory, prodding, and ok from pirofti@
* Fix delivery of SIGPROF and SIGVTALRM to threaded processes by havingguenther2013-10-081-5/+1
| | | | | | | | hardclock() set a flag on the running thread and force AST processing, and then have the thread signal itself from userret(). idea and flag names from FreeBSD ok jsing@
* Add CLOCK_UPTIME, a clock which measures time-running-not-suspended, soguenther2013-10-061-1/+8
| | | | | | | that mlarkin@ can fix programs that report rates-over-uptime. ok kettenis@ manpage corrections jmc@ (which I've probably broken again)
* Snapshots for all archs have been built, so remove the T32 codeguenther2013-09-141-334/+1
|
* Switch time_t, ino_t, clock_t, and struct kevent's ident and dataguenther2013-08-131-5/+338
| | | | | | | | | | | | | | | | | | | | members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@
* Add support for the _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME options,guenther2013-06-171-4/+31
| | | | | | | | including CLOCK_{PROCESS,THREAD}_CPUTIME_ID constants and {clock,pthread}_getcpuclockid() functions. Worked out at t2k13 with help from tedu@ and matthew@ and testing by aja@ ok matthew@
* Convert some internal APIs to use timespecs instead of timevalsguenther2013-06-031-8/+4
| | | | ok matthew@ deraadt@
* Use long long and %lld for printing tv_sec valuesguenther2013-06-021-5/+5
| | | | ok deraadt@
* do not include machine/cpu.h from a .c file; it is the responsibility ofderaadt2013-03-281-2/+1
| | | | | .h files to pull it in, if needed ok tedu
* unifdef -D __HAVE_TIMECOUNTERmiod2012-11-051-158/+1
|
* On resume, run forward the monotonic and realtimes clocks instead of jumpingguenther2012-05-241-2/+2
| | | | | | just the realtime clock, triggering and adjusting timeouts to reflect that. ok matthew@ deraadt@
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-25/+23
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* Add tracing and dumping of "pointer to struct" syscall arguments forguenther2012-03-191-3/+41
| | | | | | structs timespec, timeval, sigaction, and rlimit. ok otto@ jsing@
* Add PS_EXITING to better differentiate between the process exiting andguenther2012-03-101-2/+2
| | | | the main thread exiting. c.f. regress/sys/kern/main-thread-exited/
* lots of SCARG simplification. ok matthewtedu2010-06-301-56/+69
|
* clock_gettime(CLOCK_PROF) didn't account for the time between the lastart2010-06-281-3/+8
| | | | | | context switch and the call to clock_gettime. oga@ ok
* clock_settime() should cancel an in-progress adjtime() just likeguenther2010-04-041-25/+25
| | | | | | settimeofday() does, so move those bits into settime() "I like it" deraadt@
* Convert thrsleep() to an absolute timeout with clockid to eliminate aguenther2009-11-271-15/+34
| | | | | | race condition and prep for later support of pthread_condattr_setclock() "get it in" deraadt@, tedu@, cheers by others
* cancel the timeout upon disabling profiling / virtual timer; somartynas2009-10-161-1/+5
| | | | | | | | | | | that the timeout doesn't happen if setitimer is called between the profiling / virtual timer expires and the timeout is scheduled. firefox triggered this Profiling timer expired problem when in uthread execve signal was being delivered after timer has already been disabled; as reported on ports@ recently. special thanks to kettenis@, kurt@, guenther@. agreed by kettenis@, tedu@. ok guenther@. reminded & ok fgs@. tested by ian@.
* abort any time adjustment in progress if the clock is set with settimeofdayckuethe2009-06-051-13/+27
| | | | ok millert
* system/5918: fix clearing of ITIMER_VIRTUAL and ITIMER_PROF it_intervaldjm2008-09-191-4/+4
| | | | ok tedu@
* ratecheck(9) only seems to be used to limit things to very coarse intervalsdlg2008-04-041-2/+2
| | | | | | | like .25 seconds or 5 seconds. the accuracy of microuptime is not really needed then, so switch it to getmicrouptime. ok henning@ art@
* Do not lose nanosleep() return value in the last copyout if nonzero; PR#5697miod2008-01-021-3/+5
|
* Implement clock_gettime(CLOCK_PROF) since it's so simple.art2007-04-041-4/+6
| | | | deraadt@ ok
* Fix getitimer to use uptime as setitimer does. Fixes bad output fromart2007-01-101-2/+2
| | | | | | getitimer when the clock on the machine has been reset. miod@ ok
* Timecounter based implementation of adjfreq(2). Largely from art@otto2006-10-301-4/+12
| | | | | Tested by various using not (yet) committed amd64 timecounter code. ok deraadt@
* Normalize the correction passed to adjtime(2) before using it in thekettenis2006-06-291-1/+10
| | | | | | __HAVE_TIMECOUNTER case. ok otto@
* Adapt adjtime() code and put in a better stub for adjfreq() for theotto2006-06-271-9/+19
| | | | | timecounters case. adjfreq() does not work with timecounters, but more is coming. with help from miod; tested by dlg@; ok miod@
* Make sys_adjfreq() compile on archs that use timecountersjsg2006-06-151-1/+3
| | | | (ie sgi). Diff and request to commit from otto@
* Introducing adjfreq(2), to adjust the clock frequency.otto2006-06-141-1/+34
| | | | Loosely based on dragonfly code. ok deraadt@
* Allow any user to request the current adjustment; ok henning@ deraadt@otto2006-06-041-1/+8
|
* revert auto-skew. some ntpd implementations interact poorly.tedu2006-01-201-47/+9
|
* auto adjusting adjtime. be more responsive to large clock deltas,tedu2006-01-131-9/+47
| | | | | and attempt to compensate for incorrect clocks by adjusting ticks slowly. ok deraadt
* ansi/deregister.jsg2005-11-281-63/+26
| | | | 'go for it' deraadt@