summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_kthread.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove sigacts structure sharing. The only process that used sharing wasclaudio2020-02-211-2/+2
| | | | | | | proc0 which is used for kthreads and idle threads. proc0 and all those other kernel threads don't handle signals so there is no benefit in sharing. Simplifies the code a fair bit since the refcnt is gone. OK kettenis@
* Replace p_xstat with ps_xexit and ps_xsigguenther2019-12-111-3/+2
| | | | | | | | | Convert those to a consolidated status when needed in wait4(), kevent(), and sysctl() Pass exit code and signal separately to exit1() (This also serves as prep for adding waitid(2)) ok mpi@
* Grab the KERNEL_LOCK() in kthread_create(9) to enable unlocked codevisa2018-07-051-2/+8
| | | | | | | paths create kernel threads. This will be utilized by sosplice() for the taskq allocation. OK mpi@
* Split up fork1():guenther2017-02-121-2/+2
| | | | | | | | | | | | | | | | | - FORK_THREAD handling is a totally separate function, thread_fork(), that is only used by sys___tfork() and which loses the flags, func, arg, and newprocp parameters and gains tcb parameter to guarantee the new thread's TCB is set before the creating thread returns - fork1() loses its stack and tidptr parameters Common bits factor out: - struct proc allocation and initialization moves to thread_new() - maxthread handling moves to fork_check_maxthread() - setting the new thread running moves to fork_thread_start() The MD cpu_fork() function swaps its unused stacksize parameter for a tcb parameter. luna88k testing by aoyama@, alpha testing by dlg@ ok mpi@
* p_comm is the process's command and isn't per thread, so move it fromguenther2017-01-211-3/+3
| | | | | | struct proc to struct process. ok deraadt@ kettenis@
* Split PID from TID, giving processes a PID unrelated to the TID of theirguenther2016-11-071-2/+2
| | | | | | initial thread ok jsing@ kettenis@
* 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@
* 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.
* Add PS_SYSTEM, the process-level mirror of the thread-level P_SYSTEM,guenther2014-05-041-7/+2
| | | | | | | and FORK_SYSTEM as a flag to set them. This eliminates needing to peek into other processes threads in various places. Inspired by NetBSD ok miod@ matthew@
* Eliminate the exit sig handling, which was only invokable via theguenther2014-02-121-2/+2
| | | | | | | | Linux-compat clone() syscall when *not* using CLONE_THREAD. pirofti@ confirms Opera runs in compat without this, so out it goes; one less hair to choke on in kern_exit.c ok tedu@ pirofti@
* simplify kthread_create(). no more stdargderaadt2013-11-181-6/+3
| | | | ok matthew guenther mikeb
* do not include machine/cpu.h from a .c file; it is the responsibility ofderaadt2013-03-281-2/+1
| | | | | .h files to pull it in, if needed ok tedu
* Change fork1() and kthread_create() to match the rest of the treeguenther2011-11-091-6/+6
| | | | | | | | and use curp vs p instead of p1 vs p2. Add curpr and pr variables for the respective struct processes. Make sigactsshare() return the shared sigacts intead of taking the struct proc to update. ok deraadt@
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
* Pass FORK_SHAREFILES flag in kthread_create; avoids allocating ablambert2008-05-021-3/+3
| | | | | | | | filedesc struct and associated fdcopy operation on kernel thread creation. Instead, kernel threads share and bump reference count on proc0's filedesc. ok thib@, "definitely makes sense" art@
* Use M_ZERO in a few more places to shave bytes from the kernel.art2007-09-071-3/+2
| | | | eyeballed and ok dlg@
* 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
* Kernel stack can be swapped. This means that stuff that's on the stackmiod2006-11-291-4/+3
| | | | | | | | | | should never be referenced outside the context of the process to which this stack belongs unless we do the PHOLD/PRELE dance. Loads of code doesn't follow the rules here. Instead of trying to track down all offenders and fix this hairy situation, it makes much more sense to not swap kernel stacks. From art@, tested by many some time ago.
* kernel support for threaded processes (rthreads).tedu2005-12-031-2/+2
| | | | | | | | 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
* Have kthread_create_deferred() act immediately once kthread_run_deferred_queue()miod2004-12-081-2/+12
| | | | | | has been invoked; forgotten part of the ``create init earlier'' changes. From NetBSD as well. ok deraadt@ dlg@
* Create the init process earlier, before the root filesystem is mounted,miod2004-11-231-6/+3
| | | | | | | | | | | and have it stall on a semaphore. This allows all kthread creations which could have been requested during autoconf to be processed before root is mounted as well. This causes umass devices attached to any usb with flags 1 (such as on macppc) to configure properly instead of panicing the kernel at mountroot time. From NetBSD; tested by various.
* Remove useless ``elm'' argument from the SIMPLEQ_REMOVE_HEAD macro.grange2004-05-041-2/+2
| | | | | | This matches our SLIST behaviour and NetBSD's SIMPLEQ as well. ok millert krw deraadt
* put an mi wrapper around stdarg.h/varargs.h. gcc3 moved stdarg/varargs macrosespie2004-01-031-2/+2
| | | | | | | to built-ins, so eventually we will have one version of these files. Special adjustments for the kernel to cope: machine/stdarg.h -> sys/stdarg.h and machine/ansi.h needs to have a _BSD_VA_LIST_ for syslog* prototypes. okay millert@, drahn@, miod@.
* typos in comments; From: Bengt Wessling <bengt@lemuria.org>, 10xhenning2003-05-271-2/+2
|
* string cleaning; tedu okderaadt2003-05-061-2/+2
|
* ANSIfyart2002-06-111-7/+4
|
* Kill #if __STDC__ used to do K&R vs. ANSI varargs/stdarg; just do thingsmillert2002-03-151-10/+1
| | | | the ANSI way.
* First round of __P removal in sysmillert2002-03-141-4/+4
|
* Let fork1, uvm_fork, and cpu_fork take a function/argument pair as argument,art2001-11-061-5/+2
| | | | | | | | | | | instead of doing fork1, cpu_set_kpc. This lets us retire cpu_set_kpc and avoid a multiprocessor race. This commit breaks vax because it doesn't look like any other arch, someone working on vax might want to look at this and try to adapt the code to be more like the rest of the world. Idea and uvm parts from NetBSD.
* __dead not __noreturn__millert2001-08-081-2/+2
|
* no more cpu_set_init_frameart2001-06-271-13/+1
|
* remove old vmart2001-06-271-6/+1
|
* On popular demand, the Linux-compatibility clone(2) implementation basedniklas2001-04-021-4/+6
| | | | | on NetBSD's code, as well as some faked Posix RT extensions by me. This makes at least simple linuxthreads tests work.
* art, at least commit something which compiles!deraadt2000-07-171-2/+2
|
* FORK_SHAREVM only works on non-UVM kernels.art2000-07-171-1/+5
| | | | Pointed out by miod@
* Mark kernel threads as system processes. Make ps hide them by default,niklas2000-06-181-3/+2
| | | | | | show them with -k. Do not try to show RSS based values for them as they mess up column alignment. vmstat -f now shows kernel threads separately from rforks too.
* re-add fixed vfork code from artderaadt2000-01-311-2/+2
|
* undo vfork changes, since non-UVM was not consideredderaadt2000-01-311-2/+2
|
* Change fork1() from taking forktype and rforkflags, into a single flagsart2000-01-281-2/+2
| | | | | argument. Let sys_rfork build the arguments to fork1() and do the sanity checks itself.
* New cpu_fork API to take a stack in which you point the child's stackpointerniklas1999-08-171-2/+3
| | | | | | to, at the bottom or the top, depending on your architecture's stack growth direction. This is in preparation for Linux' clone(2) emulation. port maintainers, please check that I did the work right.
* We need machine/cpu.h for the cpu_set_init_frame defniklas1999-01-261-1/+3
|
* sigh memset is not available everywhere, I should know betterniklas1999-01-111-3/+3
|
* kthread abstraction from NetBSD, implemented with our rforkniklas1999-01-111-0/+190