dragonfly.git
19 years agoThe strings package passes back a pointer via brk_string() to internal
Matthew Dillon [Fri, 12 Nov 2004 21:46:09 +0000 (21:46 +0000)]
The strings package passes back a pointer via brk_string() to internal
memory, it should not be deallocated.  The memory is allocated in str_init()
and release in str_end() which are only called in main().

Submitted-by: Max Okumoto <okumoto@home>
Taken-from: FreeBSD/1.22

19 years agoRemove various forms of NULL, and cleanup types. This is a partial sync from
Matthew Dillon [Fri, 12 Nov 2004 21:41:54 +0000 (21:41 +0000)]
Remove various forms of NULL, and cleanup types.  This is a partial sync from
FreeBSD's make.

Submitted-by: Max Okumoto <okumoto@home>
19 years agoAdd a missing com_unlock() to the serial port drain test code. This code
Matthew Dillon [Fri, 12 Nov 2004 20:51:29 +0000 (20:51 +0000)]
Add a missing com_unlock() to the serial port drain test code.  This code
is necessary to detect non-existant serial ports on machines (such as the
eMachines laptop) which don't have any serial port hardware at all, but
the missing com_unlock() caused systems to crash in certain situations for
obvious reasons.

Many thanks to Glenn Johnson <glennpj@charter.net> for keeping on my back
about the issue and for testing the fix.  This should also fix the last of the
serial-port related bug reports stemming from the original 1.0A release.

19 years agoSwitch to OpenNTPD by default. For the moment, the documentation is
Joerg Sonnenberger [Fri, 12 Nov 2004 19:45:36 +0000 (19:45 +0000)]
Switch to OpenNTPD by default. For the moment, the documentation is
not in-sync, -S [Do not set the time immediately], because when a
default route exists, but DNS traffic is lost, the startup time is
*big*.

You can change this by overriding ntpd_flags in /etc/rc.conf.

19 years agoFix systat -netstat and remove the dependency on KVM for this part.
Joerg Sonnenberger [Fri, 12 Nov 2004 19:03:10 +0000 (19:03 +0000)]
Fix systat -netstat and remove the dependency on KVM for this part.

Submitted-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
19 years agoChange zconf.h and zlib.h to use underscored protection macros.
Joerg Sonnenberger [Fri, 12 Nov 2004 18:10:42 +0000 (18:10 +0000)]
Change zconf.h and zlib.h to use underscored protection macros.

Reported-by: Andrew Houghton <aah@roarmouse.org>
19 years agoForced commit, correct comment for last commit. 1.25 has nothing to do with
Matthew Dillon [Fri, 12 Nov 2004 17:50:56 +0000 (17:50 +0000)]
Forced commit, correct comment for last commit.  1.25 has nothing to do with
VFS and instead fixes an arithmatic overflow in the calculation of
(primarily) the nanoseconds field.  In particular, cputimer_freq64_nsec
cannot be multiplied much beyond cputimer_freq without overflowing.  The
overflow can result in a seriously incorrect nanoseconds field and mess up
ntpdate and pthreads, amoung other things.

19 years agoSpelling: Filesystem is one word.
David Rhodus [Fri, 12 Nov 2004 16:38:06 +0000 (16:38 +0000)]
Spelling: Filesystem is one word.

19 years agoQuiet tinderbox:
David Rhodus [Fri, 12 Nov 2004 16:34:00 +0000 (16:34 +0000)]
Quiet tinderbox:
Turn off the build for NULLFS, UMAPFS, UNION, CODA filesystems until
we have time to rework their VOP entry methods.

19 years agoDefault vfs.fastdev to 1 for wider testing, so the vnode bypass for device
Matthew Dillon [Fri, 12 Nov 2004 10:58:59 +0000 (10:58 +0000)]
Default vfs.fastdev to 1 for wider testing, so the vnode bypass for device
read and write is now the default.

This is a precursor to the continued work on a kernel-managed cache layer
on top of the VFS layer.  That is, the intention is to eventually switch the
VM page cache to be ABOVE the VFS layer rather then BELOW the VFS layer for
standard read() and write() calls, with potentially major performance
benefits.

19 years agoTemporarily remove union and nullfs from the vfs build list, they are
Matthew Dillon [Fri, 12 Nov 2004 10:07:32 +0000 (10:07 +0000)]
Temporarily remove union and nullfs from the vfs build list, they are
currently broken in HEAD.

19 years agoInitialize pseudointr_ch in fdc.
Joerg Sonnenberger [Fri, 12 Nov 2004 09:50:38 +0000 (09:50 +0000)]
Initialize pseudointr_ch in fdc.

19 years agoAdd _ntp to the user database, correct the path to nologin for proxy
Joerg Sonnenberger [Fri, 12 Nov 2004 09:37:26 +0000 (09:37 +0000)]
Add _ntp to the user database, correct the path to nologin for proxy
and _pflogd.

19 years agoAdd a 'preupgrade' target which creates any missing users and groups
Matthew Dillon [Fri, 12 Nov 2004 09:10:01 +0000 (09:10 +0000)]
Add a 'preupgrade' target which creates any missing users and groups
(relative to FreeBSD-4) that are required before installworld can be
run.

Adjust the installworld prechecks to bail if required users or groups
do not exist, with a message pointing to the new preupgrade target.

The 'make upgrade' target will automatically run the preupgrade target.

Required users: smmsp, _pflogd, _ntp.
Required groups: smmsp, authpf, _pflogd, _ntp

Devon noted that the 'pw' program seems to do what we need here.

19 years agoCorrect minor tinderbox -DDEBUG error.
Matthew Dillon [Fri, 12 Nov 2004 06:07:36 +0000 (06:07 +0000)]
Correct minor tinderbox -DDEBUG error.

19 years agoInitialize 'version' variable to silence compiler warning.
David Rhodus [Fri, 12 Nov 2004 02:30:29 +0000 (02:30 +0000)]
Initialize 'version' variable to silence compiler warning.

19 years agoSpelling.
David Rhodus [Fri, 12 Nov 2004 02:25:51 +0000 (02:25 +0000)]
Spelling.

19 years agoSync up items from the GENERIC config and a few more items to make
David Rhodus [Fri, 12 Nov 2004 02:24:28 +0000 (02:24 +0000)]
Sync up items from the GENERIC config and a few more items to make
this config file more handy to use on testing systems.

19 years agoUpdate the 3ware card comment to better reflect which cards are supported.
David Rhodus [Fri, 12 Nov 2004 02:21:19 +0000 (02:21 +0000)]
Update the 3ware card comment to better reflect which cards are supported.

19 years agoVFS messaging/interfacing work stage 9/99: VFS 'NEW' API WORK.
Matthew Dillon [Fri, 12 Nov 2004 00:09:56 +0000 (00:09 +0000)]
VFS messaging/interfacing work stage 9/99: VFS 'NEW' API WORK.

NOTE: unionfs and nullfs are temporarily broken by this commit.

* Remove the old namecache API.  Remove vfs_cache_lookup(), cache_lookup(),
  cache_enter(), namei() and lookup() are all gone.  VOP_LOOKUP() and
  VOP_CACHEDLOOKUP() have been collapsed into a single non-caching
  VOP_LOOKUP().

* Complete the new VFS CACHE (namecache) API.  The new API is able to
  supply topological guarentees and is able to reserve namespaces,
  including negative cache spaces (whether the target name exists or not),
  which the new API uses to reserve namespace for things like NRENAME
  and NCREATE (and others).

* Complete the new namecache API.  VOP_NRESOLVE, NLOOKUPDOTDOT, NCREATE,
  NMKDIR, NMKNOD, NLINK, NSYMLINK, NWHITEOUT, NRENAME, NRMDIR, NREMOVE.
  These new calls take (typicaly locked) namecache pointers rather then
  combinations of directory vnodes, file vnodes, and name components.  The
  new calls are *MUCH* simpler in concept and implementation.  For example,
  VOP_RENAME() has 8 arguments while VOP_NRENAME() has only 3 arguments.

  The new namecache API uses the namecache to lock namespaces without having
  to lock the underlying vnodes.  For example, this allows the kernel
  to reserve the target name of a create function trivially.  Namecache
  records are maintained BY THE KERNEL for both positive and negative hits.

  Generally speaking, the kernel layer is now responsible for resolving
  path elements.  NRESOLVE is called when an unresolved namecache record
  needs to be resolved.  Unlike the old VOP_LOOKUP, NRESOLVE is simply
  responsible for associating a vnode to a namecache record (positive hit)
  or telling the system that it's a negative hit, and not responsible for
  handling symlinks or other special cases or doing any of the other
  path lookup work, much unlike the old VOP_LOOKUP.

  It should be particularly noted that the new namecache topology does not
  allow disconnected namecache records.  In rare cases where a vnode must
  be converted to a namecache pointer for new API operation via a file handle
  (i.e. NFS), the cache_fromdvp() function is provided and a new API VOP,
  VOP_NLOOKUPDOTDOT() is provided to allow the namecache to resolve the
  topology leading up to the requested vnode.  These and other topological
  guarentees greatly reduce the complexity of the new namecache API.

  The new namei() is called nlookup().  This function uses a combination
  of cache_n*() calls, VOP_NRESOLVE(), and standard VOP calls resolve the
  supplied path, deal with symlinks, and so forth, in a nice small compact
  compartmentalized procedure.

* The old VFS code is no longer responsible for maintaining namecache records,
  a function which was mostly adhoc cache_purge()s occuring before the VFS
  actually knows whether an operation will succeed or not.

  The new VFS code is typically responsible for adjusting the state of
  locked namecache records passed into it.  For example, if NCREATE succeeds
  it must call cache_setvp() to associate the passed namecache record with
  the vnode representing the successfully created file.  The new requirements
  are much less complex then the old requirements.

* Most VFSs still implement the old API calls, albeit somewhat modified
  and in particular the VOP_LOOKUP function is now *MUCH* simpler.  However,
  the kernel now uses the new API calls almost exclusively and relies on
  compatibility code installed in the default ops (vop_compat_*()) to
  convert the new calls to the old calls.

* All kernel system calls and related support functions which used to do
  complex and confusing namei() operations now do far less complex and
  far less confusing nlookup() operations.

* SPECOPS shortcutting has been implemented.  User reads and writes now go
  directly to supporting functions which talk to the device via fileops
  rather then having to be routed through VOP_READ or VOP_WRITE, saving
  significant overhead.  Note, however, that these only really effect
  /dev/null and /dev/zero.

  Implementing this was fairly easy, we now simply pass an optional
  struct file pointer to VOP_OPEN() and let spec_open() handle the
  override.

SPECIAL NOTES: It should be noted that we must still lock a directory vnode
LK_EXCLUSIVE before issuing a VOP_LOOKUP(), even for simple lookups, because
a number of VFS's (including UFS) store active directory scanning information
in the directory vnode.  The legacy NAMEI_LOOKUP cases can be changed to
use LK_SHARED once these VFS cases are fixed.  In particular, we are now
organized well enough to actually be able to do record locking within a
directory for handling NCREATE, NDELETE, and NRENAME situations, but it hasn't
been done yet.

Many thanks to all of the testers and in particular David Rhodus for
finding a large number of panics and other issues.

19 years agoStyle(9):
Chris Pressey [Thu, 11 Nov 2004 21:16:46 +0000 (21:16 +0000)]
Style(9):
- Do not implicitly treat NUL characters, NULL pointers, or 0-valued
  integers as false-valued booleans; use explicit tests instead.
- Prefer char **argv to char *argv[].
- Small whitespace adjustments.
- No functional changes.

19 years agoAdd various improvements to the "pre-flight installer":
Chris Pressey [Thu, 11 Nov 2004 20:30:05 +0000 (20:30 +0000)]
Add various improvements to the "pre-flight installer":

- Add pfi_autologin variable.  If set to a valid username, the
  installation medium boot process will automatically log in as
  that user.  Defaults to "NONE".

- Add pfi_shutdown_command variable.  This can be set to the
  desired command used to shut down the system when the installer
  finishes doing its thing.  Defaults to "shutdown -h now".

- Launch thttpd on boot if pfi_frontend="cgi".

  In combination, these three settings allow completely
  headless (no monitor, no keyboard) operation of the installer
  independent of a serial connection (i.e. over the network.)

- Have the pfi_sshd_permit_root_login variable honour
  "without-password" and "forced-commands-only" settings. [1]

[1] Submitted by: geekgod

19 years agoUpdate installer to 1.1.2.
Chris Pressey [Thu, 11 Nov 2004 19:45:19 +0000 (19:45 +0000)]
Update installer to 1.1.2.

The most significant change in this update is that there are now two
seperate directories on the install medium, /etc and /etc.hdd :

- /etc contains the configuration used for booting the LiveCD only.
  It is NOT copied to the hard drive.

- /etc.hdd contains the default configuration used for booting from
  a hard drive.  It is NOT used for booting the LiveCD.  It IS copied
  to the hard drive, as /etc .

This avoids the `copy pristine files afterward' rigamarole and, in
so doing, simplifies both manual and automatic install routines.

The README file has also been updated to reflect this change.

Suggested-by: dillon (a while ago)
19 years agoThe 'start = 1' change wasn't needed, revert that one little bit back to
Matthew Dillon [Wed, 10 Nov 2004 20:19:51 +0000 (20:19 +0000)]
The 'start = 1' change wasn't needed, revert that one little bit back to
'start = 0'.

19 years ago- style(9) cleanup
Joerg Sonnenberger [Wed, 10 Nov 2004 18:30:13 +0000 (18:30 +0000)]
- style(9) cleanup
- allow rl_detach to be used for all error recovery in rl_attach
- drop rl_unit and use device_printf instead
- rl_list_tx_init can't fail, make it void
- eliminate splimp in rl_attach, drop it ASAP in rl_detach
- use DEFINE_CLASS_0 instead of expanding it manually

From FreeBSD:
- support cardbus attachments
- support 6bit and 8bit EEPROMs
- use ether_crc32_be instead of local code
- fix some unnessary watchdog conditions
- depend on miibus
- use pci_get_powerstate()/pci_set_powerstate()
- add various PCI and CardBus devices
- bus_dma conversion

19 years agoAdd libarchive to prebuilt libraries.
Joerg Sonnenberger [Wed, 10 Nov 2004 18:05:36 +0000 (18:05 +0000)]
Add libarchive to prebuilt libraries.

19 years agoMerge from vendor branch LIBARCHIVE:
Joerg Sonnenberger [Wed, 10 Nov 2004 18:02:24 +0000 (18:02 +0000)]
Merge from vendor branch LIBARCHIVE:
Import libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
at installworld time by setting WITH_BSDTAR. This is not the default yet.

Obtained-from: FreeBSD

19 years agoMerge from vendor branch BSDTAR:
Joerg Sonnenberger [Wed, 10 Nov 2004 18:02:24 +0000 (18:02 +0000)]
Merge from vendor branch BSDTAR:
Import libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
at installworld time by setting WITH_BSDTAR. This is not the default yet.

Obtained-from: FreeBSD

19 years agoImport libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
Joerg Sonnenberger [Wed, 10 Nov 2004 18:02:24 +0000 (18:02 +0000)]
Import libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
at installworld time by setting WITH_BSDTAR. This is not the default yet.

Obtained-from: FreeBSD

19 years agoImport libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
Joerg Sonnenberger [Wed, 10 Nov 2004 18:02:24 +0000 (18:02 +0000)]
Import libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
at installworld time by setting WITH_BSDTAR. This is not the default yet.

Obtained-from: FreeBSD

19 years agoImport libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
Joerg Sonnenberger [Wed, 10 Nov 2004 18:02:24 +0000 (18:02 +0000)]
Import libarchive and bsdtar. The default tar (/usr/bin/tar) can be choosen
at installworld time by setting WITH_BSDTAR. This is not the default yet.

Obtained-from: FreeBSD

19 years agoFix a very serious bug in contigmalloc() which we inherited from FreeBSD-4.x.
Matthew Dillon [Wed, 10 Nov 2004 17:39:20 +0000 (17:39 +0000)]
Fix a very serious bug in contigmalloc() which we inherited from FreeBSD-4.x.
The contigmalloc() code incorrectly assumes that a page in PQ_CACHE can
be reused without having to do any further checks and it unconditionally
busies and frees such pages, and assumes that the page becomes PQ_FREE even
though it might actually have gone to a PQ_HOLD state.  Additionally the
contigmalloc() code unconditionally sets m->object to NULL, ignoring the
fact that the page will be in the VM page bucket hash table if object
happens to not be NULL, leading to page bucket hash table corruption.

The fix is two fold.  First, we add checks for m->busy, (m->flags & PG_BUSY),
m->wire_count, and m->hold_count and do not reuse a page with any of those
set.  We do this for all pages, not just PQ_CACHE pages, though it is
believed that it only needs to be done for PQ_CACHE pages.  Second, we
replace the m->object = NULL assignment with an assertion that it is
already NULL, since it had better be NULL and we cannot just set it to NULL
unconditionally without blowing up the VM page hash table.

Symptoms of the bug include:

    * Filesystem corruption, in particular with slower disk drivers (e.g.
      like the 'twe' driver), or in systems with drivers which use
      contigmalloc() a lot (e.g. require bounce buffers).

      Mangled directory entries, bad indirect blocks (containing data instead
      of indirect block pointers), and files containing other file's data.

    * 'page not found in hash' panic.

This is the last major VM issue in DragonFly, one that has plagued in
particular David Rhodus (who is a heavy user of the 'twe' driver) for over
a year.  I would never have found this bug if not for DR's persistence and
the dozens of kernel cores he was able to provide me over the last year.  We
finally got a core with a 'smoking gun', after having written a program
(/usr/src/test/debug/vmpageinfo.c) to run through all the VM pages and check
their hash table association for correctness it became obvious that pages
were being reused without being removed from the hash table which finally
led to contigmalloc*().

Many thanks to: David Rhodus!  Free gift enclosed!

19 years agoThe min() and max() macros in sys/libkern.h are typed u_int and thus do not
Matthew Dillon [Wed, 10 Nov 2004 08:27:54 +0000 (08:27 +0000)]
The min() and max() macros in sys/libkern.h are typed u_int and thus do not
do the right things when handed negative numbers.  Use MIN and MAX instead.

This was causing renice -N processes to wrap back around to the worst priority
instead of MIN()'ing to the best priority.

19 years agoInstall GNU tar as gtar now in preparation for adding bsdtar.
Joerg Sonnenberger [Wed, 10 Nov 2004 00:01:54 +0000 (00:01 +0000)]
Install GNU tar as gtar now in preparation for adding bsdtar.
/usr/bin/tar is installed as symlink to /usr/bin/gtar, which
gives the current behaviour. Same for the man page. This is disabled,
if WITH_BSDTAR is set.

19 years agoClose .if.
Joerg Sonnenberger [Tue, 9 Nov 2004 22:44:06 +0000 (22:44 +0000)]
Close .if.

Reported-by: esmith
19 years agoAdd SA_LEN patch for client.c, too
Joerg Sonnenberger [Tue, 9 Nov 2004 22:06:54 +0000 (22:06 +0000)]
Add SA_LEN patch for client.c, too

19 years agovmpageinfo is a program which runs through the vm_page_array and the
Matthew Dillon [Tue, 9 Nov 2004 21:50:12 +0000 (21:50 +0000)]
vmpageinfo is a program which runs through the vm_page_array and the
vm_page_buckets hash table and validates the hash table association for
all VM pages which have objects associated with them.  This is primarily
intended for post-mortem checks of kernel cores.

19 years agoMerge from vendor branch NTPD:
Joerg Sonnenberger [Tue, 9 Nov 2004 21:29:34 +0000 (21:29 +0000)]
Merge from vendor branch NTPD:
After another look at the current changes, switch directly to the in-tree
version of OpenNTPD. This is needed e.g. to get the ntpdate-like ntpd -s.

19 years agoAfter another look at the current changes, switch directly to the in-tree
Joerg Sonnenberger [Tue, 9 Nov 2004 21:29:34 +0000 (21:29 +0000)]
After another look at the current changes, switch directly to the in-tree
version of OpenNTPD. This is needed e.g. to get the ntpdate-like ntpd -s.

19 years agoAfter another look at the current changes, switch directly to the in-tree
Joerg Sonnenberger [Tue, 9 Nov 2004 21:29:34 +0000 (21:29 +0000)]
After another look at the current changes, switch directly to the in-tree
version of OpenNTPD. This is needed e.g. to get the ntpdate-like ntpd -s.

19 years agoSwitch to gdb 6.2.1 and wait for new problem reports.
Joerg Sonnenberger [Tue, 9 Nov 2004 21:08:16 +0000 (21:08 +0000)]
Switch to gdb 6.2.1 and wait for new problem reports.

19 years agoImport OpenNTPD 3.6 (the OpenBSD version, not the portable).
Joerg Sonnenberger [Tue, 9 Nov 2004 20:05:42 +0000 (20:05 +0000)]
Import OpenNTPD 3.6 (the OpenBSD version, not the portable).

Obtained-from: OpenBSD

Do enough minor patching to get it WARNS=6 clean (mostly addition of
some header files and expanding SA_LEN, one issue of const discarding
has been submitted back).

19 years agoMerge from vendor branch NTPD:
Joerg Sonnenberger [Tue, 9 Nov 2004 20:05:42 +0000 (20:05 +0000)]
Merge from vendor branch NTPD:
Import OpenNTPD 3.6 (the OpenBSD version, not the portable).

Obtained-from: OpenBSD

Do enough minor patching to get it WARNS=6 clean (mostly addition of
some header files and expanding SA_LEN, one issue of const discarding
has been submitted back).

19 years agoImport OpenNTPD 3.6 (the OpenBSD version, not the portable).
Joerg Sonnenberger [Tue, 9 Nov 2004 20:05:42 +0000 (20:05 +0000)]
Import OpenNTPD 3.6 (the OpenBSD version, not the portable).

Obtained-from: OpenBSD

Do enough minor patching to get it WARNS=6 clean (mostly addition of
some header files and expanding SA_LEN, one issue of const discarding
has been submitted back).

19 years agoUse the speedup patches, too
Joerg Sonnenberger [Tue, 9 Nov 2004 19:31:14 +0000 (19:31 +0000)]
Use the speedup patches, too

19 years agoDefine IOV_MAX for userland too and make it available via sysctl and
Joerg Sonnenberger [Tue, 9 Nov 2004 17:52:45 +0000 (17:52 +0000)]
Define IOV_MAX for userland too and make it available via sysctl and
getconf/sysconf. This is kind of a hack, but too much code wants it.

Obtained-from: FreeBSD

19 years agoAdd lockcountnb() - a non-blocking version of lockcount() to be used only
Matthew Dillon [Tue, 9 Nov 2004 17:41:30 +0000 (17:41 +0000)]
Add lockcountnb() - a non-blocking version of lockcount() to be used only
for assertions when the lock state is supposedly stable.

19 years agoCreate a non-blocking version of BUF_REFCNT() called BUF_REFCNTNB() to be
Matthew Dillon [Tue, 9 Nov 2004 17:36:42 +0000 (17:36 +0000)]
Create a non-blocking version of BUF_REFCNT() called BUF_REFCNTNB() to be
used for non-critical KASSERT()'s or in situations where the buffer lock
is in a known state.

This fixes a blocking condition in the ATA interrupt path.  The normal
BUF_REFCNT() calls lockcount() which obtains a token which caused the
interrupt thread to temporarily block in biodone() due to a KASSERT.

Found-from: kernel core provided by David Rhodus.

19 years agoI don't know why I added use_bpf.h, it isn't needed of course.
Joerg Sonnenberger [Tue, 9 Nov 2004 11:10:10 +0000 (11:10 +0000)]
I don't know why I added use_bpf.h, it isn't needed of course.

19 years agoFix the column width for IPv6 to correctly align the fields.
Joerg Sonnenberger [Tue, 9 Nov 2004 09:10:55 +0000 (09:10 +0000)]
Fix the column width for IPv6 to correctly align the fields.

Submitted-by: Pawel Biernacki <kaktus@dragonflybsd.pl>
19 years agoRemove references to sysinstall, it vanished quite some time ago.
Joerg Sonnenberger [Tue, 9 Nov 2004 08:52:46 +0000 (08:52 +0000)]
Remove references to sysinstall, it vanished quite some time ago.

Submitted-by: Tomaz Borstnar <tomaz.borstnar@over.net>
While at it, add a reference for both pw(8) and tzsetup(8) as appropiate.

19 years agoSmall speedups:
Joerg Sonnenberger [Tue, 9 Nov 2004 08:47:36 +0000 (08:47 +0000)]
Small speedups:
- run.c: instead of counting string lenght and using strcpy afterwards anyway,
  use memmove
- tran.c: use strdup instead of malloc + strcpy

Submitted-by: Andreas Hauser <andy@splashground.de>
19 years agoFix another minor bug-a-boo inherited from 4.x sources, the wrong indirdep
Matthew Dillon [Tue, 9 Nov 2004 04:41:47 +0000 (04:41 +0000)]
Fix another minor bug-a-boo inherited from 4.x sources, the wrong indirdep
pointer was being checked in a conditional.  However, it turns out not
to matter operationally.

19 years agovfs_object_create() was being called too early on devvp in the FFS mount
Matthew Dillon [Tue, 9 Nov 2004 04:25:59 +0000 (04:25 +0000)]
vfs_object_create() was being called too early on devvp in the FFS mount
code, causing FFS's devvp to not be VMIO backed.  This also tickled a
softupdates bug which has been separately fixed.

Its nice to know that everything still works without devvp being VMIO backed,
but we really want to back it :-).  This fixes it.

19 years agoCorrect a softupdates bug, an ir_savebp buffer was not being properly
Matthew Dillon [Tue, 9 Nov 2004 04:22:52 +0000 (04:22 +0000)]
Correct a softupdates bug, an ir_savebp buffer was not being properly
disposed of.  This bug is currently only known to effect filesystems
whos block devices are not VMIO backed.  However, it's a fragile situation
at best so its good to have it fixed anyhow.

ir_savebp is stashed copy of the in-memory version of an indirect file block.
It is stashed using (devvp,blkno) (whereas the actual indirect file block
is stored using (vp,-specialblkno).  For VMIO to also tickle this bug would
have required that other unrelated operations also cache (devvp,blkno), a
case which does not (yet) exist.

19 years agoSmall patch to fix the output of apm. It called print_batt_life twice
Liam J. Foy [Mon, 8 Nov 2004 19:58:12 +0000 (19:58 +0000)]
Small patch to fix the output of apm. It called print_batt_life twice
when it should call print_batt_life and print_batt_time.

19 years agoWe don't have lkm, use aftermountlkm instead.
Joerg Sonnenberger [Mon, 8 Nov 2004 18:33:17 +0000 (18:33 +0000)]
We don't have lkm, use aftermountlkm instead.

19 years agoDo not explicitly set PCIM_CMD_SERRESPEN or PCIM_CMD_PERRESPEN. This was
Matthew Dillon [Mon, 8 Nov 2004 16:50:33 +0000 (16:50 +0000)]
Do not explicitly set PCIM_CMD_SERRESPEN or PCIM_CMD_PERRESPEN.  This was
set in FreeBSD to try to catch device problems, but it looks like we actually
found a device that blows up with an NMI during fwohci_init() so we no longer
set these bits.  OpenBSD doesn't set it.

My theory is that the device is not clearing its internal memory leaving
some of it in a parity-adverse state, causing accesses to the uninitialized
memory to fail.  Alternatively the hardware is just plain broken, but it
seems to probe fine without the bit set so...

Gabor's-hardware:
AMD Athlon 64 3000+ based system.
fwohci0: <Texas Instruments TSB43AB21/A/AI/A-EP> mem
0xd0000000-0xd0003fff,0xd0008000-0xd00087ff irq 11 at device 6.0 on pci0
fwohci0: OHCI version 1.10 (ROM=1)
fwohci0: No. of Isochronous channel is 4.
fwohci0: EUI64 00:90:f5:00:00:32:10:37
fwohci0: Phy 1394a available S400, 1 ports.
fwohci0: Link S400, max_rec 2048 bytes.

NMI-Reported-by: Gabor MICSKO <trey@hup.hu>
19 years agoSync make.1 with the rest of the make source.
Matthew Dillon [Mon, 8 Nov 2004 16:16:44 +0000 (16:16 +0000)]
Sync make.1 with the rest of the make source.

Submitted-by: Max Okumoto <okumoto@home>
Taken-From: FreeBSD

19 years agoAdd tip(1)'s emulation of cu(1) to tip's manual page.
Matthew Dillon [Mon, 8 Nov 2004 16:11:05 +0000 (16:11 +0000)]
Add tip(1)'s emulation of cu(1) to tip's manual page.

Submitted-by: "H.Miyamoto" <Ys@PixyGarden.net>
Based-on: FreeBSD

19 years agoFix a race condition in detach path of Ethernet devices. Most current
Joerg Sonnenberger [Mon, 8 Nov 2004 10:28:48 +0000 (10:28 +0000)]
Fix a race condition in detach path of Ethernet devices. Most current
drivers do something like this:

XX_stop();
ether_ifdetach();

/* continue and assume device is dead now */

This doesn't work in many cases if a BPF user is left and IFF_PROMISC is
active, because bpfdetach does a reset of the timer for many drivers.
The fix is to move the call to if_down into ether_ifdetach, which gives
the expected behaviour.

19 years agoThe last commit created a memory leak because 'buf' is static. Fix that,
Matthew Dillon [Sun, 7 Nov 2004 23:44:38 +0000 (23:44 +0000)]
The last commit created a memory leak because 'buf' is static.  Fix that,
but also make the chosen block size more consistent by basing on the larger
of STDOUT vs rfd rather then just basing it on STDOUT, and change the
constant 1024 to BUFSIZ.

It is unclear whether we should impose a minimum buffer size or a mod
(e.g. x % st_blksize == 0) requirement as well.  There are currently no cases
where this matters as anyone in their right mind will use 'dd' instead of
'cat' on special block devices.  But at least in regards to /proc/*/map
imposing a minimum based on fstat(rfd, ...) makes sense, though to really
be correct we should also 'fix' procfs to report a block size sufficient to
hold the map data in that case.

Reported-by: Jason Smethers <jason@smethers.net>
19 years ago- Remove space
Liam J. Foy [Sun, 7 Nov 2004 21:38:01 +0000 (21:38 +0000)]
- Remove space

Submitted by: The White Space and Void Destroyer aka Douwe Kiela.

19 years agoRemove not needed void casts.
Eirik Nygaard [Sun, 7 Nov 2004 20:54:52 +0000 (20:54 +0000)]
Remove not needed void casts.

Submitted by: Douwe Kiela <virtus@wanadoo.nl>

19 years agostyle(9)
Eirik Nygaard [Sun, 7 Nov 2004 19:42:16 +0000 (19:42 +0000)]
style(9)

19 years ago- Remove (void) casts that are not necessary.
Liam J. Foy [Sun, 7 Nov 2004 19:29:27 +0000 (19:29 +0000)]
- Remove (void) casts that are not necessary.

Submitted by: Douwe Kiela <virtus@wanadoo.nl>

19 years agoSync with FreeBSD rm(1) with my modifications. Some things have been
Liam J. Foy [Sat, 6 Nov 2004 19:37:44 +0000 (19:37 +0000)]
Sync with FreeBSD rm(1) with my modifications. Some things have been
left out of this sync for time being.

- Fix the leakage of a file descriptor in rm_overwrite for non-fatal
  errors(this is for rm -P).
- Fix the fatal malloc() error message.
- When the P flag is set (i.e. Overwrite regular files before deleting them),
  do only unlink the file if we could indeed overwrite the file. See
  http://www.freebsd.org/cgi/cvsweb.cgi/src/bin/rm/rm.c?rev=1.45&content-type=text/x-cvsweb-markup
  for more details.
- Fix poor wording in comment.
- When fts_read() cannot stat the file, it can't be unlinked.  At
  that case, don't display error message when -f flag is used.
- Kindly let the user know rm(1) could not overwrite non-regular
  files and continue to unlink.
- Static functions.
- Constify rw_overwrite() and check().

Ok'ed by: kernel@ eirikn@ and dillon@

19 years agoConsify some variables.
Eirik Nygaard [Sat, 6 Nov 2004 12:33:11 +0000 (12:33 +0000)]
Consify some variables.
This Removes some warnings.

Submitted by: Andreas Hauser <andy@splashground.de>

19 years ago#endif does not take an argument, comment it out.
Eirik Nygaard [Sat, 6 Nov 2004 12:29:17 +0000 (12:29 +0000)]
#endif does not take an argument, comment it out.

Submitted by: Andreas Hauser <andy@splashground.de>

Add $DragonFly$ keyword to:
src/games/hack/config.h
src/games/hack/def.monst.h
src/games/hack/def.rm.h
src/games/hack/def.wseg.h
src/games/hack/hack.Decl.c
src/games/hack/hack.h
src/games/hack/hack.monst.c

19 years agoCorrect a typo and a mdoc(7) style issue.
Matthew Dillon [Fri, 5 Nov 2004 19:09:53 +0000 (19:09 +0000)]
Correct a typo and a mdoc(7) style issue.

Submitted-by: Xin LI <delphij@frontfree.net>
Originally-from: Dima Dorfman <dd@...>

19 years agoRemove an assertion that used to double-check the cred passed into vn_open().
Matthew Dillon [Fri, 5 Nov 2004 18:43:20 +0000 (18:43 +0000)]
Remove an assertion that used to double-check the cred passed into vn_open().
The assertion is no longer needed as the cred is allowed to be different,
and vn_open() may not be called from a process any more.  In particular,
vn_open() may be called from the NDIS driver to open a firmware image file.

Reported-by: Andrew Atrens <atrens@nortelnetworks.com>
19 years agoFix a Trident DMA limitation. Symptom as reported by Brock was that his
Matthew Dillon [Fri, 5 Nov 2004 17:47:48 +0000 (17:47 +0000)]
Fix a Trident DMA limitation.  Symptom as reported by Brock was that his
laptop would lockup.

Submitted-by: Brock Johnson <wildefire@isentry.homelinux.org>
Taken-from: FreeBSD, rev 1.45 and 1.46

19 years agoGive makewhatis an absolute path to make upgrading etc from single-user
Matthew Dillon [Fri, 5 Nov 2004 17:36:05 +0000 (17:36 +0000)]
Give makewhatis an absolute path to make upgrading etc from single-user
mode easier.

Submitted-by: "Henrik N. Jensen" <hnj@unihost.net>
19 years agoBring in some more PCI ID's from FreeBSD.
Matthew Dillon [Fri, 5 Nov 2004 17:13:44 +0000 (17:13 +0000)]
Bring in some more PCI ID's from FreeBSD.

Submitted-by: Andreas Hauser <andy@splashground.de>
Taken-from: FreeBSD

19 years agoAdd humanize_number(3) and split the trimdomain(3) function out from
Matthew Dillon [Fri, 5 Nov 2004 17:05:26 +0000 (17:05 +0000)]
Add humanize_number(3) and split the trimdomain(3) function out from
logwtmp.

Submitted-by: "Douwe Kiela" <virtus@wanadoo.nl>
Taken-From: FreeBSD

19 years agoSave and restore the 'version' counter file when doing a full buildkernel
Matthew Dillon [Fri, 5 Nov 2004 10:09:52 +0000 (10:09 +0000)]
Save and restore the 'version' counter file when doing a full buildkernel
or nativekernel target so the counter is not reset each time.  Note that
the quickkernel target will increment the counter only if something has
changed.

Reported-by: walt <wa1ter@myrealbox.com>
Make some minor FBsd->DFly 'update' target cleanups.

Submitted-by: Michal Belczyk <diavul@bsd.krakow.pl>
19 years agoFix a possible remote DOS against pppd, described in detail at
Matthew Dillon [Fri, 5 Nov 2004 07:27:20 +0000 (07:27 +0000)]
Fix a possible remote DOS against pppd, described in detail at

http://www.securityfocus.com/archive/1/379450/2004-10-24/2004-10-30/0

Submitted-by: "Andre Nathan" <andre@digirati.com.br>
Taken-from: OpenBSD / same file rev 1.6

19 years agoNote last commit: changes were made primarily to avoid global variable name
Matthew Dillon [Fri, 5 Nov 2004 03:12:03 +0000 (03:12 +0000)]
Note last commit: changes were made primarily to avoid global variable name
conflicts with library procedures, 'compress' in particular, that somehow
occured in one or more DragonFly configurations and caused savecore to
believe that the -z option had been specified when it had not.

19 years agoDeclare some of the local variables static.
David Rhodus [Thu, 4 Nov 2004 21:51:18 +0000 (21:51 +0000)]
Declare some of the local variables static.

19 years ago- Remove unnecessary selection statement to see if buf == NULL.
Liam J. Foy [Thu, 4 Nov 2004 21:31:37 +0000 (21:31 +0000)]
- Remove unnecessary selection statement to see if buf == NULL.
- Don't use fileno to get stdout, just use STDOUT_FILENO
- Fix malloc err message

OK'ed by: Joerg and Jeroen

19 years agoRemove a.out support from base. Bumb WARNS to 6 for ldconfig.
Joerg Sonnenberger [Thu, 4 Nov 2004 13:14:11 +0000 (13:14 +0000)]
Remove a.out support from base. Bumb WARNS to 6 for ldconfig.

19 years agoRIP gzip, we found a nicer playmate.
Joerg Sonnenberger [Thu, 4 Nov 2004 12:30:53 +0000 (12:30 +0000)]
RIP gzip, we found a nicer playmate.

19 years agoMove libstdc++3 into the attic. It can be removed from the repo later.
Joerg Sonnenberger [Thu, 4 Nov 2004 12:27:53 +0000 (12:27 +0000)]
Move libstdc++3 into the attic. It can be removed from the repo later.

19 years agoRemove incorrect cache_purge() calls in *_rmdir() (OLD API). These could
Matthew Dillon [Wed, 3 Nov 2004 22:07:21 +0000 (22:07 +0000)]
Remove incorrect cache_purge() calls in *_rmdir() (OLD API).  These could
result in a namecache mountpoint entry losing its vnode association under
the new API.

Panic-Reported-by: Stu
19 years agoFix 'route add -host <target> -interface <interface_name>. This was
Matthew Dillon [Tue, 2 Nov 2004 23:49:38 +0000 (23:49 +0000)]
Fix 'route add -host <target> -interface <interface_name>.  This was
previously adding a static arp entry with the interface's MAC address
instead of the target's address or an incomplete address.  The result is
that the target cannot be routed to.

The fix is to (1) Install the route with 'incomplete' link level info rather
then using the interface's MAC address, (2) Allowing the incomplete address
to be resolved and timeout normally, (3) re-clearing the entry to an
incomplete status instead of destroying it when the ARP times out,
and (4) Making 'arp -d -a' only clear link level routes marked static
instead of deleting them.

Noticed-by: Mikhail Teterin <mi+dragonflybsd@aldan.algebra.com>
19 years ago- Allow ipcs to display information about IPC mechanisms owned by
Liam J. Foy [Tue, 2 Nov 2004 19:38:49 +0000 (19:38 +0000)]
- Allow ipcs to display information about IPC mechanisms owned by
  a user. The option for this is -u user. User can be a username or
  a uid. Obtained from FreeBSD

- Allow ipcs to display information about IPC mechanisms owned by
  a group. The option for this is -g group. Group can be a group name or
  a gid. Wrote by me.

Ok'ed by: dillon@ and kernel@

19 years agoNeeded to add sys/types.h for previous commit. Spotted by Mr Dillon.
Liam J. Foy [Sun, 31 Oct 2004 21:37:12 +0000 (21:37 +0000)]
Needed to add sys/types.h for previous commit. Spotted by Mr Dillon.

19 years agoUpdate the sysperf tools to match the current sysmsg functions.
Eirik Nygaard [Sun, 31 Oct 2004 20:19:24 +0000 (20:19 +0000)]
Update the sysperf tools to match the current sysmsg functions.

sc1 times getuid() using the standard syscall method.
sc2 times getuid() using the new sysmsg method.
sc3 runs in an endless loop calling getuid() with the new sysmsg method.

19 years agoThe gr_gid member of the struct group should be gid_t
Liam J. Foy [Sun, 31 Oct 2004 19:01:00 +0000 (19:01 +0000)]
The gr_gid member of the struct group should be gid_t
and not an int.

Submitted by: Douwe Kiela

19 years agoWhoops! setmode(3) returns a void *, not mode_t *.
Liam J. Foy [Sun, 31 Oct 2004 16:18:37 +0000 (16:18 +0000)]
Whoops! setmode(3) returns a void *, not mode_t *.

19 years agoRemove leftover 'is'.
Jeroen Ruigrok/asmodai [Sun, 31 Oct 2004 11:11:54 +0000 (11:11 +0000)]
Remove leftover 'is'.

19 years agoDocument ENOMEM error case, note how strdup() is 1003:2004 sanctioned.
Jeroen Ruigrok/asmodai [Sun, 31 Oct 2004 11:09:44 +0000 (11:09 +0000)]
Document ENOMEM error case, note how strdup() is 1003:2004 sanctioned.

19 years agoAdd iso-C alias and p1003.1-2004 definition.
Jeroen Ruigrok/asmodai [Sun, 31 Oct 2004 10:31:21 +0000 (10:31 +0000)]
Add iso-C alias and p1003.1-2004 definition.

19 years agoWe have to support uncompress by default, because zcat is used e.g.
Joerg Sonnenberger [Sun, 31 Oct 2004 10:26:26 +0000 (10:26 +0000)]
We have to support uncompress by default, because zcat is used e.g.
by the port system for both gzip and compress files. Therefore
replace GZIP_UNCOMPRESS with NO_GZIP_UNCOMPRESS and the reverse meaning.

19 years agoAdd NetBSD 2.0 and DragonFly 1.1.
Jeroen Ruigrok/asmodai [Sun, 31 Oct 2004 10:14:03 +0000 (10:14 +0000)]
Add NetBSD 2.0 and DragonFly 1.1.

19 years agoFix cpdup man page. The option -v[vvv] should be -v[vv].
Liam J. Foy [Sun, 31 Oct 2004 00:43:14 +0000 (00:43 +0000)]
Fix cpdup man page. The option -v[vvv] should be -v[vv].

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

19 years agoBring in Jeff Wheelhouse's CLOG / circular log file support for syslogd,
Matthew Dillon [Sat, 30 Oct 2004 20:26:48 +0000 (20:26 +0000)]
Bring in Jeff Wheelhouse's CLOG / circular log file support for syslogd,
With some formatting changes.

Side note: CLOG's use of mmap within syslogd is very dangerous and could
lead to syslogd seg-faulting out, especially since the control structure
appears to reside at the end of the physical log file.  Users of circular
log files must take care.

Requested-by: The MOB!
19 years agoThe PRId64 check was wrong, causing bootstrapping failures on
Matthew Dillon [Sat, 30 Oct 2004 18:48:31 +0000 (18:48 +0000)]
The PRId64 check was wrong, causing bootstrapping failures on
FreeBSD-4.x boxes.

19 years agoThe last fix wasn't good enough. This one causes the SWIDTH lines to be
Matthew Dillon [Sat, 30 Oct 2004 18:46:07 +0000 (18:46 +0000)]
The last fix wasn't good enough.  This one causes the SWIDTH lines to be
ignored rather then mapped as 0.

19 years agoConditionalize _CTYPE_SW* for bootstrap purposes.
Matthew Dillon [Sat, 30 Oct 2004 18:14:35 +0000 (18:14 +0000)]
Conditionalize _CTYPE_SW* for bootstrap purposes.

Reported-by: esmith <esmith@patmedia.net>