Commit Graph

1017 Commits

Author SHA1 Message Date
David Greenman
86064318c4 Use kmem_alloc_wait/kmem_free_wakeup() to avoid allocation failures
from running out of string space in the exec_map.
1996-06-03 04:12:18 +00:00
David Greenman
6120fef1bc Fix declaration of ps_strings. 1996-06-03 04:09:36 +00:00
John Dyson
4ebce1e9a6 Remove the now-unnecessary and incorrect wiring of the "other" processes
page table pages.  The pmap layer now handles that fully.
1996-06-02 06:24:27 +00:00
John Dyson
268e9c5397 Keep brelse from freeing busy pages. 1996-05-31 00:41:37 +00:00
Peter Wemm
114a8cff43 Add an option "EXTRA_VNODES" to cause an extra number of vnode structures
to be allocated at boot time.  This is an expensive option, as they
consume physical ram and are not pageable etc.  In certain situations,
this kind of option is quite useful, especially for news servers that
access a large number of directories at random and torture the name cache.
Defining 5000 or 10000 extra vnodes should cut down the amount of vnode
recycling somewhat, which should allow better name and directory caching
etc.

This is a "your mileage may vary" option, with no real indication of
what works best for your machine except trial and error.  Too many will
cost you ram that you could otherwise use for disk buffers etc.

This is based on something John Dyson mentioned to me a while ago.
1996-05-31 00:20:34 +00:00
David Greenman
cd73303c45 Fix a panic caused by (proc)->p_session being dereferenced for a process
that was exiting.
1996-05-30 01:21:50 +00:00
Peter Wemm
472fe5e4db Dont allow directories to be link()ed or unlink()ed, even for root
(returns EPERM always, the errno is specified by POSIX).

If you really have a desperate need to link or unlink a directory, you
can use fsdb. :-)

This should stop any chance of ftpd, rdist, "rm -rf", etc from
bugging out and damaging the filesystem structure or loosing races
with malicious users.

Reviewed by: davidg, bde
1996-05-24 16:19:23 +00:00
John Dyson
301051a01e Make sure that we don't place a busy or held page onto the PQ_CACHE queue. 1996-05-24 05:21:58 +00:00
John Dyson
c51bd6784e Change the *evil* allocation of memory from kmem_map to the kernel_map.
This will mess things up especially recently.
1996-05-24 01:39:50 +00:00
John Dyson
14bf02f8f4 Minor performance improvement to kern_malloc.c that increases the
probability of reuse of recently freed memory.  This improves cache
hit stats on cached memory, and improves at least fork speed consistancy.
1996-05-18 22:33:13 +00:00
John Dyson
b18bfc3da7 This set of commits to the VM system does the following, and contain
contributions or ideas from Stephen McKay <syssgm@devetir.qld.gov.au>,
Alan Cox <alc@cs.rice.edu>, David Greenman <davidg@freebsd.org> and me:

	More usage of the TAILQ macros.  Additional minor fix to queue.h.
	Performance enhancements to the pageout daemon.
		Addition of a wait in the case that the pageout daemon
		has to run immediately.
		Slightly modify the pageout algorithm.
	Significant revamp of the pmap/fork code:
		1) PTE's and UPAGES's are NO LONGER in the process's map.
		2) PTE's and UPAGES's reside in their own objects.
		3) TOTAL elimination of recursive page table pagefaults.
		4) The page directory now resides in the PTE object.
		5) Implemented pmap_copy, thereby speeding up fork time.
		6) Changed the pv entries so that the head is a pointer
		   and not an entire entry.
		7) Significant cleanup of pmap_protect, and pmap_remove.
		8) Removed significant amounts of machine dependent
		   fork code from vm_glue.  Pushed much of that code into
		   the machine dependent pmap module.
		9) Support more completely the reuse of already zeroed
		   pages (Page table pages and page directories) as being
		   already zeroed.
	Performance and code cleanups in vm_map:
		1) Improved and simplified allocation of map entries.
		2) Improved vm_map_copy code.
		3) Corrected some minor problems in the simplify code.
	Implemented splvm (combo of splbio and splimp.)  The VM code now
		seldom uses splhigh.
	Improved the speed of and simplified kmem_malloc.
	Minor mod to vm_fault to avoid using pre-zeroed pages in the case
		of objects with backing objects along with the already
		existant condition of having a vnode.  (If there is a backing
		object, there will likely be a COW...  With a COW, it isn't
		necessary to start with a pre-zeroed page.)
	Minor reorg of source to perhaps improve locality of ref.
1996-05-18 03:38:05 +00:00
Poul-Henning Kamp
7642f4742d Ups, I removed NMB_INIT too.
Complained about by:	asami
1996-05-12 07:48:47 +00:00
Poul-Henning Kamp
0482730e40 Nail down NCL_INIT = 1, and put a comment there telling what it is. 1996-05-11 20:43:23 +00:00
Bruce Evans
d03b40173c Hide options for emulators and static file systems in opt_dontuse.h.
These options only apply at config time.  Using them at compile time
would break the corresponding lkms.
1996-05-11 04:39:53 +00:00
Garrett Wollman
cb7545a995 Allocate mbufs from a separate submap so that NMBCLUSTERS works as
expected.
1996-05-10 19:28:55 +00:00
Garrett Wollman
82dab6ce62 Make it possible to return more than one piece of control information
(PR #1178).
Define a new SO_TIMESTAMP socket option for datagram sockets to return
packet-arrival timestamps  as control information (PR #1179).

Submitted by:	Louis Mamakos <loiue@TransSys.com>
1996-05-09 20:15:26 +00:00
Gary Palmer
4e31a37b94 Correct a comment. There is no fn `kprintf' 1996-05-09 18:58:06 +00:00
Garrett Wollman
6a06dea05f Our new-old mbugf allocator. This is actually something of a blast from
the past, since it returns to the old system of allocating mbufs out of
a private area rather than using the kernel malloc().  While this may seem
like a backwards step to some, the new allocator is some 20% faster than
the old one and has much better caching properties.

Written by: John Wroclawski <jtw@lcs.mit.edu>
1996-05-08 19:38:27 +00:00
Gary Palmer
6ddbf1e299 Clean up various compiler warnings. Most (if not all) were benign
Reviewed by:	bde
1996-05-08 04:29:08 +00:00
Poul-Henning Kamp
b74a76ee15 An old typo MCLBYTES/CLBYTES became more obvious bogus now.
Submitted by:		wollman
1996-05-06 17:18:12 +00:00
Joerg Wunsch
9e609dde83 uninitialized auto variable shmseg is used in ...
Closes PR #kern/1174

Submitted by:	enami@ba2.so-net.or.jp
1996-05-05 13:53:48 +00:00
Poul-Henning Kamp
aa8de40ae5 Another sweep over the pmap/vm macros, this time with more focus on
the usage.  I'm not satisfied with the naming, but now at least there is
less bogus stuff around.
1996-05-03 21:01:54 +00:00
Poul-Henning Kamp
ab76ac21e7 disksort() is gone, all drivers now use tqdisksort(). 1996-05-03 15:05:17 +00:00
Poul-Henning Kamp
e911eafcba removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
        ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
        NPDEPG

Major macro cleanup.
1996-05-02 14:21:14 +00:00
Peter Wemm
88d1b64235 Fix a nasty bug that causes random crashes and lockups particularly on
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.
1996-05-02 11:38:05 +00:00
Poul-Henning Kamp
f8845af0db First pass at cleaning up macros relating to pages, clusters and all that. 1996-05-02 10:43:17 +00:00
Poul-Henning Kamp
a8c5fef5e6 KGDB is dead. It may come back one day if somebody does it. 1996-05-02 09:34:51 +00:00
Bruce Evans
3722e90e21 Removed unused #include. 1996-05-01 03:32:46 +00:00
Bruce Evans
a794e791c8 Removed unnecessary #includes from <sys/imgact.h> so that it is
self-sufficient and added explicit #includes where required.
1996-05-01 02:43:13 +00:00
Sujal Patel
24b34f097b Fixed two typos in the comment.
Pointed out by:	davidg
1996-04-29 15:07:59 +00:00
Bruce Evans
10d245c58a Yet more b_flags fixes. The previous ones broke the clearing of B_DONE
and B_READ before writing.  This was was fatal.  They also broke the
clearing of B_INVAL before doing i/o.  This didn't actually matter.

Submitted by:	mostly by joerg
1996-04-19 19:34:19 +00:00
Bruce Evans
3f64564278 Fixed removal of devfs entries for the real slice corresponding to the
compatibility slice.  They were forgotten on last-close and then
creating them on first-open failed.

Devfs entries for slices other than the one containing the root file
system are still invisible unless you open a non-devfs inode on the
slice.
1996-04-19 19:22:29 +00:00
Sujal Patel
0e3eb7ee6c Implement the RFNOWAIT flag for rfork(). If set this flag will cause the
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>
1996-04-17 17:05:08 +00:00
David Greenman
46f578e76a Fix for PR #1146: the "next" pointer must be cached before calling soabort
since the struct containing it may be freed.
1996-04-16 03:50:08 +00:00
Poul-Henning Kamp
61220614a8 Fix a longstanding bug and a buglet of no significance.
Now net.ipx works.

Noticed by:	John Hay -- John.Hay@csir.co.za
1996-04-13 13:28:54 +00:00
Bruce Evans
78d7e629bf Spell cpu_switch() with an i in a comment. 1996-04-11 20:56:29 +00:00
Bruce Evans
79299e416a Fixed the PF_REMOTE case of ptcwrite(). I broke it in rev.1.22. Output
was duplicated until the canq filled up, and write() normally returned 0.
This case is apparently rare.  It was reported for Jove's shell buffer in
PR 1130.
1996-04-11 18:43:37 +00:00
David Greenman
39f70d4545 Killed sections 3 and 4 of my copyright as I don't agree with it (I believe
it to be unnecessarily restrictive). For tty_subr.c, update to my standard
copyright.
1996-04-08 01:22:00 +00:00
Bruce Evans
bc4750691c Use rdtsc() function instead of inline essembler. 1996-04-07 18:16:26 +00:00
Bruce Evans
6ffde942bf Removed never-used #includes of <machine/cpu.h>. Many were apparently
copied from bad examples.
1996-04-07 17:39:28 +00:00
Bruce Evans
3157adc8af Removed now-unused #includes of <machine/cpu.h>. They were for bootverbose
being declared in the wrong place.
1996-04-07 17:32:42 +00:00
Bruce Evans
92ff4bb0e7 Declared pgrpdump() properly. 1996-04-07 16:16:05 +00:00
Bruce Evans
120c5995aa Cleaned up naming and formatting in recent changes. 1996-04-07 14:32:14 +00:00
Bruce Evans
242c09c05e Don't generate code for the unused function sleep(). 1996-04-07 13:35:58 +00:00
Poul-Henning Kamp
45ec3b3838 Move the "mib" variables out to their own file. 1996-04-07 13:03:06 +00:00
Marc G. Fournier
4297524c49 Fixed a bug in DEVFS code that was producing "name slot allocation failed"
messages.
1996-04-05 19:12:01 +00:00
Marc G. Fournier
ecd87fe6c3 changed from using dev_link() to devfs_link() 1996-04-02 04:52:03 +00:00
Marc G. Fournier
ab314ae513 Convert from using dev_link() to dev_linkf() 1996-04-01 21:03:07 +00:00
Jordan K. Hubbard
5931895ece Remove bogus architectures to allow make tags to work.
Submitted-by: Andreas Klemm <andreas@knobel.gun.de>
1996-03-31 18:53:43 +00:00
Peter Wemm
289ccde0bd Correct the handling of NOCLDSTOP when using sigvec()
Make the SA_NODEFER handling more correct, previously if you called
sigaction to set a handler and had SA_NODEFER set, and manually masked
the signal itself in sa_mask, and when you read the settings back later,
you'd find SA_NODEFER incorrectly cleared.

Pointed out by: bde
1996-03-30 15:15:30 +00:00
Peter Wemm
2eb80d36fe Because of the way that ptrace() now calls procfs routines to read/write
the process's memory, it was possible for the procfs_domem() call to
return a residual leftover, but with no errno.  Since this is no good for
ptrace which ignored the the residual, remap a leftover amount into an
errno rather than fooling the caller into thinking it was successful when
in fact it was not.

Submitted by: bde (a very long time ago :-)
1996-03-30 15:02:58 +00:00
Bruce Evans
cf78fc4129 Undid the last 2 commits. Rev.1.43 reversed the changes in rev.1.42 and
rev.1.44 was a subset of them.
1996-03-28 15:03:41 +00:00
Marc G. Fournier
734daefc97 Switched from using devfs_add_devsw() to devfs_add_devswf()
Reviewed by:	julian@freebsd.org
1996-03-28 14:31:42 +00:00
Marc G. Fournier
6e18ce4676 Switched from using devfs_add_sw() to using devfs_add_swf()
Reviewed by:	julian@freebsd.org
1996-03-28 14:29:52 +00:00
John Dyson
4e489ec421 Remove a now unnecessary prototype from pmap.c. Also remove now
unnecessary vm_fault's of page table pages in trap.c.
1996-03-28 05:40:58 +00:00
Bruce Evans
27d02c9849 Fixed name of /dev/fs/klog (it's not "log").
Submitted by:	"Marc G. Fournier" <scrappy@ki.net> and edited by me
1996-03-27 19:45:28 +00:00
Bruce Evans
adcbf406c5 Fixed permissions of /devfs/lkm. 1996-03-27 19:42:14 +00:00
Bruce Evans
8fb3332429 Fixed the unit numbers of the devfs `fd' devices.
Made the devfs `fd' devices bug for bug compatible with the ones created
by MAKEDEV:
- ownership is bin.bin, not root.wheel, except for std*.  The devfsext
  interface doesn't seem to allow specifying the ownership of /devfs/fd,
  so it's still incompatible.
- std* aren't links to fd/[0-2].
1996-03-27 19:19:58 +00:00
Bruce Evans
3dffe3c5f6 Fixed permissions of /devfs/*random.
Fixed group and permissions of /devfs/perfmon.
1996-03-27 19:04:55 +00:00
Bruce Evans
1170175e62 Fixed mode of /devfs/console. 1996-03-27 18:55:19 +00:00
Bruce Evans
6ae323519c Fixed group of disk devices (was wheel or games, now operator).
Added scsi control devices.

Converted almost everything that I changed to use devfs_add_devswf()
and verbose id macros.

st.c:
Renamed enrst* to erst* since that's what the current name is (enrst
seems to be an old name).
1996-03-27 18:50:10 +00:00
Bruce Evans
ba00d77a82 Print stack pointer and frame pointer in trap messages.
Fixed "trace/trap" message.

Reviewed by:	davidg
1996-03-27 17:33:39 +00:00
Jordan K. Hubbard
2438fbba14 Bill Fenner <fenner@parc.xerox.com> comes up with a better fix to the
debugger_on_panic stuff.
1996-03-25 17:06:34 +00:00
John Dyson
d73ce5bd92 Various pipe error return fixes, and a significant typeo fix. From
Bruce Evans (of course :-)).
Submitted by:	bde
1996-03-25 01:48:28 +00:00
Jordan K. Hubbard
60743d0a33 Ok, now this is correct (even simple fixes sometimes ain't so simple :) 1996-03-23 21:41:00 +00:00
Jordan K. Hubbard
3ab332ee3f Fix bogus last commit - debugger_on_panic was referenced even when
not defined.  Another change clearly committed without testing! :-(
1996-03-23 21:23:43 +00:00
Poul-Henning Kamp
924dfd9801 Remove all traces of KADB
add sysctl
	debug.debugger_on_panic: 1
if DDB or KGDB is defined.

Requested by: davidg
1996-03-23 11:31:16 +00:00
Bruce Evans
ede8dc43a2 Fixed unsigned longs that should have been vm_offset_t.
vm_offset_t is currently unsigned long but should probably be plain
unsigned for i386's to match the choice of minimal types to represent
for fixed-width types in Lite2.  Anyway, it shouldn't be assumed
to be unsigned long.

I only fixed the type mismatches that were detected when I changed
vm_offset_t to unsigned.  Only pointer type mismatches were detected.
1996-03-19 15:03:00 +00:00
John Dyson
7fe9c39bea Yet another fix from BDE for the new pipe code. This fixes a potential
deadlock due to mismanagement of busy counters.

Reviewed by: dyson
Submitted by: bde
1996-03-17 04:52:10 +00:00
Peter Wemm
dedc04fe95 Actually implement SA_RESETHAND - some of the sigaction code recognised it
but didn't actually do anything with it (*blush*).

This should fix bde's test case where the test program set SA_RESETHAND
and when reading it back, it was gone.

Tweak/optimize SA_NODEFER so that the implementation is a little simpler
and does not incur (slight) overhead for every signal at delivery time.
1996-03-15 08:01:33 +00:00
Peter Wemm
71d7d1b17a Remove references to MAP_FILE.. That is now "default" and is only
a "#define MAP_FILE 0" that is still there for net-2 source compatability.
1996-03-12 06:20:19 +00:00
Peter Wemm
8644d6f312 Move these out of the way (to the Attic) as we do not use this version
of makesyscalls.sh (yet?).
1996-03-11 20:10:34 +00:00
Peter Wemm
1cc817594b This commit was generated by cvs2svn to compensate for changes in r14567,
which included commits to RCS files with non-trunk default branches.
1996-03-11 20:02:06 +00:00
Peter Wemm
edbfedac86 Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all
files are off the vendor branch, so this should not change anything.

A "U" marker generally means that the file was not changed in between
the 4.4Lite and Lite-2 releases, and does not need a merge.  "C" generally
means that there was a change.
[note new unused (in this form) syscalls.conf, to be 'cvs rm'ed]
1996-03-11 20:02:06 +00:00
David Greenman
be24e9e8fa Changed socket code to use 4.4BSD queue macros. This includes removing
the obsolete soqinsque and soqremque functions as well as collapsing
so_q0len and so_qlen into a single queue length of unaccepted connections.
Now the queue of unaccepted & complete connections is checked directly
for queued sockets. The new code should be functionally equivilent to
the old while being substantially faster - especially in cases where
large numbers of connections are often queued for accept (e.g. http).
1996-03-11 15:37:44 +00:00
David Greenman
2ee45d7d28 Move or add #include <queue.h> in preparation for upcoming struct socket
changes.
1996-03-11 15:13:58 +00:00
Jeffrey Hsu
a3bfb996f6 From Lite2: proc LIST changes
call kern_proc.c:procinit() to initialize LISTs
	call to usrinfoinit() subsumed by procinit()
Reviewed by:	davidg & bde
1996-03-11 06:14:38 +00:00
Jeffrey Hsu
b75356e1ac From Lite2: proc LIST changes.
Reviewed by:	david & bde
1996-03-11 06:05:03 +00:00
Jeffrey Hsu
ec3f61ff36 From Lite2: proc LIST changes
stylistic changes to function prototypes
Reviewed by:	david & bde
1996-03-11 06:04:20 +00:00
Jeffrey Hsu
70b012cab2 Merge in Lite2: proc LIST changes.
Reviewed by:	david & bde
1996-03-11 05:52:50 +00:00
Jeffrey Hsu
96e00d408e Merge in Lite2: proc LIST changes
64-bit fix for alpha
		add debugging code for locking
Reviewed by:	david & bde
1996-03-11 05:48:57 +00:00
Jeffrey Hsu
45fe51e9d3 Merge in Lite2: buf fix with comparison of wrong field against EXTPROC.
Did not accept change of second argument to ioctl from int to u_long.
Reviewed by:	davidg & bde
1996-03-11 02:24:39 +00:00
Jeffrey Hsu
7c409b8a56 From NetBSD: add #include <sys/acct.h> for acct_process() prototype.
Reviewed by:	davidg & bde
1996-03-11 02:24:21 +00:00
Jeffrey Hsu
8674077a20 From Lite2: change code parameter to u_long and initialize ps_sig.
Reviewed by:	davidg & bde
1996-03-11 02:22:02 +00:00
Jeffrey Hsu
04d41bbeb7 From Lite2: rename fs to vfs.
Reviewed by:	davidg & bde
1996-03-11 02:18:23 +00:00
Jeffrey Hsu
4b50ceef3b Merge in Lite2: LIST replacement for f_filef, f_fileb, and filehead.
Did not accept change of second argument to ioctl from int to u_long.
Reviewed by:	davidg & bde
1996-03-11 02:17:30 +00:00
Jeffrey Hsu
bc6f0e79aa Merge in Lite2: LIST replacement for f_filef, f_fileb, and filehead.
Reviewed by:	davidg & bde
1996-03-11 02:17:11 +00:00
Peter Wemm
250c11f9c3 Tweak the data/bss segment page count. The last version worked
with all the test cases I tried, I'm sure this is more correct.

Tweak some prototypes.
1996-03-10 23:44:40 +00:00
Peter Wemm
8191d577aa Fix some rounding problems.. In some (fairly rare) situtaions it mapped
one page too many, which caused obreak() to fail in vm_map_find() with
ENOMEM because of the conflicting page.
1996-03-10 22:37:34 +00:00
Søren Schmidt
e1743d02cd First attempt at FreeBSD & Linux ELF support.
Compile and link a new kernel, that will give native ELF support, and
provide the hooks for other ELF interpreters as well.

To make native ELF binaries use John Polstras elf-kit-1.0.1..
For the time being also use his ld-elf.so.1 and put it in
/usr/libexec.

The Linux emulator has been enhanced to also run ELF binaries, it
is however in its very first incarnation.
Just get some Linux ELF libs (Slackware-3.0) and put them in the
prober place (/compat/linux/...).
I've ben able to run all the Slackware-3.0 binaries I've tried
so far.
(No it won't run quake yet :)
1996-03-10 08:42:54 +00:00
John Dyson
18ff64943e Correct handling of dirty pages in I/O buffers. The case where pages
residing in a buffer that had been dirtied by a process was being
handled incorrectly.  The pages were mistakenly placed into the
cache queue.  This would likely have the effect of mmaped page modifications
being lost when I/O system calls were being used simultaneously to
the same locations in a file.
Submitted by: davidg
1996-03-09 06:46:51 +00:00
John Dyson
e5fadd05f2 Put the "free vnode isn't" check back in the right place. 1996-03-09 06:43:19 +00:00
John Dyson
0f20dc9443 Remove a now unnecessary function prototype. 1996-03-09 06:42:15 +00:00
John Dyson
836e5d1360 In order to fix some concurrency problems with the swap pager early
on in the FreeBSD development, I had made a global lock around the
rlist code.  This was bogus, and now the lock is maintained on a
per resource list basis.  This now allows the rlist code to be used for
almost any non-interrupt level application.
1996-03-03 21:11:08 +00:00
Peter Wemm
185dc76169 Deal with NetBSD byte-swapped a.out magic when checking the MID to exclude
linux binaries from the *BSD a.out loader. This is a hack, but lets me run
static NetBSD binaries.  Dynamic binaries are a much bigger problem because
the shared libraries would conflict with our native libraries, so a
/compat/netbsd alternate namespace and translation would be needed.
1996-03-03 20:06:53 +00:00
John Dyson
ef5dc8a96d Keep fork from over extending the number of processes. Since u_map is
sized exactly for maxproc, the occasional overrunning the maxproc limit
can cause problems.
1996-03-03 19:48:45 +00:00
John Dyson
c735bcf57d Fix the buffer queue problem differently. The previous fix could panic
with a buffer not on queue panic.
1996-03-03 01:04:28 +00:00
John Dyson
e188690a50 Fix a problem with the rlist code that it can have virtual pages that
don't really exist yet.  This can break pstat -s.  Jeesh, the rlist
code needs to be cleaned up...
1996-03-02 22:57:45 +00:00
Peter Wemm
d66a506616 Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff.  The scrollbars are now
working, at least on my machine. (whew! :-)

I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.

The main changes:

COMPAT_LINUX is *GONE*.  Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself.  The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code.  All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first.  Like IBCS2, you can statically compile it in with "options LINUX".

A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality().  The Linux-ELF libraries want
to use some of these.

linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.

Quite a few bugs removed, including incorrect arguments being used in
syscalls..  eg:  mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.

The build for the code has changed.  i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.

Supporting changes elsewhere in the kernel:

The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS).  This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.

The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only.  This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.

makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code.  It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)

At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area.  This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
Peter Wemm
4bd4912865 Add more options into the conf/options and i386/conf/options.i386 files
and the #include hooks so that 'make depend' is more useful.  This
covers most of the options I regularly use (but not all) and some other
easy ones.
1996-03-02 18:24:13 +00:00
Peter Wemm
bad4352830 reran makesyscalls.sh after "int len" -> "size_t len" changes. 1996-03-02 17:01:36 +00:00
Peter Wemm
3f7efdf30d Change the 'int len' args in the mmap/msync/mincore/etc class syscalls
to 'size_t' as per bde's request.
1996-03-02 16:51:25 +00:00
John Dyson
6538dda3dc 1) Fix a bug that a buffer is removed from a queue, but the
queue type is not set to QUEUE_NONE.  This appears to have
	caused a hang bug that has been lurking.
2)	Fix bugs that brelse'ing locked buffers do not "free" them, but the
	code assumes so.  This can cause hangs when LFS is used.
3)	Use malloced memory for directories when applicable.  The amount
	of malloced memory is seriously limited, but should decrease the
	amount of memory used by an average directory to 1/4 - 1/2 previous.
	This capability is fully tunable.  (Note that there is no config
	parameter, and might never be.)
4)	Bias slightly the buffer cache usage towards non-VMIO buffers.  Since
	the data in VMIO buffers is not lost when the buffer is reclaimed, this
	will help performance.  This is adjustable also.
1996-03-02 04:40:56 +00:00
John Dyson
91477adc6e Enable VMIO for non-VDIR metadata and block device. 1996-03-02 03:45:12 +00:00
John Dyson
33309c7fc0 More b_flags fixes. 1996-03-02 01:49:51 +00:00
John Dyson
f5d1e6dae6 Fix a bug that b_flags was getting unnecessarily modified by
the slice code.  The effect up to now has been insignficant, but
improved buffer allocation code will break with this problem.
1996-03-01 19:01:04 +00:00
Gary Palmer
5ccab2afa9 Add a new option: DDB_UNATTENDED. Stops machine dropping into DDB
when it panics, but leaving activation of DDB from the console
unaffected.
1996-02-28 21:42:15 +00:00
John Dyson
3eb77c8302 Fix a problem with tracking the modified bit. Eliminate the
ugly inline-asm code, and speed up the page-table-page tracking.
1996-02-25 03:02:53 +00:00
Peter Wemm
99ac3bc8da Add two sysctl variables that can be read by libutil and libkvm so that
they can adapt to simple kernel VM layout changes.
1996-02-24 14:32:53 +00:00
Poul-Henning Kamp
09bb5f7589 Make getsockopt() capable of handling more than one mbuf worth of data.
Use this to read rules out of ipfw.
Add the lkm code to ipfw.c
1996-02-24 13:38:28 +00:00
Peter Wemm
dedb7b623c Garrett pointed out that the correct place for unix system call args
is <sys/unistd.h>, with the prototype in <unistd.h>.  sys/unistd.h
is visible to the kernel compile, and is #included by unistd.h.

Also, I missed a reference to a static int in the midst of my other diffs.
1996-02-23 19:44:10 +00:00
Peter Wemm
dabee6fecc kern_descrip.c: add fdshare()/fdcopy()
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
1996-02-23 18:49:25 +00:00
Peter Wemm
e89de7b5c3 Run makesyscalls to regen the tables. 1996-02-23 18:31:34 +00:00
Peter Wemm
96ac07ef3a Add hooks for rfork/minherit pair, and reset args of vfork in preperation
for adding the syscalls.
1996-02-23 18:20:44 +00:00
Peter Wemm
4f9a71f6a0 Note the syscall numbers used in BSD/OS 2.x. We dont want to
accidently use one of these ourselves as it'd make it harder to run
their binaries.
Also, remove the now-defunct #include "opt_sysvipc.h".
1996-02-23 18:03:08 +00:00
John Dyson
6e20683c9d Fix a problem that select did not work with direct writes. Make
wakeup channels more consistant also.
1996-02-22 03:33:52 +00:00
Peter Wemm
add3bbdaef Add missing prototype for pipeselwakeup (a recently added function) - gcc
bitches about it..
1996-02-17 14:47:16 +00:00
Garrett Wollman
dc915e7cfc Kill XNS.
While we're at it, fix socreate() to take a process argument.  (This
was supposed to get committed days ago...)
1996-02-13 18:16:31 +00:00
Poul-Henning Kamp
c9c37b27d1 rewrap some long lines. 1996-02-13 14:16:36 +00:00
John Dyson
f3e79aa705 Add ifdefs for non-freebsd system usage. Add missing select wakeups,
and make the select wakup code a little neater.
1996-02-11 22:09:50 +00:00
John Dyson
5af564b4f4 Add some missing requests for the read-side to wakeup the write-side. Also
add some missing wakeups by the write side to the read side.
1996-02-09 04:36:36 +00:00
Garrett Wollman
b135805469 Define a new socket option, SO_PRIVSTATE. Getting it returns the state
of the SS_PRIV flag in so_state; setting it always clears same.
1996-02-07 16:19:19 +00:00
John Dyson
26d2f00960 Apparent fix for a pipe hang problem. 1996-02-07 06:41:56 +00:00
John Dyson
f29e1bd629 More fixes from bde.
Only modify times on success.
	splhigh() around time variable usage.
	Make atomic writes more posix compliant.
	Spelling errors.
Submitted by:	bde
1996-02-05 05:50:34 +00:00
John Dyson
96cc6b1011 Kva space allocated for direct buffer wasn't quite big enough. The
system can panic easily without this patch.
1996-02-05 05:17:15 +00:00
John Dyson
dca5129987 Changed vm_fault_quick in vm_machdep.c to be global. Needed for
new pipe code.
1996-02-04 22:09:12 +00:00
John Dyson
2834ceec7c Improve the performance for pipe(2) again. Also include some
fixes for previous version of new pipes from Bruce Evans.  This
new version:

Supports more properly the semantics of select (BDE).
Supports "OLD_PIPE" correctly (kern_descrip.c, BDE).
Eliminates incorrect EPIPE returns (bash 'pipe broken' messages.)
Much faster yet, currently tuned relatively conservatively -- but now
	gives approx 50% more perf than the new pipes code did originally.
	(That was about 50% more perf than the original BSD pipe code.)

Known bugs outstanding:
	No support for async io (SIGIO).  Will be included soon.

Next to do:
	Merge support for FIFOs.

Submitted by: bde
1996-02-04 19:56:35 +00:00
Justin T. Gibbs
f6f6004c29 Properly calculate the amount of the devconf to output in SYSCTL_OUT.
The code outputs the dc then calls the device specific externalize
routines to fill in the dc_data area.  The old code assumed that dc_data
started one byte from the end of the dc, but with the compiler optimizing
alignment and padding, this isn't always the case.  Do an explicit
&(dc.dc_data) - &dc.  This fixes lsdev -c which must have been broken
for some time.
1996-01-31 18:05:19 +00:00
David Greenman
729b1e5149 Improved killproc() log message and made it and the other similar message
tolerant of p_ucred being invalid. Starting using killproc() where
appropriate.
1996-01-31 12:44:33 +00:00
John Dyson
4ab7a1a6c7 Fix another problem with the new pipe code, pointed out by Bruce Evans.
This one fixes a problem with interactions with signals.
1996-01-31 06:00:45 +00:00
John Dyson
56363b79a9 Fix some problems with return codes on the new pipe stuff. Bruce Evans
found the problems, and this commit will fix the "first batch" :-).
1996-01-31 02:05:12 +00:00
David Greenman
07bbd7f1bb Implement what I mentioned in rev 1.18: limit per-bucket allocations to
60% of physical memory or 60% of malloc area size, whichever is smaller.
1996-01-29 11:12:37 +00:00
David Greenman
54e7152c15 Fixed two bugs in the calculation of the malloc area (kmem_map) size:
1) The calculation didn't account for NMBCLUSTERS, so if a large number of
   clusters was specified, it would leave little or no space for kernel
   malloc.
2) It was bogusly restricted to v_page_count. This doesn't take into
   account the sparseness of the malloc area and would have caused
   problems on machines with small amounts of memory. It should probably
   instead be changed to set the malloc limit to be constrained by
   the amount of memory, but I didn't do this.
1996-01-29 09:58:34 +00:00
Justin T. Gibbs
65ed8cbd4e Kernel printf now returns int. 1996-01-29 03:18:05 +00:00
John Dyson
4fd00d508b Fixed an uninitialized variable (argument to vm_map_find) -- problem
that DG detected, and promptly found a fix.
Submitted by:	davidg
1996-01-29 02:57:33 +00:00
John Dyson
f982721359 Enable the new fast pipe code. The old pipes can be used with the
"OLD_PIPE" config option.
1996-01-28 23:41:40 +00:00
John Dyson
10c5615c1d Added new files to support the new fast pipes. After the follow-on
commits, pipe performance should increase significantly.  The pipe(2)
system call is currently supported, while fifofs will be added later.
1996-01-28 23:38:26 +00:00
John Dyson
44196d615f An earlier modification had decreased CPU usage, but also
decreased performance.  This essentially undoes that change.
1996-01-28 18:25:54 +00:00
Bruce Evans
80f9be1460 Fixed dangling pointer bugs in DIOCSDINFO.
Enabled DEVFS support.  It doesn't work while devfs is mounted
(add_devfs_devsw() doesn't work then), but seems to be safe.
1996-01-28 08:15:44 +00:00
Bruce Evans
af4cb3a1c4 [Oops, forgot to commit this together with things that depend on it.]
First attempt at creating devfs entries for sliced devices.  Doesn't
quite work yet, so the heart of it is disabled.

Added bdev and cdev args to dsopen().

Create devfs entries in dsopen() and (unsuccessfully) attempt to make
them go away at the right times.  DEVFS is #undefed at the start so
that this shouldn't cause problems.
1996-01-27 09:34:21 +00:00
Poul-Henning Kamp
16cf781eed Fix a bug I made in the devfs. 1996-01-26 12:42:39 +00:00
Poul-Henning Kamp
e8cbe8fa47 Avoid local sprintfs and other printf'isms. 1996-01-25 07:21:50 +00:00
Bruce Evans
bf124e256b Restored newline at the end of panic messages. 1996-01-25 00:17:22 +00:00
Poul-Henning Kamp
120f078334 Remove %r hack, we have vprintf() now.
Add %D for "dumping" data.  Good for ethernet/MAC addresses and such.
Handle 1 < radix < 37.
1996-01-24 20:56:20 +00:00
Peter Wemm
b0281cef04 Major fixes for ptrace()...
PT_ATTACH/PT_DETACH implemented now and fully operational.
PT_{GET|SET}{REGS|FPREFS} implemented now, using code shared with procfs
PT_{READ|WRITE}_{I|D} now uses code shared with procfs
ptrace opcodes now fully permission checked, including ownerships.
doing an operation to the u-area on a swapped process should no longer
panic.
running gdb as root works for me now, where it didn't before.
general cleanup..

Note, that this has some tightening of permissions/access checks etc.
Some of these may be going too far..  In particular, the "owner" of the
traced process is enforced.  The process that created or attached to
the traced process is now the only one that can "do" things to it.
1996-01-24 18:29:00 +00:00
Poul-Henning Kamp
b4b2f81ef3 bounds check the radix, just in case. 1996-01-22 13:21:33 +00:00
John Dyson
f69170e601 Previous commit to vfs_cluster accidentally disabled read-ahead. Problem
fixed by initializing "alreadyincore" to 0 in the case of
sequential reads.
1996-01-20 23:24:16 +00:00
Bruce Evans
9f29a57754 Removed stale #includes of "opt_sysvipc.h". 1996-01-20 21:36:31 +00:00
Poul-Henning Kamp
ed71c34200 Imake %.*s really work. :-( 1996-01-19 21:05:52 +00:00
Poul-Henning Kamp
fe96d47d8e Make result of sprintf zero terminated. Fix %r for sprintf case. 1996-01-19 11:38:18 +00:00