summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* This is Bosko Milekic's mbuf allocation waiting code. Basically, thisgreen1999-12-124-22/+155
| | | | | | | | means that running out of mbuf space isn't a panic anymore, and code which runs out of network memory will sleep to wait for it. Submitted by: Bosko Milekic <bmilekic@dsuper.net> Reviewed by: green, wollman
* Remove accidental pollution unrelated to previous commit. The issuedillon1999-12-122-4/+2
| | | | here is real but has not yet been discussed with Eivind.
* Add MAP_NOSYNC feature to mmap(), and MADV_NOSYNC and MADV_AUTOSYNC todillon1999-12-124-4/+6
| | | | | | | | | | | | | | | | | madvise(). This feature prevents the update daemon from gratuitously flushing dirty pages associated with a mapped file-backed region of memory. The system pager will still page the memory as necessary and the VM system will still be fully coherent with the filesystem. Modifications made by other means to the same area of memory, for example by write(), are unaffected. The feature works on a page-granularity basis. MAP_NOSYNC allows one to use mmap() to share memory between processes without incuring any significant filesystem overhead, putting it in the same performance category as SysV Shared memory and anonymous memory. Reviewed by: julian, alc, dg
* Lock reporting and assertion changes.eivind1999-12-115-13/+24
| | | | | | | | | | | | | | | * lockstatus() and VOP_ISLOCKED() gets a new process argument and a new return value: LK_EXCLOTHER, when the lock is held exclusively by another process. * The ASSERT_VOP_(UN)LOCKED family is extended to use what this gives them * Extend the vnode_if.src format to allow more exact specification than locked/unlocked. This commit should not do any semantic changes unless you are using DEBUG_VFS_LOCKS. Discussed with: grog, mch, peter, phk Reviewed by: peter
* Zap c_index() and c_rindex(). Bruce prefers these to implicitly convertpeter1999-12-101-2/+2
| | | | | a const into a non-const as they do in libc. I feel that defeating the type checking like that quite evil, but that's the way it is.
* Make adjtime(2) adjust boottime so it doesn't cause non-monotonousphk1999-12-082-4/+22
| | | | uptime.
* Scan cdevs for potential root devices, rather than bdevs.phk1999-12-082-12/+14
|
* Remove BAD144 support, it has already been disabled for some time.phk1999-12-082-237/+4
|
* Change the default poweroff delay from 0 to 5 seconds. This seems to bemsmith1999-12-071-1/+5
| | | | | | | | | adequate for the IDE disks that I have available for testing. Most seem to wait between 1 and 3 seconds before flushing their caches. Add the ability to override the delay at compile time via the undocumented option POWEROFF_DELAY. The delay can still be set via sysctl as it was originally implemented.
* I always forget to check before I reboot a system, and while itphk1999-12-061-0/+30
| | | | | | | | boots I try in vain to remember which month or even year this system was last booted in. Print out the uptime before rebooting, and give people like me less (or more as it may be) to think about while the systems boots.
* Put on my asbestos underwear and commit the patch that I posted to -archpeter1999-12-061-3/+36
| | | | | | | | | some time ago that changes kern.randompid from a boolean to a randomness range for the next pid assigment. Too high causes a lot of extra work to scan for free pids, and too low merely wastes randomness entropy. It's still possible to select a completely random range by using PID_MAX (100k) or -1 as a shortcut to mean "the whole range". Also, don't waste randomness when doing a wraparound.
* User ldt sharing.luoqi1999-12-061-10/+1
|
* correct incomplete last changemjacob1999-12-031-1/+1
|
* Remove the 'ivars' arguement to device_add_child() andmdodd1999-12-031-12/+20
| | | | | | | | | | | | | | | | device_add_child_ordered(). 'ivars' may now be set using the device_set_ivars() function. This makes it easier for us to change how arbitrary data structures are associated with a device_t. Eventually we won't be modifying device_t to add additional pointers for ivars, softc data etc. Despite my best efforts I've probably forgotten something so let me know if this breaks anything. I've been running with this change for months and its been quite involved actually isolating all the changes from the rest of the local changes in my tree. Reviewed by: peter, dfr
* Remove check for attached state.n_hibma1999-12-021-3/+0
| | | | | | | | | | | sc = devclass_get_softc(devclass, unit); doesn't return NULL during attach anymore, and produces the sc, identical to (for devclass_get_unit(devclass, unit) != NULL that is): sc = device_get_softc(devclass_get_unit(devclass, unit)); Reviewed-by: dfr
* The functions m_copym() and m_copypacket() return read-only copies,archie1999-12-011-0/+78
| | | | | | | | | | | | because in the case of mbuf clusters they only increment the reference count rather than actually copying the data. Add comments to this effect, and add a new routine called m_dup() that returns a real, writable copy of an mbuf chain. This is preliminary work required for implementing 'ipfw tee'. Reviewed by: julian
* Separate some common sysctl code into sysctl_find_oid() and callinggreen1999-12-011-68/+65
| | | | | thereof. Also, make the errno returns _correct_, and add a new one which is more appropriate.
* Collect read and write counts for filesystems. This new codemckusick1999-12-011-20/+0
| | | | | | | | | | | | | | drops the counting in bwrite and puts it all in spec_strategy. I did some tests and verified that the counts collected for writes in spec_strategy is identical to the counts that we previously collected in bwrite. We now also get read counts (async reads come from requests for read-ahead blocks). Note that you need to compile a new version of mount to get the read counts printed out. The old mount binary is completely compatible, the only reason to install a new mount is to get the read counts printed. Submitted by: Craig A Soules <soules+@andrew.cmu.edu> Reviewed by: Kirk McKusick <mckusick@mckusick.com>
* Don't make the ktrace hook in tsleep() deref a null curproc after a panic.peter1999-11-301-1/+1
| | | | | PR: 15169 Submitted by: David Gilbert <dgilbert@velocet.ca>
* Reduce code duplication.mdodd1999-11-301-6/+8
| | | | | | | | | | Hopefully this clears up some confusion about the nature of devclass_get_softc() vs. device_get_softc() as well. The check against DS_ATTACHED remains as this is not a change that modifies functionality. Reviewed by: Peter "in principle" Wemm
* Remove vfs_getrootfsid() function (a temporary hack added a few monthsdillon1999-11-292-34/+0
| | | | | ago to make BOOTP work again). It is no longer required by BOOTP and no longer used.
* Report swapdevices as cdevs rather than bdevs.phk1999-11-291-9/+0
| | | | Remove unused dev2budev() function.
* Remove the now unused chrtoblk() function.phk1999-11-291-17/+0
|
* Make BOOTP work again.dillon1999-11-292-2/+2
| | | | Submitted by: Doug Ambrisko <ambrisko@whistle.com>
* Add a bit of sanity checking and problem avoidance in case thephk1999-11-292-4/+17
| | | | | | | timecounter hardware is bogus. This will produce a new warning "microuptime() went backwards" and try to not screw up the process resource accounting.
* Use the correct mounted-from path when allocating the root mount, if we knowmsmith1999-11-282-14/+14
| | | | | | | | | | | what it is. Be more correct in unbusying the mountpoint (especially before freeing it). Remove support for mounting 'r' devices as root. You don't mount 'r' devices anywhere else, and they're going away anyway. Submitted by: bde
* Introduce OpenBSD-like Random PIDs. Controlled by a sysctl knobdan1999-11-281-2/+5
| | | | | | | | (kern.randompid), which is currently defaulted off. Use ARC4 (RC4) for our random number generation, which will not get me executed for violating crypto laws; a Good Thing(tm). Reviewed and Approved by: bde, imp
* Convert dumpon to work on character devices instead of block devices.phk1999-11-281-2/+2
| | | | NB: You may need to change your /etc/rc.conf!
* Scheduler fixes equivalent to the ones logged in the following NetBSDbde1999-11-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit to kern_synch.c: ---------------------------- revision 1.55 date: 1999/02/23 02:56:03; author: ross; state: Exp; lines: +39 -10 Scheduler bug fixes and reorganization * fix the ancient nice(1) bug, where nice +20 processes incorrectly steal 10 - 20% of the CPU, (or even more depending on load average) * provide a new schedclk() mechanism at a new clock at schedhz, so high platform hz values don't cause nice +0 processes to look like they are niced * change the algorithm slightly, and reorganize the code a lot * fix percent-CPU calculation bugs, and eliminate some no-op code === nice bug === Correctly divide the scheduler queues between niced and compute-bound processes. The current nice weight of two (sort of, see `algorithm change' below) neatly divides the USRPRI queues in half; this should have been used to clip p_estcpu, instead of UCHAR_MAX. Besides being the wrong amount, clipping an unsigned char to UCHAR_MAX is a no-op, and it was done after decay_cpu() which can only _reduce_ the value. It has to be kept <= NICE_WEIGHT * PRIO_MAX - PPQ or processes can scheduler-penalize themselves onto the same queue as nice +20 processes. (Or even a higher one.) === New schedclk() mechansism === Some platforms should be cutting down stathz before hitting the scheduler, since the scheduler algorithm only works right in the vicinity of 64 Hz. Rather than prescale hz, then scale back and forth by 4 every time p_estcpu is touched (each occurance an abstraction violation), use p_estcpu without scaling and require schedhz to be generated directly at the right frequency. Use a default stathz (well, actually, profhz) / 4, so nothing changes unless a platform defines schedhz and a new clock. Define these for alpha, where hz==1024, and nice was totally broke. === Algorithm change === The nice value used to be added to the exponentially-decayed scheduler history value p_estcpu, in _addition_ to be incorporated directly (with greater wieght) into the priority calculation. At first glance, it appears to be a pointless increase of 1/8 the nice effect (pri = p_estcpu/4 + nice*2), but it's actually at least 3x that because it will ramp up linearly but be decayed only exponentially, thus converging to an additional .75 nice for a loadaverage of one. I killed this, it makes the behavior hard to control, almost impossible to analyze, and the effect (~~nothing at for the first second, then somewhat increased niceness after three seconds or more, depending on load average) pointless. === Other bugs === hz -> profhz in the p_pctcpu = f(p_cpticks) calcuation. Collect scheduler functionality. Try to put each abstraction in just one place. ---------------------------- The details are a little different in FreeBSD: === nice bug === Fixing this is the main point of this commit. We use essentially the same clipping rule as NetBSD (our limit on p_estcpu differs by a scale factor). However, clipping at all is fundamentally bad. It gives free CPU the hoggiest hogs once they reach the limit, and reaching the limit is normal for long-running hogs. This will be fixed later. === New schedclk() mechanism === We don't use the NetBSD schedclk() (now schedclock()) mechanism. We require (real)stathz to be about 128 and scale by an extra factor of 2 compared with NetBSD's statclock(). We scale p_estcpu instead of scaling the clock. This is more accurate and flexible. === Algorithm change === Same change. === Other bugs === The p_pctcpu bug was fixed long ago. We don't try as hard to abstract functionality yet. Related changes: the new limit on p_estcpu must be exported to kern_exit.c for clipping in wait1(). Agreed with by: dufault
* Scheduler fixes equivalent to the ones logged in the following NetBSDbde1999-11-281-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit to kern_synch.c: ---------------------------- revision 1.55 date: 1999/02/23 02:56:03; author: ross; state: Exp; lines: +39 -10 Scheduler bug fixes and reorganization * fix the ancient nice(1) bug, where nice +20 processes incorrectly steal 10 - 20% of the CPU, (or even more depending on load average) * provide a new schedclk() mechanism at a new clock at schedhz, so high platform hz values don't cause nice +0 processes to look like they are niced * change the algorithm slightly, and reorganize the code a lot * fix percent-CPU calculation bugs, and eliminate some no-op code === nice bug === Correctly divide the scheduler queues between niced and compute-bound processes. The current nice weight of two (sort of, see `algorithm change' below) neatly divides the USRPRI queues in half; this should have been used to clip p_estcpu, instead of UCHAR_MAX. Besides being the wrong amount, clipping an unsigned char to UCHAR_MAX is a no-op, and it was done after decay_cpu() which can only _reduce_ the value. It has to be kept <= NICE_WEIGHT * PRIO_MAX - PPQ or processes can scheduler-penalize themselves onto the same queue as nice +20 processes. (Or even a higher one.) === New schedclk() mechansism === Some platforms should be cutting down stathz before hitting the scheduler, since the scheduler algorithm only works right in the vicinity of 64 Hz. Rather than prescale hz, then scale back and forth by 4 every time p_estcpu is touched (each occurance an abstraction violation), use p_estcpu without scaling and require schedhz to be generated directly at the right frequency. Use a default stathz (well, actually, profhz) / 4, so nothing changes unless a platform defines schedhz and a new clock. Define these for alpha, where hz==1024, and nice was totally broke. === Algorithm change === The nice value used to be added to the exponentially-decayed scheduler history value p_estcpu, in _addition_ to be incorporated directly (with greater wieght) into the priority calculation. At first glance, it appears to be a pointless increase of 1/8 the nice effect (pri = p_estcpu/4 + nice*2), but it's actually at least 3x that because it will ramp up linearly but be decayed only exponentially, thus converging to an additional .75 nice for a loadaverage of one. I killed this, it makes the behavior hard to control, almost impossible to analyze, and the effect (~~nothing at for the first second, then somewhat increased niceness after three seconds or more, depending on load average) pointless. === Other bugs === hz -> profhz in the p_pctcpu = f(p_cpticks) calcuation. Collect scheduler functionality. Try to put each abstraction in just one place. ---------------------------- The details are a little different in FreeBSD: === nice bug === Fixing this is the main point of this commit. We use essentially the same clipping rule as NetBSD (our limit on p_estcpu differs by a scale factor). However, clipping at all is fundamentally bad. It gives free CPU the hoggiest hogs once they reach the limit, and reaching the limit is normal for long-running hogs. This will be fixed later. === New schedclk() mechanism === We don't use the NetBSD schedclk() (now schedclock()) mechanism. We require (real)stathz to be about 128 and scale by an extra factor of 2 compared with NetBSD's statclock(). We scale p_estcpu instead of scaling the clock. This is more accurate and flexible. === Algorithm change === Same change. === Other bugs === The p_pctcpu bug was fixed long ago. We don't try as hard to abstract functionality yet. Related changes: the new limit on p_estcpu must be exported to kern_exit.c for clipping in wait1(). Agreed with by: dufault
* Take a shot at implementing the fix for PR 15014 for the a.out kernelpeter1999-11-281-4/+6
| | | | | | | linker as well. PR: 15014 Submitted by: Vladimir N. Silyaev <vns@delta.odessa.ua>
* Fix an embarresing mistake in the kld symbol lookup for DDB. It shouldpeter1999-11-282-8/+12
| | | | | | | now correctly do a traceback when crashing inside a KLD module. PR: 15014 Submitted by: Vladimir N. Silyaev <vns@delta.odessa.ua>
* Updated comments for the move in the previous commit.bde1999-11-271-5/+5
|
* Fixed some comments in statclock(). The previous commit made it clearerbde1999-11-272-16/+16
| | | | that one comment was attached to null code.
* Moved scheduling-related code to kern_synch.c so that it is easier to fixbde1999-11-274-50/+29
| | | | | | | | and extend. The new function containing the code is named schedclock() as in NetBSD, but it has slightly different semantics (it already handles incrementation of p->p_cpticks, and it should handle any calling frequency). Agreed with in principle by: dufault
* Retire MFS_ROOT and MFS_ROOT_SIZE options from the MFS implementation.phk1999-11-262-0/+8
| | | | | | | | | | | | | | | | | Add MD_ROOT and MD_ROOT_SIZE options to the md driver. Make the md driver handle MFS_ROOT and MFS_ROOT_SIZE options for compatibility. Add md driver to GENERIC, PCCARD and LINT. This is a cleanup which removes the need for some of the worse hacks in MFS: We really want to have a rootvnode but MFS on a preloaded image doesn't really have one. md is a true device, so it is less trouble. This has been tested with make release, and if people remember to add the "md" pseudo-device to their kernels, PicoBSD should be just fine as well. If people have no other use for MFS, it can be removed from the kernel.
* Add a sysctl to control if argv is disclosed to the world:phk1999-11-262-1/+4
| | | | | | | kern.ps_argsopen It defaults to 1 which means that all users can see all argvs in ps(1). Reviewed by: Warner
* General clean-up of socket.h and associated sources to synchronise upphk1999-11-241-1/+1
| | | | | | | | | | | | with NetBSD and the Single Unix Specification v2. This updates some structures with other, almost equivalent types and effort is under way to get the whole more consistent. Also removes a double definition of INET6 and some other clean-ups. Reviewed by: green, bde, phk Some part obtained from: NetBSD, SUSv2 specification
* Change the prototype of the strto* routines to make the secondarchie1999-11-242-4/+5
| | | | | | | | | | | parameter a char ** instead of a const char **. This make these kernel routines consistent with the corresponding libc userland routines. Which is actually 'correct' is debatable, but consistency and following the spec was deemed more important in this case. Reviewed by (in concept): phk, bde
* Fix some bugs in user-end output and add a reference to the originaln_hibma1999-11-221-5/+9
| | | | copyright in the resulting file.
* Convert various pieces of code to use vn_isdisk() rather than checkingphk1999-11-224-14/+13
| | | | | | | | for vp->v_type == VBLK. In ccd: we don't need to call VOP_GETATTR to find the type of a vnode. Reviewed by: sos
* KAME netinet6 basic part(no IPsec,no V6 Multicast Forwarding, no UDP/TCPshin1999-11-222-3/+117
| | | | | | | | | | for IPv6 yet) With this patch, you can assigne IPv6 addr automatically, and can reply to IPv6 ping. Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project
* Introduce the new functionphk1999-11-214-15/+33
| | | | | | | | | | | | | | p_trespass(struct proc *p1, struct proc *p2) which returns zero or an errno depending on the legality of p1 trespassing on p2. Replace kern_sig.c:CANSIGNAL() with call to p_trespass() and one extra signal related check. Replace procfs.h:CHECKIO() macros with calls to p_trespass(). Only show command lines to process which can trespass on the target process.
* s/p_cred->pc_ucred/p_ucred/gphk1999-11-214-4/+4
|
* If vfs_mountroot_try() isn't given a path to try mounting, return a silentmsmith1999-11-212-2/+2
| | | | | error rather than complaining about it verbosely. No path is not really a failure, but the diagnostic was confusing and unuseful.
* Tempt fate and stop index from converting a const char * into a char *.peter1999-11-211-2/+2
| | | | | | | I've made a seperate version (c_index() etc) that use const/const, but I'm not sure it's worth it considering there is one file in the tree that uses index on const strings (kern_linker.c) and it's easily adjusted to scan the strings directly (and is perhaps more efficient that way).
* Revert peter's commit to remove cdevsw_add() - it was a bit prematurejkh1999-11-211-0/+2
| | | | | since things fail to function properly without it (pty allocation becomes somewhat haphazard).
* struct mountlist and struct mount.mnt_list have no business beingphk1999-11-208-54/+50
| | | | | | | | | | a CIRCLEQ. Change them to TAILQ_HEAD and TAILQ_ENTRY respectively. This removes ugly mp != (void*)&mountlist comparisons. Requested by: phk Submitted by: Jake Burkholder jake@checker.org PR: 14967
* Vnode was left referenced in the case if ELF image is broken.bp1999-11-201-1/+3
| | | | Reviewed by: Peter Wemm <peter@netplex.com.au>
* Conditionalise unwanted chattyness.jkh1999-11-191-1/+2
|
OpenPOWER on IntegriCloud