summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add ddb ps/o, displaying just the non-idle on-proc threadsguenther2015-09-111-8/+30
| | | | ok deraadt@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* start retiring the nointr allocator. specify PR_WAITOK as a flag as atedu2014-12-191-13/+13
| | | | marker for which pools are not interrupt safe. ok dlg
* convert bcopy to memcpy. ok millerttedu2014-12-101-2/+2
|
* pass size argument to free()deraadt2014-11-031-2/+2
| | | | ok doug tedu
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* Track whether a process is a zombie or not yet fully built via flagsguenther2014-07-041-2/+2
| | | | | | | | | | | PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
* Move from struct proc to process the reference-count-holding pointersguenther2014-05-151-4/+3
| | | | | | | | | | to the process's vmspace and filedescs. struct proc continues to keep copies of the pointers, copying them on fork, clearing them on exit, and (for vmspace) refreshing on exec. Also, make uvm_swapout_threads() thread aware, eliminating p_swtime in kernel. particular testing by ajacoutot@ and sebastia@
* Eliminates struct pcred by moving the real and saved ugids intoguenther2014-03-301-5/+2
| | | | | | | | | struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
* Move p_emul and p_sigcode from proc to process.guenther2014-03-261-2/+2
| | | | | | | | | Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself. ok deraadt@ millert@
* Threads can't be zombies, only processes, so change zombproc to zombprocess,guenther2014-01-201-38/+41
| | | | | | | | make it a list of processes, and change P_NOZOMBIE and P_STOPPED from thread flags to process flags. Add allprocess list for the code that just wants to see processes. ok tedu@
* format string fix: p_*ticks are u_intsf2013-10-021-2/+2
|
* Stop merging the per-thread and per-process flags when reportingguenther2013-09-221-2/+2
| | | | | | | | them via sysctl(KERN_PROC). In struct kinfo_proc the per-process flags move to p_psflags, leaving the per-thread flags in p_flags. Flag descriptions in ps(1) updated to be less obtuse. discussed with matthew@ some time ago; ok jca@, manpage bits ok jmc@
* The ps flags are split between thread and process. It is usefulbluhm2013-08-121-4/+6
| | | | | | | for ddb to show both. So or them together in the ps overview and list them explicitly for the specific thread. Also sync the ddb bit names with the define names. OK miod@
* Uncomment kprintf format attributes for sys/kernsyl2013-08-081-2/+2
| | | | tested on vax (gcc3) ok miod@
* Comment out recently added __attribute__((__format__(__kprintf__))) annotationsmiod2013-02-171-2/+2
| | | | | | in MI code; gcc 2.95 does not accept such annotation for function pointer declarations, only function prototypes. To be uncommented once gcc 2.95 bites the dust.
* Add explicit __attribute__ ((__format__(__kprintf__)))) to the functions andmiod2013-02-091-2/+3
| | | | | | function pointer arguments which are {used as,} wrappers around the kernel printf function. No functional change.
* Make the KERN_NPROCS and KERN_MAXPROC sysctl()s and the RLIMIT_NPROC rlimitguenther2012-04-101-4/+4
| | | | | | | | count processes instead of threads. New sysctl()s KERN_NTHREADS and KERN_MAXTHREAD count and limit threads. The nprocs and maxproc kernel variables are replaced by nprocess, maxprocess, nthreads, and maxthread. ok tedu@ mikeb@
* %, is not a valid format specifiermiod2011-09-181-2/+2
|
* The scheduling 'nice' value is per-process, not per-thread, so move itguenther2011-03-071-2/+2
| | | | | | into struct process. ok tedu@ deraadt@
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-64/+74
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* Rollback the allproclk and fileheadlk addition. When grabbing anguenther2010-07-191-4/+1
| | | | | | | | rwlock, the thread will release biglock if it sleeps, means that atomicity from before the rw_enter() to after it is not guaranteed. The change didn't address those, so pulling it until it does. "go for it" tedu@
* A process on the zombie list can have a NULL p_pgrp if it sleeps whenguenther2010-07-101-2/+3
| | | | | | | grabbing allproclk in proc_zap(); skip such processes in sysctl(KERN_PROC*) and handle the NULL pointer in ddb's ps. ok tedu@
* Add a rwlock around the filehead and allproc lists, mainly to protecttedu2010-03-241-1/+4
| | | | | list walkers in sysctl that can block. As a reward, no more vslock. With some feedback from art, guenther, phessler. ok guenther.
* Make sure the process tree is is loop-free by forbidding ptrace()guenther2010-01-281-5/+5
| | | | | | | | of a direct ancestor, closing a localhost DoS. As an exception, do permit ptrace() of pid 1 and have inferiors() stop climbing if it hits that. ok tedu@ hpux_compat suggestion from miod@
* Misplaced comment.art2009-04-151-5/+5
| | | | From Kirill Timofeev
* change all callers of enterpgrp() to pre-allocate a pgrp or session ifderaadt2008-11-011-17/+30
| | | | | | it might be needed later -- before calling pfind(), so that enterpgrp() can operate without sleeping ok tedu
* accidental commit ... backoutderaadt2008-10-311-39/+19
|
* kern_sysctl.cderaadt2008-10-311-19/+39
|
* Make context switching much more MI:art2007-10-101-3/+3
| | | | | | | | | | | | | | | | | | | | - Move the functionality of choosing a process from cpu_switch into a much simpler function: cpu_switchto. Instead of having the locore code walk the run queues, let the MI code choose the process we want to run and only implement the context switching itself in MD code. - Let MD context switching run without worrying about spls or locks. - Instead of having the idle loop implemented with special contexts in MD code, implement one idle proc for each cpu. make the idle loop MI with MD hooks. - Change the proc lists from the old style vax queues to TAILQs. - Change the sleep queue from vax queues to TAILQs. This makes wakeup() go from O(n^2) to O(n) there will be some MD fallout, but it will be fixed shortly. There's also a few cleanups to be done after this. deraadt@, kettenis@ ok
* Use M_ZERO in a few more places to shave bytes from the kernel.art2007-09-071-4/+2
| | | | eyeballed and ok dlg@
* Allow ddb>ps to print the full name of the wait state. Things likeckuethe2007-08-041-3/+3
| | | | | "flt_noram1" would get truncated otherwise. ok deraadt
* Start moving state that is shared among threads in a process intoart2007-04-031-1/+4
| | | | | | | | | | | a new struct. Instead of doing a huge rename and deal with the fallout for weeks, like other projects that need no mention, we will slowly and carefully move things out of struct proc into a new struct process. - Create struct process and the infrastructure to create and remove them. - Move threads in a process into struct process. deraadt@, tedu@ ok
* Since p_flag is often manipulated in interrupts and without biglockart2007-03-151-2/+2
| | | | | | | | | | | | it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int. Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way. kettenis@ ok
* fix memory leak conditions in thrsleep and significantly simplifytedu2005-12-221-9/+1
|
* older gcc (like real C) does not let you declare local variables afterderaadt2005-12-041-4/+4
| | | | doing functional code; ie. LIST_INIT()
* kernel support for threaded processes (rthreads).tedu2005-12-031-1/+9
| | | | | | | | uses rfork(RFTHREAD) to create threads, which are presently processes that are a little more tightly bound together. several new syscalls added to facilitate a userland thread library. all conditional on RTHREADS, currently disabled. ok deraadt
* ansi/deregister.jsg2005-11-281-38/+22
| | | | 'go for it' deraadt@
* oops, kernel free needs two args. thanks pedrotedu2005-07-041-5/+7
|
* malloc(M_WAITOK) implies sleeping, so we have to double check thattedu2005-07-031-7/+15
| | | | somebody else didn't beat us in uid_find().
* split out uidinfo from kern_proc.c private, use it to store lock count,tedu2005-03-101-32/+22
| | | | | | restrict lock count per uid to a global limit, add sysctl to adjust limit. this prevents a user from creating too many locks. problem noticed by devon o'dell. ok deraadt miod pedro
* Use list and queue macros where applicable to make the code easier to read;miod2004-12-261-15/+13
| | | | no change in compiler assembly output.
* handle SONPROC; ok aaron, deraadt, krwmarkus2004-11-181-2/+2
|
* cacheing -> cachingpedro2004-10-041-2/+2
|
* move db_show_all_procs to kern_proc.c, proc_printit goes in DDB too.tedu2004-07-251-1/+90
| | | | | shuffle functions around so that scheduler is all together. no real functional changes. ok art@ testing miod@
* SIMPLELOCK -> mutex for the lock around deadproc list.art2004-07-221-14/+1
| | | | | | | Also move the whole deadproc infrastructure to kern_exit, it's only used there. miod@ ok
* debranch SMP, have funniklas2004-06-131-3/+3
|
* The Sxxx proc state defines start at 1, not 0. Also make the constmillert2004-01-291-5/+5
| | | | | usage more correct and fix a signed/unsigned format mismatch. Based on a patch from Patrick Latifi. OK deraadt@
* Remove the advertising clause in the UCB license which Berkeleymillert2003-06-021-6/+2
| | | | rescinded 22 July 1999. Proofed by myself and Theo.
* Quoting Theo: Do not approve diffs when you're hungover.art2003-05-121-3/+3
| | | | Accessing p_md members from MI code is not legal.