summaryrefslogtreecommitdiff
path: root/sys/kern/kern_time.c
AgeCommit message (Collapse)Author
2008-04-04ratecheck(9) only seems to be used to limit things to very coarse intervalsDavid Gwynne
like .25 seconds or 5 seconds. the accuracy of microuptime is not really needed then, so switch it to getmicrouptime. ok henning@ art@
2008-01-02Do not lose nanosleep() return value in the last copyout if nonzero; PR#5697Miod Vallat
2007-04-04Implement clock_gettime(CLOCK_PROF) since it's so simple.Artur Grabowski
deraadt@ ok
2007-01-10Fix getitimer to use uptime as setitimer does. Fixes bad output fromArtur Grabowski
getitimer when the clock on the machine has been reset. miod@ ok
2006-10-30Timecounter based implementation of adjfreq(2). Largely from art@Otto Moerbeek
Tested by various using not (yet) committed amd64 timecounter code. ok deraadt@
2006-06-29Normalize the correction passed to adjtime(2) before using it in theMark Kettenis
__HAVE_TIMECOUNTER case. ok otto@
2006-06-27Adapt adjtime() code and put in a better stub for adjfreq() for theOtto Moerbeek
timecounters case. adjfreq() does not work with timecounters, but more is coming. with help from miod; tested by dlg@; ok miod@
2006-06-15Make sys_adjfreq() compile on archs that use timecountersJonathan Gray
(ie sgi). Diff and request to commit from otto@
2006-06-14Introducing adjfreq(2), to adjust the clock frequency.Otto Moerbeek
Loosely based on dragonfly code. ok deraadt@
2006-06-04Allow any user to request the current adjustment; ok henning@ deraadt@Otto Moerbeek
2006-01-20revert auto-skew. some ntpd implementations interact poorly.Ted Unangst
2006-01-13auto adjusting adjtime. be more responsive to large clock deltas,Ted Unangst
and attempt to compensate for incorrect clocks by adjusting ticks slowly. ok deraadt
2005-11-28ansi/deregister.Jonathan Gray
'go for it' deraadt@
2005-10-27make sure ppsratecheck() returns 0 if maxpps is 0;Markus Friedl
from alexander bluhm; ok deraadt
2005-10-13In realitexpire(), do not re-add the itimer timeout if the process is inAaron Campbell
the midst of exiting. This solves a race condition that causes freed memory to be left referenced in the master kernel timeout worklist, leading to a uvm_fault. The same race condition was already fixed earlier in r1.53 of kern_clock.c for the process virtual and profile timeout structs. deraadt@ ok, testing by krw@
2005-10-10Avoid arithmetic overflows in computation of adjtime(). Fixes adjusting in theOtto Moerbeek
wrong direction for large offsets as nick@ saw. With tom@ and toby@; ok tdeval@ krw@
2005-05-31Protect p_timer with splclock. It can be fiddled with in hardclock (butArtur Grabowski
only for curproc, that's why no SCHED_LOCK or similar is necessary). miod@ "appears to be harmless" markus@ ok
2005-05-29sched work by niklas and art backed out; causes panicsTheo de Raadt
2005-05-25This patch is mortly art's work and was done *a year* ago. Art wants to thankNiklas Hallqvist
everyone for the prompt review and ok of this work ;-) Yeah, that includes me too, or maybe especially me. I am sorry. Change the sched_lock to a mutex. This fixes, among other things, the infamous "telnet localhost &" problem. The real bug in that case was that the sched_lock which is by design a non-recursive lock, was recursively acquired, and not enough releases made us hold the lock in the idle loop, blocking scheduling on the other processors. Some of the other processors would hold the biglock though, which made it impossible for cpu 0 to enter the kernel... A nice deadlock. Let me just say debugging this for days just to realize that it was all fixed in an old diff noone ever ok'd was somewhat of an anti-climax. This diff also changes splsched to be correct for all our architectures.
2004-07-28This touches only MI code, and adds new time keeping code. TheThorsten Lockert
code is all conditionalized on __HAVE_TIMECOUNTER, and not enabled on any platforms. adjtime(2) support exists, courtesy of nordin@, sysctl(2) support and a concept of quality for each time source attached exists. High quality time sources exists for PIIX4 ACPI timer as well as some AMD power management chips. This will have to be redone once we actually add ACPI support (at that time we need to use the ACPI interfaces to get at these clocks). ok art@ ken@ miod@ jmc@ and many more
2004-06-26Don't sleep forever on short nanosleeps.Thomas Nordin
2004-06-24This moves access to wall and uptime variables in MI code,Thorsten Lockert
encapsulating all such access into wall-defined functions that makes sure locking is done as needed. It also cleans up some uses of wall time vs. uptime some places, but there is sure to be more of these needed as well, particularily in MD code. Also, many current calls to microtime() should probably be changed to getmicrotime(), or to the {,get}microuptime() versions. ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others "Oh, that is not your problem!" from miod@
2004-06-21First step towards more sane time handling in the kernel -- this changesThorsten Lockert
things such that code that only need a second-resolution uptime or wall time, and used to get that from time.tv_secs or mono_time.tv_secs now get this from separate time_t globals time_second and time_uptime. ok art@ niklas@ nordin@
2004-06-13debranch SMP, have funNiklas Hallqvist
2004-06-09Merge in a piece of the SMP branch into HEAD.Artur Grabowski
Introduce the cpu_info structure, p_cpu field in struct proc and global scheduling context and various changed code to deal with this. At the moment no architecture uses this stuff yet, but it will allow us slow and controlled migration to the new APIs. All new code is ifdef:ed out. ok deraadt@ niklas@
2004-02-15pretty code that's easier to read, same effect.Ted Unangst
from netbsd via Pedro Martelletto <pbastos@rdc.puc-rio.br>
2003-09-01match syscallargs comments with realityHenning Brauer
from Patrick Latifi <patrick.l@hermes.usherb.ca> ok jason@ tedu@
2003-08-26fix sys_clock_settime. hint from nordin@ ok deraadt@Ted Unangst
2003-08-15change arguments to suser. suser now takes the process, and a flagsTed Unangst
argument. old cred only calls user suser_ucred. this will allow future work to more flexibly implement the idea of a root process. looks like something i saw in freebsd, but a little different. use of suser_ucred vs suser in file system code should be looked at again, for the moment semantics remain unchanged. review and input from art@ testing and further review miod@
2003-08-11implement CLOCK_MONOTONIC from NetBSD; ok marc@Kevin Lo
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-05-19no need for nfs headers since nqnfs had been removed way long time agoMichael Shalayeff
2002-10-02which is int not u_int so check for negative values. ok deraadt@, art@Thomas Nordin
2002-07-25Avoid time wrap at securelevel 2. ok millert@ fgsch@Thomas Nordin
2002-06-11Remove unnecessary spllowersoftclock(). ok art@Thomas Nordin
2002-03-14First round of __P removal in sysTodd C. Miller
2002-02-17Repeat. But this time get the math right and avoid sleeping forever.Artur Grabowski
2002-02-15undo latest commit for now, it breaks nanosleepPeter Valchev
2002-02-15Don't get confused in nanosleep(2) when the time changes.Artur Grabowski
There is no need to use 'time' when we can use 'mono_time'. (oh and now it's faster too)
2001-12-12Handle itimer intervals smaller than the resolution of the clock; pr#2182.Thomas Nordin
2001-06-25Remove NQNFSConstantine Sapuntzakis
2000-10-10implement ppsratecheck(9). from netbsd.Jun-ichiro itojun Hagino
refer mono_time only once in ratecheck(9).
2000-07-07Be more paranoid about return values from hzto.Artur Grabowski
2000-07-06Change splsoftclock() to spllowersoftclock(). (art@ ok)Hakan Olsson
2000-07-05Stop sleeps from returning early (by up to a clock tick).Paul Janzen
From FreeBSD: eventually, we should replace hzto() with something like tvtohz() as well.
2000-03-23Don't reinitialize the tsleep and ITIMER_REAL timers all the time.Artur Grabowski
The function and the argument never change.
2000-03-23Use the new timeout facilities for ITIMER_REAL.Artur Grabowski
2000-03-17ratecheck - function to help implement rate-limited actions (from NetBSD)Jakob Schlyter
ok art@
2000-01-22Don't allow the time to be set forward so far it will wrap and become negative,Todd C. Miller
thus allowing an attacker to bypass the next check below. The cutoff is 1 year before rollover occurs, so even if the attacker uses adjtime(2) to move the time past the cutoff, it will take a very long time to get to the wrap point. The actual check is tv_sec > INT_MAX - 365*24*60*60 because on 64 bit platforms tv_sec is 64 bits but time_t is 32 bits. This will need to be changed some time in the future when the size of time_t changes. Add a printf when a user tries to turn the clock backwards and securelevel > 1
1999-12-06Implement compatibility for Linux stime() syscall.Aaron Campbell