dragonfly.git
12 years agoMerge remote-tracking branch 'crater/master'
Thomas Nikolajsen [Thu, 16 Feb 2012 06:35:29 +0000 (07:35 +0100)]
Merge remote-tracking branch 'crater/master'

12 years agoRevert "libstand.3: remove .Xo/.Xc"
Thomas Nikolajsen [Thu, 16 Feb 2012 06:25:06 +0000 (07:25 +0100)]
Revert "libstand.3: remove .Xo/.Xc"

.Xo/.Xc support has been added to mandoc(1).

This reverts commit 7ad109144437549598e004ac327522a3106f57f9.

12 years agomfiutil(8): Fix typo.
Sascha Wildner [Thu, 16 Feb 2012 05:12:49 +0000 (06:12 +0100)]
mfiutil(8): Fix typo.

12 years agokernel/pci: Implement the PCIOCATTACHED ioctl.
Sascha Wildner [Tue, 14 Feb 2012 22:18:33 +0000 (23:18 +0100)]
kernel/pci: Implement the PCIOCATTACHED ioctl.

This fixes pciconf -a

Taken-from: FreeBSD

12 years agoLINT/LINT64: Remove obsolete comment.
Sascha Wildner [Tue, 14 Feb 2012 23:35:56 +0000 (00:35 +0100)]
LINT/LINT64: Remove obsolete comment.

12 years agoRemove an obsolete header file specific to labpc(4) (which was removed).
Sascha Wildner [Mon, 13 Feb 2012 22:54:06 +0000 (23:54 +0100)]
Remove an obsolete header file specific to labpc(4) (which was removed).

12 years agoworld: Add missing DPADDs in some Makefiles.
Sascha Wildner [Mon, 13 Feb 2012 21:37:59 +0000 (22:37 +0100)]
world: Add missing DPADDs in some Makefiles.

12 years agoFix some typos.
Sascha Wildner [Mon, 13 Feb 2012 14:09:01 +0000 (15:09 +0100)]
Fix some typos.

12 years agobinutils: Fix typo in Makefile
John Marino [Sun, 12 Feb 2012 22:10:28 +0000 (23:10 +0100)]
binutils: Fix typo in Makefile

The variable for the backup binutils is BU_BACKUP, not BU_SECONDARY.
The backup binutils wasn't getting built after the recent makefile
changes due to this mixup.

12 years agobinutils: Revert unwanted change to Makefile.inc
John Marino [Sun, 12 Feb 2012 21:28:31 +0000 (22:28 +0100)]
binutils: Revert unwanted change to Makefile.inc

In the original changeset, Makefile.inc1 was incorporated into
Makefile.inc.  When it was split out, one of the variables was orphaned,
and as a result some of the binaries won't get installed.  Changes to
these two files should not have been committed before.

12 years agoremove unused /usr/libexec/binutils2*/elf/ld
John Marino [Sun, 12 Feb 2012 17:44:21 +0000 (18:44 +0100)]
remove unused /usr/libexec/binutils2*/elf/ld

After a recent commit (0784934ab2d8a3bba5ad1f59713db3cea8005865),
objformat handles the execution of the linker.  It chooses between
/usr/libexec/binutils*/elf/ld.bfd and /usr/libexec/binutils*/elf/ld.gold
and  /usr/libexec/binutils*/elf/ld is no longer referenced.

This commit cleans up the binutils 2.21 and 2.22 ld binaries using the
"make upgrade" command.

12 years agobinutils: Make manpage handling generic to ease maintenance
John Marino [Sun, 12 Feb 2012 17:35:45 +0000 (18:35 +0100)]
binutils: Make manpage handling generic to ease maintenance

DragonFly has two sets of binutils with one designated as primary and the
other is the backup.  In the recent past, every time these designation
were switched or a new binutils was brought in, around 30 makefiles had
to be manually and tediously updated in at least 3 places per file.

This commit implements common variables that will make future primary
designation changes not require changes to individual makefiles, but
rather limit the update to a couple of commons ones.

12 years agoobjformat - Duplicate NELEM() macro
Samuel J. Greear [Sun, 12 Feb 2012 18:24:26 +0000 (11:24 -0700)]
objformat - Duplicate NELEM() macro

* Fix buildworld on DragonFly hosts built before Dec 18, 2010 (2.9).

* NELEM() macro was added to sys/param.h on Dec 18, 2010 and objformat was
  made to use it on May 20, 2011. This broke upgrades for machines running a
  DragonFly version built prior to Dec 18, 2010 since objformat is built with
  the hosts headers as part of the cross tools stage.

12 years agoobjformat: Avoid unnecessary getenv calls
John Marino [Sun, 12 Feb 2012 11:13:28 +0000 (12:13 +0100)]
objformat: Avoid unnecessary getenv calls

The CCVER and BINUTILSVERS are always checked by objformat, even when
these values won't be used.  For example, there's no need to know the
value of CCVER when executing the realelf binutils binary, but it was
getting requested in all cases.

This commit limits the getenv requests to the bare minimum required.
Additionally it adds whitespace to the commands structure for the
purpose of aesthetics.

12 years agoobjformat: Add LINKERVER environment variable recognition
John Marino [Sun, 12 Feb 2012 09:48:33 +0000 (10:48 +0100)]
objformat: Add LINKERVER environment variable recognition

objformat will now scan for the LINKERVER environment variable.  If this
variable exists *AND* it has the value of "ld.gold", the command "ld"
will point at the gold linker.  In every other case, it will point at
the classic "gnu ld" linker.

The relative command position of "ld" was moved to after the compiler
group because it's a popular command and having it towards the front
means less time in the search loop.

12 years agostatic dl_iterate_phdr: remove unused phent variable
John Marino [Sat, 11 Feb 2012 22:23:14 +0000 (23:23 +0100)]
static dl_iterate_phdr: remove unused phent variable

This variable had been used in a validity check that was removed before
the last commit of dlfcn.c and it got orphaned.

12 years agogold linker v2.22: Return to constructors in DT_INIT_ARRAY
John Marino [Sat, 11 Feb 2012 21:17:12 +0000 (22:17 +0100)]
gold linker v2.22: Return to constructors in DT_INIT_ARRAY

This commit effectively reverses 17078250df568635285cd6be4515d29ee8c1b72a.
At the time, DragonFly did not recognize .init_array sections in an elf
file, and the gold linker was lumping the contructors from gcc into this
array which was subsequently filtered out.

DT_INIT_ARRAY and friends are now fully supported since commit
b28bf640312db2b299faff75052fbb01d67fd821 so the local modification is
being removed in favor of a default build.

12 years agortld: Add support for preinit, init, and fini arrays
John Marino [Sat, 11 Feb 2012 19:17:51 +0000 (20:17 +0100)]
rtld: Add support for preinit, init, and fini arrays

As far as I can tell, all BSDs limit their ELF executable file
initialization and termination to the .init and .fini sections.  In
contrast, Linux has additionally supported the .preinit_array,
.init_array, and .fini_array sections for over a decade through glibc.
With this commit, DragonFly becomes the first BSD to support these
arrays of function pointers.  It was tested using test cases taken from
glibc, gnu ld linker, and the gold linker.

For the main executable file, the .init_array and .fini_array sections
are handled by crt1, just like .init and .fini are.  In the case of
a statically linked binary, the .preinit_array section is also handled
by crt1.  The real-time linker handles the .init_array and .fini_array
sections for dynamically shared objects (libraries) and .preinit_array
for dynamically-linked binaries.  There are no .preinit_array sections
in the DSOs per standard.

These sections are described by the System V Application Binary Interface
http://www.sco.com/developers/gabi/latest/ch4.sheader.html#special_sections

The .init_array and .fini_array handling by rtld was reviewed by
Konstantin Belousov.

12 years agoRemove the duplicate fsx from tools/regression.
Sascha Wildner [Sat, 11 Feb 2012 19:29:36 +0000 (20:29 +0100)]
Remove the duplicate fsx from tools/regression.

12 years agodisk - add uuid to udev dict of parts
Alex Hornung [Fri, 10 Feb 2012 16:44:28 +0000 (16:44 +0000)]
disk - add uuid to udev dict of parts

 * Add the partition (disklabel64) UUID to the
   udev dictionary of partition disk devices,
   e.g. da0s1a.

12 years agodevattr - add more helpful failure message
Alex Hornung [Thu, 9 Feb 2012 21:49:14 +0000 (21:49 +0000)]
devattr - add more helpful failure message

Reported-by: luxh, swildner
12 years agondis(4): Use callout_init_mp(). Overlooked when I ported it.
Sascha Wildner [Thu, 9 Feb 2012 16:52:59 +0000 (17:52 +0100)]
ndis(4): Use callout_init_mp(). Overlooked when I ported it.

12 years agopuffs(4): Don't reference vp before it's initialized.
Sascha Wildner [Thu, 9 Feb 2012 16:30:16 +0000 (17:30 +0100)]
puffs(4): Don't reference vp before it's initialized.

12 years agohptiop(4): Use cam_calc_geometry() instead of duplicating it.
Sascha Wildner [Thu, 9 Feb 2012 13:02:07 +0000 (14:02 +0100)]
hptiop(4): Use cam_calc_geometry() instead of duplicating it.

Taken-from: FreeBSD

12 years agohptiop(4): Remove an unused variable.
Sascha Wildner [Thu, 9 Feb 2012 12:25:58 +0000 (13:25 +0100)]
hptiop(4): Remove an unused variable.

12 years agotest - Adjust randread to not share file descriptors
Matthew Dillon [Wed, 8 Feb 2012 23:32:52 +0000 (15:32 -0800)]
test - Adjust randread to not share file descriptors

* Close and reopen the device when randread fork()s so the physical
  file descriptor is not shared.  The vnode will still be shared.

* Works around a serialization issue when a file descriptor is shared.

12 years agomps(4): Add module version.
Sascha Wildner [Wed, 8 Feb 2012 20:40:35 +0000 (21:40 +0100)]
mps(4): Add module version.

12 years agolibexec: Remove duplicate includes.
Sascha Wildner [Wed, 8 Feb 2012 12:59:10 +0000 (13:59 +0100)]
libexec: Remove duplicate includes.

12 years agoRevert "mount_psshfs: Add a missing include dir to the Makefile."
Sascha Wildner [Wed, 8 Feb 2012 12:48:14 +0000 (13:48 +0100)]
Revert "mount_psshfs: Add a missing include dir to the Makefile."

This reverts commit 25766f8a90b7331f83451cfc4e175d1148a5dd08.

My thinking was wrong and it is not needed.

12 years agousr.sbin: Remove duplicate includes.
Sascha Wildner [Wed, 8 Feb 2012 12:37:51 +0000 (13:37 +0100)]
usr.sbin: Remove duplicate includes.

12 years agomount_psshfs: Add a missing include dir to the Makefile.
Sascha Wildner [Wed, 8 Feb 2012 12:37:23 +0000 (13:37 +0100)]
mount_psshfs: Add a missing include dir to the Makefile.

12 years agousr.bin: Remove duplicate includes.
Sascha Wildner [Wed, 8 Feb 2012 12:17:10 +0000 (13:17 +0100)]
usr.bin: Remove duplicate includes.

12 years agomps(4): Mark a function __printflike() and fix a resulting warning.
Sascha Wildner [Wed, 8 Feb 2012 11:01:20 +0000 (12:01 +0100)]
mps(4): Mark a function __printflike() and fix a resulting warning.

12 years agosbin: Remove duplicate includes.
Sascha Wildner [Tue, 7 Feb 2012 16:41:13 +0000 (17:41 +0100)]
sbin: Remove duplicate includes.

12 years agoSome cleanup in the puffs manpages.
Sascha Wildner [Tue, 7 Feb 2012 13:28:53 +0000 (14:28 +0100)]
Some cleanup in the puffs manpages.

12 years agoifconfig(8): Use strdup() instead of duplicating it.
Sascha Wildner [Tue, 7 Feb 2012 02:27:58 +0000 (03:27 +0100)]
ifconfig(8): Use strdup() instead of duplicating it.

12 years agomps(4): Remove some useless casts.
Sascha Wildner [Tue, 7 Feb 2012 10:53:42 +0000 (11:53 +0100)]
mps(4): Remove some useless casts.

I've inserted them by mistake because I had not realized that the
wrong typedefs for U32 and S32 were the real issue.

12 years agomps: Hold lock for the shutdown event handler
Sepherosa Ziehau [Tue, 7 Feb 2012 09:36:19 +0000 (17:36 +0800)]
mps: Hold lock for the shutdown event handler

12 years agomps: If we don't have enough space for a sge and chain, don't claim we can
Sepherosa Ziehau [Tue, 7 Feb 2012 09:35:20 +0000 (17:35 +0800)]
mps: If we don't have enough space for a sge and chain, don't claim we can

12 years agomps: Use WAITOK to allocate critical data struct on attach path
Sepherosa Ziehau [Tue, 7 Feb 2012 09:17:55 +0000 (17:17 +0800)]
mps: Use WAITOK to allocate critical data struct on attach path

12 years agomps: Properly define U32 and S32
Sepherosa Ziehau [Tue, 7 Feb 2012 09:15:45 +0000 (17:15 +0800)]
mps: Properly define U32 and S32

12 years agomps.4: Document how we disable MSI and comment out MSI-X documentation.
Sascha Wildner [Tue, 7 Feb 2012 08:50:08 +0000 (09:50 +0100)]
mps.4: Document how we disable MSI and comment out MSI-X documentation.

12 years agomps(4): Sync with FreeBSD.
Sascha Wildner [Tue, 7 Feb 2012 08:42:32 +0000 (09:42 +0100)]
mps(4): Sync with FreeBSD.

This a still in progress port of the new, LSI-supported version of the
mps(4) driver from FreeBSD.

Some of the changes are (from FreeBSD's commit msg):

- Integrated RAID (IR) support.
- Support for WarpDrive controllers.
- Support for SCSI protection information (EEDP).
- Support for TLR (Transport Level Retries), needed for tape drives.
- Improved error recovery code.
- ioctl interface compatible with LSI utilities.

This commit also moves the driver from sys/dev/disk to sys/dev/raid.

It still fails attaching at this stage. Work on it will continue in
master.

12 years agodpt(4): Remove an old unneeded file.
Sascha Wildner [Mon, 6 Feb 2012 13:29:06 +0000 (14:29 +0100)]
dpt(4): Remove an old unneeded file.

12 years agomlx(4): Remove an unused variable.
Sascha Wildner [Mon, 6 Feb 2012 08:29:22 +0000 (09:29 +0100)]
mlx(4): Remove an unused variable.

12 years agosnd_hda(4): Use MSI if it is supported by the device.
Sascha Wildner [Mon, 6 Feb 2012 03:42:17 +0000 (04:42 +0100)]
snd_hda(4): Use MSI if it is supported by the device.

12 years agopci: Fix manual interrupt routing support
Sepherosa Ziehau [Mon, 6 Feb 2012 03:02:18 +0000 (11:02 +0800)]
pci: Fix manual interrupt routing support

- Add function id to tunable name
- Call BUS_CONFIG_INTR upon manually assigned interrupt

Tested-by: swildner@
12 years agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 6 Feb 2012 02:17:58 +0000 (03:17 +0100)]
Update the pciconf(8) database.

Jan 18, 2012 snapshot from http://pciids.sourceforge.net/

12 years agosh: Test EXIT trap with multiple statements in it
Peter Avalos [Sun, 5 Feb 2012 20:43:12 +0000 (12:43 -0800)]
sh: Test EXIT trap with multiple statements in it

Obtained-from:  FreeBSD 230211

12 years agosh: Add testcases that should not be broken by future optimizations.
Peter Avalos [Sun, 5 Feb 2012 20:38:57 +0000 (12:38 -0800)]
sh: Add testcases that should not be broken by future optimizations.

Obtained-from:  FreeBSD 230121

12 years agosh: Avoid possible echo options in a testcase.
Peter Avalos [Sun, 5 Feb 2012 20:36:00 +0000 (12:36 -0800)]
sh: Avoid possible echo options in a testcase.

Obtained-from:  FreeBSD 229742

12 years agosh: Fix swapped INTON/INTOFF.
Peter Avalos [Sun, 5 Feb 2012 20:26:01 +0000 (12:26 -0800)]
sh: Fix swapped INTON/INTOFF.

A possible consequence of this bug was a memory leak if SIGINT arrived
during a 'set' command (listing variables).

Obtained-from:  FreeBSD 231001

12 years agosh: Use vfork in a few common cases.
Peter Avalos [Sun, 5 Feb 2012 20:21:25 +0000 (12:21 -0800)]
sh: Use vfork in a few common cases.

This uses vfork() for simple commands and command substitutions containing a
single simple command, invoking an external program under certain conditions
(no redirections or variable assignments, non-interactive shell, no job
control). These restrictions limit the amount of code executed in a vforked
child.

There is a large speedup (for example 35%) in microbenchmarks. The
difference in buildkernel is smaller (for example 0.5%) but still
statistically significant. See
http://lists.freebsd.org/pipermail/freebsd-hackers/2012-January/037581.html
for some numbers.

The use of vfork() can be disabled by setting a variable named
SH_DISABLE_VFORK.

Obtained-from:  FreeBSD 230998

12 years agosh: Fix $? in the first command of a 'for'.
Peter Avalos [Sun, 5 Feb 2012 20:12:44 +0000 (12:12 -0800)]
sh: Fix $? in the first command of a 'for'.

In the first command of a 'for', $? should be the exit status of the last
pipeline (command substitution in the word list or command before 'for'),
not always 0.

Obtained-from:  FreeBSD 230463

12 years agosh: Remove "kill" example function, which is superseded by the kill
Peter Avalos [Sun, 5 Feb 2012 20:10:27 +0000 (12:10 -0800)]
sh: Remove "kill" example function, which is superseded by the kill
builtin

Obtained-from:  FreeBSD 230437

12 years agosh: Fix execution of multiple statements in a trap when evalskip is set
Peter Avalos [Sun, 5 Feb 2012 20:07:56 +0000 (12:07 -0800)]
sh: Fix execution of multiple statements in a trap when evalskip is set

Before this fix, only the first statement of the trap was executed if
evalskip was set. This is for example the case when:
    o  "-e" is set for this shell
    o  a trap is set on EXIT
    o  a function returns 1 and causes the script to abort

Obtained-from:  FreeBSD 230212

12 years agosh: Fix some bugs with exit status from case containing ;&.
Peter Avalos [Sun, 5 Feb 2012 20:04:53 +0000 (12:04 -0800)]
sh: Fix some bugs with exit status from case containing ;&.

Also, rework evalcase() to not evaluate any tree. Instead, return the
NCLISTFALLTHRU node and handle it in evaltree().

Fixed bugs:

* If a ;& list with non-zero exit status is followed by an empty ;; or final
  list, the exit status of the case command should be equal to the exit
  status of the ;& list, not 0.

* An empty ;& case should not reset $?.

Obtained-from:  FreeBSD 230161

12 years agosh: Fix two bugs with case and exit status:
Peter Avalos [Sun, 5 Feb 2012 20:02:44 +0000 (12:02 -0800)]
sh: Fix two bugs with case and exit status:

* If no pattern is matched, POSIX says the exit status shall be 0 (even if
  there are command substitutions).
* If a pattern is matched and there are no command substitutions, the first
  command should see the $? from before the case command, not always 0.

Obtained-from:  FreeBSD 230154

12 years agosh: Change input buffer size from 1023 to 1024.
Peter Avalos [Sun, 5 Feb 2012 20:00:29 +0000 (12:00 -0800)]
sh: Change input buffer size from 1023 to 1024.

Apparently this improves performance on slower platforms.

Obtained-from:  FreeBSD 230118

12 years agosh: Fix out of bounds array access when trap is used with an invalid
Peter Avalos [Sun, 5 Feb 2012 19:52:44 +0000 (11:52 -0800)]
sh: Fix out of bounds array access when trap is used with an invalid
signal.

Obtained-from:  FreeBSD 230117

12 years agosh: Properly show "Not a directory" error in cd builtin.
Peter Avalos [Sun, 5 Feb 2012 19:44:29 +0000 (11:44 -0800)]
sh: Properly show "Not a directory" error in cd builtin.

The errno message display added in 72cbf4010 did not take attempting to
cd to a non-directory or something that cannot be stat()ed into account.

Obtained-from:  FreeBSD 230095

12 years agosh: Make various functions static.
Peter Avalos [Sun, 5 Feb 2012 19:42:22 +0000 (11:42 -0800)]
sh: Make various functions static.

Obtained-from:  FreeBSD 229220

12 years agosh: Remove unused function scopyn().
Peter Avalos [Sun, 5 Feb 2012 19:30:56 +0000 (11:30 -0800)]
sh: Remove unused function scopyn().

Obtained-from: FreeBSD 229219

12 years agosh: Make patmatch() non-recursive.
Peter Avalos [Sun, 5 Feb 2012 19:28:08 +0000 (11:28 -0800)]
sh: Make patmatch() non-recursive.

Obtained-from:  FreeBSD 229201

12 years agosh: Allow quoting ^ and ] in bracket expressions.
Peter Avalos [Sun, 5 Feb 2012 19:23:10 +0000 (11:23 -0800)]
sh: Allow quoting ^ and ] in bracket expressions.

Obtained-from:  FreeBSD 228943

12 years agosh: Use dirent.d_type in pathname generation.
Peter Avalos [Sun, 5 Feb 2012 19:20:09 +0000 (11:20 -0800)]
sh: Use dirent.d_type in pathname generation.

This improves performance for globs where a slash or another component
follows a component with metacharacters by eliminating unnecessary
attempts to open directories that are not.

Obtained-from:  FreeBSD 228942

12 years agosh: Cache de->d_namlen in a local variable.
Peter Avalos [Sun, 5 Feb 2012 19:16:08 +0000 (11:16 -0800)]
sh: Cache de->d_namlen in a local variable.

Obtained-from:  FreeBSD 228941

12 years agosh: Don't force special builtins non-special in optimized command subst.
Peter Avalos [Sun, 5 Feb 2012 19:11:06 +0000 (11:11 -0800)]
sh: Don't force special builtins non-special in optimized command subst.

This is not necessary: errors are already caught in evalbackcmd() and
forcelocal handles changes to variables.

Obtained-from:  FreeBSD 228937

12 years agoSupport exception handling on statically-linked binaries
John Marino [Sun, 5 Feb 2012 16:21:27 +0000 (17:21 +0100)]
Support exception handling on statically-linked binaries

The real-time dynamic linker handles exceptions on dynamically-linked
binaries through the dl_iterate_phdr function.  The RTLD isn't invoked
on statically-built executables so thrown exceptions weren't getting
handled.  There was a dummy dl_iterate_phdr function in libc with a
weak symbol that gets looked at when the rtld version isn't present.
This function was populated and gets called when the statically-linked
executable throws an exception.

It requires the GNU_EH_FRAME program header to be present.  The base
gcc 4.4 spec file was modified to emit this header for statically-built
binaries in addition to the dynamically lined ones.

12 years agocdefs: Rework and augment visibility attributes
John Marino [Sun, 5 Feb 2012 16:14:25 +0000 (17:14 +0100)]
cdefs: Rework and augment visibility attributes

One macro based on GCC visibility functions was already defined,
__exported.  However, it was marked as available for all GCC versions
when it fact it was introduced with gcc 4.0.

There was no macro for hidden visibility attributes, so the macros
__dso_hidden and __dso_public were borrowed from NetBSD.  __dso_public
is an alias for __exported.  The definition for all three macros were
made on the condition that the gcc version used is 4.0 or later.

12 years agokernel -- linprocfs: linprocfs_allocvp should return a locked vnode.
Venkatesh Srinivas [Sun, 5 Feb 2012 15:04:57 +0000 (10:04 -0500)]
kernel -- linprocfs: linprocfs_allocvp should return a locked vnode.

Fixes a panic where VFS_ROOT returned an unlocked vnode and led to
a lockmgr panic from vput in the namecache.

Reported-by: phma
Bug: 2298

12 years agoRevert "librefuse: Remove from Makefile; it breaks world"
Sascha Wildner [Sun, 5 Feb 2012 13:30:14 +0000 (14:30 +0100)]
Revert "librefuse: Remove from Makefile; it breaks world"

This reverts commit 7e1d2825717ccf4a77edc0de7cf1ae109928db1f.

12 years agolibpuffs: Fix a path that was assuming source is in /usr/src.
Sascha Wildner [Sun, 5 Feb 2012 13:28:41 +0000 (14:28 +0100)]
libpuffs: Fix a path that was assuming source is in /usr/src.

12 years agoboot2: slim it down about 300 bytes
John Marino [Sun, 5 Feb 2012 10:28:50 +0000 (11:28 +0100)]
boot2: slim it down about 300 bytes

The boot2_32.ld loader file needs to come in at 7680 bytes or less, while
boot2_64.ld can be a little bigger with a 14848 byte threshold.  The
32-bit version has the least memory margin.  Using the base gcc 4.4
compiler, it only has 396 bytes to spare.

Using updates from FreeBSD buys 292 additional bytes when built by the
base compiler.  This additional space may be useful for building world
with clang which may have slightly larger executables.

List of changes from FreeBSD
==========================
SVN 151382 (16 OCT 2005)
SHRINK: Convert load() ep and es arrays to static variables

SVN 180145 (01 JUL 2008)
BUG: parse function off by one
change "if (dsk.slice > NDOSPART)" to "if (dsk.slice > NDOSPART + 1)"

SVN 214210 (22 OCT 2010)
SHRINK: Avoid using memcpy() for copying 32bit chunks.

SVN 218713 (15 FEB 2011)
SHRINK: Change autoboot type from int to uint8_t

SVN 218745 (16 FEB 2011)
SHRINK: Remove reading of symbols from a.out loaded files.  This
functionality was left over from the early FreeBSD 3.x days to
support kernels in a.out format which never applied to DragonFly.
Removing it saves around 100 bytes.  bootinfo.bi_esymtab was also
relocated to the ELF section rather than aways being set.

SVN 219186 (02 MAR 2011)
SHRINK: Change the tick overflow computation.
Remove bi_basemem, bi_extmem, bi_memsizes_valid (unused).
Switch kname to a pointer from an array to avoid using memcpy() twice.
Remove memsize function (unused)

SVN 219452 (10 MAR 2011)
SHRINK: Convert to uint8_t: dsk.slice, dsk.part, sl.
Remove fmt variable in load() used in redundant condition ladder.
Set buffer as static in printf() to save space.

SVN 220392 (06 APR 2011)
BUG: Move getc() before xgetc() so gcc does not emit a warning about
function having no body.

Minor changes from John Marino
==============================
Created RBF_NOINTR and RBF_PROBEKBD macros for consist style.
Removed "#if 0" sections to clean up.
returned "static" back to drvread body (was still in prototype).
Changed xputc() to return the char rather than void (matches FreeBSD),

12 years agoCCVER=gcc46: Now builds world and kernel cleanly
John Marino [Sun, 5 Feb 2012 07:00:44 +0000 (08:00 +0100)]
CCVER=gcc46: Now builds world and kernel cleanly

Starting with gcc 4.5, sbin/restore would break on interactive.c with
the complaint that the designated length of the storage array within
the adirent union structure was not constant.  After three previous
proposals on the best way to fix it, this is the one requiring the
least code change.  (Don't count the spelling correction!)

This was the last place the breaks using WORLD_CCVER=gcc46.  The
kernel builds cleanly.  Both the gcc46-built world and kernel load
and function normally.

suggested-by: vsrinivas

12 years agolibrefuse: Remove from Makefile; it breaks world
John Marino [Sun, 5 Feb 2012 07:52:26 +0000 (08:52 +0100)]
librefuse: Remove from Makefile; it breaks world

The refuse library fails during a clean build (presumably on test machines
/usr/include/fuse_opt.h existed and the build defaulted to that one).

/usr/src/lib/librefuse/fuse.h:191:22: fatal error: fuse_opt.h:
No such file or directory
compilation terminated.

12 years agoBring in the "Port PUFFS from NetBSD/FreeBSD" GSoC 2011 project results.
Sascha Wildner [Sun, 5 Feb 2012 01:29:51 +0000 (02:29 +0100)]
Bring in the "Port PUFFS from NetBSD/FreeBSD" GSoC 2011 project results.

With some additional stuff done by me (properly hooking into the build,
add some manpages, and other missing bits here and there, nothing
functional).

What we get:

* puffs(3) and refuse(3) libraries
* puffs(4) and putter(9) kernel parts
* mount_psshfs(8) utility

Note that it still might crash or stop working, so it's still
experimental. We're bringing it anyway because several people showed
interest in continuing to work on it and so it doesn't rot outside
our tree, gets at least built with world/kernel, etc.

Submitted-by: Nick Prokharau <nickprok@gmail.com>
12 years agoCCVER=gcc46: Separate LDFLAGS meant for gcc and ld
John Marino [Sat, 4 Feb 2012 18:27:10 +0000 (19:27 +0100)]
CCVER=gcc46: Separate LDFLAGS meant for gcc and ld

The same LDFLAGS variable was being applied to gcc and ld.  Apparently
gcc 4.4 and below recognized and accepted the -m switch and passed it
on to the linker, but gcc 4.6 wasn't handling it.

A new variable COMPILER_LDFLAGS has been created alongside LDFLAGS.  The
former is meant to be passed to gcc and the latter is passed to ld.

12 years agoCCVER=gcc46: Adjust Makefile so boot2 remains < 7.5kb
John Marino [Sat, 4 Feb 2012 17:27:41 +0000 (18:27 +0100)]
CCVER=gcc46: Adjust Makefile so boot2 remains < 7.5kb

A big sticking point with getting gcc46 to successfully buildworld was
getting boot2 to come in at 7680 bytes or less.  Unmodified it was
weighing in 784 bytes too much.  Every applying several byte-reducing
changes to it from FreeBSD only knocked off about 380 bytes.

Comparing the assembly dumps between versions built by the base
compiler and gcc46 didn't reveal that much, but using the readelf
utility on both did.  GCC 4.6 was embedding the .eh_frame section
to the object file generated from boot2.c which was adding over 1900
bytes to it.

After adding three command line switches to the makefile, the
exception handler section is prohibited from building.  There are
4968 bytes still available, down from 4988 bytes seen with the base
compiler.  The updates from FreeBSD can be applied later to free up
more memory but for now it's not required.

12 years agoCCVER=gcc46: Minor tweaks for buildworld
John Marino [Sat, 28 Jan 2012 17:19:55 +0000 (18:19 +0100)]
CCVER=gcc46: Minor tweaks for buildworld

Currently WORLD_CCVER=gcc46 will break on gcc4.1, include/rpcsvc, and is
not recognized by libc.  This commit will fix that.  The nis.x fix is the
least understood as the gnatcpp seems not to like multiline macros when
used with rpcgen.

12 years agocustom cc script: Use gcc46's c++ library instead of base
John Marino [Sat, 4 Feb 2012 10:37:42 +0000 (11:37 +0100)]
custom cc script: Use gcc46's c++ library instead of base

There will be a slight performance hit with having to make two calls to
gnatc++ before every real call in order to use gnat-aux's c++ library
rather than the base systems gcc 4.4 c++ library.  The alternative is
hardcoding these values as a function of arch which is less appealing.

12 years agokernel: Remove the no longer functional APIC_IO option.
Sascha Wildner [Fri, 3 Feb 2012 13:13:20 +0000 (14:13 +0100)]
kernel: Remove the no longer functional APIC_IO option.

12 years agovkernel - Fix semi-random SIGILL crashes under heavy network loads
Matthew Dillon [Thu, 2 Feb 2012 23:17:44 +0000 (15:17 -0800)]
vkernel - Fix semi-random SIGILL crashes under heavy network loads

* SIGIO was being installed with SA_NODEFER, resulting in situations
  under heavy network loads where multiple SIGIOs could stack and cause
  a stack overflow.  This often resulted in the sendsig code in the kernel
  generating a SIGILL to the process after being unable to push a new
  signal context.

* Removing SA_NODEFER appears to solve the problem.

Reported-by: tuxillo
12 years agorconfig - Fix getopt options
Antonio Huete Jimenez [Thu, 2 Feb 2012 16:53:18 +0000 (17:53 +0100)]
rconfig - Fix getopt options

12 years agoLINT*: Add DEBUG_LOCKS_LATENCY.
Sascha Wildner [Thu, 2 Feb 2012 11:00:10 +0000 (12:00 +0100)]
LINT*: Add DEBUG_LOCKS_LATENCY.

12 years agokernel: Remove the obsolete SHMALL, SHMMAX and SHMMAXPGS options.
Sascha Wildner [Thu, 2 Feb 2012 10:44:47 +0000 (11:44 +0100)]
kernel: Remove the obsolete SHMALL, SHMMAX and SHMMAXPGS options.

In 6e2ab4bff5412f15d11ea4f8fb4a157de12432a8 we switched to autosizing
maximum shm pages along with a tunable to override.

12 years agokernel - Fix lockmgr lock mismatch panics when iwn used without wlan
Matthew Dillon [Thu, 2 Feb 2012 03:43:26 +0000 (19:43 -0800)]
kernel - Fix lockmgr lock mismatch panics when iwn used without wlan

* If if_iwn is ifconfig'd without going through wlan the wlan_serializer
  is not held during the firmware load stage, resulting in a panic.
  Acquire the serializer for this case.

* Note: iwn worked fine with wlan, but this fixes an annoying panic when
  people try to mess with it without wlan.

Reported-by: fxr (irc)
12 years agouname(1): Bring back CVS IDs except ours.
Sascha Wildner [Thu, 2 Feb 2012 02:23:54 +0000 (03:23 +0100)]
uname(1): Bring back CVS IDs except ours.

12 years agorconfig - LVM stripe script
Antonio Huete Jimenez [Wed, 1 Feb 2012 23:00:46 +0000 (00:00 +0100)]
rconfig - LVM stripe script

It uses lvm(8) facilities to install a DragonFly system in a
logical volume made of as many disk as you specify in the disk
list. It creates a swap partition and a /boot UFS filesystem
as it is required for proper operation.

12 years agosym(4): Sync with FreeBSD.
Sascha Wildner [Wed, 1 Feb 2012 22:36:39 +0000 (23:36 +0100)]
sym(4): Sync with FreeBSD.

This fixes disk detection issues in QEMU, among other things. It is also
available as a module now.

Tested-by: tuxillo
12 years agoLINT*: Fix some wrong paths in the comments.
Sascha Wildner [Wed, 1 Feb 2012 22:39:30 +0000 (23:39 +0100)]
LINT*: Fix some wrong paths in the comments.

12 years agokernel - Add missing DRM_LOCK()
Matthew Dillon [Wed, 1 Feb 2012 21:40:19 +0000 (13:40 -0800)]
kernel - Add missing DRM_LOCK()

* Add missing DRM_LOCK() in the i915 X11 ioctl path

Reported-by: Pierre Abbat
Dump-by: Magliano Andrea
12 years agoroute utils: Recognize IFT_CARP link layer address
Sepherosa Ziehau [Mon, 23 Jan 2012 15:00:11 +0000 (23:00 +0800)]
route utils: Recognize IFT_CARP link layer address

12 years agocarp: Make carp interfaces work like ethernet interfaces
Sepherosa Ziehau [Mon, 23 Jan 2012 08:19:06 +0000 (16:19 +0800)]
carp: Make carp interfaces work like ethernet interfaces

- Use ether_ifattach() instead of if_attach() to attach carp and carp's
  ioctl methed will fallback to ether_ioctl().
- VHID changes will be reflected into the carp's ethernet address.
- Reimplement carp output path.
  *  carp uses the parent's if_output() i.e. ether_output(), but passes
     the carp interface's ifp.
  *  The ether_output() is adjusted to detect the carp interface and
     switch to the carp's parent interface just before performing the
     real output.
  *  ARP resolve will use carp instead of its parent interface, thus
     the ARP output's source ethernet address and the sender hardware
     address are consistent and loopback on the carp will work as
     expected.
- Reimplement carp input path>
  *  Input interface will be changed to carp if the packet is destined
     to the carp's ethernet address.
  *  If the received packet is broadcast or multicast, all of the carps
     on the receiving interface will receive a copy of the packet.
- Fix up gratuitous ARP.
  *  No gratuitous ARP will be sent for carp upon IP address changes.
  *  Gratuitous ARP sent by carp use itself as interface not carp's
     parent interface.
- Fix up ARP input path.  Since ARP request is broadcast packet, parent
  interface of the carp will also receive the packet and will reply the
  ARP request.  If carp and its parent interface have same IP address,
  the parent's ARP reply will confuse the ARP requester: the ethernet
  address of the IP is no longer carp's ethernet address.
- Rework carp's prefix route addition and deletion.
  *  Add IP addresses to carp will not add prefix routes
  *  Bring carp interface up will not add prefix routes for carp's
     existing IP addresses
  *  Carp IP addresses prefix route will be added when carp is master,
     and the parent's corresponding IP addresses prefix route will be
     deleted.
  *  Carp IP addresses prefix route will be deleted when carp is no
     longer master and the parent's corresponding IP addresses prefix
     route will be added back.
- Handle carp parent interface's up/down events.
  *  When carp's parent is down, we fake up a parent IP address deletion
     event for carp.
  *  When carp's parent is up, we fake up a parent IP address addition
     event for carp.
- Stringent checks on CARP proto input path.
- Nullfy ifnet's serialier; carp is protected by global carp token.
- Mark CARP protocol MPSAFE

Idea-from: OpenBSD

12 years agokernel - Improve pageout daemon & memory pressure detection w/tmpfs
Matthew Dillon [Wed, 1 Feb 2012 04:52:46 +0000 (20:52 -0800)]
kernel - Improve pageout daemon & memory pressure detection w/tmpfs

* PG_NEED_COMMIT pages are unwired from the buffer cache they are now
  unconditionally placed on the active queue, even if 'activate' is not
  set.

* This results in non-freeable tmpfs pages remaining in the active queue
  most of the time.  They will be cycled into the inactive queue and flushed
  out if swap is present as per normal pageout daemon operation,

  When swap is not present or is full, these pages are reactivated
  unconditionally.

12 years agokernel - Adjust tmpfs to use the new PG_NEED_COMMIT flag
Matthew Dillon [Wed, 1 Feb 2012 04:46:01 +0000 (20:46 -0800)]
kernel - Adjust tmpfs to use the new PG_NEED_COMMIT flag

* Adjust tmpfs to use vm_page_need_commit() instead of redirtying VM
  pages in its strategy code.

* The new mechanism also allows the pageout daemon to act more naturally
  when flushing clean pages with PG_NEED_COMMIT set.

* May fix some tmpfs corruption issues

Reported-by: tuxillo
12 years agokernel - Add vm_page_need_commit() and vm_page_clear_commit()
Matthew Dillon [Wed, 1 Feb 2012 04:41:57 +0000 (20:41 -0800)]
kernel - Add vm_page_need_commit() and vm_page_clear_commit()

* Add vm_page_need_commit() and vm_page_clear_commit().  This controls the
  PG_NEED_COMMIT flag on individual VM pages.

  When set a clean VM page cannot be reused and is still subject to
  flushing by the pageout daemon.

* Refactor buwrite() to use the new mechanism instead of dirtying the
  pages underlying the buffer.

* This allows the normal page and buffer flushing mechanism to operate
  even in situations where the VM page is also the nominal backing store
  for the data (as in tmpfs).

* Will be used by tmpfs.

12 years agokernel - Fix incorrect assertion during udp auto-binding
Matthew Dillon [Tue, 31 Jan 2012 22:18:36 +0000 (14:18 -0800)]
kernel - Fix incorrect assertion during udp auto-binding

* When sendto() is used and the UDP socket is not bound the binding
  operation is done by the netisr thread and causes an assertion due
  to not being a process.

* The assertion is incorrect, remove it.  This only occured when lport has
  not been assigned and the cred check is only needed when it has.

Reported-by: Pierre Abbat
12 years agokern - Skip rlimit check when caller is a kernel thread.
Antonio Huete Jimenez [Mon, 30 Jan 2012 13:29:56 +0000 (14:29 +0100)]
kern - Skip rlimit check when caller is a kernel thread.

Pointed-out-by: vsrinivas
12 years agokernel/cryptodev: Remove useless zlib dependency.
Sascha Wildner [Tue, 31 Jan 2012 11:15:13 +0000 (12:15 +0100)]
kernel/cryptodev: Remove useless zlib dependency.