dragonfly.git
14 years agoatc - Fix bug related to delayed command and altitude change
Matthias Schmidt [Sun, 20 Dec 2009 09:05:20 +0000 (10:05 +0100)]
atc - Fix bug related to delayed command and altitude change

When playing atc, if a plane has a delayed turn command, and you issue
an altitude command that would send the plane to the same altitude to
which it is already going, the delay is disabled and the plane turns
immediately.

Fix is from OpenBSD (PR 3448).

Discussed-with: swildner@
Provided-by: 26c3
14 years agomd(4) - Several fixes to make the module loading/unloading work properly.
Antonio Huete Jimenez [Tue, 29 Dec 2009 17:31:35 +0000 (18:31 +0100)]
md(4) - Several fixes to make the module loading/unloading work properly.

Previously, md(4) crashed the system. It produced inconsistencies due
it wasn't registered as a module, thus allowing to be kldloaded even
when it was compiled in on kernel.

Reported-by  : Sascha Wildner and many people
Lots-of-help : Alex Hornung
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue174>

14 years agoinstaller: Fix the manual configuration of lnc(4) in VMware.
Sascha Wildner [Mon, 28 Dec 2009 20:51:17 +0000 (21:51 +0100)]
installer: Fix the manual configuration of lnc(4) in VMware.

7daaee58e8b828a4951bb466c19b066381826d2c fixed the DHCP case but not the
manual configuration case. Apply a similar fix there.

While here, move the DHCP fix a bit up, just to look similar in both
cases.

However, the exact issue hasn't been found yet. We don't know why string
is junk in VMware before these fixes, as nothing before the old location
of the asprintf() seems to modify it.

In-discussion-with: matthias

14 years agokernel - MPSAFE stabilization
Matthew Dillon [Mon, 28 Dec 2009 17:15:25 +0000 (09:15 -0800)]
kernel - MPSAFE stabilization

* Fix for 'panic: sysref_activate: bad count 00000002'.  Mistakenly
  assumed the lockmgr lock was sufficient protection but forgot it
  might be acquired LK_SHARED.  Extend v_spinlock protection to fix
  the problem.

14 years agokernel - fine-grained namecache and partial vnode MPSAFE work
Matthew Dillon [Mon, 28 Dec 2009 06:36:07 +0000 (22:36 -0800)]
kernel - fine-grained namecache and partial vnode MPSAFE work

Namecache subsystem

* All vnode->v_flag modifications now use vsetflags() and vclrflags().
  Because some flags are set and cleared by vhold()/vdrop() which
  do not require any locks to be held, all modifications must use atomic
  ops.

* Clean up and revamp the namecache MPSAFE work.  Namecache operations now
  use a fine-grained MPSAFE locking model which loosely follows these
  rules:

  - lock ordering is child to parent.  e.g. lock file, then lock parent
    directory.  This allows resolver recursions up the parent directory
    chain.

  - Downward-traversing namecache invalidations and path lookups will
    unlock the parent (but leave it referenced) before attempting to
    lock the child.

  - Namecache hash table lookups utilize a per-bucket spinlock.

  - vnode locks may be acquired while holding namecache locks but not
    vise-versa.  VNodes are not destroyed until all namecache references
    go away, but can enter reclamation.  Namecache lookups detect the case
    and re-resolve to overcome the race.  Namecache entries are not
    destroyed while referenced.

* Remove vfs_token, the namecache MPSAFE model is now totally fine-grained.

* Revamp namecache locking primitves (cache_lock/cache_unlock and
  friends).  Use atomic ops and nc_exlocks instead of nc_locktd and
  build-in a request flag.  This solves busy/tsleep races between lock
  holder and lock requester.

* Revamp namecache parent/child linkages.  Instead of using vfs_token to
  lock such operations we simply lock both child and parent namecache
  entries.  Hash table operations are also fully integrated with the
  parent/child linking operations.

* The vnode->v_namecache list is locked via vnode->v_spinlock, which
  is actually vnode->v_lock.lk_spinlock.

* Revamp cache_vref() and cache_vget().  The passed namecache entry must
  be referenced and locked.  Internals are simplified.

* Fix a deadlock by moving the call to _cache_hysteresis() to a
  place where the current thread otherwise does not hold any locked
  ncp's.

* Revamp nlookup() to follow the new namecache locking rules.

* Fix a number of places, e.g. in vfs/nfs/nfs_subs.c, where ncp->nc_parent
  or ncp->nc_vp was being accessed with an unlocked ncp.  nc_parent
  and nc_vp accesses are only valid if the ncp is locked.

* Add the vfs.cache_mpsafe sysctl, which defaults to 0.  This may be set
  to 1 to enable MPSAFE namecache operations for [l,f]stat() and open()
  system calls (for the moment).

VFS/VNODE subsystem

* Use a global spinlock for now called vfs_spin to manage vnode_free_list.
  Use vnode->v_spinlock (and vfs_spin) to manage vhold/vdrop ops and
  to interlock v_auxrefs tests against vnode terminations.

* Integrate per-mount mnt_token and (for now) the MP lock into VOP_*()
  and VFS_*() operations.  This allows the MP lock to be shifted further
  inward from the system calls, but we don't do it quite yet.

* HAMMER: VOP_GETATTR, VOP_READ, and VOP_INACTIVE are now MPSAFE.  The
  corresponding sysctls have been removed.

* FIFOFS: Needed some MPSAFE work in order to allow HAMMER to make things
  MPSAFE above, since HAMMER forwards vops for in-filesystem fifos to
  fifofs.

* Add some debugging kprintf()s when certain MP races are averted, for
  testing only.

MISC

* Add some assertions to the VM system.

* Document existing and newly MPSAFE code.

14 years agokgdb - Fix kernel trapframe backtraces for i386
Matthew Dillon [Mon, 28 Dec 2009 02:19:59 +0000 (18:19 -0800)]
kgdb - Fix kernel trapframe backtraces for i386

* A recent gdb update removed our stack frame sniffer hooks,
  add them back in for i386.

* I got trapframe to work properly for i386.  I dunno about
  interrupt frames.

14 years agoInstall mandoc_char.7 because mandoc.1 references it.
Sascha Wildner [Sun, 27 Dec 2009 21:21:21 +0000 (21:21 +0000)]
Install mandoc_char.7 because mandoc.1 references it.

14 years agodevelopment.7: Adjust targets.
Sascha Wildner [Sun, 27 Dec 2009 20:44:17 +0000 (20:44 +0000)]
development.7: Adjust targets.

14 years agohammer volume - Serialize volume operations
Michael Neumann [Sun, 27 Dec 2009 18:28:21 +0000 (19:28 +0100)]
hammer volume - Serialize volume operations

Only one hammer volume-add or hammer volume-del operation
is allowed at the same time per mount.

While for volume-add operations it is not strictly needed, it is
absolutely required for the reblocking phase of the volume-del
operation.

14 years agokernel - Correct bug in cache_fullpath()
Matthew Dillon [Sun, 27 Dec 2009 16:40:19 +0000 (08:40 -0800)]
kernel - Correct bug in cache_fullpath()

* cache_copy() needs to check for a NULL ncp

Reported-by: Stathis Kamperis
14 years agokernel - fix improper VOP_*() calls on dead vnode
Matthew Dillon [Sun, 27 Dec 2009 09:06:48 +0000 (01:06 -0800)]
kernel - fix improper VOP_*() calls on dead vnode

* Certain degenerate cases were trying to make dead vnodes
  inactive.  Fixes vp->v_mount a panic.

* It is possible that more such cases will leak out of the woodwork.

Reported-by: Stathis Kamperis
14 years agokernel - Add per-mount token to replace mplock.
Matthew Dillon [Sun, 27 Dec 2009 02:12:56 +0000 (18:12 -0800)]
kernel - Add per-mount token to replace mplock.

* Fix issues with dupfdopen() not being MPSAFE.

* Implement a dummy mount structure for devfs-synthesized vnodes prior
  to the root mount.

* Wrap all VFS_*() calls, including vfs_init() and vfs_uninit(), to
  acquire the per-mount token if not flagged as being MPSAFE.

* Wrap all VOP_*() calls to acquire the per-mount token if not flagged
  as being MPSAFE.

* Move VOP_READ/VOP_WRITE MPSAFE flags to the mount structure.

* Make fifoops MPSAFE (so HAMMER can flag read & write as being
  MPSAFE generally).

* The VFS code currently also acquires the MP lock when not MPSAFE
  (there are things called by VFSes which are not yet MPSAFE), except
  for read() and write().

14 years agovesa(4): Remove some old prototypes.
Sascha Wildner [Wed, 23 Dec 2009 06:36:04 +0000 (07:36 +0100)]
vesa(4): Remove some old prototypes.

14 years agomptable(1): Only suggest to try -grope when -grope wasn't used.
Sascha Wildner [Thu, 24 Dec 2009 21:52:52 +0000 (21:52 +0000)]
mptable(1): Only suggest to try -grope when -grope wasn't used.

14 years agonrelease: Adjust a little for x86_64.
Sascha Wildner [Thu, 24 Dec 2009 21:00:16 +0000 (21:00 +0000)]
nrelease: Adjust a little for x86_64.

14 years agox86_64: Fix a warning.
Sascha Wildner [Thu, 24 Dec 2009 02:07:06 +0000 (02:07 +0000)]
x86_64: Fix a warning.

14 years agoDecrement prisoncount on error
Michael Neumann [Wed, 23 Dec 2009 11:41:21 +0000 (12:41 +0100)]
Decrement prisoncount on error

14 years agosignal.h - Rename 'union sigval' members to fit requirements in SuSv2 and POSIX.
Antonio Huete Jimenez [Mon, 21 Dec 2009 22:27:20 +0000 (23:27 +0100)]
signal.h - Rename 'union sigval' members to fit requirements in SuSv2 and POSIX.

Also leave the old members there to keep compatibility.

Taken-from: FreeBSD

14 years agoacpi_thermal.4: Revert a bit (temperatures are still in 10ths of Kelvin).
Sascha Wildner [Tue, 22 Dec 2009 22:42:56 +0000 (23:42 +0100)]
acpi_thermal.4: Revert a bit (temperatures are still in 10ths of Kelvin).

14 years agoFix some x86_64 warnings in the kernel (and remove nowerror).
Sascha Wildner [Tue, 22 Dec 2009 16:06:37 +0000 (17:06 +0100)]
Fix some x86_64 warnings in the kernel (and remove nowerror).

14 years agohammer(8): Add -X to usage().
Sascha Wildner [Tue, 22 Dec 2009 13:55:53 +0000 (14:55 +0100)]
hammer(8): Add -X to usage().

Submitted-by: Dylan Reinhold <dylan@ocnetworking.com>
14 years agoacpi_hp.4 & mandoc.1: mdoc fluff
Sascha Wildner [Tue, 22 Dec 2009 13:41:24 +0000 (14:41 +0100)]
acpi_hp.4 & mandoc.1: mdoc fluff

14 years agoaio: Make sysconf() report correct value.
Stathis Kamperis [Mon, 21 Dec 2009 20:42:39 +0000 (22:42 +0200)]
aio: Make sysconf() report correct value.

Issue 6 says that _POSIX_ASYNCHRONOUS_IO shall be defined equal to
-1, 0, or 200112L. But sysconf() shall report either -1 or 200112L.

We provide headers, data types and functions for the AIO interface,
but not any actual implementation. This means that the symbol
_POSIX_ASYNCHRONOUS_IO shall be 0 (it is already) and sysconf()
shall return -1 (it didn't until now).

14 years agoSync zoneinfo database with tz{code,data}2009t from elsie.
Sascha Wildner [Mon, 21 Dec 2009 18:40:48 +0000 (19:40 +0100)]
Sync zoneinfo database with tz{code,data}2009t from elsie.

Theory:         8.3  -> 8.4
asia:           8.44 -> 8.48
europe:         8.24 -> 8.25
zone.tab:       8.29 -> 8.31

Theory      "Calendrical Calculations" updated (thanks to Steve Ward).
asia        Hong Kong comments corrected; Xinjiang comments added.
europe      Russian region comments updated (thanks to Oscar van Vlijmen)
zone.tab    version change only

14 years agokernel - Fix atomic ops for x86_64 kernel build
Matthew Dillon [Mon, 21 Dec 2009 18:19:28 +0000 (10:19 -0800)]
kernel - Fix atomic ops for x86_64 kernel build

* atomic*_ptr functions were not casting arguments to long, resulting
  in compile-time errors.

14 years agoHAMMER Utility - Add ssh compression option
Matthew Dillon [Mon, 21 Dec 2009 17:29:49 +0000 (09:29 -0800)]
HAMMER Utility - Add ssh compression option

* Unfortunately the utility already uses -C, so the new option is -X

* For the moment the utility has no visibility on the actual
  over-the-wire bandwidth used and any specified bandwidth limits
  will apply to the uncompressed data stream.

14 years agokernel - namecache MPSAFE work
Matthew Dillon [Mon, 21 Dec 2009 16:15:18 +0000 (08:15 -0800)]
kernel - namecache MPSAFE work

* Most of the MPSAFE coding required for namecache operation.  The MP
  lock still surrounds this code.

* Use a per-bucket spinlock for nchashtbl[] lookups.

* Use a global spinlock for ncneglist.

* Use a global token for nc_parent interlocks.

* Use a per-vnode spinlock (v_spinlock == v_lock.lk_spinlock) to
  manage access to the v_namecache list.

* Recode namecache locks to use atomic_cmpset_ptr() based around
  nc_locktd instead of nc_exlocks.  nc_exlocks is still used to
  track the exclusive lock count.

  NOTE: There may be an issue with the way nc_lockreq is handled.

* Recode cache_hold/drop to use atomic_cmpset_int().

* Carefully code cache_zap() for MPSAFEness.  In particular, multiple
  locks must be held before it can be determined that a namecache
  structure no longer has any referers.  Here is where having the global
  token is really useful.

* cache_fullpath() and vn_fullpath() previously assumed the good graces
  of the MP lock and didn't bother holding refs on the namecache pointers
  they were traversing.  Now they do.

* nlookup*() functions also previously made assumptions with regards
  to holding refs.  Now they properly hold refs.

* struct namecache's nc_flag field is no longer modified outside of
  holding a lock on the structure, so we do not have to resort to
  atomic ops.

14 years agokernel - Split an assertion in the sysref code to make it MPSAFE
Matthew Dillon [Mon, 21 Dec 2009 16:13:47 +0000 (08:13 -0800)]
kernel - Split an assertion in the sysref code to make it MPSAFE

* An assertion in the sysref code was not MPSAFE.  Test SRF_ALLOCATED
  after we have determined that the object is completely free.

14 years agoRemove the JG64 kernel config (a subset of X86_64_GENERIC).
Sascha Wildner [Mon, 21 Dec 2009 11:44:35 +0000 (12:44 +0100)]
Remove the JG64 kernel config (a subset of X86_64_GENERIC).

Adjust the x86_64 test framework which was the last place where it was used.

14 years agoMisc. manpage cleanup for the recent T/TCP removal.
Sascha Wildner [Sat, 12 Dec 2009 08:43:31 +0000 (09:43 +0100)]
Misc. manpage cleanup for the recent T/TCP removal.

14 years agocrypto - Mark cryptodev ioctl as MPSAFE
Alex Hornung [Mon, 21 Dec 2009 08:27:41 +0000 (08:27 +0000)]
crypto - Mark cryptodev ioctl as MPSAFE

* Mark the cryptodev (/dev/crypto) ioctl as MPSAFE.

14 years agokern_memio - mark dev_ops READ and WRITE MPSAFE
Alex Hornung [Mon, 21 Dec 2009 08:26:09 +0000 (08:26 +0000)]
kern_memio - mark dev_ops READ and WRITE MPSAFE

* Mark read and write dev ops as being MPSAFE. This affects urandom,
  random, zero, null, mem, kmem.

14 years agodevfs - Introduce MPSAFE read/write/ioctl support
Alex Hornung [Mon, 21 Dec 2009 08:22:46 +0000 (08:22 +0000)]
devfs - Introduce MPSAFE read/write/ioctl support

* Add D_MPSAFE_READ, D_MPSAFE_WRITE and D_MPSAFE_IOCTL defines for use
  with the dev_ops structure to mark the read,write and/or ioctl methods
  as mpsafe.

* Change devfs so that it won't acquire the mplock for
  read/writes/ioctls that are marked as MPSAFE.

* Add some statistics under sysctl vfs.devfs about the number of read
  and writes done with the mplock and without it.

* While here, MPSAFE specf_stat in devfs so it doesn't acquire the
  mplock anymore as it doesn't even need it.

14 years agokernel - lwkt_token code, minor fix to last commit
Matthew Dillon [Mon, 21 Dec 2009 05:34:02 +0000 (21:34 -0800)]
kernel - lwkt_token code, minor fix to last commit

* lwkt_getalltokens() has to release any partially acquired tokens
  when it fails to get them all.  Fixes an issue with the last commit
  that could cause processes to get stuck in a Run state.

14 years agokernel - Refactor the lwkt_token code, making it faster
Matthew Dillon [Mon, 21 Dec 2009 03:33:07 +0000 (19:33 -0800)]
kernel - Refactor the lwkt_token code, making it faster

* Rewrite the core token functions and revamp the structures.  The
  lwkt_token structure now contains just a single element, a pointer
  to the on-stack lwkt_tokref.  The lwkt_tokref now contains the
  owner id.

* Recursive tokens are still fully supported and coded trivially.

* Critical sections and spinlocks are no longer needed or used by
  the lwkt_token code.  Token aquisition is basically a single
  atomic_cmpset_ptr() call in the critical path.  Everything runs
  ultra clean now.

* Improve the pool token API.

* Remove extranious cruft

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Mon, 21 Dec 2009 03:23:12 +0000 (19:23 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoSilence -Wold-style-definition in a number of places in the kernel.
Sascha Wildner [Sun, 20 Dec 2009 23:02:13 +0000 (00:02 +0100)]
Silence -Wold-style-definition in a number of places in the kernel.

14 years agokernel - jails - undo minor prisoncount atomic ops
Matthew Dillon [Sun, 20 Dec 2009 23:02:24 +0000 (15:02 -0800)]
kernel - jails - undo minor prisoncount atomic ops

* cleanup, the functions in question aren't MPSAFE yet anyway.

14 years agofsmid followup - fix compiler warning in ls
Matthew Dillon [Sun, 20 Dec 2009 22:43:47 +0000 (14:43 -0800)]
fsmid followup - fix compiler warning in ls

* Fix an unused variable warning that was causing buildworld to
  fail (due to WARNS options).

14 years agomake.conf.5: Note that NO_WERROR applies to the kernel build as well.
Sascha Wildner [Sun, 20 Dec 2009 21:57:00 +0000 (22:57 +0100)]
make.conf.5: Note that NO_WERROR applies to the kernel build as well.

14 years agokernel - remove FSMID support
Matthew Dillon [Sun, 20 Dec 2009 18:20:50 +0000 (10:20 -0800)]
kernel - remove FSMID support

* Remove all the fsmid stuff.  I never got it working 100% (e.g. such as
  when hardlinks are present) and it really complicates the MPSAFE work
  on the namecache.

* Remove struct stat->st_fsmid (replace with a spare field)

* Comment out the _ST_FSMID_PRESENT_ flag.  Userland conditionalizes
  on the flag so it should still build.

* The kqueue vnode monitoring feature is good enough and more portable.

14 years agotop(1): Merge top.x and top.local.1 into one manual page.
Sascha Wildner [Sun, 20 Dec 2009 15:46:34 +0000 (16:46 +0100)]
top(1): Merge top.x and top.local.1 into one manual page.

14 years agotop: Describe new output "CTIME" in man page.
Jan Lentfer [Sun, 20 Dec 2009 15:05:15 +0000 (16:05 +0100)]
top: Describe new output "CTIME" in man page.

14 years agoAdd some missing ACPI source files (for LINT).
Sascha Wildner [Sun, 20 Dec 2009 14:24:08 +0000 (15:24 +0100)]
Add some missing ACPI source files (for LINT).

14 years agoFix acpi (loading it failed).
Sascha Wildner [Sun, 20 Dec 2009 14:22:58 +0000 (15:22 +0100)]
Fix acpi (loading it failed).

Reported-by: alexh
14 years agoAdd a BUS_ADD_CHILD.9 manual page (adapted from FreeBSD).
Sascha Wildner [Sun, 20 Dec 2009 14:02:51 +0000 (15:02 +0100)]
Add a BUS_ADD_CHILD.9 manual page (adapted from FreeBSD).

14 years agombuf.9: We have neither the MFREE() nor M_COPY_PKTHDR() macros.
Sascha Wildner [Sun, 20 Dec 2009 13:24:23 +0000 (14:24 +0100)]
mbuf.9: We have neither the MFREE() nor M_COPY_PKTHDR() macros.

14 years agohash.9: Improve wording.
Sascha Wildner [Sun, 20 Dec 2009 13:11:36 +0000 (14:11 +0100)]
hash.9: Improve wording.

14 years agohash.9: Update the manual page for the *_ext() functions.
Sascha Wildner [Sun, 20 Dec 2009 13:04:05 +0000 (14:04 +0100)]
hash.9: Update the manual page for the *_ext() functions.

14 years agoFix UP kernel build.
Sascha Wildner [Sun, 20 Dec 2009 11:28:28 +0000 (12:28 +0100)]
Fix UP kernel build.

14 years agokernel - add hashinit_ext() and phashinit_ext()
Matthew Dillon [Sun, 20 Dec 2009 08:13:38 +0000 (00:13 -0800)]
kernel - add hashinit_ext() and phashinit_ext()

* Add hashinit_ext() and phashinit_ext(), extended versions of
  hashinit() and phashinit() which take a structure size and zero
  the array instead of assuming it is only an array of LIST_HEAD's.

14 years agokernel - misc MPSAFe work
Matthew Dillon [Sun, 20 Dec 2009 06:18:37 +0000 (22:18 -0800)]
kernel - misc MPSAFe work

* prisoncount, prison_hold(), and prison_free() are now MPSAFE

* Remove spinlock from ucred

* Fix cr_ref race in crfree(), and crfree() is now fully MPSAFE.

* cache_hold(), cache_copy(), cache_changemount() are now MPSAFE.

* cache_drop() is not yet MPSAFE in the 1->0 transition case.

* nlookup_init() is now MPSAFE

14 years agokernel - Move mplock to machine-independent C
Matthew Dillon [Sun, 20 Dec 2009 02:57:32 +0000 (18:57 -0800)]
kernel - Move mplock to machine-independent C

* Remove the per-platform mplock code and move it all into
  machine-independent code: sys/mplock2.h and kern/kern_mplock.c.

* Inline the critical path.

* When a conflict occurs kern_mplock.c will KTR log the file and line
  number of both the holder and conflicting acquirer.  Set
  debug.ktr.giant_enable=-1 to enable conflict logging.

14 years agoktrdump - Parse format string manually, implement %s
Matthew Dillon [Sun, 20 Dec 2009 02:28:39 +0000 (18:28 -0800)]
ktrdump - Parse format string manually, implement %s

* Allows %s to be used in KTR format strings in-kernel.  ktrdump will
  read the string out via KVM and print it.

* We parse the format string manually, so we may have to add stuff as
  time goes on.

14 years agobusdma - Fix bouncebuffer operation for 64 bit builds / mountroot & boot issues
Matthew Dillon [Sat, 19 Dec 2009 20:00:46 +0000 (12:00 -0800)]
busdma - Fix bouncebuffer operation for 64 bit builds / mountroot & boot issues

* BUF_SPACE_MAXADDR was incorrectly defined for 64 bit builds, effectively
  disabling bounce buffers.  Fixed.

* This created issues with drivers (particularly NATA) which only support
  32 bit physical addresses, causing x86_64 machines to fail to boot or
  to blow up.

Reported-by: several people
14 years agosignal - Introduce si_code codes
Alex Hornung [Sat, 19 Dec 2009 10:11:28 +0000 (10:11 +0000)]
signal - Introduce si_code codes

* Introduce si_code codes #defines for signals.

* Assign proper si_code for most traps.

* Get rid of x86_64-only si_code code #defines.

* This also fixes build of pkgsrc devel/boost-libs

Dragonfly-bug: http://bugs.dragonflybsd.org/issue1313

14 years agotop: Remove WCPU, implement CTIME.
Jan Lentfer [Sat, 19 Dec 2009 12:04:17 +0000 (13:04 +0100)]
top: Remove WCPU, implement CTIME.
     * WCPU is a quite useless value for a long time,
       thus it has been replaced with
     * CTIME, which presents the same value as 'ps -S'
       does for the CPU value. This is the process's own
       cpu time plus the cpu time of it's exited child
       processes

14 years agoFix buildworld with -DNDEBUG in CFLAGS.
Sascha Wildner [Fri, 18 Dec 2009 21:10:57 +0000 (22:10 +0100)]
Fix buildworld with -DNDEBUG in CFLAGS.

ANSI C requires that if NDEBUG is defined, assert(3) shall be disabled,
that is, defined "((void)0)".

The usage of NDEBUG in libevent is not related to assert(3), so simply
remove the #ifdef's (as was done upstream in later versions of
libevent).

14 years agoexamples/kld - Fix for devfs.
Joe Talbott [Fri, 18 Dec 2009 15:56:46 +0000 (10:56 -0500)]
examples/kld - Fix for devfs.

Remove dev_ops_{add,remove} and remove mknod from Makefile.

14 years agoCONFIG - untangle whitespace mess
Alex Hornung [Fri, 18 Dec 2009 10:22:33 +0000 (10:22 +0000)]
CONFIG - untangle whitespace mess

* fix whitespace mess introduced by previous commit.

14 years agoCONFIG - add NULLFS
Alex Hornung [Fri, 18 Dec 2009 09:39:37 +0000 (09:39 +0000)]
CONFIG - add NULLFS

* add option NULLFS to all kernel config files, as nullfs is more or
  less a requirement for a hammer system due to pfs.

* Incidentally this solves problems when mounting /usr and other PFS
  when the modules are out of sync with the kernel; for example after a
  bad buildkernel and using an old kernel.

Discussed-With: Matt Dillon

14 years agodump - rename md dumpsys to md_dumpsys
Alex Hornung [Fri, 18 Dec 2009 08:54:21 +0000 (08:54 +0000)]
dump - rename md dumpsys to md_dumpsys

* Rename the machine dependent dumpsys() to md_dumpsys().

* Add dumpsys() which takes no arguments, giving backward compatibility
  and the possibility to use 'call dumpsys' from the ddb> prompt.
  dumpsys() then calls md_dumpsys(), except for vkernels.

14 years agodevfs - Populate getattr va_size for disks properly
Alex Hornung [Thu, 17 Dec 2009 15:29:15 +0000 (15:29 +0000)]
devfs - Populate getattr va_size for disks properly

* As getattr() va_size is used for lseek SEEK_END, we need to set
  va_size for disk devices to the underlying device's media size.

* Beware that *stat() will not be affected, and st_size will remain
  the size of the devfs_node structure, as it has been so far.

Dragonfly-bug: http://bugs.dragonflybsd.org/issue1632
Reported-by: Steve O'Hara-Smith
14 years agoncurses: Update master to work with v5.7 in contrib.
Jan Lentfer [Thu, 17 Dec 2009 14:57:20 +0000 (15:57 +0100)]
ncurses: Update master to work with v5.7 in contrib.

14 years agoMerge branch 'vendor/NCURSES'
Jan Lentfer [Thu, 17 Dec 2009 14:05:32 +0000 (15:05 +0100)]
Merge branch 'vendor/NCURSES'

14 years agovendor/NCURSES: Import v5.7 sources
Jan Lentfer [Thu, 17 Dec 2009 14:03:46 +0000 (15:03 +0100)]
vendor/NCURSES: Import v5.7 sources

14 years agoncurses: Update to work without version tag.
Jan Lentfer [Thu, 17 Dec 2009 13:56:13 +0000 (14:56 +0100)]
ncurses: Update to work without version tag.

14 years agoMerge branch 'vendor/NCURSES'
Jan Lentfer [Thu, 17 Dec 2009 13:17:25 +0000 (14:17 +0100)]
Merge branch 'vendor/NCURSES'

14 years agovendor/NCURSES: Remove version tag.
Jan Lentfer [Thu, 17 Dec 2009 13:10:54 +0000 (14:10 +0100)]
vendor/NCURSES: Remove version tag.

14 years agokern/kern_kinfo.c: Fix incorrect population of kinfo_proc.kp_cru
Jan Lentfer [Thu, 17 Dec 2009 08:18:50 +0000 (09:18 +0100)]
kern/kern_kinfo.c: Fix incorrect population of kinfo_proc.kp_cru

14 years agoFix some warnings that creep up when compiling without INVARIANTS.
Sascha Wildner [Wed, 16 Dec 2009 08:36:59 +0000 (09:36 +0100)]
Fix some warnings that creep up when compiling without INVARIANTS.

* Add a __debugvar define to <sys/systm.h> which is empty when INVARIANTS
  is set (default) and __attribute__((unused)) when INVARIANTS is not set.

* Use __debugvar in the declaration of variables which are only used in a
  KASSERT or KKASSERT to avoid 'unused variable' warnings.

Suggested-by: aggelos
Reported-by: Joel K. Petterson <joelkpettersson@gmail.com>
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1629>

14 years agoFix the SOEKRIS build (kernel without I686_CPU).
Sascha Wildner [Wed, 16 Dec 2009 08:22:35 +0000 (09:22 +0100)]
Fix the SOEKRIS build (kernel without I686_CPU).

14 years agoFix the LINT build.
Sascha Wildner [Wed, 16 Dec 2009 08:21:48 +0000 (09:21 +0100)]
Fix the LINT build.

14 years agoUnbreak HAMMER root mounts
Michael Neumann [Wed, 16 Dec 2009 00:10:40 +0000 (01:10 +0100)]
Unbreak HAMMER root mounts

Absolute device names in vfs.root.mountfrom where handled incorrectly.

Reported-by: aggelos
14 years agokernel - adjust falloc and arguments to dupfdopen, fsetfd, fdcheckstd
Matthew Dillon [Tue, 15 Dec 2009 20:31:02 +0000 (12:31 -0800)]
kernel - adjust falloc and arguments to dupfdopen, fsetfd, fdcheckstd

* Make changes to the pointer type passed (proc, lwp, filedesc) to
  numerous routines.

* falloc() needs access to td_ucred (it was previously using p_ucred which
  is not MPSAFE).

* Adjust fsetfd() to make it conform to the other fsetfd*() procedures.

* Related changes to fdcheckstd() and dupfdopen().

14 years agokernel - use new td_ucred in numerous places
Matthew Dillon [Tue, 15 Dec 2009 18:43:48 +0000 (10:43 -0800)]
kernel - use new td_ucred in numerous places

* Use curthread->td_ucred in numerous places, primarily system calls,
  where curproc->p_ucred was used before.

* Clean up local variable use related to the above.

* Adjust several places where p_ucred is replaced to properly deal
  with lwp threading races to avoid accessing and freeing a potentially
  stale ucred.

* Adjust static procedures in the ktrace code to generally take lwp
  pointers instead of proc pointers.

14 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Matthew Dillon [Tue, 15 Dec 2009 18:41:50 +0000 (10:41 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

14 years agoAdd -Werror to the kernel build.
Sascha Wildner [Tue, 15 Dec 2009 14:52:07 +0000 (15:52 +0100)]
Add -Werror to the kernel build.

* Add a new 'nowerror' keyword to config(8) for parsing the 'files' files.
  When specified, it will prevent the file from being compiled with
  -Werror.

  Note that files that have their own compile-with rules need "${WERROR}"
  added to get -Werror.

* Adjust all 'files' files accordingly: Set nowerror where we still warn
  (i386 or x86_64) and add "${WERROR}" to compile-with rules where it
  applies.

* Remove explicit -Werror-implicit-function-declaration setting as it is
  now useless (-Wimplicit-function-declaration is already part of -Wall).

You will need an updated config(8) (i.e., one that understands 'nowerror')
for this to work so don't forget to quick/buildworld before recompiling
the kernel. nativekernel users will have to update their host config(8).

NO_WERROR in /etc/make.conf applies here as well and turns off the setting
of -Werror for the kernel, too.

In-discussion-with: corecode, aggelos, and others

14 years agomp_machdep.c: Fix some warnings of the SMP without APIC_IO build.
Sascha Wildner [Tue, 15 Dec 2009 14:10:40 +0000 (15:10 +0100)]
mp_machdep.c: Fix some warnings of the SMP without APIC_IO build.

14 years agoLINT - clear a bunch of warnings
Alex Hornung [Tue, 15 Dec 2009 12:42:14 +0000 (12:42 +0000)]
LINT - clear a bunch of warnings

* Clear a bunch of warnings that appear when building LINT kernel.

14 years agoFix warning in the UP build.
Sascha Wildner [Tue, 15 Dec 2009 11:14:30 +0000 (12:14 +0100)]
Fix warning in the UP build.

14 years agokernel - Third time's the charm - move lwp_ucred to td_ucred
Matthew Dillon [Tue, 15 Dec 2009 08:24:00 +0000 (00:24 -0800)]
kernel - Third time's the charm - move lwp_ucred to td_ucred

* Easier access to the cached ucred via the thread structure instead of
  the lwp.

14 years agosavecore(8) - Update manpage
Alex Hornung [Tue, 15 Dec 2009 08:00:53 +0000 (08:00 +0000)]
savecore(8) - Update manpage

* Update savecore man page to reflect changes to the savecore utility itself.

Obtained-from: FreeBSD

14 years agokernel - Make adjustments to the per-lwp ucred
Matthew Dillon [Tue, 15 Dec 2009 04:40:54 +0000 (20:40 -0800)]
kernel - Make adjustments to the per-lwp ucred

* Rename lwp_syscall_ucred to lwp_ucred and move ucred synchronization
  from syscall2() to userenter().  It now runs on any user entry into
  the kernel, not just for system calls.

  NOTE: A VM fault from the kernel itself does not call userenter() and
        does not trigger another synchronization.  This is the behavior
we desire, to ensure that lwp_ucred is stable.

  There are numerous non-syscall cases (e.g. signal, fault, etc) where
  we may need to access a safe ucred.

* Remove the SMP conditional.  lwp_ucred is now tracked for both UP and SMP.
  There is no point optimizing this for UP since there is basically no cost
  for tracking lwp_ucred.

14 years agokernel - move proc->p_lock, add lwp ucred caching
Matthew Dillon [Tue, 15 Dec 2009 03:29:43 +0000 (19:29 -0800)]
kernel - move proc->p_lock, add lwp ucred caching

* Move p_lock out from the struct proc copy area, change it from a
  char to an int, and make PHOLD/PRELE MPSAFE.

* System calls now cache a read-only copy of p->p_ucred in
  lp->lwp_syscall_ucred.  This will be used by system call code
  to access the ucred in a MPSAFE manner.

14 years agovga(4): Simplify conditions for mode rejection somewhat.
Sascha Wildner [Mon, 14 Dec 2009 20:16:50 +0000 (21:16 +0100)]
vga(4): Simplify conditions for mode rejection somewhat.

When mapping the video parameter table to our mode_map, only reject modes
which are neither 40x25, 80x25 nor 80x30, instead of rejecting or accepting
the whole table based on comparing the initial mode's BIOS and power-up
register settings.

Add a VGA_KEEP_POWERON_MODE option which (when set) preserves the register
settings which were found for the initial mode upon power-on for switching
back to it (or some mode derived from it) from another mode. The power-on
settings are also taken for the initial mode in case the video parameter
table has no valid settings for it.

This is kinda similar to what's proposed in FreeBSD's kern/64114.

14 years agoperiodic - Don't include timestamps in e-mail output by default.
Joe Talbott [Mon, 14 Dec 2009 17:25:39 +0000 (12:25 -0500)]
periodic - Don't include timestamps in e-mail output by default.

14 years agoHAMMER Utility - fix unfreeable pointer in 'hammer info'
Matthew Dillon [Mon, 14 Dec 2009 16:30:08 +0000 (08:30 -0800)]
HAMMER Utility - fix unfreeable pointer in 'hammer info'

* Fix the construction of the mountedon variable to ensure the
  variable can be free()'d.

Reported-by: "Steve O'Hara-Smith" <steve@sohara.org>
Also-suggested-by: Antonio Huete Jimenez <ahuete.devel@gmail.com>
14 years agoHAMMER Utility - Fix seg-fault in hammer cleanup if blank lines in config
Matthew Dillon [Mon, 14 Dec 2009 16:01:57 +0000 (08:01 -0800)]
HAMMER Utility - Fix seg-fault in hammer cleanup if blank lines in config

* If the HAMMER config contained blank lines the hammer cleanup
  directive would seg-fault trying to parse it.

* Ignore blank lines.  Also ignore lines beginning with a '#' when
  parsing the config.

Reported-by: elekktretterr@exemail.com.au
14 years agosetlocale.3: Correct function name.
Sascha Wildner [Mon, 14 Dec 2009 04:37:36 +0000 (05:37 +0100)]
setlocale.3: Correct function name.

14 years agopnp.4: Comment out some docs (code either gone or #if 0'd).
Sascha Wildner [Mon, 14 Dec 2009 04:24:37 +0000 (05:24 +0100)]
pnp.4: Comment out some docs (code either gone or #if 0'd).

14 years agorman.9: Comment out documentation for rman_await_resource().
Sascha Wildner [Mon, 14 Dec 2009 03:38:51 +0000 (04:38 +0100)]
rman.9: Comment out documentation for rman_await_resource().

The code is #if 0'd too.

14 years agovcount.9: count_udev() no longer exists.
Sascha Wildner [Mon, 14 Dec 2009 03:27:35 +0000 (04:27 +0100)]
vcount.9: count_udev() no longer exists.

See aec8eea47f8acbdec20843e7d8e7bc6d4255cce3

14 years agopthread_rwlock_timedwrlock.3: Correct function name.
Sascha Wildner [Mon, 14 Dec 2009 03:06:04 +0000 (04:06 +0100)]
pthread_rwlock_timedwrlock.3: Correct function name.

14 years agosleep.9: Adjust for serialize_sleep() -> zsleep() rename.
Sascha Wildner [Mon, 14 Dec 2009 02:55:41 +0000 (03:55 +0100)]
sleep.9: Adjust for serialize_sleep() -> zsleep() rename.

See ed3f6624e9093425dd733be90efc696df86c9e0e

Also, sync the MLINKS with the manual page.

14 years agokernel - Move MP lock inward, plus misc other stuff
Matthew Dillon [Sun, 13 Dec 2009 20:19:30 +0000 (12:19 -0800)]
kernel - Move MP lock inward, plus misc other stuff

* Remove the MPSAFE flag from the syscalls.master file.  All system calls
  are now called without the MP lock held and will acquire the MP lock if
  necessary.

* Shift the MP lock inward.  Try to leave most copyin/copyout operations
  outside the MP lock.  Reorder some of the copyouts in the linux emulation
  code to suit.

  Kernel resource operations are MP safe.

  Process ucred access is now outside the MP lock but not quite MP safe
  yet (will be fixed in a followup).

* Remove unnecessary KKASSERT(p) calls left over from the time before
  system calls where prefixed with sys_*

* Fix a bunch of cases in the linux emulation code when setting groups
  where the ngrp range check is incorrect.

14 years agoRemove misleading comments
Michael Neumann [Sun, 13 Dec 2009 20:15:09 +0000 (21:15 +0100)]
Remove misleading comments

14 years agoHAMMER - Stabilize and refactor volume removal
Michael Neumann [Sun, 13 Dec 2009 18:56:55 +0000 (19:56 +0100)]
HAMMER - Stabilize and refactor volume removal

* Correctly handle already freed layer1 entries.
* Correclty avoid reallocation on the volume to be removed
  during reblocking.
* Erase volume header after removal so that trying to mount it
  afterwards will fail (otherwise mount will silently use it).

14 years agolibc: Some warning fixes.
Sascha Wildner [Sun, 13 Dec 2009 18:26:08 +0000 (19:26 +0100)]
libc: Some warning fixes.

14 years agoSync libc's un-namespace.h with namespace.h.
Sascha Wildner [Sun, 13 Dec 2009 16:19:57 +0000 (17:19 +0100)]
Sync libc's un-namespace.h with namespace.h.