dragonfly.git
12 years agohammer2 - Implement more of the hammer2_chain infrastructure
Matthew Dillon [Sun, 12 Feb 2012 19:23:17 +0000 (11:23 -0800)]
hammer2 - Implement more of the hammer2_chain infrastructure

* Allocate system structures through their chain type.

* Implement core lookup and iteration code

* Non-terminal media objects which are smaller than HAMMER2_PBUFSIZE (64K)
  cannot hold onto their buffer cache buffer without deadlocking against
  or interfering with the chain.

  This is just inodes for now.  An embedded copy of the media data is
  retained (I had removed it before thinking I could just map the bp but
  it doesn't work, so it goes back in).

* Data references for other media objects can be temporary and allocated.
  The chain locking and unlocking code will instantiate and destroy the
  allocated copy as needed.

  This also enforces the chain locking requirement for media data access.

* hammer2_chain_create() skeleton added (cannot create indirect blocks yet).

* hammer2_chain_delete() does nothing atm.

* tested with mount/umount.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Sun, 12 Feb 2012 19:22:32 +0000 (11:22 -0800)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

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 agohammer2 - fix umount panic, misc fixes
Matthew Dillon [Sat, 11 Feb 2012 08:27:34 +0000 (00:27 -0800)]
hammer2 - fix umount panic, misc fixes

* Properly assign the vnode type.  Remove ip->type and instead of use
  ip->data.type.  This also allows vflush() to work properly during umount.

* Handle degenerate VOP_RECLAIM case.

* Add freecache[] array to help in the upcoming simple test-only freemap
  allocator.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Sat, 11 Feb 2012 06:40:05 +0000 (22:40 -0800)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agoUse copyinstr for volume field.
Venkatesh Srinivas [Sat, 11 Feb 2012 03:38:10 +0000 (22:38 -0500)]
Use copyinstr for volume field.

12 years agohammer2 - Implement most of the hammer2_chain_*() function set
Matthew Dillon [Sat, 11 Feb 2012 02:20:05 +0000 (18:20 -0800)]
hammer2 - Implement most of the hammer2_chain_*() function set

* Implement hammer2_chain_push/first/next/get/link/unlink.  Integrate
  the hammer2_inode into the chain topology.

* Route both the reference count and the busy count through the chain
  structure.

* Implement simplified I/O via the chain functions.

* Indirect blocks not yet implemented in the chain functions.

* Use the chain functions to locate both the super-root inode and the
  root-inode via its label.

12 years agohammer2 - flesh out inode and blockref chaining
Matthew Dillon [Fri, 10 Feb 2012 22:12:13 +0000 (14:12 -0800)]
hammer2 - flesh out inode and blockref chaining

* Move the inode code into hammer2_inode.c

* Rename ipstack to chain and do an initial skeleton in hammer2_chain.c

* The hammer2_chain structures embed a blockref and maintain a chain
  of pointers all the way to the volume root.

  hammer2_chain structures are embedded in major hammer2 system memory
  structures (hammer2_inode, hammer2_mount, hammer2_indblock).

  All lookups and searches are tracked via hammer2_chain structures.

12 years agohammer2 - Add copyright headers
Matthew Dillon [Fri, 10 Feb 2012 22:11:34 +0000 (14:11 -0800)]
hammer2 - Add copyright headers

* Add copyright headers

12 years agohammer2 - hammer2_install_volume_header() cleanup
Matthew Dillon [Fri, 10 Feb 2012 18:10:27 +0000 (10:10 -0800)]
hammer2 - hammer2_install_volume_header() cleanup

* Use one bp and copy the best valid header into the hmp.

* Flesh out the error reporting.

* Document the fact that a read may fail due to device EOF.

12 years agohammer2 - correct icrc generation for sector 0
Matthew Dillon [Fri, 10 Feb 2012 18:09:25 +0000 (10:09 -0800)]
hammer2 - correct icrc generation for sector 0

* Correct the icrc generation for sector 0. Other icrc's are also stored
  in sector 0 and have be generated first.

* Write the volume header out to all volume header alternates.  All four
  are, in fact, master copies.  The mount code will find the best one.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Fri, 10 Feb 2012 17:40:47 +0000 (09:40 -0800)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

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 agohammer2 -- Add missing error set in valid path.
Venkatesh Srinivas [Fri, 10 Feb 2012 15:17:12 +0000 (10:17 -0500)]
hammer2 -- Add missing error set in valid path.

12 years agohammer2 -- Read multiple volume headers and validate CRC for sect0.
Venkatesh Srinivas [Fri, 10 Feb 2012 14:56:46 +0000 (09:56 -0500)]
hammer2 -- Read multiple volume headers and validate CRC for sect0.

12 years agohammer2 - wire in statfs/statvfs, add the chain structure, etc
Matthew Dillon [Fri, 10 Feb 2012 07:49:37 +0000 (23:49 -0800)]
hammer2 - wire in statfs/statvfs, add the chain structure, etc

* Wire mnt_stat and mnt_vstat.  Currently dummy-up the values.  This allows
  the mount point to show up in 'df' output.

* Add the chain structure for upcoming directory search work.  This
  structure will also be used to track through indirect blocks.  The
  chain structure supplies the full blockref chain from an in-memory
  structure to the root volume, allowing modifications to be properly
  tracked.

* Move the volume header read to its own support procedure, it's going to
  eventually be considerably more complex.

* Bring the hammer2_dirhash() procedure in from newfs_hammer2.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Fri, 10 Feb 2012 06:04:34 +0000 (22:04 -0800)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agoRead volume header.
Venkatesh Srinivas [Fri, 10 Feb 2012 04:00:54 +0000 (23:00 -0500)]
Read volume header.

12 years agoCorrect assertion in hammer2_freei.
Venkatesh Srinivas [Fri, 10 Feb 2012 03:46:13 +0000 (22:46 -0500)]
Correct assertion in hammer2_freei.

12 years agohammer2 - followup cleanup
Matthew Dillon [Fri, 10 Feb 2012 03:31:08 +0000 (19:31 -0800)]
hammer2 - followup cleanup

* followup cleanup to last commit

12 years agohammer2 - cleanup, kldload, mount, iget/ifree and other stuff.
Matthew Dillon [Fri, 10 Feb 2012 03:28:11 +0000 (19:28 -0800)]
hammer2 - cleanup, kldload, mount, iget/ifree and other stuff.

* Make kldload and kldunload run cleanly

* Make mount/umount run cleanly.  Properly deallocate the root inode and
  close the underlying device.

* Write iget/ifree and properly deal with deadlocks between reclaim and
  iget.

* Remove the hm_ prefix for the hammer2_mount structure.

* Use 'hammer2_xxx_t' instead of 'struct hammer2_xxx' in many cases.

* Other general cleanups.

12 years agohammer2 - complain if the hammer2 kld module isn't loaded
Matthew Dillon [Fri, 10 Feb 2012 02:18:45 +0000 (18:18 -0800)]
hammer2 - complain if the hammer2 kld module isn't loaded

* Complain if the hammer2 kld module isn't loaded instead of exiting
  silently.

12 years agohammer2 - code cleanup, fix kldload issue
Matthew Dillon [Fri, 10 Feb 2012 01:54:59 +0000 (17:54 -0800)]
hammer2 - code cleanup, fix kldload issue

* More code cleanups.   Formatting, add missing copyright notices,
  staticization, etc.

* Fix a missing symbol that was renamed.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Fri, 10 Feb 2012 01:40:00 +0000 (17:40 -0800)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agohammer2 -- Flesh out _mount vfsops, add mountctl.
Venkatesh Srinivas [Fri, 10 Feb 2012 00:29:01 +0000 (19:29 -0500)]
hammer2 -- Flesh out _mount vfsops, add mountctl.

12 years agohammer2 -- Remove tmpfs scaffold.
Venkatesh Srinivas [Fri, 10 Feb 2012 00:15:43 +0000 (19:15 -0500)]
hammer2 -- Remove tmpfs scaffold.

tmpfs structures were used in HAMMER2 development to help get a
mountable object, but were no longer needed.

12 years agoMerge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository...
Matthew Dillon [Thu, 9 Feb 2012 22:29:41 +0000 (14:29 -0800)]
Merge branches 'hammer2' and 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

12 years agohammer2 -- Cleanup volume header readout a bit.
Venkatesh Srinivas [Thu, 9 Feb 2012 21:54:03 +0000 (16:54 -0500)]
hammer2 -- Cleanup volume header readout a bit.

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 agohammer2 -- Compile fixes #2.
Venkatesh Srinivas [Thu, 9 Feb 2012 21:26:50 +0000 (16:26 -0500)]
hammer2 -- Compile fixes #2.

Disable code reading volhdr for a bit; allows mounting w/o panic.

12 years agohammer2 -- Compile fixes.
Venkatesh Srinivas [Thu, 9 Feb 2012 21:02:56 +0000 (16:02 -0500)]
hammer2 -- Compile fixes.

12 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into...
Matthew Dillon [Thu, 9 Feb 2012 20:29:11 +0000 (12:29 -0800)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly into hammer2

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 agohammer2 - Initial newfs_hammer2 implementation
Matthew Dillon [Thu, 9 Feb 2012 06:28:48 +0000 (22:28 -0800)]
hammer2 - Initial newfs_hammer2 implementation

* This is a rough start for the newfs_hammer2 implementation.

* Creates the volume header, super-root inode, and named root inode.

12 years agohammer2 - Adjust media fields
Matthew Dillon [Thu, 9 Feb 2012 06:16:17 +0000 (22:16 -0800)]
hammer2 - Adjust media fields

* Expand the reserved area from 2MB to 4MB per every 2GB.  Just in case.

* Add definitions for compress and check code classes.

* Other misc adjustments.

12 years agohammer2 - add titling to DESIGN document
Matthew Dillon [Thu, 9 Feb 2012 03:19:35 +0000 (19:19 -0800)]
hammer2 - add titling to DESIGN document

* Add titling to the DESIGN document

12 years agohammer2 - More media format spec work, add DESIGN document
Matthew Dillon [Thu, 9 Feb 2012 03:08:47 +0000 (19:08 -0800)]
hammer2 - More media format spec work, add DESIGN document

* Add additional fields to support up to 256 configured copyid's in the
  volume header.  Directory subtree copies are still limited to 8 but this
  will allow us to implement many different copy sets for different
  sub-trees.

* Add a flags field to the blockref for synchronization and desynchronization
  flags.

* Rename allocmap to freemap and add a freemap_version field which is
  separate from the global version field, which will allow a HAMMER2
  volume to at least be mounted read-only on older versions of HAMMER2
  if the only difference is in the freemap handling algorithm.

* Add the DESIGN document.

12 years agohammer2 - create new branch, sync working trees from dillon & vsrinivas
Matthew Dillon [Wed, 8 Feb 2012 23:50:01 +0000 (15:50 -0800)]
hammer2 - create new branch, sync working trees from dillon & vsrinivas

* hammer2 branch in main repo created.  This branch will loosely track
  master with the additional hammer2 bits added.  Any changes that have to
  be made to non-hammer2 bits will be done in master and merged into this
  branch instead of the other way around.

* Merge dillon's and vsrinivas's work, placing the files in the appropriate
  places in the source tree.

* Initial whitespace cleanup so git doesn't complain

* Major adjustments to hammer2_disk.h taking into account all discussions
  between dillon and vsrinivas to date relative to the original design.

  (1) The media blockref was expanded from 32 to 64 bytes in order to
      accomodate up to a 192 bit cryptographic hash.

  (2) The new blockref will also support multiple crc/hash/check algorithms.

  (3) The new blockref will also support multiple block compression algorithms.

  (4) The new blockref supports a full 64-bit key as well as a key mask,
      and an explicit type field instead of overloading the functionality
      of data_off's 6-bit physical storage size radix.

  (5) The fully associative blockset was reduced from 16 to 8 blockref
      entries.

  (6) Support for multiple copies is possible within a fully associative
      blockset (also needed new fields in the new blockref).

  (7) The media volume structure has been fleshed out to support the new
      features.

  (8) The volume structure now also contains fields for configuring device
      paths for up to 8 copies, a fully associative blockset pointint to
      the root inode, and multiple sub-block crcs.

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.