summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_time.c
Commit message (Collapse)AuthorAgeFilesLines
...
* If the pointer to the new itimerval is NULL in kern_setitimer(), justjhb2005-02-071-0/+3
| | | | read the old value via kern_getitimer().
* Various and sundry style fixes.jhb2005-02-071-4/+4
|
* Split out kernel side of {get,set}itimer(2) into two parts: the first thatsobomax2005-01-251-34/+55
| | | | | | | | pops data from the userland and pushes results back and the second which does actual processing. Use the latter to eliminate stackgap in the linux wrappers of those syscalls. MFC after: 2 weeks
* move kern_nanosleep to sys/syscallsubr.hps2005-01-191-0/+1
| | | | Requested by: jhb
* - rename nanosleep1 to kern_nanosleepps2005-01-191-5/+3
| | | | | | | - Add a 32bit syscall entry for nanosleep Reviewed by: peter Obtained from: Yahoo!
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* Rework how we store process times in the kernel such that we always storejhb2004-10-051-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the raw values including for child process statistics and only compute the system and user timevals on demand. - Fix the various kern_wait() syscall wrappers to only pass in a rusage pointer if they are going to use the result. - Add a kern_getrusage() function for the ABI syscalls to use so that they don't have to play stackgap games to call getrusage(). - Fix the svr4_sys_times() syscall to just call calcru() to calculate the times it needs rather than calling getrusage() twice with associated stackgap, etc. - Add a new rusage_ext structure to store raw time stats such as tick counts for user, system, and interrupt time as well as a bintime of the total runtime. A new p_rux field in struct proc replaces the same inline fields from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime). A new p_crux field in struct proc contains the "raw" child time usage statistics. ruadd() has been changed to handle adding the associated rusage_ext structures as well as the values in rusage. Effectively, the values in rusage_ext replace the ru_utime and ru_stime values in struct rusage. These two fields in struct rusage are no longer used in the kernel. - calcru() has been split into a static worker function calcru1() that calculates appropriate timevals for user and system time as well as updating the rux_[isu]u fields of a passed in rusage_ext structure. calcru() uses a copy of the process' p_rux structure to compute the timevals after updating the runtime appropriately if any of the threads in that process are currently executing. It also now only locks sched_lock internally while doing the rux_runtime fixup. calcru() now only requires the caller to hold the proc lock and calcru1() only requires the proc lock internally. calcru() also no longer allows callers to ask for an interrupt timeval since none of them actually did. - calcru() now correctly handles threads executing on other CPUs. - A new calccru() function computes the child system and user timevals by calling calcru1() on p_crux. Note that this means that any code that wants child times must now call this function rather than reading from p_cru directly. This function also requires the proc lock. - This finishes the locking for rusage and friends so some of the Giant locks in exit1() and kern_wait() are now gone. - The locking in ttyinfo() has been tweaked so that a shared lock of the proctree lock is used to protect the process group rather than the process group lock. By holding this lock until the end of the function we now ensure that the process/thread that we pick to dump info about will no longer vanish while we are trying to output its info to the console. Submitted by: bde (mostly) MFC after: 1 month
* Update previous commit to:kbyanc2004-06-211-18/+13
| | | | | | | | | | | | | * Obtain/release schedlock around calls to calcru. * Sort switch cases which do not cascade per style(9). * Sort local variables per style(9). * Remove "superfluous" whitespace. * Cleanup handling of NULL uap->tp in clock_getres(). It would probably be better to return EFAULT like clock_gettime() does by passing the pointer to copyout(), but I presume it was written to not fail on purpose in the original code. I'll defer to -standards on this one. Reported by: bde
* Implement CLOCK_VIRTUAL and CLOCK_PROF for clock_gettime(2) andkbyanc2004-06-171-9/+39
| | | | | | | clock_getres(2). Reviewed by: phk PR: 23304
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* constify the second args to timevaladd() and timevalsub().alfred2003-10-261-2/+2
|
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Wait for the real interval timer callout handler to finish executing if itjhb2003-06-091-0/+2
| | | | | | | | | | is currently executing when we try to remove it in exit1(). Without this, it was possible for the callout to bogusly rearm itself and eventually refire after the process had been free'd resulting in a panic. PR: kern/51964 Reported by: Jilles Tjoelker <jilles@stack.nl> Reviewed by: tegge, bde
* In setitimer(2), if the it_value of the new itimer value is clear, thenjhb2003-05-131-3/+4
| | | | | | | | don't add the current time to it, but leave it as clear so that when the timer is disabled, the it_value is always clear. Reviewed by: bde Approved by: re (rwatson)
* o fix ppsratecheck to interpret a maxpps of zero as "ignore everything"sam2003-02-261-1/+5
| | | | | o add a comment explaining the significance of using 0 or -1 (actually any negative value) for maxpps
* OK, I was too sleepy there...phk2003-02-231-2/+4
| | | | Pointy hat over here!
* Implement CLOCK_MONOTONIC.phk2003-02-231-2/+3
|
* Remove duplicate includes.cognet2003-02-201-1/+0
| | | | Submitted by: Cyril Nguyen-Huu <cyril@ci0.org>
* Use the proc lock to protect p_realtimer instead of Giant, and obtaintjr2003-02-171-42/+33
| | | | | | sched_lock around accesses to p_stats->p_timer[] to avoid a potential race with hardclock. getitimer(), setitimer() and the realitexpire() callout are now Giant-free.
* Split the global timezone structure into two integer fields tophk2003-02-031-7/+6
| | | | | | | | | | prevent the compiler from optimizing assignments into byte-copy operations which might make access to the individual fields non-atomic. Use the individual fields throughout, and don't bother locking them with Giant: it is no longer needed. Inspired by: tjr
* No need to lock Giant around call to nanosleep1() in nanosleep().tjr2003-02-031-2/+0
|
* Avoid holding Giant across copyout() in gettimeofday() and getitimer().tjr2003-02-031-4/+4
|
* Remove unnecessary locking of Giant around nanotime() in clock_gettime().tjr2003-01-191-2/+0
|
* useracc() is mpsafe so we only need to hold Giantalfred2003-01-191-10/+5
| | | | | | over the call to nanosleep1() Pointed out by: tjr
* o reduce the overhead of calling ppsratecheck by using ticks instead ofsam2002-12-311-55/+24
| | | | | | | | | | | | | calling getmicrouptime (but maintain the struct timeval-based calling convention for compatibility) o eliminate the use of timersub in ratecheck Note that flood ping tests indicate ppsratecheck is inaccurate (but on the conservative side) with this revised implementation. If more accuracy is needed we'll have to introduce an alternate interface or increase the overhead. Reviewed by: silby, dillon, bde
* add generic rate limiting support from netbsd; ratelimit is purely time based,sam2002-12-201-0/+88
| | | | | | ppsratecheck is for controlling packets/second Obtained from: netbsd
* SCARGS removal take II.alfred2002-12-141-12/+12
|
* Backout removal SCARGS, the code freeze is only "selectively" over.alfred2002-12-131-12/+12
|
* Remove SCARGS.alfred2002-12-131-12/+12
| | | | Reviewed by: md5
* Introduce mac_check_system_settime(), a MAC check allowing policies torwatson2002-11-031-0/+13
| | | | | | | augment the system policy for changing the system time. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Round up instead of towards 0 in clock_getres() so that a resolution ofbde2002-09-251-1/+6
| | | | | | | 0 is never returned. PR: 41781 MFC after: 3 days
* A side effect of some debugging: prototypify and deregister.phk2002-08-181-45/+18
|
* more caddr_t removal.alfred2002-06-291-10/+6
|
* Hide the private parts of timecounter from a couple of places that don'tphk2002-04-261-1/+1
| | | | really need to know the gory details.
* Improve the implementation of adjtime(2).phk2002-04-151-72/+0
| | | | | | | | | | | | | | | | | | | | | | | Apply the change as a continuous slew rather than as a series of discrete steps and make it possible to adjust arbitraryly huge amounts of time in either direction. In practice this is done by hooking into the same once-per-second loop as the NTP PLL and setting a suitable frequency offset deducting the amount slewed from the remainder. If the remaining delta is larger than 1 second we slew at 5000PPM (5msec/sec), for a delta less than a second we slew at 500PPM (500usec/sec) and for the last one second period we will slew at whatever rate (less than 500PPM) it takes to eliminate the delta entirely. The old implementation stepped the clock a number of microseconds every HZ to acheive the same effect, using the same rates of change. Eliminate the global variables tickadj, tickdelta and timedelta and their various use and initializations. This removes the most significant obstacle to running timecounter and NTP housekeeping from a timeout rather than hardclock.
* - Change settime() to take a thread as its first argument instead of a procjhb2002-04-101-36/+27
| | | | | | | | | so it can use td_ucred. - Push Giant down into the end of settime() where we actually set the time on the timecounter and time of day clock. - Remove Giant from clock_settime(). - Push Giant down in settimeofday() to just protect the 'tz' global variable.
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-3/+3
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Remove __P.alfred2002-03-191-6/+6
|
* Take the common case of gettimeofday(&tv, NULL) out from under Giant.phk2002-02-181-8/+4
|
* o Modify static settime() to accept the proc * for the process requestingrwatson2001-09-261-5/+6
| | | | | | | a time change, and callers so that they provide td->td_proc. o Modify settime() to use securevel_gt() for securelevel checking. Obtained from: TrustedBSD Project
* KSE Milestone 2julian2001-09-121-26/+28
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Giant Pushdowndillon2001-09-011-47/+126
| | | | | | | | clock_gettime() clock_settime() nanosleep() settimeofday() adjtime() getitimer() setitimer() __sysctl() ogetkerninfo() sigaction() osigaction() sigpending() osigpending() osigvec() osigblock() osigsetmask() sigsuspend() osigsuspend() osigstack() sigaltstack() kill() okillpg() trapsignal() nosys()
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-0/+3
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Lock the process while sending it SIGARLM and updating p_realtimer.jhb2001-03-071-0/+4
|
* Use callout_reset instead of timeout(9). Most callouts are staticallyjake2000-11-271-5/+5
| | | | | | allocated, 2 have been added to struct proc for setitimer and sleep. Reviewed by: jhb, jlemon
* Remove unneeded <sys/buf.h> includes.phk2000-04-181-1/+0
| | | | | Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks by 924 bytes.
* Isolate the Timecounter internals in their own two files.phk2000-03-201-1/+2
| | | | | | | | | | | | | | | Make the public interface more systematically named. Remove the alternate method, it doesn't do any good, only ruins performance. Add counters to profile the usage of the 8 access functions. Apply the beer-ware to my code. The weird +/- counts are caused by two repocopies behind the scenes: kern/kern_clock.c -> kern/kern_tc.c sys/time.h -> sys/timetc.h (thanks peter!)
* Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for thephk1999-10-301-1/+2
| | | | | | | | | "rw" argument, rather than hijacking B_{READ|WRITE}. Fix two bugs (physio & cam) resulting by the confusion caused by this. Submitted by: Tor.Egge@fast.no Reviewed by: alc, ken (partly)
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Minor tweaks to make sure (new) prerequisites for <sys/buf.h> (mostlypeter1999-06-271-1/+2
| | | | splbio()/splx()) are #included in time.
OpenPOWER on IntegriCloud