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

12 years agokernel: Allow zlib to build as a module.
Sascha Wildner [Tue, 31 Jan 2012 11:10:20 +0000 (12:10 +0100)]
kernel: Allow zlib to build as a module.

Submitted-by: CosmicDJ
12 years agocrypto.ko: Add a missing file.
Sascha Wildner [Tue, 31 Jan 2012 10:17:27 +0000 (11:17 +0100)]
crypto.ko: Add a missing file.

Submitted-by: CosmicDJ
12 years agolibc: correct copyright notice in makecontext.c
Markus Pfeiffer [Fri, 27 Jan 2012 21:59:06 +0000 (21:59 +0000)]
libc: correct copyright notice in makecontext.c

12 years ago<sys/param.h>: Oops, actually bump the version.
Sascha Wildner [Tue, 31 Jan 2012 09:29:20 +0000 (10:29 +0100)]
<sys/param.h>: Oops, actually bump the version.

12 years ago<sys/param.h>: Bump the version for i4b removal (had public headers).
Sascha Wildner [Tue, 31 Jan 2012 09:27:57 +0000 (10:27 +0100)]
<sys/param.h>: Bump the version for i4b removal (had public headers).

12 years agoCleanup ISDN remains via 'make upgrade'.
Sascha Wildner [Tue, 31 Jan 2012 09:22:49 +0000 (10:22 +0100)]
Cleanup ISDN remains via 'make upgrade'.

12 years agoMerge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
Venkatesh Srinivas [Tue, 31 Jan 2012 05:18:17 +0000 (00:18 -0500)]
Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly

12 years agotmpfs: Support NFS export of tmpfs filesystems.
Venkatesh Srinivas [Tue, 31 Jan 2012 05:15:24 +0000 (00:15 -0500)]
tmpfs: Support NFS export of tmpfs filesystems.

* Implement vop_mountctl and MOUNTCTL_SET_EXPORT interfaces to allow mountd
  to export a tmpfs filesystem.

* Implement vfs_checkexp to allow NFS to function.

Closes: Bug 2277

12 years agocrypt(3)/blowfish - Return NULL on error
Samuel J. Greear [Tue, 31 Jan 2012 01:02:41 +0000 (18:02 -0700)]
crypt(3)/blowfish - Return NULL on error

* According to http://www.openwall.com/lists/oss-security/2011/11/15/3
  crypt(3) should probably not return ":" on error.

* Make crypt_blowfish() return NULL on error as per the crypt(3) manpage.

Submitted-by: Loganaden Velvindron <loganaden@gmail.com>
12 years agotoken.9: Put sections into conventional order.
Sascha Wildner [Mon, 30 Jan 2012 18:42:51 +0000 (19:42 +0100)]
token.9: Put sections into conventional order.

12 years agotoken.9: Start sentences on a new line and remove trailing whitespace.
Sascha Wildner [Mon, 30 Jan 2012 18:40:31 +0000 (19:40 +0100)]
token.9: Start sentences on a new line and remove trailing whitespace.

12 years agotoken.9: Add an MLINK for lwkt_gettoken_shared(9).
Sascha Wildner [Mon, 30 Jan 2012 18:39:55 +0000 (19:39 +0100)]
token.9: Add an MLINK for lwkt_gettoken_shared(9).

12 years agolibthread_xu: Unbreak the build.
Sascha Wildner [Mon, 30 Jan 2012 18:35:06 +0000 (19:35 +0100)]
libthread_xu: Unbreak the build.

12 years agolibthread_xu: Implement stub sem_open/sem_close/sem_unlink.
Venkatesh Srinivas [Mon, 30 Jan 2012 13:04:53 +0000 (08:04 -0500)]
libthread_xu: Implement stub sem_open/sem_close/sem_unlink.

The stub sem_open/sem_close/sem_unlink routines return ENOSYS; this is an
improvement over the default implementation, which returned 0 without doing
any work. libc_r already provided the stubs.

Closes: Bug #2285

12 years agoDocument shared tokens in token(9).
Venkatesh Srinivas [Mon, 30 Jan 2012 13:00:19 +0000 (08:00 -0500)]
Document shared tokens in token(9).

12 years agoRemove ISDN support. Tools, kernel code, manpages, examples, everything.
Sascha Wildner [Mon, 30 Jan 2012 11:35:22 +0000 (12:35 +0100)]
Remove ISDN support. Tools, kernel code, manpages, examples, everything.

We were the last to keep it (FreeBSD disconnected it in 2007 and removed
it in 2008).

Makefile_upgrade.inc will be updated later.

12 years agobinutils/ld: Don't add /usr/lib to the library search path twice.
Sascha Wildner [Mon, 30 Jan 2012 11:19:49 +0000 (12:19 +0100)]
binutils/ld: Don't add /usr/lib to the library search path twice.

The various toolchains we build during buildworld need different
search paths for various stages. The ${USRDATA_PREFIX} variable,
which has different values depending on the stage, is used as a
prefix so that the compilers we use to build our world can search
their includes and libraries in /usr/obj. For the compiler that
ultimately gets installed upon installworld, the prefix is empty.

In ld's Makefile, the correct path prefixed with ${USRDATA_PREFIX}
is already added to the default path a few lines above, so all is
good. This commit removes the extra /usr/lib that was unconditionally
added after the prefixed one (which is wrong).

12 years agocustom cc script: Fix "Unterminated quoted string" error
John Marino [Mon, 30 Jan 2012 07:48:20 +0000 (08:48 +0100)]
custom cc script: Fix "Unterminated quoted string" error

When updating gcc46 to handle c++ by default, the old quotation mark
was accidently left in place, causing a world build breakage at
include/rpc.

12 years agokernel: Add some missing headers to the Makefiles of cryptodev and tun.
Sascha Wildner [Sun, 29 Jan 2012 21:39:58 +0000 (22:39 +0100)]
kernel: Add some missing headers to the Makefiles of cryptodev and tun.

Reported-by: CosmicDJ on #dragonflybsd
12 years agotexinfo: Add /usr/pkg/info to the list of directories searched by info(1).
Sascha Wildner [Sun, 29 Jan 2012 21:15:31 +0000 (22:15 +0100)]
texinfo: Add /usr/pkg/info to the list of directories searched by info(1).

12 years agoasr(4): Sync with FreeBSD.
Sascha Wildner [Sun, 29 Jan 2012 15:13:13 +0000 (16:13 +0100)]
asr(4): Sync with FreeBSD.

Updates us to V1.10 which is mostly cleanup:

* Massive cleanup of the driver to remove dead code and non-conformant
  style.

* Removed most i386-specific code to make it more portable.

* Converted to the bus_space API.

Tested with an old ASR-2110S.

12 years agokernel - properly initialize vnode->v_pfsmp
Francois Tigeot [Sun, 29 Jan 2012 08:42:38 +0000 (09:42 +0100)]
kernel - properly initialize vnode->v_pfsmp

* add and rewrite comments to document it better

12 years agocustom cc script: add c++ support for gcc46 compiler
John Marino [Sat, 28 Jan 2012 16:34:57 +0000 (17:34 +0100)]
custom cc script: add c++ support for gcc46 compiler

12 years agocompilers.conf: Update default CXX path for gcc46
John Marino [Sat, 28 Jan 2012 15:36:28 +0000 (16:36 +0100)]
compilers.conf: Update default CXX path for gcc46

lang/gnat-aux builds the languages c, c++, obj-c, fortran, and Ada
by default.  Its now reasonable to have the default CXX value for
gcc46 point to gnatc++.

12 years agoMerge branch 'master' of /repository/git/dragonfly
Venkatesh Srinivas [Sat, 28 Jan 2012 03:47:08 +0000 (19:47 -0800)]
Merge branch 'master' of /repository/git/dragonfly

12 years agoRevert "sys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it"
Thomas Nikolajsen [Sat, 28 Jan 2012 01:04:27 +0000 (02:04 +0100)]
Revert "sys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it"

This reverts commit dbcbcaa29ebe161b19b6cec288c1a8559aebc0a0.

12 years agoCOMPAT_LINUX: Remove need for COMPAT_43
Thomas Nikolajsen [Sat, 28 Jan 2012 00:59:37 +0000 (01:59 +0100)]
COMPAT_LINUX: Remove need for COMPAT_43

Implement linux_sethostname and linux_ostat natively to
stop using implementation from COMPAT_43.

Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2289>
Submitted-by: Samuel J. Greear and Matt Dillon
12 years agokernel -- nata: Use ATA_DEFAULT_TIMEOUT (10) rather than 1 for ATA controlcmds.
Venkatesh Srinivas [Fri, 27 Jan 2012 10:55:15 +0000 (02:55 -0800)]
kernel -- nata: Use ATA_DEFAULT_TIMEOUT (10) rather than 1 for ATA controlcmds.

A one-second timeout for control commands was inappropriate for
SET TRANSFER MODE/ENABLE RCACHE/ENABLE WCACHE on spun-down WD Caviar Greens,
among others.

12 years agolast(1)/sort(1): Remove __RCSID().
Sascha Wildner [Fri, 27 Jan 2012 09:55:09 +0000 (10:55 +0100)]
last(1)/sort(1): Remove __RCSID().

12 years agosys/config: Readd COMPAT_DF12 to i386 kernels, to run FreeBSD 4 binaries
Thomas Nikolajsen [Thu, 26 Jan 2012 22:58:05 +0000 (23:58 +0100)]
sys/config: Readd COMPAT_DF12 to i386 kernels, to run FreeBSD 4 binaries

Commit ce6b2144 made this change to GENERIC,
do the same for the other i386 kernels.

12 years agosys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it
Thomas Nikolajsen [Thu, 26 Jan 2012 22:52:53 +0000 (23:52 +0100)]
sys/config: Readd COMPAT_43 to i386 kernels: COMPAT_LINUX needs it
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue2289>

12 years agolibc: add getcontext, setcontext, makecontext and swapcontext on x86_64
Markus Pfeiffer [Wed, 25 Jan 2012 13:11:23 +0000 (13:11 +0000)]
libc: add getcontext, setcontext, makecontext and swapcontext on x86_64

The *context functions are not part of the POSIX standard anymore, but
are still used by quite some packages.

12 years agodrm - Add PCI ID for Radeon HD 4250 (AMD 880 onboard video)
Samuel J. Greear [Thu, 26 Jan 2012 04:39:34 +0000 (21:39 -0700)]
drm - Add PCI ID for Radeon HD 4250 (AMD 880 onboard video)

12 years agoRevert "Remove mergemaster(8)."
Sascha Wildner [Wed, 25 Jan 2012 18:35:25 +0000 (19:35 +0100)]
Revert "Remove mergemaster(8)."

This reverts commit 650094e10aa76969d99d60b3e506b55e4e2bf5fc.

It is still being used by people.

I thought mergemaster was only useful in conjunction with maintained
CVS IDs. Should have known about its -s option.

Requested-by: pavalos
12 years agoRemove mergemaster(8).
Sascha Wildner [Wed, 25 Jan 2012 18:05:05 +0000 (19:05 +0100)]
Remove mergemaster(8).

12 years agokget.8: Rewrite it a bit and fix some mdoc stuff.
Sascha Wildner [Wed, 25 Jan 2012 09:24:08 +0000 (10:24 +0100)]
kget.8: Rewrite it a bit and fix some mdoc stuff.

12 years agoRevert "nataraid(4): Add devstat support."
Sascha Wildner [Wed, 25 Jan 2012 08:05:46 +0000 (09:05 +0100)]
Revert "nataraid(4): Add devstat support."

This reverts commit 3e184884618d66845f8b90e6dae483155da6dce6.

Oops, it was a bit too untested and causes nasty messages on the
console. Will investigate and commit a proper fix.

Reported-by: Joerg Anslik <joerg@anslik.de>
12 years agokernel - Fix SILI callout timer race
Matthew Dillon [Mon, 23 Jan 2012 20:55:33 +0000 (12:55 -0800)]
kernel - Fix SILI callout timer race

* Do similar fix for SILI that we did for AHCI.

* callout_stop_sync() can block.  If this occurs a race can cause a
  CCB to be processed for completion twice.

* Add a serial number to detect this situation.

* If the serial number does not match after the timeout is stopped
   we don't want to mess with the xa at all.

Tested-by: lentferj
12 years agokernel: Use bioq_takefirst() in a few more places.
Sascha Wildner [Mon, 23 Jan 2012 13:20:14 +0000 (14:20 +0100)]
kernel: Use bioq_takefirst() in a few more places.

12 years agoldscript.*: sync with FreeBSD
John Marino [Sun, 22 Jan 2012 19:09:11 +0000 (20:09 +0100)]
ldscript.*: sync with FreeBSD

12 years agocsu: Add .note.ABI-tag and .note.GNU-stack
John Marino [Mon, 23 Jan 2012 00:21:15 +0000 (01:21 +0100)]
csu: Add .note.ABI-tag and .note.GNU-stack

For all arches except sparc, gcc emits the section directive for the
following struct with a PROGBITS type.  However, newer versions of binutils
(after 2.16.90) require the section to be of NOTE type, to guarantee that
the .note.ABI-tag section correctly ends up in the first page of the final
executable.

Unfortunately, there is no clean way to tell gcc to use another section
type, so this C file (or the C file that includes it) must be compiled in
multiple steps:

- Compile the .c file to a .s file.
- Edit the .s file to change the 'progbits' type to 'note', for the section
  directive that defines the .note.ABI-tag section.
- Compile the .s file to an object file.

These steps are done in the invididual Makefiles for each applicable arch.

Taken-from: FreeBSD SVN 217375 (13 JAN 2011)

On i386 crtn.S:
Keep the stack aligned to a 16 byte boundary when calling init functions
so that we don't cause a bus error if they start storing SSE math stuff
on the stack.

Taken-from: FreeBSD SVN 146369 (19 MAY 2005)

12 years agoelf: Add translation function between vm_prot_t and p_flags
John Marino [Sat, 21 Jan 2012 19:48:38 +0000 (20:48 +0100)]
elf: Add translation function between vm_prot_t and p_flags

No functionality added, just refactors code.  This will be useful if
stack protection is implemented in the future.

12 years agoman rtld: add -fPIC flag to _rtld_functrace example
John Marino [Sat, 21 Jan 2012 22:28:57 +0000 (23:28 +0100)]
man rtld: add -fPIC flag to _rtld_functrace example

12 years agortld: Add STT_GNU_IFUNC and R_MACHINE_IRELATIVE_GNU support
John Marino [Sat, 21 Jan 2012 23:00:15 +0000 (00:00 +0100)]
rtld: Add STT_GNU_IFUNC and R_MACHINE_IRELATIVE_GNU support

Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to
rtld. This adds runtime bits neccessary for the use of the dispatch
functions from the dynamically-linked executables and shared libraries.

To allow use of external references from the dispatch function, resolution
of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries
for PLT are prepared, and normal resolution of the GOT entries is finished.
Similar to how it is done by GNU, IRELATIVE relocations are resolved in
advance, instead of normal lazy handling for PLT.

Taken-from:
FreeBSD SVN 228435 (12 DEC 2011)
FreeBSD SVN 228503 (14 DEC 2011)
FreeBSD SVN 229508 (04 JAN 2012)

12 years agortld: Use DAGS for symbol lookup; adjust weak symbol logic
John Marino [Sat, 21 Jan 2012 21:35:24 +0000 (22:35 +0100)]
rtld: Use DAGS for symbol lookup; adjust weak symbol logic

get_program_var_addr() must prefer the strong symbol to the weak one.
Search global objects, together with main object and dependencies for the
requested symbol.

Move the common code from symlook_default() into new helper
symlook_global(), and use it both in symlook_global() and
get_program_var_addr().  Supply lock state to get_program_var_addr().

Taken-from: FreeBSD SVN 217223 (10 JAN 2011)

Eliminate the use of symlook_needed function in favor of DAGS.  Place
elements on DAG lists in breadth-first order. This allows us to walk
pre-built list in all cases where breadth-first dependency chain
enumeration is required.

Fix dlsym on special handle obtained by dlopen(NULL, ...) to do what
comment claims it does. Take advantage of recently added symlook_global
function to iterate over main objects and global DAGs lists properly in
search of a symbol. Since rtld itself provides part of the global
namespace, search rtld_obj too.

Remove recursion from init_dag and symlook_needed functions. Use
symlook_needed for ELF filtee processing only and change lookup order
used in the function to match the order used by Solaris runtime linker
under same circumstances. While there, fix weak symbol handling in the
loop so that we return the first weak symbol definition if no strong one
was found, instead of the last one.

Taken-from: FreeBSD SVN 218051 (28 JAN 2011)

12 years agortld: Add stubs to support PT_GNU_STACK
John Marino [Sat, 21 Jan 2012 20:53:12 +0000 (21:53 +0100)]
rtld: Add stubs to support PT_GNU_STACK

This functionality requires kernel support to determine the initial stack
access mode.  This is how it's supposed to work:

If the loaded DSO requires an executable stack as specified by the PF_X
bit or p_flags on PT_GNU_STACK phdr, yet the current stack protection does
not permit execution: The map_stacks_exec function should change the
stack protection mode of all thread stacks.

The PT_GNU_STACK phdr parser has been implemented as well as a private
interface to _rtld_get_stack_prot() in order to export the stack access
mode calculated by rtld.

Left to do:
1) Implement stack protection in the kernel
2) Add PT_GNU_STACK functionality in the kernel
3) Add a method to change stack protection mode in libc or libthread
4) Implement map_stacks_exec function in rtld.

12 years agortld: Implement ELF filters (DT_FILTER and DT_AUXILIARY)
John Marino [Sat, 21 Jan 2012 17:31:30 +0000 (18:31 +0100)]
rtld: Implement ELF filters (DT_FILTER and DT_AUXILIARY)

Filtrees are loaded on demand unless LD_LOADFLTR environment variable is
set or -z loadfltr was specified during the linking.  This forces rtld
to upgrade read-locked rtld_bind_lock to write lock when it encounters an
object with filter during symbol lookup.

Consolidate common arguments of the symbol lookup functions in the SymLook
structure.

Taken-from: FreeBSD SVN 216728 (27 DEC 2010)

12 years agortld: Remove useless arch Makefiles
John Marino [Sat, 21 Jan 2012 21:02:15 +0000 (22:02 +0100)]
rtld: Remove useless arch Makefiles

The ability to build an executable dynamic linker was previously removed
from the main makefile, so uncommenting LDSCRIPT in the arch Makefile
would no longer work even if the elf_rtld.x files were put in the arch
directory.  To avoid confusion, these optional Makefiles have been
completely removed.

12 years agortld: Make thread-safe by replacing libc printf functions
John Marino [Sat, 21 Jan 2012 15:07:30 +0000 (16:07 +0100)]
rtld: Make thread-safe by replacing libc printf functions

The dynamic linker is linked with the specially built static pic libc to
get some C runtime services such as printf().  Unfortunately, the
multithread-safeness measures in libc do now work in the rtld environment.

The dynlinker now uses FreeBSD's kernel printf() implementation instead of
libc's version.  This printf does not require any shared global data and
thus is mt-safe.  This commit replaces printf() and related functions with
rtld_ versions, and also removes calls to err(3).

Currently stdio is still pulled from libc within the libmap implementation
that uses fopen().  This is safe, yet not optimal, and is a candidate for
future change.

The makefile was cleaned up to remove the unused bits to building an
executable dynlinker and also require gnu99.

Taken-from: FreeBSD SVN 225152

12 years agortld: Set foundation to use aux vectors to get osreldate
John Marino [Sat, 21 Jan 2012 13:13:17 +0000 (14:13 +0100)]
rtld: Set foundation to use aux vectors to get osreldate

__getosreldate isn't used by rtld currently.  The FreeBSD dynamic linker
does use it indirectly in libc's mmap wrapper.  The capability is included
here both to ease the task to synchronizing with FreeBSD, and to quickly
obtain the capability in the future if necessary.  It's currently disabled
with the undefined ENABLE_OSRELDATE macro.

The splitting of digest_dynamic required to use aux vectors also has the
benefit of avoiding the use of malloc at startup.

12 years agortld: Compress FreeBSD CVSIDs
John Marino [Sat, 21 Jan 2012 11:08:45 +0000 (12:08 +0100)]
rtld: Compress FreeBSD CVSIDs

The FreeBSD repository is still handled by CVS, but its converted to
Subversion and from that, git.  Neither the svn nor git version feature
expanded $FreeBSD$ tags.  The only way to get this is to pull directly
from CVS which isn't convenient.

In the case of a few files, the only difference between the DragonFly
version and the FreeBSD version is the CVS tag.  As the main development
of rtld is happening on FreeBSD and since I've started collaborating
with FreeBSD developers on new dynamic linker features, we want to
actively keep our linkers synchronized.  Compressing the FreeBSD CVSID
tags makes that easier for me, the only person currently maintaining
the dynamic linker.  The usually-wrong expanded CVS tag wasn't providing
any useful information to me either.

12 years agortld: Remove unused xrealloc function
John Marino [Sat, 21 Jan 2012 10:52:42 +0000 (11:52 +0100)]
rtld: Remove unused xrealloc function

xrealloc was added back in the prebind support days, but wasn't removed
when the resident executable support that replaced it arrived back in
2004.

12 years agoUnbreak buildworld due to the libpcap import.
Peter Avalos [Mon, 23 Jan 2012 08:30:48 +0000 (00:30 -0800)]
Unbreak buildworld due to the libpcap import.

12 years agocarp: Use ifq_set_maxlen() to set send queue's max length
Sepherosa Ziehau [Mon, 23 Jan 2012 03:45:01 +0000 (11:45 +0800)]
carp: Use ifq_set_maxlen() to set send queue's max length

While im here, clean up white space and indentation

12 years agoMerge branch 'master' of /home/www-data/gitweb/dragonfly
Peter Avalos [Mon, 23 Jan 2012 03:07:23 +0000 (19:07 -0800)]
Merge branch 'master' of /home/www-data/gitweb/dragonfly

12 years agoUpdate files for tcpdump-4.2.1 import.
Peter Avalos [Mon, 23 Jan 2012 03:05:13 +0000 (19:05 -0800)]
Update files for tcpdump-4.2.1 import.

12 years agoMerge branch 'vendor/TCPDUMP'
Peter Avalos [Mon, 23 Jan 2012 01:25:22 +0000 (17:25 -0800)]
Merge branch 'vendor/TCPDUMP'

12 years agoImport tcpdump-4.2.1.
Peter Avalos [Mon, 23 Jan 2012 01:08:25 +0000 (17:08 -0800)]
Import tcpdump-4.2.1.

See the CHANGES files for the details.

12 years agokernel/firewire: Move a dereference behind the NULL check.
Sascha Wildner [Mon, 23 Jan 2012 00:55:44 +0000 (01:55 +0100)]
kernel/firewire: Move a dereference behind the NULL check.

12 years agokernel/netgraph: Put parentheses around a SLIST_EMPTY().
Sascha Wildner [Mon, 23 Jan 2012 00:23:46 +0000 (01:23 +0100)]
kernel/netgraph: Put parentheses around a SLIST_EMPTY().

12 years agoUpdate files for libpcap-1.2.1 import.
Peter Avalos [Mon, 23 Jan 2012 00:23:29 +0000 (16:23 -0800)]
Update files for libpcap-1.2.1 import.

Reduce diffs from the vendor source.
Reorganize Makefile to make it ordered like the vendor's.

12 years agobktr(4): Fix some mistakes in #ifdef'd code.
Sascha Wildner [Mon, 23 Jan 2012 00:16:15 +0000 (01:16 +0100)]
bktr(4): Fix some mistakes in #ifdef'd code.