aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_time.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix warnings in preparation for adding -Wall -Wcast-qual to theMatthew Dillon1999-01-271-2/+2
| | | | | | | kernel compile Notes: svn path=/head/; revision=43301
* Nitpicking and dusting performed on a train. Removes trivial warningsPoul-Henning Kamp1998-10-251-2/+1
| | | | | | | about unused variables, labels and other lint. Notes: svn path=/head/; revision=40648
* Add a tc_ prefix to struct timecounter members.Poul-Henning Kamp1998-06-091-2/+2
| | | | | | | Urged by: bde Notes: svn path=/head/; revision=36810
* Fixed interval calculation in realitimexpire() again. Obtained from:Bruce Evans1998-05-171-4/+4
| | | | | | | | | rev.1.9. Broken in: rev.1.50. Fixed a spelling error. Obtained from: Lite2. Notes: svn path=/head/; revision=36128
* Fixed stale references to hzto() in comments.Bruce Evans1998-05-171-2/+2
| | | | Notes: svn path=/head/; revision=36127
* s/nanoruntime/nanouptime/gPoul-Henning Kamp1998-05-171-6/+6
| | | | | | | | | s/microruntime/microuptime/g Reviewed by: bde Notes: svn path=/head/; revision=36119
* Nuke signanosleep(). (I've left nanosleep1() seperate to nanosleep()Peter Wemm1998-05-141-56/+1
| | | | | | | as I don't want to mess with the multiple returns) Notes: svn path=/head/; revision=36035
* Commit an old change that has been sitting around for a long while.Peter Wemm1998-05-141-2/+16
| | | | | | | | | | | | | signanosleep() did not deal with signal masks properly. This change was based on a discussion with bde some time ago (at least 6 months or more). signanosleep() should probably go away since it was never really used for more than a few weeks and doesn't appear in released code. It should probably be killed before somebody uses it and it becomes a gratuitous nonstandard feature. Notes: svn path=/head/; revision=36032
* Make a kernel version of the timer* functions called timerval* to bePoul-Henning Kamp1998-04-061-13/+13
| | | | | | | | | more consistent. OK'ed by: bde Notes: svn path=/head/; revision=35058
* More fixes for the iterative case of nanosleep1 from bruce.Poul-Henning Kamp1998-04-051-5/+5
| | | | | | | I hate the 2-arg time{spec|val}{add|sub} functions! Notes: svn path=/head/; revision=35045
* Make the dummy timecounter run at 1 MHz rather than 100kHz (noticed by bde)Poul-Henning Kamp1998-04-051-10/+9
| | | | | | | fix the itimer(REAL) handling. Notes: svn path=/head/; revision=35044
* If there is no error code, don't copyout the remaining time. (AsPeter Wemm1998-04-051-3/+3
| | | | | | | | documented in the man page and the standards). (and besides, nanosleep1 isn't setting it in this case at present anyway, so we'd be copying junk). Notes: svn path=/head/; revision=35043
* Fix nanosleep1 based on Bruces suggestion.Poul-Henning Kamp1998-04-051-28/+22
| | | | Notes: svn path=/head/; revision=35042
* tsleep() returns EWOULDBLOCK if the timeout expired. Don't return thisPeter Wemm1998-04-051-2/+2
| | | | | | | to usermode, otherwise sleep(3) fails, cron doesn't work, etc etc etc. Notes: svn path=/head/; revision=35040
* Handle double fraction overflow in nano & microtime functions (spotted by Bruce)Poul-Henning Kamp1998-04-041-6/+3
| | | | | | | Use tvtohz() a place where it fits. Notes: svn path=/head/; revision=35033
* Time changes mark 2:Poul-Henning Kamp1998-04-041-60/+30
| | | | | | | | | | | | | | | | | | | | * Figure out UTC relative to boottime. Four new functions provide time relative to boottime. * move "runtime" into struct proc. This helps fix the calcru() problem in SMP. * kill mono_time. * add timespec{add|sub|cmp} macros to time.h. (XXX: These may change!) * nanosleep, select & poll takes long sleeps one day at a time Reviewed by: bde Tested by: ache and others Notes: svn path=/head/; revision=35029
* Eradicate the variable "time" from the kernel, using various measures.Poul-Henning Kamp1998-03-301-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde Notes: svn path=/head/; revision=34961
* Add two new functions, get{micro|nano}time.Poul-Henning Kamp1998-03-261-1/+2
| | | | | | | | | | | | | | | They are atomic, but return in essence what is in the "time" variable. gettime() is now a macro front for getmicrotime(). Various patches to use the two new functions instead of the various hacks used in their absence. Some puntuation and grammer patches from Bruce. A couple of XXX comments. Notes: svn path=/head/; revision=34901
* Fixed the calculation of `delta' in settime(). We once set allBruce Evans1998-02-251-29/+14
| | | | | | | | | | | | | | | | | | | | | | | | | times consistently wrong (up to 1 tick too late), but recent changes fixed the setting of the main clock, making other times inconsistent. The inconsistencies tended to show up as a negative resource usage for the process that set the time. Fixed the check for setting the clock backwards. A stale timestamp (`time') was checked, so it was possible to set the clock backwards by up to almost 1 tick. Until recently, this bug was compensated for by setting the clock consistently wrong. Merged the comment about setting the clock backwards from Lite2. Removed latency micro-optimizations/speed pessimizations in settime(). microtime() and set_timecounter() are relatively expensive, and they must be called together with clock updates blocked to get a consistent `delta', so significant latency optimizations are not possible. Removed some stale comments. Notes: svn path=/head/; revision=33818
* Replace TOD clock code with more systematic approach.Poul-Henning Kamp1998-02-201-6/+7
| | | | | | | | | | | | | | | | | | Highlights: * Simple model for underlying hardware. * Hardware basis for timekeeping can be changed on the fly. * Only one hardware clock responsible for TOD keeping. * Provides a real nanotime() function. * Time granularity: .232E-18 seconds. * Frequency granularity: .238E-12 s/s * Frequency adjustment is continuous in time. * Less overhead for frequency adjustment. * Improves xntpd performance. Reviewed by: bde, bde, bde Notes: svn path=/head/; revision=33690
* Remove a bunch of variables which were unused both in GENERIC and LINT.Poul-Henning Kamp1997-11-071-2/+1
| | | | | | | Found by: -Wunused Notes: svn path=/head/; revision=31016
* Move the "retval" (3rd) parameter from all syscall functions and putPoul-Henning Kamp1997-11-061-22/+13
| | | | | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled. Notes: svn path=/head/; revision=30994
* Simplify the lease_check stuff.Poul-Henning Kamp1997-10-261-3/+9
| | | | Notes: svn path=/head/; revision=30739
* Fix returned sleep period for large valuesAndrey A. Chernov1997-10-201-3/+5
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=30606
* Sigh. Signal handlers are executed on leaving the system call, notPeter Wemm1997-10-151-8/+2
| | | | | | | | | | | | | at moment of delivery. Restoring the signal mask after the tsleep() is next to useless since the signal is still queued.. This was interacting with usleep(3) on receipt of a SIGALRM causing it to near busy loop. Now, we set the new signal mask "permanently" for signanosleep(). Problem noted by: bde Notes: svn path=/head/; revision=30440
* init_main.c subr_autoconf.c:Justin T. Gibbs1997-09-211-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for "interrupt driven configuration hooks". A component of the kernel can register a hook, most likely during auto-configuration, and receive a callback once interrupt services are available. This callback will occur before the root and dump devices are configured, so the configuration task can affect the selection of those two devices or complete any tasks that need to be performed prior to launching init. System boot is posponed so long as a hook is registered. The hook owner is responsible for removing the hook once their task is complete or the system boot can continue. kern_acct.c kern_clock.c kern_exit.c kern_synch.c kern_time.c: Change the interface and implementation for the kernel callout service. The new implemntaion is based on the work of Adam M. Costello and George Varghese, published in a technical report entitled "Redesigning the BSD Callout and Timer Facilities". The interface used in FreeBSD is a little different than the one outlined in the paper. The new function prototypes are: struct callout_handle timeout(void (*func)(void *), void *arg, int ticks); void untimeout(void (*func)(void *), void *arg, struct callout_handle handle); If a client wishes to remove a timeout, it must store the callout_handle returned by timeout and pass it to untimeout. The new implementation gives 0(1) insert and removal of callouts making this interface scale well even for applications that keep 100s of callouts outstanding. See the updated timeout.9 man page for more details. Notes: svn path=/head/; revision=29680
* Removed unused #includes.Bruce Evans1997-09-021-3/+1
| | | | Notes: svn path=/head/; revision=29041
* Don't return EINVAL for negative timespecs in the nanosleep functions.Bruce Evans1997-08-261-12/+9
| | | | | | | | | | Negative timespecs are perfectly valid. Just return 0 immediately for them. Also, return 0 immediately for zero timespecs. Fixed some style bugs. Notes: svn path=/head/; revision=28773
* setitimer: if it_value == 0 clear it_interval nowAndrey A. Chernov1997-08-141-2/+6
| | | | | | | | non-zero it_interval values have no sense if it_value == 0 but checked by itimerfix which may cause EINVAL return Notes: svn path=/head/; revision=28213
* Bypass itimerfix 100000000 limit in nanosleep1 using loop through timeoutsAndrey A. Chernov1997-08-131-46/+64
| | | | Notes: svn path=/head/; revision=28171
* Fixed syscall arg checking in clock_settime(). Stack garbage wasBruce Evans1997-08-031-2/+2
| | | | | | | | | checked to be >= 0. This bug was introduced in rev.1.26. Reported by: John Hay <jhay@mikom.csir.co.za> Notes: svn path=/head/; revision=27855
* Add tickadj to struct clockinfo, like NetBSD and OpenBSD.John Hay1997-06-241-2/+1
| | | | | | | NOTE: libc, time, kgmon and rpc.rstatd will have to be recompiled. Notes: svn path=/head/; revision=26897
* oops, fix a braino that I noticed during the commit.. Don't verify thePeter Wemm1997-06-011-5/+7
| | | | | | | | remaining time pointer if it's NULL, since we don't write back in that case! (*blush*!) Notes: svn path=/head/; revision=26336
* - implement signanosleep(2) by moving common code from nanosleep() into aPeter Wemm1997-06-011-28/+102
| | | | | | | | | | | shared function. - use p->p_sleepend to try and get more accurate "time remaining" results when the time has been adjusted. - verify writeability of return address so that we can fail before sleeping if the address for the result is bogus. Notes: svn path=/head/; revision=26335
* Fixes from Bruce:Peter Wemm1997-05-101-59/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Serious: - An important timevalfix() in settime[ofday]() was lost. Not so serious: - There was a race initializing `delta' in the check for setting the time backwards. - The `#ifdef notyet' check for setting the time more than a day forwards was back to front. [[I deleted the code, it's useless because of iteration - Peter]] - The timespec was not checked for validity in clock_settime(). - The timespec was not fully checked for validity in nanotime(). The check in itimerfix() is too late, since the conversion from a timespec to a timeval may overflow. - A garbage timeval was checked in settimeofday() for the (uap->tv == NULL && uap->tzp != NULL) case. I added the broken check this some time ago. Cosmetic: - The "inadvertantly (sic) sleeping forever" test always failed. hzto() always returns >= 1. - The style wasn't very KNFish. (I only changed new code.) Submitted by: bde Notes: svn path=/head/; revision=25656
* Pay attention to what Bruce actually saysBrian Somers1997-05-101-5/+2
| | | | | | | | | | rather than what I think he's going to say. (Now undoing the last timerval change) Really suggested by: bde Notes: svn path=/head/; revision=25646
* Don't require that it_interval be valid ifBrian Somers1997-05-101-2/+5
| | | | | | | | | it_value is set to zero - as per documentation. Suggested by: ache & bde Notes: svn path=/head/; revision=25643
* Implementation of posix-style clock_* and nanosleep syscalls as implementedPeter Wemm1997-05-081-33/+215
| | | | | | | | | | | | | | | in NetBSD. The core of settimeofday() is moved to a seperate static function settime() which both clock_settime() and settimeofday() call. Note that I picked up the securelevel > 1 check from NetBSD that prevents the clock being set backwards in high securelevel mode (this was a hole that allowed resetting of inode access timestamps to arbitary values) Obtained from: mostly from NetBSD, but the settime() function is from our gettimeofday(), some tweaks by me. Notes: svn path=/head/; revision=25583
* Removed `volatile' from declaration of `time', and removed the resultingBruce Evans1997-03-221-4/+3
| | | | | | | | | | | null casts. `time' is nonvolatile for accesses within a region locked by splclock()/splx(). Accesses outside such a region are invalid, and splx() must have the side effect of potentially changing all global variables (since there are hundreds of sort of volatile variables like `time'), so declaring `time' as volatile didn't have any real benefits. Notes: svn path=/head/; revision=24102
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notPeter Wemm1997-02-221-1/+1
| | | | | | | ready for it yet. Notes: svn path=/head/; revision=22975
* This is the kernel Lite/2 commit. There are some requisite userlandJohn Dyson1997-02-101-1/+3
| | | | | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org> Notes: svn path=/head/; revision=22521
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-141-1/+1
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* if we jump the time, we need to check all the process real interval timers.Julian Elischer1996-09-301-2/+5
| | | | Notes: svn path=/head/; revision=18582
* Use a big delta in adjtime() for big negative adjustments as well asBruce Evans1996-07-121-2/+2
| | | | | | | | | | | for big positive adjustments. The existence of big adjustments may be a bug (it's not documented...) but there was no good reason for the asymmetric behaviour. Reviewed by: wollman Notes: svn path=/head/; revision=17123
* Updated some comments in settimeofday().Bruce Evans1996-06-081-3/+15
| | | | Notes: svn path=/head/; revision=16223
* Removed never-used #includes of <machine/cpu.h>. Many were apparentlyBruce Evans1996-04-071-3/+1
| | | | | | | copied from bad examples. Notes: svn path=/head/; revision=15117
* Finished staticizing of timevalfix().Bruce Evans1995-12-261-1/+3
| | | | Notes: svn path=/head/; revision=13016
* A Major staticize sweep. Generates a couple of warnings that I'll dealPoul-Henning Kamp1995-12-141-3/+3
| | | | | | | | | with later. A number of unused vars removed. A number of unused procs removed or #ifdefed. Notes: svn path=/head/; revision=12819
* Fixed settimeofday():Bruce Evans1995-11-191-5/+7
| | | | | | | | | | | - don't allow invalid timevals. - normalize timevals as they are built - don't call timevaladd() with a possibly invalid timeval and normalize the result. Fixed a warning. Notes: svn path=/head/; revision=12381
* Included <sys/sysproto.h> to get central declarations for syscall argsBruce Evans1995-11-121-1/+12
| | | | | | | | | | | | | structs and prototypes for syscalls. Ifdefed duplicated decentralized declarations of args structs. It's convenient to have this visible but they are hard to maintain. Some are already different from the central declarations. 4.4lite2 puts them in comments in the function headers but I wanted to avoid the large changes for that. Notes: svn path=/head/; revision=12221