summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_fork.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-10/+7
| | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled.
* Fixed some gratuitous ANSIisms.bde1997-08-261-5/+5
|
* Print a warning if an unsupported (under SMP) shared address space forkpeter1997-08-221-2/+5
| | | | is attempted rather than just failing with an errno.
* This is an upgrade so that the kernel supports the AIO calls fromdyson1997-07-061-1/+3
| | | | | | | | | | | POSIX.4. Additionally, there is some initial code that supports LIO. This code supports AIO/LIO for all types of file descriptors, with few if any restrictions. There will be a followup very soon that will support significantly more efficient operation for VCHR type files (raw.) This code is also dependent on some kernel features that don't work under SMP yet. After I commit the changes to the kernel to support proper address space sharing on SMP, this code will also work under SMP.
* Preliminary support for per-cpu data pages.peter1997-06-221-1/+14
| | | | | | | | | | | | | | | | This eliminates a lot of #ifdef SMP type code. Things like _curproc reside in a data page that is unique on each cpu, eliminating the expensive macros like: #define curproc (SMPcurproc[cpunumber()]) There are some unresolved bootstrap and address space sharing issues at present, but Steve is waiting on this for other work. There is still some strictly temporary code present that isn't exactly pretty. This is part of a larger change that has run into some bumps, this part is standalone so it should be safe. The temporary code goes away when the full idle cpu support is finished. Reviewed by: fsmp, dyson
* Modifications to existing files to support the initial AIO/LIO anddyson1997-06-161-1/+15
| | | | kernel based threading support.
* Don't need "opt_smp.h" on these filespeter1997-05-291-2/+1
|
* Create sysctl kern.fast_vfork, on for uniprocessor by default, off forpeter1997-04-261-6/+11
| | | | SMP.
* Disable RFMEM in vfork for smp case.. It doesn't seem to work too wellpeter1997-04-261-2/+7
| | | | yet..
* Restore memory space separation (RFMEM) for vfork() afterache1997-04-231-1/+1
| | | | shell imgact memory clobbering fixed
* Give up on the fast vfork() for a while.dyson1997-04-231-2/+2
|
* Re-institute the efficent version of vfork. It appears to make adyson1997-04-201-2/+2
| | | | | | | difference of approx 3mins in make world on my P6!!! This means that vfork now has full address space sharing, so beware with sloppy vfork programming. Also, you really do need to apply the previously committed popen fix in libc.
* Make a problem that I cannot reproduce go away for now. This commitdyson1997-04-141-2/+2
| | | | | | is to decrease the inconvienience of other developers until I can really fix the code. Reviewed by: Donald J. Maddox <dmaddox@scsn.net>
* Fully implement vfork. Vfork is now much much faster than even ourdyson1997-04-131-4/+44
| | | | | | | | | | | | | | | | | fork. (On my machine, fork is about 240usecs, vfork is 78usecs.) Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory from the other threads of a group. Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating possible existing shares with other threads/processes. Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a thread from the rest of the group. Fix the case where a thread does an exec. It is almost nonsense for a thread to modify the other threads address space by an exec, so we now automatically divorce the address space before modifying it.
* Remove explicit zero of p_vmspace on creation, it's now in the startzeropeter1997-04-071-6/+1
| | | | section of the proc struct.
* The biggie: Get rid of the UPAGES from the top of the per-process addresspeter1997-04-071-28/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | space. (!) Have each process use the kernel stack and pcb in the kvm space. Since the stacks are at a different address, we cannot copy the stack at fork() and allow the child to return up through the function call tree to return to user mode - create a new execution context and have the new process begin executing from cpu_switch() and go to user mode directly. In theory this should speed up fork a bit. Context switch the tss_esp0 pointer in the common tss. This is a lot simpler since than swithching the gdt[GPROC0_SEL].sd.sd_base pointer to each process's tss since the esp0 pointer is a 32 bit pointer, and the sd_base setting is split into three different bit sections at non-aligned boundaries and requires a lot of twiddling to reset. The 8K of memory at the top of the process space is now empty, and unmapped (and unmappable, it's higher than VM_MAXUSER_ADDRESS). Simplity the pmap code to manage process contexts, we no longer have to double map the UPAGES, this simplifies and should measuably speed up fork(). The following parts came from John Dyson: Set PG_G on the UPAGES that are now in kernel context, and invalidate them when swapping them out. Move the upages object (upobj) from the vmspace to the proc structure. Now that the UPAGES (pcb and kernel stack) are out of user space, make rfork(..RFMEM..) do what was intended by sharing the vmspace entirely via reference counting rather than simply inheriting the mappings.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Pass P_SUGID on to the child of a fork(). It was possible to get rlogindg1997-02-171-0/+4
| | | | | | | to coredump previously since it (somewhat uniquely) is setuid and forks without execing, and thus without passing P_SUGID the child could coredump and possibly divulge sensitive information (such as encrypted passwords from the passwd database).
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-1/+1
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
* Fixed interrupt unmasking for child processes which I broke inbde1997-01-151-0/+1
| | | | | | | | | | | | rev.1.10 two years ago. Children continued to run at splhigh() after returning from vm_fork(). This mainly affected kernel processes and init. For ordinary processes, interrupts are normally unmasked a few instructions later after fork() returns (it may be important for syscall() not to reschedule the child processes). Kernel processes had workarounds for the problem. Init manages to start because some routines "know" that it is safe to go to sleep despite their caller starting them at a high ipl. Then its ipl gets fixed on its first normal return from a syscall.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Move static variable nextpid out from fork1(). Now top(1) can printwosch1996-10-271-2/+3
| | | | last pid value.
* Eliminated nested include of <sys/unistd.h> in <sys/file.h> in the kernel.bde1996-09-031-2/+2
| | | | | | | Include it directly in the few places where it is used. Reduced some #includes of <sys/file.h> to #includes of <sys/fcntl.h> or nothing.
* Some cleanups to the callout lists recently added.julian1996-08-221-30/+37
| | | | | | | | note that at_shutdown has a new parameter to indicate When during a shutdown the callout should be made. also add a RB_POWEROFF flag to reboot "howto" parameter.. tells the reboot code in our at_shutdown module to turn off the UPS and kill the power. bound to be useful eventually on laptops
* add callout lists for exit() and fork()julian1996-08-191-1/+72
| | | | | | | | | | | | | | | I've been meaning to do this for AGES as I keep having to patch those routines whenever I write a proprietary package or similar.. any module that assigns resources to processes needs to know when these events occur. there are existsing modules that should be modified to take advantage of these.. e.g. SYSV IPC primatives presently have #ifdef entries in exit() this also helps with making LKMs out of such things.. (see the man pages at_exit(9) and at_fork(9))
* Converted timer/run queues to 4.4BSD queue style. Removed old and unuseddg1996-07-311-2/+1
| | | | | | | sleep(). Implemented wakeup_one() which may be used in the future to combat the "thundering herd" problem for some special cases. Reviewed by: dyson
* Clean up -Wunused warnings.gpalmer1996-06-121-2/+1
| | | | Reviewed by: bde
* Fix a nasty bug that causes random crashes and lockups particularly onpeter1996-05-021-1/+6
| | | | | | | | | | | | | | | | | | | | | | very busy servers (eg: news, web). This is an interaction between embryonic processes that have not yet finished forking, and happen to cause the kernel VM space to grow, hitting the uninitialised variable. It was possible for this to strike at any time, depending on the size of your kernel and load patterns. One machine had paniced occasionally when cron launches a job since before the 2.1 release. If you had "options DIAGNOSTIC", you may have seen references to bogus addresses like 0xdeadc142 and the like. This is a minimal change to fix the problem, it will probably be done better by reordering p_vmspace to be in the startzero section, but it becomes harder to validate then. It's been vulnerable since pmap.c rev 1.40 (Jan 9, 1995), so it's been a cause of problems since well before 2.0.5. This was when the merged VM/buffer cache and the dynamic growing kernel VM space were first committed. This probably fixes a few of PR's.
* Implement the RFNOWAIT flag for rfork(). If set this flag will cause thesmpatel1996-04-171-38/+34
| | | | | | | | | | | | | | forked child to be dissociated from the parent). Cleanup fork1(), implement vfork() and fork() in terms of rfork() flags. Remove RFENVG, RFNOTEG, RFCNAMEG, RFCENVG which are Plan9 specific and cannot possibly be implemented in FreeBSD. Renumbered the flags to make up for the removal of the above flags. Reviewed by: peter, smpatel Submitted by: Mike Grupenhoff <kashmir@umiacs.umd.edu>
* From Lite2: proc LIST changes.hsu1996-03-111-39/+12
| | | | Reviewed by: david & bde
* Keep fork from over extending the number of processes. Since u_map isdyson1996-03-031-2/+11
| | | | | sized exactly for maxproc, the occasional overrunning the maxproc limit can cause problems.
* kern_descrip.c: add fdshare()/fdcopy()peter1996-02-231-12/+61
| | | | | | | | | | | | | | | | | | | | kern_fork.c: add the tiny bit of code for rfork operation. kern/sysv_*: shmfork() takes one less arg, it was never used. sys/shm.h: drop "isvfork" arg from shmfork() prototype sys/param.h: declare rfork args.. (this is where OpenBSD put it..) sys/filedesc.h: protos for fdshare/fdcopy. vm/vm_mmap.c: add minherit code, add rounding to mmap() type args where it makes sense. vm/*: drop unused isvfork arg. Note: this rfork() implementation copies the address space mappings, it does not connect the mappings together. ie: once the two processes have split, the pages may be shared, but the address space is not. If one does a mmap() etc, it does not appear in the other. This makes it not useful for pthreads, but it is useful in it's own right for having light-weight threads in a static shared address space. Obtained from: Original by Ron Minnich, extended by OpenBSD
* Converted two options over to the new scheme: USER_LDT and KTRACE.wollman1996-01-031-1/+3
|
* Untangled the vm.h include file spaghetti.dg1995-12-071-1/+3
|
* Included <sys/sysproto.h> to get central declarations for syscall argsbde1995-11-121-1/+4
| | | | | | | | | | structs and prototypes for syscalls. Ifdefed duplicated decentralized declarations of args structs. It's convenient to have this visible but they are hard to maintain. Some are already different from the central declarations. 4.4lite2 puts them in comments in the function headers but I wanted to avoid the large changes for that.
* Remove prototype definitions from <sys/systm.h>.swallace1995-10-081-1/+5
| | | | | | | | | | | | | | Prototypes are located in <sys/sysproto.h>. Add appropriate #include <sys/sysproto.h> to files that needed protos from systm.h. Add structure definitions to appropriate files that relied on sys/systm.h, right before system call definition, as in the rest of the kernel source. In kern_prot.c, instead of using the dummy structure "args", create individual dummy structures named <syscall>_args. This makes life easier for prototype generation.
* Remove trailing whitespace.rgrimes1995-05-301-2/+2
|
* Add and move declarations to fix all of the warnings from `gcc -Wimplicit'bde1995-03-161-4/+1
| | | | | | (except in netccitt, netiso and netns) and most of the warnings from `gcc -Wnested-externs'. Fix all the bugs found. There were no serious ones.
* Don't count the parent's previous timeslice in the child's resource usagebde1995-01-211-4/+3
| | | | | | (it was counted twice). Set the start time more accurately.
* Cosmetics. related to getting prototypes into view.phk1994-10-101-1/+3
|
* Got rid of map.h. It's a leftover from the rmap code, and we use rlists.dg1994-10-091-2/+1
| | | | Changed swapmap into swaplist.
* "idle priority" support. Based on code from Henrik Vestergaard Draboel,dg1994-10-021-6/+1
| | | | but substantially rewritten by me.
* Realtime priority scheduling support.dg1994-09-011-1/+6
| | | | Submitted by: Henrik Vestergaard Draboel
* Fix up some sloppy coding practices:wollman1994-08-181-2/+4
| | | | | | | | | | | | - Delete redundant declarations. - Add -Wredundant-declarations to Makefile.i386 so they don't come back. - Delete sloppy COMMON-style declarations of uninitialized data in header files. - Add a few prototypes. - Clean up warnings resulting from the above. NB: ioconf.c will still generate a redundant-declaration warning, which is unavoidable unless somebody volunteers to make `config' smarter.
* Process scheduling changes - adapted from FreeBSD 1.1.5. Basically,dg1994-08-061-1/+7
| | | | | | | | charge scheduling CPU of child process to the parent and have child inherit scheduling CPU from parent on fork. Makes a **big** difference in the feel of the system to interactive users. Submitted by: John Dyson
* Added $Id$dg1994-08-021-0/+1
|
* The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.rgrimes1994-05-251-0/+3
| | | | | Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
* BSD 4.4 Lite Kernel Sourcesrgrimes1994-05-241-0/+315
OpenPOWER on IntegriCloud