Commit Graph

34 Commits

Author SHA1 Message Date
thorpej ea8fb3e04a Turn the proclist lock into a read/write spinlock. Update proclist locking
calls to reflect this.  Also, block statclock rather than softclock during
in the proclist locking functions, to address a problem reported on
current-users by Sean Doran.
1999-07-25 06:30:33 +00:00
thorpej 01a8cffe77 Add a read/write lock to the proclists and PID hash table. Use the
write lock when doing PID allocation, and during the process exit path.
Use a read lock every where else, including within schedcpu() (interrupt
context).  Note that holding the write lock implies blocking schedcpu()
from running (blocks softclock).

PID allocation is now MP-safe.

Note this actually fixes a bug on single processor systems that was probably
extremely difficult to tickle; it was possible that schedcpu() would run
off a bad pointer if the right clock interrupt happened to come in the
middle of a LIST_INSERT_HEAD() or LIST_REMOVE() to/from allproc.
1999-07-22 21:08:30 +00:00
thorpej 2715b812d1 Rework the process exit path, in preparation for making process exit
and PID allocation MP-safe.  A new process state is added: SDEAD.  This
state indicates that a process is dead, but not yet a zombie (has not
yet been processed by the process reaper).

SDEAD processes exist on both the zombproc list (via p_list) and deadproc
(via p_hash; the proc has been removed from the pidhash earlier in the exit
path).  When the reaper deals with a process, it changes the state to
SZOMB, so that wait4 can process it.

Add a P_ZOMBIE() macro, which treats a proc in SZOMB or SDEAD as a zombie,
and update various parts of the kernel to reflect the new state.
1999-07-22 18:13:36 +00:00
thorpej 4edbfb00a8 - Add a new proclist, deadproc, which holds dead-but-not-yet-zombie
processes.
- Create a new data structure, the proclist_desc, which contains a
  pointer to a proclist, and eventually, a pointer to the lock for that
  proclist.  Declare a static array of proclist_descs, proclists[],
  consisting of allproc, deadproc, and zombproc.
1998-09-08 23:47:49 +00:00
thorpej 8a1009afd9 Use the pool allocator and the "nointr" pool page allocator for rusage
structures.
1998-09-01 01:02:33 +00:00
thorpej 3f8397855e Use the pool allocator and the "nointr" pool page allocator for pgrp
structures.
1998-09-01 00:08:44 +00:00
thorpej 4dc0e91e12 Use the pool allocator and "nointr" pool page allocator for pcred and
plimit structures.
1998-08-31 23:20:16 +00:00
thorpej 3d5e078fe9 Use the "nointr" pool page allocator. 1998-08-28 21:20:05 +00:00
thorpej f3d7e7e21c Add some braces to make egcs happy (ambiguous else warning). 1998-08-18 06:11:35 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
thorpej 0e28b643e9 Use a pool for proc structures. 1998-08-02 04:41:32 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
kleink 59fe905973 Fix variable declarations: register -> register int. 1998-02-14 19:34:12 +00:00
thorpej d2924ae854 Prevent the session ID from disappearing if the session leader exits
(thus causing s_leader to become NULL) by storing the session ID separately
in the session structure.  Export the session ID to userspace in the
eproc structure.

Submitted by Tom Proett <proett@nas.nasa.gov>.
1998-02-14 00:37:26 +00:00
chs f64abc7b4c add flags arg to hashinit(), to pass to malloc(). 1998-02-07 02:44:44 +00:00
gwr 5e15995438 Moved db_kill_proc() and db_show_all_procs() to ddb/db_xxx.c 1997-05-21 19:56:50 +00:00
kleink e7b98401d4 Pull in the declarations of db_expression() and db_error(), used by
db_kill_proc().
1997-05-08 17:22:05 +00:00
gwr 48c524e63a Add db_kill_proc() for DDB (and move db_show_all_procs here so
all the "proc" debugging stuff is here in one place).
1997-05-07 18:48:15 +00:00
christos f443b89c92 backout previous kprintf change 1996-10-13 02:32:29 +00:00
christos 60d201973e printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:46:11 +00:00
christos 09afd77655 More proto fixes 1996-02-09 18:59:18 +00:00
christos 8a5b1b92e2 First pass at prototyping 1996-02-04 02:15:01 +00:00
mycroft 7439778432 Use %p. 1995-03-19 23:44:44 +00:00
cgd d218233b36 various cleanups for -Wall. some inspired by James Jegers. 1994-12-24 15:07:22 +00:00
mycroft 2f710a54ee Convert process, file, and namei lists and hash tables to use queue.h. 1994-08-30 03:04:28 +00:00
cgd cf92afd66e New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:29:24 +00:00
mycroft 699bbb84b6 Update to 4.4-Lite fs code. 1994-06-08 11:28:29 +00:00
cgd 540aa31a08 update to lite 1994-05-19 05:57:44 +00:00
cgd 4bbabd8e7a Rename a lot of process flags. 1994-05-04 03:41:12 +00:00
mycroft 21edb9924e Canonicalize all #includes. 1993-12-18 03:59:02 +00:00
andrew 0e6cb953ea ANSIfications - removed all implicit function return types and argument
definitions.  Ensured that all files include "systm.h" to gain access to
general prototypes.  Casts where necessary.
1993-06-27 06:01:27 +00:00
cgd fe1802950b add include of select.h if necessary for protos, or delete if extraneous 1993-05-22 11:40:42 +00:00
cgd 8d6c77881c make kernel select interface be one-stop shopping & clean it all up. 1993-05-18 18:18:40 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00