summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exit.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Snapshots for all archs have been built, so remove the T32 codeguenther2013-09-141-26/+1
|
* Switch time_t, ino_t, clock_t, and struct kevent's ident and dataguenther2013-08-131-23/+64
| | | | | | | | | | | | | | | | | | | | members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@
* factor out pid allocation to functions. add a small cache of recentlytedu2013-06-051-1/+2
| | | | | exited pids that won't get recycled. ok deraadt
* some small style changes that are distracting me from seeing a real bugtedu2013-06-011-12/+11
|
* Merge from FreeBSD, r191313guenther2013-05-071-5/+5
| | | | | | | | | | | | | | | --------------------------- On the exit of the child process which parent either set SA_NOCLDWAIT or ignored SIGCHLD, unconditionally wake up the parent instead of doing this only when the child is a last child. This brings us in line with other U**xes that support SA_NOCLDWAIT. If the parent called waitpid(childpid), then exit of the child should wake up the parent immediately instead of forcing it to wait for all children to exit. --------------------------- ok tedu@, millert@
* rthreads are always enabled. remove the sysctl.tedu2013-04-061-4/+1
| | | | ok deraadt guenther kettenis matthew
* vrele() is a tricky beast. it can sleep if the refcount hits zero,tedu2013-03-301-5/+10
| | | | | | leaving us with a free type function that isn't atomic. deal with this by erasing any reachable pointers to the vnode first, then free it. ok deraadt guenther
* 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
* Plug a race where we're trying to kill a traced process while it is aleadykettenis2012-09-081-4/+5
| | | | | | | | exiting. At that point ps_single may point to a proc that's already freed. Since there is no point in killing a process that's already exiting, just skip this step. ok guenther@
* Apply profiling to all threads instead of just the thread that calledguenther2012-08-021-3/+3
| | | | | | | profil() by moving P_PROFIL from proc->p_flag to process->ps_flags with matching adjustment in fork1() and exit1() ok matthew@
* exit1(EXIT_THREAD) needs to call single_thread_check() so that itguenther2012-07-111-1/+3
| | | | | | | | can be suspended and/or decrement pr->ps_singlecount if necessary. With that added, the call the other direction needs to use its own flag (EXIT_THREAD_NOCHECK) to avoid looping. problem diagnosed from a hang naddy@ hit; ok kettenis@
* The linux emulation exit hook needs to be able to sleep, so call itguenther2012-07-091-7/+8
| | | | | | before changing p_stat to SDEAD ok pirofti@
* If single threading is active, drirect the SIGKILL signal we send to orphanedkettenis2012-04-141-2/+11
| | | | | | | traced processes to the active thread, otherwise we will deadlock resulting in an unkillable stopped process. ok guenther@
* Backout a tiny part of the previous commit. Decrementing ps_singlecount inkettenis2012-04-131-5/+1
| | | | | | exit1() is wrong, since single_thread_check() already decrements it and may call exit1() after that. I can't reproduce the hang that this was supposed to fix anyway.
* First stab at making ptrace(2) usable for debugging multi-threaded programs.kettenis2012-04-131-1/+20
| | | | | | | | | | It implements a full-stop model where all threads are stopped before handing over control to the debugger. Events are reported as before through wait(2); you will have to call ptrace(PT_GET_PROCESS_STATE, ...) to find out which thread hit the event. Since this changes the size of struct ptrace_state, you will have to recompile gdb. ok guenther@
* Move the P_WAITED flag from struct proc to struct process.kettenis2012-04-111-3/+4
| | | | ok guenther@
* Make the KERN_NPROCS and KERN_MAXPROC sysctl()s and the RLIMIT_NPROC rlimitguenther2012-04-101-7/+9
| | | | | | | | 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@
* ruadd() does the summing of system and user times, so doing so againguenther2012-04-061-5/+1
| | | | | | results in bogus total times, as reported by numerous ports people. ok miod@
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-18/+36
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* Add PS_EXITING to better differentiate between the process exiting andguenther2012-03-101-1/+2
| | | | the main thread exiting. c.f. regress/sys/kern/main-thread-exited/
* First steps for making ptrace work with rthreads:guenther2012-02-201-12/+14
| | | | | | | | | | - move the P_TRACED and P_INEXEC flags, and p_oppid, p_ptmask, and p_ptstat member from struct proc to struct process - sort the PT_* requests into those that take a PID vs those that can also take a TID - stub in PT_GET_THREAD_FIRST and PT_GET_THREAD_NEXT ok kettenis@
* Reimplement mutexes, condvars, and rwlocks to eliminate bugs,guenther2012-01-171-3/+3
| | | | | | | | | | | | | particularly the "consume the signal you just sent" hang, and putting the wait queues in userspace. Do cancellation handling in pthread_cond_*wait(), pthread_join(), and sem_wait(). Add __ prefix to thr{sleep,wakeup,exit,sigdivert}() syscalls; add 'abort" argument to thrsleep to close cancellation race; make thr{sleep,wakeup} return errno values via *retval to avoid touching userspace errno.
* Handle rthreads consistently in ktrace by moving the flags and vnode intoguenther2011-12-141-8/+6
| | | | | | | | struct process; KTRFAC_ACTIVE becomes P_INKTR. Also, save the credentials used to open the file in sys_ktrace() and use them for all writes to the vnode. much feedback and ok jsing@
* Suspend other rthreads before dumping core or execing; make them exitguenther2011-12-111-36/+25
| | | | | | when exec succeeds. ok jsing@
* sys_wait4 properly returns int. ok deraadttedu2011-07-251-2/+2
|
* Clean up after P_BIGLOCK removal.art2011-07-061-4/+4
| | | | | | | KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK oga@ ok
* Recommit the reverted sigacts change now that the NFS use-after-freeguenther2011-07-051-4/+4
| | | | | | | | problem has been tracked down. This fixes the sharing of the signal handling state: shared bits go in sigacts, per-rthread bits goes in struct proc. ok deraadt@
* Revert the sigacts diff: NFS can apparently retain pointers to processesguenther2011-04-181-4/+4
| | | | | | until they're zombies and then send them signals (for intr mounts). Until that is untangled, the sigacts change is unsafe. sthen@ was the victim for this one
* Correct the sharing of the signal handling state: stuff that shouldguenther2011-04-151-4/+4
| | | | | | | | | | | | be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves to struct sigacts, wihle stuff that should be per rthread (ps_oldmask, SAS_OLDMASK, ps_sigstk) moves to struct proc. Treat the coredumping state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread until our locking around coredumping is better. Oh, and remove the old SunOS-compat ps_usertramp member. "I like the sound of this" tedu@
* Move PPWAIT flag from struct proc to process, so that rthreads inguenther2011-04-031-4/+6
| | | | | | | | | a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created. ok blambert@
* Fix knote handling for exiting processes: when triggering a NOTE_EXITguenther2010-08-021-3/+3
| | | | | | | | | knote, remove it from the process's klist; after handling those, remove and drop any remaining knotes from the process's klist. Ban attaching knotes to processes that have started exiting or attaching them via the pid of a thread other than the main thread. ok tedu@, deraadt@
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-107/+120
| | | | | | | | | 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-5/+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@
* We always copy struct pcred when creating a new process, so the referenceguenther2010-06-291-9/+10
| | | | | count was always one. That's pointless, so remove the member and the code. ok tedu@
* Eliminate RTHREADS kernel option in favor of a sysctl. The actual statustedu2010-06-291-5/+4
| | | | | (not done) hasn't changed, but now it's less work to test things. ok art deraadt
* Bad tedu, no cookie.oga2010-05-261-6/+6
| | | | | | | | | | Don't set SDEAD on the process in exit1 untile we have grabbed the allproclk. allproclk is a rwlock and thus we may sleep to grab hold of it. This is a big of a bugger when we just set a flag that means we panic if we sleep. ok art@. turns Tom Murphy's fstat panic into a deadlock instead *sigh*, this is being looked into.
* move knote list to struct process. ok guenthertedu2010-05-181-2/+3
|
* Add a rwlock around the filehead and allproc lists, mainly to protecttedu2010-03-241-1/+5
| | | | | list walkers in sysctl that can block. As a reward, no more vslock. With some feedback from art, guenther, phessler. ok guenther.
* When using ptrace(), death of the traced process should always sendguenther2009-12-201-2/+2
| | | | | | | | | SIGCHLD to the tracer, even if the real parent requested an alternate exit signal. So, delay clearing the P_TRACED flag from exit1() to sys_wait4() so that we don't send the wrong signal from reaper(). Originally discussed with kurt months ago "looks good" deraadt@
* svr4_sys_waitsys() was seemingly implemented by copying sys_wait4()guenther2009-12-201-22/+26
| | | | | | | | | and hacking on it. Since then, some of the details of finishing a wait have changed (p_exitsig handling), so factor out the common bit into into proc_finish_wait() and have both sys_wait4() and svr4_sys_waitsys() call that to kill the divergence. "looks good" deraadt@
* Change threxit() to take a pointer to a pid_t to zero out from theguenther2009-11-271-3/+9
| | | | | | | | | | kernel so that librthread can detect when a thread is completely done with its stack without need a kqueue. The dying thread moves itself to a GC list, other threads scan the GC list on pthread_create() and pthread_join() and free the stack and handle once the thread's thread id is zeroed. "get it in" deraadt@, tedu@, cheers by others
* Don't drop the big lock at the end of exit1(), but move it into the middle ofderaadt2009-10-051-4/+1
| | | | | | | | | sched_exit(). This means that cpu_exit() and whatever it does (for instance calling free(), as well as the deadproc p_hash handling are now locked as well. This may have been one of the causes of the reaper panics, especially with rthread patches... which were terminating a lot of threads very quickly onto the deadproc p_hash list. ok kurt kettenis miod
* Remove extra psignal/wakeup in exit1() which can cause the parent tokurt2009-06-241-6/+3
| | | | | receive SIGCHLD twice if scheduled before the reaper runs. diff by guenther@ and myself. okay guenther@ deraadt@
* Fix SEM_UNDO handling for rthreads: use the struct process* insteadguenther2009-04-031-5/+3
| | | | | | | | of the struct proc* as the identifier for SEM_UNDO tracking and only call semexit() from the original thread, once the process as a whole is exiting ok tedu@
* Remove cpu_wait(). It's original use was to be called from the reaper sooga2009-03-261-9/+1
| | | | | | | | MD code would free resources that couldn't be freed until we were no longer running in that processor. However, it's is unused on all architectures since mikeb@'s tss changes on x86 earlier in the year. ok miod@
* Move the functionality of psignal() to a new function ptsignal()guenther2008-12-161-6/+8
| | | | | | | | | | | | | that takes an additional argument "type" that indicates whether the signal is for the process, just a particular thread, or propagated to a thread because it's not caught or blocked. psignal() becomes a wrapper that does the first of those. So that sys_kill() can tell apart signals for the process and signals for the process's original thread, the tid of the original thread is defined as its pid + THREAD_PID_OFFSET. ok tedu@ art@ andreas@ kurt@ "better early than late" deraadt@
* a little bit of paranoiaderaadt2008-12-111-1/+2
|
* remove a really stupid comment. Duh, of course it can blockderaadt2008-11-061-2/+1
|
* accidental commit ... backoutderaadt2008-10-311-7/+3
|
* kern_sysctl.cderaadt2008-10-311-3/+7
|