17 years agoRemove the canwait argument to dup_sockaddr(). Callers of dup_sockaddr()
Matthew Dillon [Sun, 6 Jun 2004 19:16:17 +0000 (19:16 +0000)]
Remove the canwait argument to dup_sockaddr().  Callers of dup_sockaddr()
all assume that it just works, so it really has to work.  Since interrupts
are now threads we can use M_INTWAIT.  While it is possible that a memory
deadlock issue exists here (e.g. if swapping over NFS), it isn't likely in
this case.

17 years agoThe usbcom's device was being released too early in the close sequence.
Matthew Dillon [Sun, 6 Jun 2004 18:58:09 +0000 (18:58 +0000)]
The usbcom's device was being released too early in the close sequence.
Note that this fixes a null pointer panic but we still get the
following warning: 'ucom: Warning: cdevsw_remove() called while 1 device
refs still exist! (major 138)'

Submitted-by: YONETANI Tomokazu <qhwt+dragonfly-bugs@les.ath.cx>
17 years agoDeal with revoke()'d descriptors. The underlying vnode is vgone()'d, which
Matthew Dillon [Sun, 6 Jun 2004 18:47:51 +0000 (18:47 +0000)]
Deal with revoke()'d descriptors.  The underlying vnode is vgone()'d, which
means that it is forceably closed.  This clears v_rdev even though file
descriptors may still have references to the vnode, which leads to panics
(mainly on tty devices).

Check for v_rdev == NULL in most specfs fileops calls and return an error
code instead of panicing.   This isn't the cleanest solution but it's fine
for now.

Reported-by: Sascha Wildner <saw@online.de>
17 years agoANSI-fication. No operational changes.
Hiten Pandya [Sun, 6 Jun 2004 16:41:05 +0000 (16:41 +0000)]
ANSI-fication.  No operational changes.

17 years agoRegister keyword removal. No operational changes.
Hiten Pandya [Sun, 6 Jun 2004 15:05:55 +0000 (15:05 +0000)]
Register keyword removal.  No operational changes.

17 years agoAdd a reference to the ulimit(3) manual page.
Hiten Pandya [Sun, 6 Jun 2004 13:33:28 +0000 (13:33 +0000)]
Add a reference to the ulimit(3) manual page.

17 years agoImplement POSIX.1-2001 (XSI)'s ulimit(3) library call.
Hiten Pandya [Sun, 6 Jun 2004 13:32:27 +0000 (13:32 +0000)]
Implement POSIX.1-2001 (XSI)'s ulimit(3) library call.

Obtained-from:   FreeBSD (HEAD)

17 years agoDo not use the installed include files, instead, set the include path
Hiten Pandya [Sun, 6 Jun 2004 13:30:33 +0000 (13:30 +0000)]
Do not use the installed include files, instead, set the include path
to ${.CURDIR}/../../include; so that the right version is used.

17 years agoNow that we have clients that use m_getcl(9), set the default mcl_pool_max
Hiten Pandya [Sun, 6 Jun 2004 11:49:54 +0000 (11:49 +0000)]
Now that we have clients that use m_getcl(9), set the default mcl_pool_max
pool size for mbuf+clusters to '10' instead of '0', to improve performace.

Obtained-from:   FreeBSD, rev. (RELENG_4)

17 years agoDiscard the first 1024 bytes of output as suggested by
Hiten Pandya [Sun, 6 Jun 2004 10:58:31 +0000 (10:58 +0000)]
Discard the first 1024 bytes of output as suggested by
http://citeseer.nj.nec.com/fluhrer01weaknesses.html and

Obtained-from: FreeBSD rev. 1.7 src/lib/libc/gen/arc4random.c

17 years agoClose race condition in accept(2).
Jeffrey Hsu [Sun, 6 Jun 2004 05:59:44 +0000 (05:59 +0000)]
Close race condition in accept(2).

17 years agoFix typo in error message - there is no system call named "lchflags."
Chris Pressey [Sun, 6 Jun 2004 05:48:01 +0000 (05:48 +0000)]
Fix typo in error message - there is no system call named "lchflags."

17 years agoDetect and foil optimistic ACK attack with forced slow-start
Jeffrey Hsu [Sun, 6 Jun 2004 05:38:58 +0000 (05:38 +0000)]
Detect and foil optimistic ACK attack with forced slow-start
as suggested by Azcorra, Bernardos, and Soto.

17 years agoAdd the MSFBUF API. MSFBUFs are like SFBUFs but they manage ephermal
Matthew Dillon [Sat, 5 Jun 2004 19:57:40 +0000 (19:57 +0000)]
Add the MSFBUF API.  MSFBUFs are like SFBUFs but they manage ephermal
multi-page mappings instead of single-page mappings.  MSFBUFs have the
same caching and page invalidation optimizations that SFBUFs have and are
considered to be SMP-friendly.

Whereas XIO manages pure page lists, MSFBUFs manage KVA mappings of pure
page lists.

This initial commit just gets the basic API operational.  The roadmap for
future work includes things like better interactions with third-party XIOs,
mapping user buffers into the kernel (extending the xio_init_ubuf() API into
the MSFBUF API), and allowing higher level subsystems to pass previously
released MSFBUFs as a hint to speed-up regeneration.  We also need to come
up with a way to overload additional sets of MSFBUFs representing smaller
chunks of memory on top of the same KVA space in order to efficiently use
our KVA reservation when dealing with subsystems like the buffer cache.

MSFBUFs will eventually replace the KVA management in the BUF/BIO, PIPE,
and other subsystems which create fake linear mappings with pbufs.  The
general idea for BUF/BIO will be to use XIO and MSFBUFs to avoid KVA
mapping file data through the nominal I/O path.  XIO will be the primary I/O
buffer mechanism while MSFBUFs will be used when things like UFS decide they
need a temporary mapping.

This is a collaborative work between Hiten Pandya <hmp@leaf.dragonflybsd.org>
and Matthew Dillon <dillon@backplane.com>.

17 years agoM_NOWAIT is just wrong in the init code. The allocation must succeed.
Matthew Dillon [Sat, 5 Jun 2004 18:04:47 +0000 (18:04 +0000)]
M_NOWAIT is just wrong in the init code.  The allocation must succeed.

17 years agoRearrange the kern_getcwd() procedure to return the base of the string
Matthew Dillon [Sat, 5 Jun 2004 16:34:07 +0000 (16:34 +0000)]
Rearrange the kern_getcwd() procedure to return the base of the string
rather then relocating the string.

Also fix two bugs: (1) the original bcopy was copying data beyond the end of
the buffer ([bp, bp+buflen] exceeds the buffer), and (2), the uap->buflen
checks must be made in __getcwd(), before the kernel tries to malloc() space.

17 years agoAdd a manual page describing the LSI Fusion family of devices with a
Hiten Pandya [Sat, 5 Jun 2004 15:02:05 +0000 (15:02 +0000)]
Add a manual page describing the LSI Fusion family of devices with a
few changes by me.

Requested-by: David Rhodus <drhodus@machdep.com>

17 years agoem(4) assumes that bus_dmamap_destroy of bus_dmamap_load_mbuf maps
Joerg Sonnenberger [Sat, 5 Jun 2004 13:52:29 +0000 (13:52 +0000)]
em(4) assumes that bus_dmamap_destroy of bus_dmamap_load_mbuf maps
unconditionally succeds w/o previous bus_dmamap_unload. This assumption
is currently true because bus_dmamap_load_mbuf doesn't support bounce
pages. Nevertheless is that an implementation detail which em(4) should
not depend on.

Discussed-with: Hiten Pandya <hmp@backplane.com>

17 years agoFix a small bug in the last commit. ether_ifdetach has to be called
Joerg Sonnenberger [Sat, 5 Jun 2004 13:09:00 +0000 (13:09 +0000)]
Fix a small bug in the last commit. ether_ifdetach has to be called
explicitly if bus_setup_intr fails.

17 years agoSwap order of first and second argument in bcopy, forgot this when changing
Eirik Nygaard [Sat, 5 Jun 2004 10:27:58 +0000 (10:27 +0000)]
Swap order of first and second argument in bcopy, forgot this when changing
from strncpy.

17 years agoUse MAXPATHLEN as the size of the checkpoint filename sysctl variable instead
Eirik Nygaard [Sat, 5 Jun 2004 10:04:38 +0000 (10:04 +0000)]
Use MAXPATHLEN as the size of the checkpoint filename sysctl variable instead
of a hardcoded value.

17 years agoPrint the entire path to where the checkpoint file is being created to avoid
Eirik Nygaard [Sat, 5 Jun 2004 10:02:07 +0000 (10:02 +0000)]
Print the entire path to where the checkpoint file is being created to avoid
confusion if the application changes it's working dir.

Pointers by: Matthew Dillon <dillon@apollo.backplane.com>

17 years agoSplit the __getcwd syscall into a kernel and an userland part, so it can be
Eirik Nygaard [Sat, 5 Jun 2004 09:58:15 +0000 (09:58 +0000)]
Split the __getcwd syscall into a kernel and an userland part, so it can be
used in the kernel as well.

Pointers by: Matthew Dillon <dillon@apollo.backplane.com>

17 years agoAllow dup_sockaddr() to block, otherwise the code becomes non-deterministic.
Matthew Dillon [Sat, 5 Jun 2004 05:34:57 +0000 (05:34 +0000)]
Allow dup_sockaddr() to block, otherwise the code becomes non-deterministic.
Since we are a thread now this should be fairly safe.

17 years agoFix typo.
Chris Pressey [Sat, 5 Jun 2004 03:23:14 +0000 (03:23 +0000)]
Fix typo.

Reported-by: Brad Harvell
17 years agoasync syscall work: The async syscall code got dated by recent LWKT
Matthew Dillon [Fri, 4 Jun 2004 20:35:39 +0000 (20:35 +0000)]
async syscall work: The async syscall code got dated by recent LWKT
changes, set mp_abort_port and clear MSGF_DONE as appropriate.

If a system call returns EASYNC, record the message in p->p_sysmsgq so we
can run them down in exit1().

In exit1(), run down any asynch system calls that are still running.  Note
that this commit does not implement abort support (yet).

Get rid of lwkt_port->mp_refs, it was not being used and it is likely never
going to be used (reference counting LWKT is hazzardous anyway since it
doesn't really fit the access model).

Add lwkt_checkmsg() to support some of the rearranged async syscall code.

17 years agoRemove dtom(). dtom() is no longer supported (precursor requirement for
Matthew Dillon [Fri, 4 Jun 2004 20:29:02 +0000 (20:29 +0000)]
Remove dtom().  dtom() is no longer supported (precursor requirement for
eventual mbuf allocator replacement).

17 years agoUse a normal malloc() for PCB allocations instead of the really aweful mbuf
Matthew Dillon [Fri, 4 Jun 2004 20:27:32 +0000 (20:27 +0000)]
Use a normal malloc() for PCB allocations instead of the really aweful mbuf
hacks that were previously being used (which also gets rid of the remaining
dtom() calls).

Get rid of the packet/queue overloading and instead malloc() a queue header
for queueing packets.  The old code depended on dtom() to figure out the
mbuf associated with the packet and we are removing dtom().

Give NS a default usrreq so it doesn't panic the system on boot, but note
that NS will remain broken until the usrreq can be tied into the existing

Review and testing by: Hiten Pandya and David Rhodus

17 years agoRe-arrange the 'Executable' column for the '-l' option so that long
Hiten Pandya [Fri, 4 Jun 2004 17:30:26 +0000 (17:30 +0000)]
Re-arrange the 'Executable' column for the '-l' option so that long
pathnames are printed correctly.

Suggested-by: Matthew Dillon <dillon at backplane.com>

17 years agoContinue cleaning em(4).
Joerg Sonnenberger [Fri, 4 Jun 2004 16:32:11 +0000 (16:32 +0000)]
Continue cleaning em(4).

Merge PCI resource allocation / deallocation into em_attach and em_detach.
Change the order of allocations in em_attach to work without splimp()
Remove adapter->unit, adapter->next and adapter->prev.
Use em_detach for the error handling in em_attach as well.
Move the reset of if_timer into em_stop.
Use adapter->hw.mac_addr instead of arpcom's entry.

17 years agoAllow top(1) to toggle display of processes+threads or *only* threads
Hiten Pandya [Fri, 4 Jun 2004 11:21:53 +0000 (11:21 +0000)]
Allow top(1) to toggle display of processes+threads or *only* threads
by adding a '-O' command line argument and run-time toggle.

This is useful when one wants to only monitor activity of current
active threads.

Document this new functionality and update the patches accordingly.

Requested-by: David Rhodus <drhodus@machdep.com>

17 years agoDeprecate use of m_act, which is an alias of m_nextpkt; just use
Hiten Pandya [Fri, 4 Jun 2004 07:45:46 +0000 (07:45 +0000)]
Deprecate use of m_act, which is an alias of m_nextpkt; just use
m_nextpkt instead.

17 years agoAdd MPF_INT (for mpipe_init()), which allows one to specify that an MPIPE
Matthew Dillon [Fri, 4 Jun 2004 06:56:12 +0000 (06:56 +0000)]
Add MPF_INT (for mpipe_init()), which allows one to specify that an MPIPE
allocation request may use the interrupt memory reserve.

17 years agoFlush cached access mode after modifying a files attributes for NFSv3.
Hiten Pandya [Fri, 4 Jun 2004 05:06:40 +0000 (05:06 +0000)]
Flush cached access mode after modifying a files attributes for NFSv3.
It's likely that modifying the attiributes will affect the file's

Fix created by Ian Dowse and Peter Edwards of the FreeBSD Project.
Test case available in PR# 44336 in FreeBSD GNATS.

17 years agoUse MPIPE instead of misusing m_getclr() (i.e. m_get) for NETNS's
Matthew Dillon [Fri, 4 Jun 2004 04:59:57 +0000 (04:59 +0000)]
Use MPIPE instead of misusing m_getclr() (i.e. m_get) for NETNS's
struct nspcb.  This also gets rid of a dtom() call.

Note: the changes compile but are untested.

17 years agoUse MPIPE instead of the really hackish use of m_get() and mtod()/dtom()
Matthew Dillon [Fri, 4 Jun 2004 04:32:23 +0000 (04:32 +0000)]
Use MPIPE instead of the really hackish use of m_get() and mtod()/dtom()
for the 'tcptemp' structure.

17 years agoRemove dtom() in unused (#ifndef notdef'd) code. Well, just remove the whole
Matthew Dillon [Fri, 4 Jun 2004 04:30:55 +0000 (04:30 +0000)]
Remove dtom() in unused (#ifndef notdef'd) code.  Well, just remove the whole
of the related #ifdef notdef'd sections.

17 years agoTEST
Matthew Dillon [Fri, 4 Jun 2004 04:25:07 +0000 (04:25 +0000)]

17 years agoUse MPIPE instead of (the really aweful improper use of) mbuf_alloc() for
Matthew Dillon [Fri, 4 Jun 2004 03:57:41 +0000 (03:57 +0000)]
Use MPIPE instead of (the really aweful improper use of) mbuf_alloc() for
struct ipq.  This also gets rid of a nasty dtoc().

17 years agoANSIfication. No functional changes.
Matthew Dillon [Fri, 4 Jun 2004 01:46:49 +0000 (01:46 +0000)]
ANSIfication.  No functional changes.

17 years agoms_cmd has changed to a union, update the test code.
Matthew Dillon [Thu, 3 Jun 2004 21:03:32 +0000 (21:03 +0000)]
ms_cmd has changed to a union, update the test code.

17 years agoAdd a manual page which describes the vn_fullpath(9) function.
Hiten Pandya [Thu, 3 Jun 2004 19:26:36 +0000 (19:26 +0000)]
Add a manual page which describes the vn_fullpath(9) function.

Adapted from the manual page in the FreeBSD CVS repository.

17 years agoMake pr_input use variadic arguments for anything but the first mbuf.
Joerg Sonnenberger [Thu, 3 Jun 2004 18:30:04 +0000 (18:30 +0000)]
Make pr_input use variadic arguments for anything but the first mbuf.

Add a warning for NSIP, it is likely to be broken.

17 years agoLock manipulation of the 'exec_res_list', i.e., the list of resident
Hiten Pandya [Thu, 3 Jun 2004 18:17:43 +0000 (18:17 +0000)]
Lock manipulation of the 'exec_res_list', i.e., the list of resident

Joerg Sonnenberger <joerg@bec.de>, Matthew Dillon <dillon@backplane.com>

17 years agoSurround a multi-line conditional block with braces for readability.
Hiten Pandya [Thu, 3 Jun 2004 18:12:41 +0000 (18:12 +0000)]
Surround a multi-line conditional block with braces for readability.

Suggested-by: Matthew Dillon <dillon at backplane.com>

17 years agoRemove the compat macro textvp_fullpath(), and use vn_fullpath()
Hiten Pandya [Thu, 3 Jun 2004 18:09:33 +0000 (18:09 +0000)]
Remove the compat macro textvp_fullpath(), and use vn_fullpath()

Discussed-with:  Matthew Dillon <dillon at backplane.com>

17 years agoCleanup the manual page:
Hiten Pandya [Thu, 3 Jun 2004 16:37:05 +0000 (16:37 +0000)]
Cleanup the manual page:

* add an AUTHORS section.

* use the '.Pa' command to markup a filename.

* remove hard sentence breaks and an empty section command.

17 years agoVM Resident Executables update:
Hiten Pandya [Thu, 3 Jun 2004 16:28:15 +0000 (16:28 +0000)]
VM Resident Executables update:

Kernel Part:

* decrement the exec_res_id counter in exec_sys_unregister, otherwise
  we will have an incorrect count of currently resident executables.

* add a structure called 'xresident' which stores enough information
  about resident executables, so that we can export it to userland
  via sysctl; the structure resides in sys/resident.h.

* add a sysctl node, called 'vm.resident' which enumerates though
  exec_res_list, i.e., the queue which stores information about the
  executables that are currently resident

* move the exec_res_list queue initialization and a MALLOC_DEFINE
  near the top of the file, right after the include files; and also
  initialize the exec_res_id counter to '0'.

NOTE! The 'vm.resident' sysctl node is only available to root!

Userland Part:

* add a '-l' option to resident(8), so that it displays the list
  of executables that are currently memory-resident.

* update the program usage string so that it is in par with the
  functionality offered by the program.

* update the manual page.

Requested-by: many...
Discussed-with:  Matthew Dillon <dillon@backplane.com>

17 years agoMake pr_domain and pr_usrreqs pointers to const. The general stack is not
Joerg Sonnenberger [Thu, 3 Jun 2004 16:21:22 +0000 (16:21 +0000)]
Make pr_domain and pr_usrreqs pointers to const. The general stack is not
supposed to change this and it allows us to make all this structures
const like they should be. If a network protocol wants to modify them,
they can still either modify the private version directly or create a copy
and change that.

17 years agoCleanup the textvp_fullpath() function; summary of changes:
Hiten Pandya [Thu, 3 Jun 2004 15:54:14 +0000 (15:54 +0000)]
Cleanup the textvp_fullpath() function; summary of changes:

* rename it to vn_fullpath(), and move prototype to sys/vnode.h;
  for now, keep a compat macro called textvp_fullpath(); this
  macro is temporary until I change linprocfs and procfs to play
  with vn_fullpath().

* rename last argument to 'freebuf', instead of 'retfreebuf'.

* if the second argument (vnode pointer) is NULL, fall back
  and use the passed-in process' p->p_textvp.

* make sure the client passes a process pointer, otherwise
  return EINVAL.

A manual page will be added real soon.

17 years agoQuotactl(2) should set the uid correctly, based on the QUOTA type supplied.
Hiten Pandya [Thu, 3 Jun 2004 15:40:22 +0000 (15:40 +0000)]
Quotactl(2) should set the uid correctly, based on the QUOTA type supplied.

Previously, it would set the uid to p->p_ucred->cr_ruid unconditionally
without checking if the QUOTA type is GRPQUOTA or USRQUOTA; thus allowing
a user with UID X to access the groupquota of gid X.

Inspired-by: PR# 33940 (by Vladimir B. Grebenschikov) [FreeBSD GNATS]

17 years agoRemove some long gone #defines, PFCLUSTER_BEHIND and PFCLUSTER_AHEAD;
Hiten Pandya [Thu, 3 Jun 2004 15:29:43 +0000 (15:29 +0000)]
Remove some long gone #defines, PFCLUSTER_BEHIND and PFCLUSTER_AHEAD;

This change was inspired by a similar change made in FreeBSD's HEAD
a few months ago by:

Alan Cox <alc at freebsd.org>

No operational changes.

17 years agoChange pr_output's signature to take two fixed arguments and possible
Joerg Sonnenberger [Thu, 3 Jun 2004 15:04:52 +0000 (15:04 +0000)]
Change pr_output's signature to take two fixed arguments and possible
additional varidic arguments. Change the various protocols accordingly.

This is not the signature NetBSD uses (only struct mbuf * + variadic),
but since all protocols use the socket argument (beside NS), it is more
reasonable to keep that static as well.

While at it, fix the pr_soport in ip6protosw to match the protosw.

17 years agoMove extern declaration to file scope to fix warning
Joerg Sonnenberger [Thu, 3 Jun 2004 13:34:37 +0000 (13:34 +0000)]
Move extern declaration to file scope to fix warning

17 years agoDon't cast away the const before dereferencing.
Joerg Sonnenberger [Thu, 3 Jun 2004 13:30:26 +0000 (13:30 +0000)]
Don't cast away the const before dereferencing.

17 years agoHide unused functions to silence GCC
Joerg Sonnenberger [Thu, 3 Jun 2004 13:12:24 +0000 (13:12 +0000)]
Hide unused functions to silence GCC

17 years agoHide unused function under #ifdef SMP
Joerg Sonnenberger [Thu, 3 Jun 2004 13:09:07 +0000 (13:09 +0000)]
Hide unused function under #ifdef SMP

17 years agoAdd ref counting to the checkpoint handler and unload function so an unload
Eirik Nygaard [Thu, 3 Jun 2004 10:00:06 +0000 (10:00 +0000)]
Add ref counting to the checkpoint handler and unload function so an unload
will not happen when a program is being checkpointed.

17 years agoClean up some misuses of bp->b_dev after a strategy function has completed
Matthew Dillon [Wed, 2 Jun 2004 19:31:02 +0000 (19:31 +0000)]
Clean up some misuses of bp->b_dev after a strategy function has completed
(the field cannot be used after biodone() has been called).  Add a separate
dev_t argument to diskerr() to take care of the issue and get rid of some
FD error reporting hacks at the same time.

Reported-by: David Rhodus
17 years agoANSIfication and cleanup. No functional changes.
Matthew Dillon [Wed, 2 Jun 2004 17:18:43 +0000 (17:18 +0000)]
ANSIfication and cleanup.  No functional changes.

Submitted-by: Tim Wickberg <me@k9mach3.org>
17 years agoAllow an inp control block to be inserted on multiple wildcard hash tables.
Jeffrey Hsu [Wed, 2 Jun 2004 16:41:28 +0000 (16:41 +0000)]
Allow an inp control block to be inserted on multiple wildcard hash tables.

17 years agoPlug a memory leak when the kernel initialiazes config_devtab resources
Hiten Pandya [Wed, 2 Jun 2004 15:25:01 +0000 (15:25 +0000)]
Plug a memory leak when the kernel initialiazes config_devtab resources
in resource_new_name().

PR:       kern/33344 (FreeBSD GNATS)
Patch-by: David Xu <davidxu at freebsd.org>
17 years agoChange mbug allocation flags from M_ to MB_ to avoid confusion with malloc
Eirik Nygaard [Wed, 2 Jun 2004 14:43:04 +0000 (14:43 +0000)]
Change mbug allocation flags from M_ to MB_ to avoid confusion with malloc

Requested by: Jeffrey Hsu

17 years agoInclude ns.h to get prototyp for ns_cksum
Joerg Sonnenberger [Wed, 2 Jun 2004 14:19:11 +0000 (14:19 +0000)]
Include ns.h to get prototyp for ns_cksum

17 years agoImprove the way error message from ALART are printed.
Joerg Sonnenberger [Wed, 2 Jun 2004 14:00:12 +0000 (14:00 +0000)]
Improve the way error message from ALART are printed.

17 years agoset_lapic_isrloc depends on APIC_IO for the prototype to exist, it isn't
Joerg Sonnenberger [Wed, 2 Jun 2004 13:56:34 +0000 (13:56 +0000)]
set_lapic_isrloc depends on APIC_IO for the prototype to exist, it isn't
used otherwise.

17 years agoUse volatile and __DEVOLATILE to silence gcc warnings.
Joerg Sonnenberger [Wed, 2 Jun 2004 13:49:46 +0000 (13:49 +0000)]
Use volatile and __DEVOLATILE to silence gcc warnings.

17 years agoUse __DECONST to silence GCC. Make some private routines static.
Joerg Sonnenberger [Wed, 2 Jun 2004 11:46:11 +0000 (11:46 +0000)]
Use __DECONST to silence GCC. Make some private routines static.

17 years agoMerge from FreeBSD, RELENG_4 branch, revision
Hiten Pandya [Wed, 2 Jun 2004 07:34:29 +0000 (07:34 +0000)]
Merge from FreeBSD, RELENG_4 branch, revision

--- original commit message ---
  There is a comma missing in the table initializing the
  pmap_prefault_pageorder array.  This has two effects:

  1. The resulting bogus contents of the array thwarts part of
  the optimization effect pmap_prefault() is supposed to have.

  2. The resulting array is only 7 elements long (auto-sized), while
  pmap_prefault() expects it to be the intended 8 elements.  So
  this function in fact accesses memory beyond the end of the array.
  Fortunately though, if the data at this location is out of bounds
  it will be ignored.

  This bug dates back more than 6 years.  It has been introduced
  in revision 1.178.

  Submitted by:   Uwe Doering <gemini@geminix.org>
  PR:        67460
--- original commit message ---

17 years agoVM86 calls on some BIOSs, apparently mainly VESA calls, use 8254 timers that
Matthew Dillon [Tue, 1 Jun 2004 22:24:10 +0000 (22:24 +0000)]
VM86 calls on some BIOSs, apparently mainly VESA calls, use 8254 timers that
we are using.  Restore our timers after making a vm86 call.  This is a hack,
but it seems to work.

Testing by: Sascha Wildner <saw@online.de>

17 years agoANSIfication. No operational changes.
Matthew Dillon [Tue, 1 Jun 2004 22:19:30 +0000 (22:19 +0000)]
ANSIfication.  No operational changes.

Submitted-by: Tim Wickberg <me@k9mach3.org>
17 years agoAdd a pfil_has_hooks() inline to shortcut calls to pfil_run_hooks(),
Matthew Dillon [Tue, 1 Jun 2004 20:49:08 +0000 (20:49 +0000)]
Add a pfil_has_hooks() inline to shortcut calls to pfil_run_hooks(),
allowing us to include PFIL_HOOKS without introducing any performance impact
when no hooks are being used.  This is in prep for making PFIL_HOOKS

17 years agoAdd RLIMIT_POSIXLOCKS support to csh/tcsh.
Matthew Dillon [Tue, 1 Jun 2004 20:34:01 +0000 (20:34 +0000)]
Add RLIMIT_POSIXLOCKS support to csh/tcsh.

17 years agoThe const call is linted, use proper cast to silence GCC
Joerg Sonnenberger [Tue, 1 Jun 2004 17:35:58 +0000 (17:35 +0000)]
The const call is linted, use proper cast to silence GCC

17 years agoFix some const warnings
Joerg Sonnenberger [Tue, 1 Jun 2004 17:35:03 +0000 (17:35 +0000)]
Fix some const warnings

17 years agoInitialize the magic cookie using real numbers instead of a multi-character
Joerg Sonnenberger [Tue, 1 Jun 2004 17:31:17 +0000 (17:31 +0000)]
Initialize the magic cookie using real numbers instead of a multi-character

17 years agoExplicitly cast-away volatile since it should be save here.
Joerg Sonnenberger [Tue, 1 Jun 2004 17:30:30 +0000 (17:30 +0000)]
Explicitly cast-away volatile since it should be save here.

17 years agoExplicitly cast away the volatile for conversions and argument passings.
Joerg Sonnenberger [Tue, 1 Jun 2004 17:27:44 +0000 (17:27 +0000)]
Explicitly cast away the volatile for conversions and argument passings.

17 years agoUse struct thread for kernel threads, not struct proc.
Joerg Sonnenberger [Tue, 1 Jun 2004 17:12:15 +0000 (17:12 +0000)]
Use struct thread for kernel threads, not struct proc.

17 years agoCorrect spelling.
Hiten Pandya [Tue, 1 Jun 2004 14:00:50 +0000 (14:00 +0000)]
Correct spelling.

Submitted-by: Tim Wickberg <me at k9mach3.org>

17 years agoRemove '-*- nroff -*-'.
Hiten Pandya [Tue, 1 Jun 2004 11:36:53 +0000 (11:36 +0000)]
Remove '-*- nroff -*-'.

Lets make a habit not to put editor-related magic into our base
files.  They are redundant and useless.

17 years agoStyle(9) cleanup:
Chris Pressey [Tue, 1 Jun 2004 01:15:59 +0000 (01:15 +0000)]
Style(9) cleanup:

- Remove `register' keywords.
- Single space after `switch'.
- No functional changes.

17 years agoPanic in udp_output() if a socket is found in an inconsistent state.
Jeffrey Hsu [Mon, 31 May 2004 23:53:14 +0000 (23:53 +0000)]
Panic in udp_output() if a socket is found in an inconsistent state.

17 years agoRemove unused error variable.
Eirik Nygaard [Mon, 31 May 2004 20:48:41 +0000 (20:48 +0000)]
Remove unused error variable.

Submitted-by: Dheeraj Reddy <dheerajs@comcast.net>
17 years agoSince RNDC does not yet support 'restart', use RCNG to restart named
Matthew Dillon [Mon, 31 May 2004 17:52:30 +0000 (17:52 +0000)]
Since RNDC does not yet support 'restart', use RCNG to restart named
instead of rolling our own.

Suggested-by: Brad Harvell <dfbrad@whatzit.org>
17 years agoFix the path to named's pid file.
Matthew Dillon [Mon, 31 May 2004 17:51:47 +0000 (17:51 +0000)]
Fix the path to named's pid file.

Submitted-by: Brad Harvell <dfbrad@whatzit.org>
17 years agoWhen doing a restart, sleep for 0.1 seconds after the kill to avoid racing
Matthew Dillon [Mon, 31 May 2004 17:50:39 +0000 (17:50 +0000)]
When doing a restart, sleep for 0.1 seconds after the kill to avoid racing
the kill in wait_for_pids() (which imposes a 2 second delay when the race
is lost).

17 years agoIn the root fs search use the correct unit number when checking for
Matthew Dillon [Mon, 31 May 2004 17:38:08 +0000 (17:38 +0000)]
In the root fs search use the correct unit number when checking for
device existinance.  The new device infrastructure often registers disk
unist separately, so looking up unit 0 when only unit N exists will not
succeed.  We might want to later augment this with the slice and partition
number (which are 0 at the time the search is made prior to the real lookup),
but this should work for now.

Submitted-by: Hiroki Sato <hrs@allbsd.org>
17 years agoTwo unused arguments were recently removed from pmap_init() without
Matthew Dillon [Mon, 31 May 2004 17:06:41 +0000 (17:06 +0000)]
Two unused arguments were recently removed from pmap_init() without
fixing the call or the prototype.  Fix those.

Reported-by: walt <wa1ter@myrealbox.com>
17 years agoDo not use the display function if the -o (opaque) or -x (hexdump)
Hiten Pandya [Mon, 31 May 2004 14:59:34 +0000 (14:59 +0000)]
Do not use the display function if the -o (opaque) or -x (hexdump)
arguments were provided to sysctl(8).

The display function is used when a sysctl node is registered as
`special' in sysctl(8), so instead of showing the normal "var:val"
output, it would format the values instead.  E.g. vm.loadavg.

17 years agoRemove an unimplemented advisory function, pmap_pageable(); there is
Hiten Pandya [Mon, 31 May 2004 11:43:49 +0000 (11:43 +0000)]
Remove an unimplemented advisory function, pmap_pageable(); there is
no pmap implementation in existance that requires it implemented.

Discussed-with:  Alan Cox <alc at freebsd.org>,
                 Matthew Dillon <dillon at backplane.com>

17 years agoRemove a stale comment: PG_DIRTY and PG_FILLED were removed in
Hiten Pandya [Mon, 31 May 2004 01:51:23 +0000 (01:51 +0000)]
Remove a stale comment: PG_DIRTY and PG_FILLED were removed in
revisions 1.17 and 1.12 respectively.

Noticed-by: Alan Cox <alc at freebsd.org>
17 years agoForce commit to clarify that the previous revision should have been
Hiten Pandya [Sat, 29 May 2004 09:53:58 +0000 (09:53 +0000)]
Force commit to clarify that the previous revision should have been
credited to:

YONETANI Tomokazu <qhwt+dragonfly-commit at les.ath.cx>

17 years agoAdjust include path so that the machine.h in ${.OBJDIR} is used
Hiten Pandya [Sat, 29 May 2004 09:51:43 +0000 (09:51 +0000)]
Adjust include path so that the machine.h in ${.OBJDIR} is used
instead of the one in src/contrib/top.

17 years agoFirst pass at updating top(1):
Hiten Pandya [Sat, 29 May 2004 05:11:15 +0000 (05:11 +0000)]
First pass at updating top(1):

* add command line option '-T' for displaying kernel threads
  such as pagedaemon, tcp_thread, and so on; the threads are
  now marked '<thread>' in the top(1) display.

* cleanup manipulation of COMMAND strings, insipired by a
  similar change in NetBSD's top(1).

* add a toggle for system processes, called 'S' so we dont
  need to restart top(1) to {un}display system processes.

* change some sprintf's to snprintfs for safety.

* update the sort/ordering top(1) commands so that it correctly
  displays kernel threads by priority time used etc.

* add a 'thr' sort order function so that kernel threads can be
  collected together in the top(1) display; this is useful when
  running it in batch mode.

* fix the screen width issue for terminals that have more than
  80 columns; this was necessary for showing threads properly in
  SMP mode.

* add ability for top(1) to sort kernel threads their priority
  (note, thread priorities are stored differently).

NOTE! top(1) is now using the contrib-patching framework just like
we do with GCC-3 so that it will be simple to update the base code
in the future if required.

Thanks go to Matthew Dillon <dillon@backplane.com> for reviewing the
patches and supplying me with an SMP machine to test the changes.

17 years agoMake sysctl_kern_proc() iterate through available cpus to retrieve the
Matthew Dillon [Sat, 29 May 2004 02:47:50 +0000 (02:47 +0000)]
Make sysctl_kern_proc() iterate through available cpus to retrieve the
list of threads installed on each one rather then just retrieve the threads
on the cpu it happens to have been called from.

To accomplish this, sysctl_kern_proc() now uses the new LWKT API to
migrate itself to each target cpu in order to safely access the thread
list on that cpu, ending up on the same cpu it started from.  The overhead
is nasty to be sure, but who cares when only 'top' and 'ps' and related
non-critical utilities use the feature?

17 years agooops.
David Rhodus [Fri, 28 May 2004 20:30:18 +0000 (20:30 +0000)]
make `pkg_add -r XFree86` work again by changing the Latest path back.

17 years agoAdd lwkt_setcpu_self(), a function which migrates the current thread to
Matthew Dillon [Fri, 28 May 2004 08:37:34 +0000 (08:37 +0000)]
Add lwkt_setcpu_self(), a function which migrates the current thread to
the specified cpu.  This will soon be used by sysctl_kern_proc() to
collect thread information across all available cpus (because it is only
legal to manipulate a thread on the cpu it belongs to).

Yes, you heard that right and, yes, the overhead is nasty... one whole
microsecond per cpu at least, possibly even two.  But who cares for
something like 'ps'?

In-conversation-with: Hiten Pandya <hmp@freebsd.org>

17 years agoInitialize the FP unit earlier in the AP boot sequence. This solves
Matthew Dillon [Thu, 27 May 2004 19:21:49 +0000 (19:21 +0000)]
Initialize the FP unit earlier in the AP boot sequence.  This solves
reported problems on MP systems not booting with mmxopt=1 .

Reported-by: Many. Thanks to David Rhodus for testing and debugging!
17 years agoAttach bind-9.2.4rc4 to the base system. Rip out bind-8 binaries and add
Matthew Dillon [Thu, 27 May 2004 18:15:43 +0000 (18:15 +0000)]
Attach bind-9.2.4rc4 to the base system.  Rip out bind-8 binaries and add
in / adjust for most bind-9 binaries.  Note that some pre-generated header
files have been hacked into /usr/src/usr.sbin/named and might have to be
regenerated from the original distribution when incorporating updates to
bind.  But, for the most part, the build is clean.

Clean up rc.d/named and etc/defaults/rc.conf, add a README file to
/etc/namedb describing setup requirements, and change the default
named.conf file and RCNG variables to (if named is enabled) run named in
a chrooted environment as user 'bind'.  Adapt the 'getroot' script that
I have used for many years to provide a better root.zone master methodology
instead of the root hints file that has been traditionally shipped.

Adjust the mtree files and distrib-dirs target to create the necessary
infrastructure in /etc/namedb for handling a chrooted named.

NOTE: bind-8 had 'ndc' and 'named-xfer'.  bind-8 has rndc and there is no
named-xfer (it is builtin to named).  nslookup still exists but is deprecated
in favor of 'dig', and the old dnskeygen/dnsquery mechanism has been replaced
by the newer dnssec-* mechanism.