7 years agolibc -- stdlib: Implement quick_exit and at_quick_exit from C11.
Venkatesh Srinivas [Fri, 24 Feb 2012 18:07:07 +0000 (10:07 -0800)]
libc -- stdlib: Implement quick_exit and at_quick_exit from C11.

7 years agopuffs - check whether the FS has the given op
Alex Hornung [Fri, 24 Feb 2012 16:09:21 +0000 (16:09 +0000)]
puffs - check whether the FS has the given op

 * Previously calls to some of the vnops that are unimplemented in the
   actual puffs filesystem were succeeding.

 * We now check whether the op exists before trying to pass it to
   the userland FS. If it doesn't exist, fail (or return ok if no real
   action needs to be taken).

7 years agopuffs - fix panic on hardlink
Alex Hornung [Fri, 24 Feb 2012 14:57:08 +0000 (14:57 +0000)]
puffs - fix panic on hardlink

 * puffs was trying to lock the vp in nlink again, but kern_link does
   that already via vget.

Reported-by: Sascha Wildner (swildner@)
7 years agokern - Do not expose _kthread_create()
Antonio Huete Jimenez [Fri, 24 Feb 2012 10:01:30 +0000 (11:01 +0100)]
kern - Do not expose _kthread_create()

Pointed-out-by: aggelos
7 years agokern build: Tweak ldscripts for gold linker
John Marino [Thu, 23 Feb 2012 18:03:04 +0000 (19:03 +0100)]
kern build: Tweak ldscripts for gold linker

The gold linker v2.21 was able to link a working kernel although its
modules were unloadable.  The gold linker v2.22 could build loadable
modules, but the kernel wouldn't boot!  It's not clear why the modules
started to work -- my guess is that the ancient ldscripts used during
the 2.21 trial were the culprit.

The gold linker changed its ELF program header handling defaults for
version 2.22, and this resulted in an extra LOAD segment reserved only
for the program headers.  The DragonFly loader wasn't expecting that
and instantly rebooted when trying to load a gold kernel.

The solution was to add a PHDRS section to the ldscripts to specify
exactly the section to segment mapping, and prevent gold from putting
the elf headers in their own load segment.  Now gold matches gnu ld
linker in having only two LOAD segments, text and data.

As a curiousity, gold sets the LOAD segment alignment value at 0x1000
for both i386 and x86_64, where gnu ld sets the segment alignment at
0x1000 for i386 and 0x200000 for x86_64.  This seems to have no impact
on the loading of the kernel.

7 years agoloaded: Remove obsolete -elf cflags
John Marino [Thu, 23 Feb 2012 21:59:45 +0000 (22:59 +0100)]
loaded: Remove obsolete -elf cflags

The gnu ld ignores -elf, but gold linker interprets this flag as
entry=lf.  It's a dinosaur from the FreeBSD aout days.

7 years agoLINT: Add CPU_HAS_SSE2.
Sascha Wildner [Thu, 23 Feb 2012 18:23:40 +0000 (19:23 +0100)]

7 years agobuild - Add git gc --aggressive to src and pkgsrc git repo creation
Matthew Dillon [Thu, 23 Feb 2012 17:04:38 +0000 (09:04 -0800)]
build - Add git gc --aggressive to src and pkgsrc git repo creation

* Issue a git gc --aggressive after pulling the git repo for src
  and/or pkgsrc.  This will garbage collect and recompress the
  repo, significantly reducing the disk space required.

* Primarily intended to reduce the size of the usb and dvd gui nrelease

* The gc pass takes a few minutes to run but seems worth it.

7 years agoRemove the KTR_MSGPORT kernel option which was never used.
Sascha Wildner [Wed, 22 Feb 2012 09:35:03 +0000 (10:35 +0100)]
Remove the KTR_MSGPORT kernel option which was never used.

7 years agokern - Merge two functions to avoid duplicated code.
Antonio Huete Jimenez [Tue, 21 Feb 2012 19:19:34 +0000 (20:19 +0100)]
kern - Merge two functions to avoid duplicated code.

- Merged kthread_create() and kthread_create_cpu() into
  _kthread_create() thus avoiding some duplicated code.
- Set TDF_VERBOSE on threads only under bootverbose.

7 years agoMakefile.inc1: Remove a no longer used variable.
Sascha Wildner [Tue, 21 Feb 2012 16:00:32 +0000 (17:00 +0100)]
Makefile.inc1: Remove a no longer used variable.

7 years agoRemove the old <sys/ata.h> header and make it a link of <sys/nata.h>.
Sascha Wildner [Mon, 20 Feb 2012 18:29:44 +0000 (19:29 +0100)]
Remove the old <sys/ata.h> header and make it a link of <sys/nata.h>.

7 years agochkey, chpass, enigma, lock, newgrp, pw - Handle NULL return from crypt(3)
Samuel J. Greear [Mon, 20 Feb 2012 17:34:19 +0000 (10:34 -0700)]
chkey, chpass, enigma, lock, newgrp, pw - Handle NULL return from crypt(3)

7 years agoFix some typos.
Sascha Wildner [Mon, 20 Feb 2012 13:31:04 +0000 (14:31 +0100)]
Fix some typos.

7 years agodsched(4): Some miscellaneous cleanup.
Sascha Wildner [Mon, 20 Feb 2012 11:58:50 +0000 (12:58 +0100)]
dsched(4): Some miscellaneous cleanup.

* Rename the bfq manpage to dsched_bfq(4), so that we don't run into
  name conflicts in the future. If someone wrote a manpage for
  dsched_as, it would have resulted in an as(4) manpage.

* Add options DSCHED_AS and DSCHED_BFQ to LINT*.

* Also, remove an unneeded check in dsched_as.

7 years agokern build: Update ldscripts
John Marino [Sun, 19 Feb 2012 16:24:56 +0000 (17:24 +0100)]
kern build: Update ldscripts

All for ldscripts (includes two virtual kernel scripts) have been
synchronized with binutils 2.22.  The previous sync was with FreeBSD
which is still using binutils 2.17.50.

A notable update is the usage of "-z max-page-size".  This is required
because the gold linker has a standard maximum page size of 0x1000 bytes
compared to 0x200000 bytes for the gnu ld linker.  It's an option to
change the default, but the gold default of 4KB has advantages.  Or in
other words, using a default maximum page size of 2MB has impacts to
library size and available memory that can be avoided.

Another thing to note is the vkernel64 has now been changed to load at
0x200000 like it's pc64 counterpart.

7 years agox86_64 getmemsize: Recover 0x100000 bytes
John Marino [Sun, 19 Feb 2012 15:26:19 +0000 (16:26 +0100)]
x86_64 getmemsize: Recover 0x100000 bytes

When binutils 2.20 was brought in, the x86_64 kernel built with it loaded
at 0x200000 instead of 0x100000 as it was previously.  The getmemsize()
function was never updated with the new address so the physical memory
between 0x100000 and 0x200000 has been lost since then.

The hardcoded value has been updated.  In the future, it may be a good
idea to replace with a variable as FreeBSD has done.

7 years agoMerge remote-tracking branch 'crater/master'
Thomas Nikolajsen [Sat, 18 Feb 2012 10:42:01 +0000 (11:42 +0100)]
Merge remote-tracking branch 'crater/master'

7 years agotmpfs.5: Add note that DragonFly NFS client needs to disable ReaddirPlus
Thomas Nikolajsen [Sat, 18 Feb 2012 10:37:22 +0000 (11:37 +0100)]
tmpfs.5: Add note that DragonFly NFS client needs to disable ReaddirPlus

7 years agoVFS accounting: optimize vop_write() performance
Fran├žois Tigeot [Sat, 18 Feb 2012 09:36:06 +0000 (10:36 +0100)]
VFS accounting: optimize vop_write() performance

* Avoid a mount list scan if accounting is globally disabled

7 years agoVFS accounting: check if nullfs mp* really exist
Francois Tigeot [Fri, 17 Feb 2012 22:58:58 +0000 (23:58 +0100)]
VFS accounting: check if nullfs mp* really exist

* Nullfs are a clever hack, they forget their mp after mount and let the
  non-nullfs underlying mount point do all the work

* Nevertheless, we need to get the real struct mount associated to a mount
  point to count the space used by PFSes. We cache it in the vnode.

* But since the vnode we use really belongs to the lowest underlying
  mount point, the upper-level mp may already have been freed.

* We need to first check if it still valid; a new function,
  mountlist_exists() now exists for that purpose.

* Should fix issue #2266

7 years agortld: add carriage return to die()
John Marino [Sat, 18 Feb 2012 07:47:35 +0000 (08:47 +0100)]
rtld: add carriage return to die()

Add missing EOL character to the die() message.  This was lost when rtld_fdputstr() was
brought into rtld.

FreeBSD PR bin/165075
FreeBSD SVN 231582 (13 Feb 2012)

7 years agohier.7: Add back a .Bl that was removed with the binutils 2.20 removal.
Sascha Wildner [Fri, 17 Feb 2012 22:05:03 +0000 (23:05 +0100)]
hier.7: Add back a .Bl that was removed with the binutils 2.20 removal.

7 years agokernel/pf: In the ioctl code, make sure NPFLOG is actually defined.
Sascha Wildner [Fri, 17 Feb 2012 11:22:26 +0000 (12:22 +0100)]
kernel/pf: In the ioctl code, make sure NPFLOG is actually defined.

The inclusion of if_pflog.h was conditionalized on NPFLOG but it is
if_pflog.h itself that actually defines NPFLOG (because it includes

So if_pflog.h was never included and some initialization code in
the ioctls for adding and changing rules was not executed.

7 years agokernel: Remove unused attributes from stuff that is, in fact, used.
Sascha Wildner [Thu, 16 Feb 2012 22:56:53 +0000 (23:56 +0100)]
kernel: Remove unused attributes from stuff that is, in fact, used.

7 years agopuc(4): Enable it for x86_64, too.
Sascha Wildner [Thu, 16 Feb 2012 21:30:49 +0000 (22:30 +0100)]
puc(4): Enable it for x86_64, too.

I have no idea if it works, but it is not in our GENERIC kernels so it
looks safe to just lurk for someone adding it to their config and
reporting breakage.

7 years agopuc.4: Fix path.
Sascha Wildner [Thu, 16 Feb 2012 21:28:44 +0000 (22:28 +0100)]
puc.4: Fix path.

7 years agokernel/i386: Remove a no longer needed include, too.
Sascha Wildner [Thu, 16 Feb 2012 19:53:33 +0000 (20:53 +0100)]
kernel/i386: Remove a no longer needed include, too.

7 years agokernel: Remove the unused is_physical_memory() function.
Sascha Wildner [Thu, 16 Feb 2012 19:51:28 +0000 (20:51 +0100)]
kernel: Remove the unused is_physical_memory() function.

It used to be used in dumping functions of raid and disk drivers but
updates and alexh's dumping upgrades (b24cd69c3515fbc52) removed all
usage more than two years ago.

7 years agokernel: mfs -- Fix unmount panic for MFS filesystems.
Venkatesh Srinivas [Thu, 16 Feb 2012 15:53:22 +0000 (07:53 -0800)]
kernel: mfs -- Fix unmount panic for MFS filesystems.

mfs_start() is active for the life of an MFS mount, handling copyin/out
requests. It is directed to exit when an MFS filesystem is unmounted.
The VFS accounting code and VFS MPLOCK code assumed that the mountpoint
structure was stable on return of mfs_start, which was not the case.

To work around that, don't call acinit if the vfs_start vfsop returns
EMOUNTEXIT, a kernel-specific pseudo-errno. Also allow marking vfs_start
MPSAFE and mark mfs vfs_start MPSAFE, to avoid accessing a per-mount
token field. A future commit will rework MFS's locking so that critical
sections are not used to protect the MFS bioq.

This is a hack for MFS; future work should either rework the filesystem
or replace it outright with tmpfs.

Closes: Bug 2276

7 years agoisp(4): Fix wrong sizeof().
Sascha Wildner [Thu, 16 Feb 2012 14:48:27 +0000 (15:48 +0100)]
isp(4): Fix wrong sizeof().

7 years agoproplib manpages: Add missing .Nd
Sascha Wildner [Thu, 16 Feb 2012 10:48:59 +0000 (11:48 +0100)]
proplib manpages: Add missing .Nd

7 years agoobjformat.1: Fix date.
Sascha Wildner [Thu, 16 Feb 2012 10:00:54 +0000 (11:00 +0100)]
objformat.1: Fix date.

7 years agokernel: Include <sys/ioccom.h> where ioctls are defined (part 2).
Sascha Wildner [Thu, 16 Feb 2012 09:35:04 +0000 (10:35 +0100)]
kernel: Include <sys/ioccom.h> where ioctls are defined (part 2).

Some cases that I previously missed.

7 years agokernel: Include <sys/ioccom.h> where ioctls are defined.
Sascha Wildner [Thu, 16 Feb 2012 09:08:57 +0000 (10:08 +0100)]
kernel: Include <sys/ioccom.h> where ioctls are defined.

Not where they are used.

See http://bugs.dragonflybsd.org/issues/1334

7 years agokernel: Remove opt_bus.h references where they are not needed.
Sascha Wildner [Thu, 16 Feb 2012 07:54:23 +0000 (08:54 +0100)]
kernel: Remove opt_bus.h references where they are not needed.

It only defines BUS_DEBUG (if set) and BUS_DEBUG is only used in
subr_bus.c, so it doesn't need to be included anywhere else.

7 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'

7 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.

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

7 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

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

7 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).

7 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.

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

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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.

7 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

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

7 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.

7 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.

7 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
7 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.

7 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.

7 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

7 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.

7 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.

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

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

7 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.

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

7 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.

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

7 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.

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

7 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.

7 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.

7 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.

7 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

7 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

7 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

7 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

7 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.

7 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

7 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.

7 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.

7 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.

7 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@
7 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/

7 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

7 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

7 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

7 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

7 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

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
for some numbers.

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

Obtained-from:  FreeBSD 230998

7 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

7 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

Obtained-from:  FreeBSD 230437

7 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

7 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

7 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

7 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

7 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

Obtained-from:  FreeBSD 230117

7 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

7 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

7 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

7 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