summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_time.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove VOP_LEASE and supporting functions. This hasn't been used sincerwatson2009-04-101-12/+0
| | | | | | | | | | | | | | the removal of NQNFS, but was left in in case it was required for NFSv4. Since our new NFSv4 client and server can't use it for their requirements, GC the old mechanism, as well as other unused lease- related code and interfaces. Due to its impact on kernel programming and binary interfaces, this change should not be MFC'd. Proposed by: jeff Reviewed by: jeff Discussed with: rmacklem, zach loafman @ isilon
* Correctly sanity-check timer IDs. [SA-09:06]cperciva2009-03-231-1/+2
| | | | | | | | | | Limit the size of malloced buffer when dumping environment variables. [EN-09:01] Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-09:06.ktimer Errata: FreeBSD-EN-09:01.kenv
* Remove even more unneeded variable assignments.ed2009-02-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | kern_time.c: - Unused variable `p'. kern_thr.c: - Variable `error' is always caught immediately, so no reason to initialize it. There is no way that error != 0 at the end of create_thread(). kern_sig.c: - Unused variable `code'. kern_synch.c: - `rval' is always assigned in all different cases. kern_rwlock.c: - `v' is always overwritten with RW_UNLOCKED further on. kern_malloc.c: - `size' is always initialized with the proper value before being used. kern_exit.c: - `error' is always caught and returned immediately. abort2() never returns a non-zero value. kern_exec.c: - `len' is always assigned inside the if-statement right below it. tty_info.c: - `td' is always overwritten by FOREACH_THREAD_IN_PROC(). Found by: LLVM's scan-build
* In realtimer_delete(), clear timer's value and interval to telldavidxu2008-10-201-0/+8
| | | | | | | realtimer_expire() to not rearm the timer, otherwise there is a chance that a callout will be left there and be tiggered in future unexpectly. Bug reported by: tegge@
* Make sure reading td_runtime in critical section since thread may bedavidxu2008-01-181-1/+2
| | | | preempted and td_runtime will be modified.
* Add POSIX clock id CLOCK_THREAD_CPUTIME_ID, this can be used to measuredavidxu2008-01-181-0/+16
| | | | per-thread runtime in user code.
* rufetch and calcru sometimes should be called atomically together.attilio2007-06-091-0/+4
| | | | | | | | | | This patch fixes places where they should be called atomically changing their locking requirements (both assume per-proc spinlock held) and introducing rufetchcalc which wrappers both calls to be performed in atomic way. Reviewed by: jeff Approved by: jeff (mentor)
* Commit 14/14 of sched_lock decomposition.jeff2007-06-051-4/+4
| | | | | | | | | | | - Use thread_lock() rather than sched_lock for per-thread scheduling sychronization. - Use the per-process spinlock rather than the sched_lock for per-process scheduling synchronization. Tested by: kris, current@ Tested on: i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc. Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
* Remove MAC Framework access control check entry points made redundant withrwatson2007-04-221-14/+0
| | | | | | | | | | | | | | | | | | the introduction of priv(9) and MAC Framework entry points for privilege checking/granting. These entry points exactly aligned with privileges and provided no additional security context: - mac_check_sysarch_ioperm() - mac_check_kld_unload() - mac_check_settime() - mac_check_system_nfsd() Add mpo_priv_check() implementations to Biba and LOMAC policies, which, for each privilege, determine if they can be granted to processes considered unprivileged by those two policies. These mostly, but not entirely, align with the set of privileges granted in jails. Obtained from: TrustedBSD Project
* Further system call comment cleanup:rwatson2007-03-051-26/+16
| | | | | | | | | | - Remove also "MP SAFE" after prior "MPSAFE" pass. (suggested by bde) - Remove extra blank lines in some cases. - Add extra blank lines in some cases. - Remove no-op comments consisting solely of the function name, the word "syscall", or the system call name. - Add punctuation. - Re-wrap some comments.
* Remove 'MPSAFE' annotations from the comments above most system calls: allrwatson2007-03-041-21/+0
| | | | | | | | system calls now enter without Giant held, and then in some cases, acquire Giant explicitly. Remove a number of other MPSAFE annotations in the credential code and tweak one or two other adjacent comments.
* - Remove third parameter of itimer_find, the parameter is always zero.davidxu2006-11-281-46/+16
| | | | | - Call callout_drain on deleting POSIX timer. - Use kern_timer_delete in exiting hook.
* Merge posix4/* into normal kernel hierarchy.trhodes2006-11-111-2/+1
| | | | | Reviewed by: glanced at by jhb Approved by: silence on -arch@ and -standards@
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-2/+3
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-221-1/+2
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* Move tz_minuteswest and tz_dsttime to subr_clock.cphk2006-10-021-3/+0
|
* First part of a little cleanup in the calendar/timezone/RTC handling.phk2006-10-021-0/+1
| | | | | | Move relevant variables to <sys/clock.h> and fix #includes as necessary. Use libkern's much more time- & spamce-efficient BCD routines.
* - Change process_exec function handlers prototype to include structnetchild2006-08-151-4/+11
| | | | | | | | | | | | | image_params arg. - Change struct image_params to include struct sysentvec pointer and initialize it. - Change all consumers of process_exit/process_exec eventhandlers to new prototypes (includes splitting up into distinct exec/exit functions). - Add eventhandler to userret. Sponsored by: Google SoC 2006 Submitted by: rdivacky Parts suggested by: jhb (on hackers@)
* INT_MAX is defined in file sys/limits.h, include the file now.davidxu2006-08-021-0/+1
|
* Let kernel POSIX timer code and mqueue code to use integer as a resourcedavidxu2006-03-011-23/+23
| | | | | handle, the timer_t and mqd_t types will be a pointer which userland will define it.
* Fix compiling warning on 64 bits system.davidxu2005-12-091-1/+1
|
* Register itimers_event_hook as a kernel event handler, so I don'tdavidxu2005-12-091-2/+9
| | | | have to duplicate code to call it in exec() and exit1().
* 1. Set timer configuration values for sysconf().davidxu2005-12-011-2/+15
| | | | | 2. Set overrun limit to INT_MAX, report ERANGE error if overrun will be greater than INT_MAX.
* Add several aliases for existing clockid_t names to indicate that therwatson2005-11-271-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | application wishes to request high precision time stamps be returned: Alias Existing CLOCK_REALTIME_PRECISE CLOCK_REALTIME CLOCK_MONOTONIC_PRECISE CLOCK_MONOTONIC CLOCK_UPTIME_PRECISE CLOCK_UPTIME Add experimental low-precision clockid_t names corresponding to these clocks, but implemented using cached timestamps in kernel rather than a full time counter query. This offers a minimum update rate of 1/HZ, but in practice will often be more frequent due to the frequency of time stamping in the kernel: New clockid_t name Approximates existing clockid_t CLOCK_REALTIME_FAST CLOCK_REALTIME CLOCK_MONOTONIC_FAST CLOCK_MONOTONIC CLOCK_UPTIME_FAST CLOCK_UPTIME Add one additional new clockid_t, CLOCK_SECOND, which returns the current second without performing a full time counter query or cache lookup overhead to make sure the cached timestamp is stable. This is intended to support very low granularity consumers, such as time(3). The names, visibility, and implementation of the above are subject to change, and will not be MFC'd any time soon. The goal is to expose lower quality time measurement to applications willing to sacrifice accuracy in performance critical paths, such as when taking time stamps for the purpose of rescheduling select() and poll() timeouts. Future changes might include retrofitting the time counter infrastructure to allow the "fast" time query mechanisms to use a different time counter, rather than a cached time counter (i.e., TSC). NOTE: With different underlying time mechanisms exposed, using different time query mechanisms in the same application may result in relative non-monoticity or the appearance of clock stalling for a single clockid_t, as a cached time stamp queried after a precision time stamp lookup may be "before" the time returned by the earlier live time counter query.
* Add CLOCK_UPTIME to clock_gettime(2) reporting the currentandre2005-11-181-0/+2
| | | | | | uptime measured in SI seconds. Sponsored by: TCP/IP Optimization Fundraise 2005
* Fix name compatible problem with POSIX standard. the sigval_ptr anddavidxu2005-11-041-1/+1
| | | | | | sigval_int really should be sival_ptr and sival_int. Also sigev_notify_function accepts a union sigval value but not a pointer.
* Cleanup some signal interfaces. Now the tdsignal function acceptsdavidxu2005-11-031-28/+11
| | | | | | | | | both proc pointer and thread pointer, if thread pointer is NULL, tdsignal automatically finds a thread, otherwise it sends signal to given thread. Add utility function psignal_event to send a realtime sigevent to a process according to the delivery requirement specified in struct sigevent.
* Let itimer store itimerspec instead of itimerval, so I don't have todavidxu2005-10-301-59/+118
| | | | | | | | | | | | | | | | | | | convert to or from timeval frequently. Introduce function itimer_accept() to ack a timer signal in signal acceptance code, this allows us to return more fresh overrun counter than at signal generating time. while POSIX says: "the value returned by timer_getoverrun() shall apply to the most recent expiration signal delivery or acceptance for the timer,.." I prefer returning it at acceptance time. Introduce SIGEV_THREAD_ID notification mode, it is used by thread libary to request kernel to deliver signal to a specified thread, and in turn, the thread library may use the mechanism to implement SIGEV_THREAD which is required by POSIX. Timer signal is managed by timer code, so it can not fail even if signal queue is full filled by sigqueue syscall.
* Don't touch last overrun if signal was already on queue.davidxu2005-10-231-2/+0
|
* Make p_itimers as a pointer, so file sys/proc.h does not need to includedavidxu2005-10-231-28/+25
| | | | sys/timers.h.
* Implement POSIX timers. Current only CLOCK_REALTIME and CLOCK_MONOTONICdavidxu2005-10-231-2/+664
| | | | | | | | | | | | clock are supported. I have plan to merge XSI timer ITIMER_REAL and other two CPU timers into the new code, current three slots are available for the XSI timers. The SIGEV_THREAD notification type is not supported yet because our sigevent struct lacks of two member fields: sigev_notify_function sigev_notify_attributes I have found the sigevent is used in AIO, so I won't add the two members unless the AIO code is adjusted.
* Implement 32bit wrappers for clock_gettime, clock_settime, andps2005-10-151-19/+51
| | | | clock_getres.
* Implement kern_adjtime(), kern_readv(), kern_sched_rr_get_interval(),jhb2005-03-311-17/+34
| | | | | kern_settimeofday(), and kern_writev() to allow for further stackgap reduction in the compat ABIs.
* 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
|
OpenPOWER on IntegriCloud