dragonfly.git
8 years agoRemove kk_KZ.PT154 and all latin locales
John Marino [Sat, 1 Aug 2015 22:00:20 +0000 (00:00 +0200)]
Remove kk_KZ.PT154 and all latin locales

Latin, strangely enough, is not covered by CLDR POSIX files.  Thus,
it is impossible to completely load the locales.  Both LC_CTYPE and
LC_COLLATE need updated files.  Thus, all version of the Latin
locales needs to go.

The kk_KZ locale just came back with the UTF-8 codeset, but there are
character maps for PT154, so it's impossible to continue to have this
locale.

8 years agolocales: also update lv_LV, pt_BR and kk_KZ
John Marino [Sat, 1 Aug 2015 21:46:16 +0000 (23:46 +0200)]
locales: also update lv_LV, pt_BR and kk_KZ

These were stuck with old definitions due to the cldr2def's configure
file missing these three locales.

8 years agoActivate kk_KZ, lv_LV, and pt_BR locales
John Marino [Sat, 1 Aug 2015 21:40:45 +0000 (23:40 +0200)]
Activate kk_KZ, lv_LV, and pt_BR locales

These three locales already existed, but they weren't being updated.
I've adjusted the xml configuration to get them building (minus the
kk_KZ.PT154 locale which will be removed).

While here, update the tools/tools/locale Makefile to replace all
six LC categories in /usr/src/share with the "make install" target,
and then install them on a live system with "make post-install" target.

8 years agoRemove obsolete mklocale directory and its old src files
John Marino [Sat, 1 Aug 2015 18:45:59 +0000 (20:45 +0200)]
Remove obsolete mklocale directory and its old src files

8 years agoUse localedef(1) to generate LC_CTYPE, switch off mklocale
John Marino [Sat, 1 Aug 2015 18:43:29 +0000 (20:43 +0200)]
Use localedef(1) to generate LC_CTYPE, switch off mklocale

Active the new share/ctypedef directory and deactivate share/mklocale.
This means the LC_CTYPE files will be generated by localedef(1) now.
As a result, remove mklocale from bootstrap tools and remove it via
"make upgrade"

8 years agolibc/locale: Revamp CTYPE support (from Illumos)
John Marino [Sat, 1 Aug 2015 18:36:42 +0000 (20:36 +0200)]
libc/locale: Revamp CTYPE support (from Illumos)

The LC_CTYPE format didn't change, but libc stills needs a revamp
to properly use the new LC_CTYPE files that localedef(2) generates.

8 years agoFix cldr2def tool and regenerate 2 makefiles as a result
John Marino [Sat, 1 Aug 2015 19:37:53 +0000 (21:37 +0200)]
Fix cldr2def tool and regenerate 2 makefiles as a result

I accidently changed the wrong makefile so both colldef and ctype makefiles
wrong wrong.  I adjusted the tool and regenerated the makefiles.

While here, remove the unused map.UTF-8 that should have been removed
earlier but wasn't due to a git misuse.

8 years agoUnbreak world
John Marino [Sat, 1 Aug 2015 19:24:08 +0000 (21:24 +0200)]
Unbreak world

I didn't mean to update the share/colldef Makefile yet, and an
incorrect version got committed.  This should fix world.

8 years agobuildworld - Fix bootstrapping from older worlds
Matthew Dillon [Sat, 1 Aug 2015 18:51:39 +0000 (11:51 -0700)]
buildworld - Fix bootstrapping from older worlds

* __returns_twice doesn't exist in older sys/cdefs.h, fix bootstrapping by
  shoehorning a default if it does not exist.

8 years agolibc/locale: Replace ascii.c, it was removed too soon
John Marino [Sat, 1 Aug 2015 18:12:12 +0000 (20:12 +0200)]
libc/locale: Replace ascii.c, it was removed too soon

I am not sure what happened, I limited the commit commit but somehow
this deleted file got included in a recent commit.  It will be removed
again shortly.

8 years agoAdd share/ctypedef directory (it will replace mklocale)
John Marino [Sat, 1 Aug 2015 17:49:02 +0000 (19:49 +0200)]
Add share/ctypedef directory (it will replace mklocale)

This directory will generate new LC_CTYPE files.  They require a
significant update to libc/locale so it is not hooked into the
build yet.  This the the produce of the clr2def tool upgrade
and the generated codeset maps at tools/tools/locale/etc/final-maps.

8 years agoPregenerate maps for LC_CTYPE generation
John Marino [Sat, 1 Aug 2015 17:41:45 +0000 (19:41 +0200)]
Pregenerate maps for LC_CTYPE generation

These are the products of the new convert_map.pl which localedef
will use to generate LC_CTYPE.  To avoid duplication, these maps
will be used where they are (in tools/tools/locale/etc/final-maps)

It turns out that the widths.txt file is only used for LC_CTYPE,
so it's being moved as well as being removed from share/colldef.

8 years agoFix three clr2def2 character maps
John Marino [Sat, 1 Aug 2015 17:37:45 +0000 (19:37 +0200)]
Fix three clr2def2 character maps

The localedef(1) tool does not allow two symbols to be mapped to
the same unicode character.  I actually don't know if this is really
"wrong", but I had to adjust a couple of character sets that
violated this rule: ARMSCII-8 and Big5HKSCS.  Neither are present
on Illumos so that may explain why localedef(1) wasn't prepared
to do anything except throw an error.

The CP866 charset had a trailing garbage at the end of the file that
localedef didn't like, so I removed it.

8 years agoclr2def: Add LC_CTYPE source file generation support
John Marino [Sat, 1 Aug 2015 17:27:04 +0000 (19:27 +0200)]
clr2def: Add LC_CTYPE source file generation support

I added the capability to generate LC_CTYPE source files (really this is
basically extracting a section from the POSIX files) but there was some
logic to figure out how to use the least amount of files because some of
them are large.

I compromised on a scheme that makes two reductions.  The first eliminates
true duplicates and uses the SAME+= mechanism to create symlinks.  However,
this leaves still some duplicates because while the output is distinct,
the source files are the same (e.g. en_US.ISO8859* uses the same input file
as en_US.UTF-8 locale, but the LC_CTYPE products differ.  The script
identifies those are replaces them with symlinks.  So it looks like a lot
of files but really it's only about 12 or so.

During the actual LC_CTYPE generating, character maps are needed.  I added
a Illumos tool to do this, which I had to modify.  Unlike Illumos, we will
pregenerate the maps that the tool (convert_map.pl) produces.  I had to
spend hours troubleshooting various "invalid" inputs so this is definitely
something that should not be repeated in the build.

8 years agoFix zh_Hans_CN.GB2312 locale
John Marino [Sat, 1 Aug 2015 17:12:21 +0000 (19:12 +0200)]
Fix zh_Hans_CN.GB2312 locale

It turns out that using a commented source file for LC_* file generation
really isn't a good idea.  In the cldr2def tool's charmap.xls, the
low ASCII is transformed to the "Full width" versions, but the first
byte just happens to be "#".  Yes, that's right, the comment character.

Since all comments are either "#" or or followed by a space, I can fix
the resulting broken zh_Hans_CN.GB2312 by alterning the grep instruction.
However, if we ever have a legitimate single "#" character as input, then
this won't work anymore.

The Armenian changes are a result to a tool correction that will be
commited shortly.

8 years agokernel/dsched: Use <machine/inttypes.h>, not <inttypes.h>.
Sascha Wildner [Sat, 1 Aug 2015 17:54:41 +0000 (19:54 +0200)]
kernel/dsched: Use <machine/inttypes.h>, not <inttypes.h>.

8 years agokernel/vfs_quota: Remove unneeded <inttypes.h> inclusion.
Sascha Wildner [Sat, 1 Aug 2015 17:53:41 +0000 (19:53 +0200)]
kernel/vfs_quota: Remove unneeded <inttypes.h> inclusion.

8 years agokernel: Use <sys/stdbool.h> in kernel code, not <stdbool.h>.
Sascha Wildner [Sat, 1 Aug 2015 17:39:20 +0000 (19:39 +0200)]
kernel: Use <sys/stdbool.h> in kernel code, not <stdbool.h>.

8 years agokernel/iscsi: Remove unneeded <signal.h> inclusion.
Sascha Wildner [Sat, 1 Aug 2015 17:17:02 +0000 (19:17 +0200)]
kernel/iscsi: Remove unneeded <signal.h> inclusion.

8 years agokernel: Use <sys/bitstring.h> instead of <bitstring.h>.
Sascha Wildner [Sat, 1 Aug 2015 17:02:46 +0000 (19:02 +0200)]
kernel: Use <sys/bitstring.h> instead of <bitstring.h>.

8 years ago<bitstring.h>: Move it to /usr/src/sys/sys so kernel files can use it too.
Sascha Wildner [Sat, 1 Aug 2015 17:01:14 +0000 (19:01 +0200)]
<bitstring.h>: Move it to /usr/src/sys/sys so kernel files can use it too.

To avoid using userspace headers in the kernel.

8 years agoagp: Remove some debugging printfs
François Tigeot [Sat, 1 Aug 2015 07:56:38 +0000 (09:56 +0200)]
agp: Remove some debugging printfs

8 years agodrm: Add linux/hashtable.h
François Tigeot [Sat, 1 Aug 2015 07:16:24 +0000 (09:16 +0200)]
drm: Add linux/hashtable.h

8 years agokernel/usb4bsd: Install gadget example drivers and fix usbtest.
Sascha Wildner [Sat, 1 Aug 2015 06:23:24 +0000 (08:23 +0200)]
kernel/usb4bsd: Install gadget example drivers and fix usbtest.

Taken-from: FreeBSD

8 years agokernel/usb4bsd: Set USB_HAVE_MSCTEST_DETACH and adjust include guard.
Sascha Wildner [Sat, 1 Aug 2015 05:16:50 +0000 (07:16 +0200)]
kernel/usb4bsd: Set USB_HAVE_MSCTEST_DETACH and adjust include guard.

8 years agoinet6: Simplify nd6_dad_ns_output() interface
Sepherosa Ziehau [Fri, 31 Jul 2015 14:08:21 +0000 (22:08 +0800)]
inet6: Simplify nd6_dad_ns_output() interface

8 years agoinet6: Make DAD lockless MPSAFE
Sepherosa Ziehau [Fri, 31 Jul 2015 14:08:04 +0000 (22:08 +0800)]
inet6: Make DAD lockless MPSAFE

8 years agonet: Factor out ASSERT_IN_NETISR and ASSERT_IS_NETISR
Sepherosa Ziehau [Fri, 31 Jul 2015 14:07:41 +0000 (22:07 +0800)]
net: Factor out ASSERT_IN_NETISR and ASSERT_IS_NETISR

8 years agoi386 removal, part 27/x: Remove i386 specific stuff from the RAID drivers.
Sascha Wildner [Fri, 31 Jul 2015 19:31:41 +0000 (21:31 +0200)]
i386 removal, part 27/x: Remove i386 specific stuff from the RAID drivers.

pst(4) goes completely.

8 years agokernel: Uncomment VINUMDEBUG in LINT64. It compiles now.
Sascha Wildner [Fri, 31 Jul 2015 19:08:43 +0000 (21:08 +0200)]
kernel: Uncomment VINUMDEBUG in LINT64. It compiles now.

8 years agokernel: Add prototypes for setjmp()/longjmp() to <sys/systm.h>.
Sascha Wildner [Fri, 31 Jul 2015 19:08:00 +0000 (21:08 +0200)]
kernel: Add prototypes for setjmp()/longjmp() to <sys/systm.h>.

Used by ddb and vinum. Remove the inclusion of the <setjmp.h> userspace
header.

8 years agoregcomp: limit comparison to C locale only
John Marino [Fri, 31 Jul 2015 13:00:23 +0000 (15:00 +0200)]
regcomp: limit comparison to C locale only

The regex code does not work with multibyte codesets like UTF-8.  In fact,
it doesn't even work with single-byte codesets like ISO-8859-1.  The
comparison blows up at index 128 (the range is 0 to UCHAR_MAX (255).

As a temporary workaround, all comparisons will be done in C locale
regardless of the environment setting.  The regex library needs to be
updated to handle all codesets.

8 years agolibc/collcmp: Fix initialization of s2
John Marino [Fri, 31 Jul 2015 11:23:18 +0000 (13:23 +0200)]
libc/collcmp: Fix initialization of s2

8 years agolibc/regex: Sync with FreeBSD
John Marino [Fri, 31 Jul 2015 10:00:55 +0000 (12:00 +0200)]
libc/regex: Sync with FreeBSD

8 years agolibc/xdr: Sync xdr_sizeof.c with FreeBSD and add it to the build.
Sascha Wildner [Thu, 30 Jul 2015 22:21:20 +0000 (00:21 +0200)]
libc/xdr: Sync xdr_sizeof.c with FreeBSD and add it to the build.

FreeBSD did so too after our last upgrade. Shouldn't hurt.

8 years agogcc50: Adjust makefiles for new file locations
John Marino [Thu, 30 Jul 2015 21:30:40 +0000 (23:30 +0200)]
gcc50: Adjust makefiles for new file locations

8 years agogcc50: Remove generic versions of added files
John Marino [Thu, 30 Jul 2015 20:22:02 +0000 (22:22 +0200)]
gcc50: Remove generic versions of added files

These files can probably stay in place with .PATH and -I order giving
preference to "dragonfly" over "generic", but let's go ahead and just
remove them from contrib to avoid any possible confusion.

8 years agogcc50: Add proper locale support to libstdc++ (local mod)
John Marino [Thu, 30 Jul 2015 20:03:21 +0000 (22:03 +0200)]
gcc50: Add proper locale support to libstdc++ (local mod)

These patches will be sent upstream soon.  DragonFly is the only BSD
with c++ local support.  The exception is "messages".  The glibc has
gettext functions incorporated to support it, but we can't used libintl
because that would require linking it to every c++ executable.

8 years agolibc/calloc: Remove calloc.c, which has been unbuilt since 82949828d.
Sascha Wildner [Thu, 30 Jul 2015 19:44:36 +0000 (21:44 +0200)]
libc/calloc: Remove calloc.c, which has been unbuilt since 82949828d.

calloc() is part of nmalloc.c as well as of dmalloc.c

8 years agomake upgrade: Stop removing hi_IN.UTF-8 and la_LN.UTF-8
John Marino [Thu, 30 Jul 2015 19:38:19 +0000 (21:38 +0200)]
make upgrade: Stop removing hi_IN.UTF-8 and la_LN.UTF-8

These old upgrade entries were removing newly installed locales.

Reported-by: swildner
8 years agoi386 removal, part 26/x: Remove i386 specific lib/libc/quad.
Sascha Wildner [Thu, 30 Jul 2015 17:35:45 +0000 (19:35 +0200)]
i386 removal, part 26/x: Remove i386 specific lib/libc/quad.

None of the platforms which lead to it being compiled into FreeBSD's
libc look too interesting, so remove it.

Also remove copies of a number of those functions residing in libkern
and stop compiling one of these files into libstand. Libstand also
has a quad.h header. Shrink it together to what is actually needed
(not much), while here.

8 years agosocket: Close the soreference() race against socket owner netisr sofree()
Sepherosa Ziehau [Thu, 30 Jul 2015 15:24:37 +0000 (23:24 +0800)]
socket: Close the soreference() race against socket owner netisr sofree()

The race is kinda like this:

    Other thread/netisrN         netisrM (so->so_pcb owner)
             :                              :
      getpooltoken(head);                   :
      so->so_head = NULL;                   :
             :                          sofree(so); (*)
      soreference(so);                      :
      relpooltoken(head);                   :

(*)
sofree(so) frees the socket, since so->so_head is NULL and
getpooltoken(head) is not called.

Reported-by: dillon@
8 years agosocket: Group accept queue operations together
Sepherosa Ziehau [Thu, 30 Jul 2015 15:16:33 +0000 (23:16 +0800)]
socket: Group accept queue operations together

8 years agosocket: Nuke unused so_pru_abort()
Sepherosa Ziehau [Thu, 30 Jul 2015 15:02:58 +0000 (23:02 +0800)]
socket: Nuke unused so_pru_abort()

8 years agosocket: Remove unused soabort()
Sepherosa Ziehau [Thu, 30 Jul 2015 14:56:38 +0000 (22:56 +0800)]
socket: Remove unused soabort()

8 years agoinet6: Use M_INTWAIT for DAD record
Sepherosa Ziehau [Wed, 29 Jul 2015 14:53:04 +0000 (22:53 +0800)]
inet6: Use M_INTWAIT for DAD record

8 years agoinet6: Use static initializer to initialize DAD queue
Sepherosa Ziehau [Wed, 29 Jul 2015 14:38:29 +0000 (22:38 +0800)]
inet6: Use static initializer to initialize DAD queue

8 years agoCreate 3 new locales by softlink
John Marino [Thu, 30 Jul 2015 14:24:18 +0000 (16:24 +0200)]
Create 3 new locales by softlink

This creates aliases to en_US.ISO8859-1, en_US.ISO8859-15 and
ja_JP.eucJP.  These locales are valid on linux and significantly
tested by gcc's libstdc++.

While here, correct an obsolete comment.

8 years agoi386 removal, part 25/x: Remove i386 parts from kgdb, libkvm, crunchide.
Sascha Wildner [Wed, 29 Jul 2015 17:06:58 +0000 (19:06 +0200)]
i386 removal, part 25/x: Remove i386 parts from kgdb, libkvm, crunchide.

8 years agoAdd README to localedef directory (credits, licensing)
John Marino [Wed, 29 Jul 2015 15:25:08 +0000 (17:25 +0200)]
Add README to localedef directory (credits, licensing)

8 years agolocales: Change defaults for territory-only locales
John Marino [Wed, 29 Jul 2015 13:51:47 +0000 (15:51 +0200)]
locales: Change defaults for territory-only locales

From research, it appears that the default for territory-only locales
(e.g. en_US, de_DE) is to use ISO-8859-X (where X is not 15).  The
@euro modifier is the alias for ISO-8859-15.

Since there is no apparent standard, I am going to switch the defaults
from aliasing to UTF-8 to ISO-8859 where available.  For the non-latin
character sets, I left these at UTF-8 rather than try to decide on a
different default.

Incidentally, this enables a number of gcc libstdc++ tests to pass as
well.

8 years agolocaledef(1): Update license of 12 source files (CDDL => BSD2)
John Marino [Wed, 29 Jul 2015 10:31:55 +0000 (12:31 +0200)]
localedef(1): Update license of 12 source files (CDDL => BSD2)

The localdef sources were relicensed to 2-clause BSD by Illumos project
on 4 July 2014:

https://github.com/Nexenta/illumos-nexenta/commit/cf17542a37fc83d0ae093777e30d480423858c29

It was done for the benefit of the BSD community.  It is a nice gesture,
but I don't see this being much of a change.

1) The bundled avl files are still CDDL licensed, so that may spread to
   the entire program.

2) Even as CDDL, I didn't see this being an issue since localedef is
   self-contained so CDDL is limited to it.  (IANAL)

8 years agolocaledef(1): Better bootstrap fix
John Marino [Wed, 29 Jul 2015 09:30:16 +0000 (11:30 +0200)]
localedef(1): Better bootstrap fix

We don't need to build localedef in ctools as well as bootstrap tools.
Moreover, when I removed from bootstrap tools, it built but segfaulted
on use.  The COLL_WEIGHTS_MAX file needs to be in the header because
it affects the structure definition.  When it's moved there, the build
on older platforms will succeed.

8 years agommap.2: Remove (now) useless BUGS section.
Sascha Wildner [Wed, 29 Jul 2015 08:11:45 +0000 (10:11 +0200)]
mmap.2: Remove (now) useless BUGS section.

8 years ago<sys/systm.h>: Small indent fix.
Sascha Wildner [Wed, 29 Jul 2015 08:10:58 +0000 (10:10 +0200)]
<sys/systm.h>: Small indent fix.

8 years agoi386 removal, part 24/x: Remove i386 specific parts from NDIS.
Sascha Wildner [Wed, 29 Jul 2015 08:08:55 +0000 (10:08 +0200)]
i386 removal, part 24/x: Remove i386 specific parts from NDIS.

8 years agolocaledef - Fix buildworld bootstrapping issue
Matthew Dillon [Wed, 29 Jul 2015 03:28:05 +0000 (20:28 -0700)]
localedef - Fix buildworld bootstrapping issue

* When running buildworld on an older system the localedef built in
  BTOOLS using /usr/include/limits.h will fail building the locales.

* Fix the problem by adding localedef to CTOOLS.

* Also fix a problem where the old limits.h defines COLL_WEIGHTS_MAX as 0
  and breaks the building of localedef itself.  Check for the case in
  collate.c.

8 years agomcast: Use M_INTWAIT for multicast addresses allocation
Sepherosa Ziehau [Tue, 28 Jul 2015 15:29:04 +0000 (23:29 +0800)]
mcast: Use M_INTWAIT for multicast addresses allocation

8 years agoinet6: Use M_INTWAIT for prefix and prefix's router allocation
Sepherosa Ziehau [Tue, 28 Jul 2015 14:48:36 +0000 (22:48 +0800)]
inet6: Use M_INTWAIT for prefix and prefix's router allocation

Suggested-by: dillon@
8 years agoifaddr: Use M_INTWAIT for ifaddr allocation
Sepherosa Ziehau [Tue, 28 Jul 2015 14:46:18 +0000 (22:46 +0800)]
ifaddr: Use M_INTWAIT for ifaddr allocation

Suggested-by: dillon@
8 years agomanpages - Remove obsolete info
Matthew Dillon [Wed, 29 Jul 2015 02:55:32 +0000 (19:55 -0700)]
manpages - Remove obsolete info

* Remove the BUGS section describing a 2GB limit to individual mmap()
  calls.  This was a limitation on 32-bit systems but no such limit exists
  on 64-bit systems.

Reported-by: Alex Merritt
8 years agocollate 4/4: Remove colldef(1) tool from base (swap bootstrap)
John Marino [Tue, 28 Jul 2015 19:51:54 +0000 (21:51 +0200)]
collate 4/4: Remove colldef(1) tool from base (swap bootstrap)

It cannot read the new input files and it generates v1.2 LC_COLLATE which
libc can no longer read.  There is no use left for colldef(1).

Colldef was tool required for bootstrap, so replace it with localedef.
The share/colldef makefile must be what requires this built.

8 years agocollate 3/4: Bring in input files for new LC_COLLATE format
John Marino [Tue, 28 Jul 2015 19:47:10 +0000 (21:47 +0200)]
collate 3/4: Bring in input files for new LC_COLLATE format

These input files use localedef(1) instead of colldef(1) to generate and
install new LC_COLLATE files.

Only UTF-8 collation will be installed.  All other codesets will symlink to
their UTF-8 counterparts. UTF-8 is the default codeset for every territory.

8 years agocollate 2/4: Hook localedef to build, unhook colldef
John Marino [Tue, 28 Jul 2015 19:36:27 +0000 (21:36 +0200)]
collate 2/4: Hook localedef to build, unhook colldef

8 years agocollate 1/4: Add support for LC_COLLATE format "DragonFly 4.4" in libc
John Marino [Tue, 28 Jul 2015 19:25:23 +0000 (21:25 +0200)]
collate 1/4: Add support for LC_COLLATE format "DragonFly 4.4" in libc

The collate functions within libc have been using version 1 and 1.2 of the
packed LC_COLLATE binary formats.  These were generated with the colldef
tool, but the new LC_COLLATE files are going to be generated by the new
localedef tool using CLDR POSIX files as input.  The DragonFly-flavored
version of localedef identifies the format as "DragonFly 4.4".  Any
LC_COLLATE file with a different version will simply not be loaded, and
all LC* categories will get set to "C" (aka "POSIX") locale.

This work is based off of Nexenta's contribution to Illumos (successor
to OpenSolaris).  The integration with xlocale is my work though.

The following commits will enable localedef tool, disable the colldef
tool, add generated colldef directory, and finally remove colldef from
base.

8 years agocldr2def: Fix colldef makefile for full buildworld
John Marino [Tue, 28 Jul 2015 22:17:30 +0000 (00:17 +0200)]
cldr2def: Fix colldef makefile for full buildworld

The LC_COLLATE file generation will fail with relative paths, so
use ${.CURDIR} in the makefile to fix buildworld.  Also the output
file has to include the object directory, otherwise the files are
all build in /usr/src.

8 years agobuildworld - Fix stage-1 build breakage
Matthew Dillon [Tue, 28 Jul 2015 21:39:48 +0000 (14:39 -0700)]
buildworld - Fix stage-1 build breakage

* Conditionalize sort to not use the new isnan() function in the
  bootstrap stage where it might not exist.

8 years agolibc.a: Add __isnan and __isnanf
John Marino [Tue, 28 Jul 2015 21:29:05 +0000 (23:29 +0200)]
libc.a: Add __isnan and __isnanf

These symbols are not present in libm (the deleted message isn't
correct). Remove the PIC check to put __isnan and __isnanf in the
static c library.  Incidentally, __isnanl is already in static
library because the PIC check was forgotten.

8 years agosbin/hammer: Use HAMMER_BUFSIZE
Tomohiro Kusumi [Tue, 28 Jul 2015 19:58:50 +0000 (04:58 +0900)]
sbin/hammer: Use HAMMER_BUFSIZE

- Use HAMMER_BUFSIZE insteaf of 16KiB.

8 years agodirfs - Add kqueue(2) support
Antonio Huete Jimenez [Tue, 28 Jul 2015 19:47:12 +0000 (12:47 -0700)]
dirfs - Add kqueue(2) support

- Based on tmpfs work on 80ae59d743
- FIFO ops not added

8 years agosort(1): Replace NetBSD version with Free/Open version
John Marino [Tue, 28 Jul 2015 18:41:56 +0000 (20:41 +0200)]
sort(1): Replace NetBSD version with Free/Open version

With my ongoing collation work, I discovered our sort was not locale
sensitive, but GNU sort was.  I replaced our ancient GNU sort with
NetBSD's version about 4 years ago.  NetBSD hasn't updated that version
since.  However, FreeBSD got rid of their GNU sort fairly recently and
replaced it with another BSD-licensed version.  Four months ago, it was
imported into OpenBSD, they made some corrections which were incorporated
back in FreeBSD in the April timeframe.

This version is locale sensitive and gives the same answers as GNU sort in
my (admittedly) very limited testing.

I fixed some minor issues that GCC5 was squawking about (mainly unused
variables) and I changed the --parallel option PTHREAD_MUTEX_ADAPTIVE_NP
behavior to PTHREAD_MUTEX_ERRORCHECK (the default POSIX behavior).  DF
does not have the former flag implemented.

8 years agocldr2def: Update to generate colldef replacement directory
John Marino [Tue, 28 Jul 2015 15:55:34 +0000 (17:55 +0200)]
cldr2def: Update to generate colldef replacement directory

The new localedef tool needs extracts for CLDR POSIX localization
definition files, and it needs the UTF-8 character map along with
the width definitions (mainly for Asian monitor support).

Since the LC_COLLATE handling is fundamentally different from the
first four groups, new sections to the cldr2def tool had to be
written, thus requiring me to brush up on my perl skills.

The finalize script (which I had previously written) was modified
to copy the widths and charmap files over to the regenerated
colldef directory (a drop-in replacement for share/colldef).

8 years agoAdd localedef(1), a locale definition generator tool
John Marino [Tue, 28 Jul 2015 16:31:53 +0000 (18:31 +0200)]
Add localedef(1), a locale definition generator tool

The localedef tool can read entire (and unmodified) CLDR posix definition
files, and generate all 6 LC categories: LC_COLLATE, LC_CTYPE, LC_TIME,
LC_NUMERIC, LC_MONETARY and LC_MESSAGES.

The last 4 of those aren't needed.  We already have a tool that generates
msgdef, timedef, moneydef and numericdef.  In the immediate future,
localedef will only be used generate LC_COLLATE files in a new format.
This will render colldef files unreadable, thus colldef will be removed
when this happens.

In the future, localedef will be tasked to generate LC_CTYPE files as
well.  When that happens, the mklocale tool will be retired.

While localedef *can* read pristine POSIX files (which causes 6 files
to be generated), it will given files with only the LC_COLLATE part,
which will also have all the white space removed as well.  Remove just
the spaces can save megabytes.

This tool has a long history with Solaris [1].  The Nexenta developers
modified it to read CLDR files and created the much richer collation
formats.  The libc collation functions have to be modified to read the
new format (called "DragonFly-4.4") and to handle the new data structures.

The result will be that locale-sensitive tools and functions will now
properly sort multibyte and unicode strings.  Our "BSD" sort is not locale
sensitive, so it will probably have to be replaced with GNU sort in order
to leverage our new collation capabilities.

This can't be hooked into the build yet.  It needs the new header for
collate.c to define the data structures.  Until that happens, this is
actually unbuildable.

[1] Linux also has a tool called localdef, but I do know know if it shares
    a common history or if it uses CLDR POSIX files.  It seems to have the
    same purpose though.

8 years agoinet6: No need to explicitly avoid calling ioctl(SIOCSADDR)
Sepherosa Ziehau [Mon, 27 Jul 2015 14:47:58 +0000 (22:47 +0800)]
inet6: No need to explicitly avoid calling ioctl(SIOCSADDR)

Rearrange the code a little bit.

8 years agoinet6: Use M_WAITOK on SIOCAIFADDR_IN6 path.
Sepherosa Ziehau [Mon, 27 Jul 2015 14:27:03 +0000 (22:27 +0800)]
inet6: Use M_WAITOK on SIOCAIFADDR_IN6 path.

Addition:
- Use M_ZERO, instead of calling bzero().
- Avoid M_ZERO, if the allocated memory is to be completely over-
  written.
- Remove unapplied comment.

8 years agoroute: Enhance panic message
Sepherosa Ziehau [Mon, 27 Jul 2015 14:03:30 +0000 (22:03 +0800)]
route: Enhance panic message

8 years agosys/vfs/hammer: Add HAMMER_BTREE_TYPE_NONE
Tomohiro Kusumi [Mon, 27 Jul 2015 16:17:31 +0000 (01:17 +0900)]
sys/vfs/hammer: Add HAMMER_BTREE_TYPE_NONE

- No functional changes, but just makes things clearer.

- root_btree_{beg|end} has 0 (not used) for btype.
  Defining a macro for it makes code clearer than
  implicitly taking care of btype by 0 or non-0.

8 years agosys/vfs/hammer: Keep root node signature on root split
Tomohiro Kusumi [Sun, 26 Jul 2015 18:43:10 +0000 (03:43 +0900)]
sys/vfs/hammer: Keep root node signature on root split

- newfs_hammer sets a signature value for the root btree node
  so keep that signature on root node split along with other
  fields being copied to the new root node. This doesn't affect
  the existing fs as it's used for nothing.

- (The former root node signature is not cleared on root split,
  so every node that has once been the root has the signature.
  The one at the lowest zone offset is the original one unless
  moved by reblock)

8 years agosbin/hammer: Fix hammer show output format
Tomohiro Kusumi [Sun, 26 Jul 2015 16:19:45 +0000 (01:19 +0900)]
sbin/hammer: Fix hammer show output format

- Sync with other formats.

8 years agosbin/hammer: Cleanup headers
Tomohiro Kusumi [Sun, 26 Jul 2015 08:16:05 +0000 (17:16 +0900)]
sbin/hammer: Cleanup headers

- Define struct softprune in hammer_util.h just like other
  hammer userspace structures are defined here.

8 years agosbin/hammer: Cleanup zone statistics
Tomohiro Kusumi [Sun, 26 Jul 2015 05:59:55 +0000 (14:59 +0900)]
sbin/hammer: Cleanup zone statistics

- No functional changes, things should have been named this way.

8 years agodirfs - Do not acquire dirfs' mount token
Antonio Huete Jimenez [Mon, 27 Jul 2015 16:46:44 +0000 (09:46 -0700)]
dirfs - Do not acquire dirfs' mount token

- dirfs is still marked as non mp-safe so the VN ops are protected
  by VFS_MPLOCK()

8 years agodirfs - Remove no longer needed comment
Antonio Huete Jimenez [Sun, 26 Jul 2015 22:57:33 +0000 (15:57 -0700)]
dirfs - Remove no longer needed comment

8 years agotestcases - Remove posixipc test
Antonio Huete Jimenez [Sun, 26 Jul 2015 16:44:18 +0000 (09:44 -0700)]
testcases - Remove posixipc test

- POSIX IPC tests are already migrated individually to dfregress(8)

8 years agotop.1 - Fix manpage
Antonio Huete Jimenez [Sun, 26 Jul 2015 16:03:46 +0000 (09:03 -0700)]
top.1 - Fix manpage

- This commit follows up 30277d08ae where top(1) went back to
  use RES again after PRES was removed.

8 years agodirfs - Change debug levels
Antonio Huete Jimenez [Sun, 26 Jul 2015 14:49:35 +0000 (07:49 -0700)]
dirfs - Change debug levels

- Specific debug levels are specified for easier debugging:

    1       Calls to VFS operations (mount, umount, ...)
    3       Calls to VN operations (open, close, read, ...)
    5       Calls to subroutines
    9       Everything

- Once dirfs is stabilised, debugging facilities will go and
  only KTR will remain.

8 years agoboot - Fix minor memory leak, statistics
Matthew Dillon [Mon, 27 Jul 2015 04:45:51 +0000 (21:45 -0700)]
boot - Fix minor memory leak, statistics

* open() calls devopen() which installs a generic malloc'd device
  wrapper in f->f_devdata.  However, some devices will replace this
  with their own descriptor.

  Add F_DEVDESC to indicate when f->f_devdata contains this generic
  object, free and clear the generic object when replacing f_devdata
  in particular devices.

  This fixes a minor memory leak of 192 bytes on open()s made by the boot
  code when booting from e.g. PXE.

* Fix incorrect MallocCount statistics.  calloc() and realloc() were
  improperly incrementing the global, even though the malloc() call they
  both make also increments it.

* Remove the unused F_NODEV flag.  This flag is never set, collapse the
  related code.

8 years agotcpdrop: Drop a specific tcp connection or all tcp connections
Sepherosa Ziehau [Sun, 26 Jul 2015 09:20:18 +0000 (17:20 +0800)]
tcpdrop: Drop a specific tcp connection or all tcp connections

Obtained-from: OpenBSD via FreeBSD

8 years agowcscoll.3: Fix copy/paste error (due to wcsxfrm)
John Marino [Sun, 26 Jul 2015 12:38:30 +0000 (14:38 +0200)]
wcscoll.3: Fix copy/paste error (due to wcsxfrm)

8 years agoboot - Put loader heap in high memory
Matthew Dillon [Sun, 26 Jul 2015 08:03:46 +0000 (01:03 -0700)]
boot - Put loader heap in high memory

* We ran out of low BIOS memory.  The initrd.img.gz unpacking requires a
  bit more than ~32KB of temporary space and it ran the loader out of
  low-BIOS heap memory.

  This can cause the loader to fail to load the image and prevent proper
  crypto or single-user bootstrapping.

* Steal the heap from high-memory, just ender the kernel+modules load area
  limit.  For now, steal 1MB, which gives the loader plenty of space again.
  The kernel will lose 1MB of physical memory, boo-hoo.

* The loader must remove the heap from the SMAP passed to the kernel.

* Move any objects requiring VTOPSEG/VTOPOFF out of malloc and into a
  static or stack declaration.

Reported-by: cgag, multiple
8 years agosbin/hammer: Fix memory allocation for zone statistics
Tomohiro Kusumi [Sat, 25 Jul 2015 16:01:33 +0000 (01:01 +0900)]
sbin/hammer: Fix memory allocation for zone statistics

- 2550036 allocates unnecessary amount of memory when the
  filesystem consists of >1 volumes and accounting actually
  reaches to the second volume. This commit fixes it by
  splitting bitmap into bitmaps[2^8] where 2^8 is the maximum
  number of volumes. Other than that it's basically the same.

  layer1/layer2 direct map:
      <------> Max 2^8 volumes
  zzzzvvvvvvvvoooo oooooooooooooooo oooooooooooooooo oooooooooooooooo
  ----111111111111 1111112222222222 222222222ooooooo oooooooooooooooo
              <----...
              Most environment doesn't use address space this
              far as the storage usually isn't as huge as 2^52,
              so hammer_extend_layer2_bits() allocating bitmaps
              for this region mostly ends up waste of memory.
              Having an array bitmaps[2^8] prevents this as the
              volume-bits-masked-laye1-index doesn't jump up by
              2^10 when v part gets ++.

8 years agonetif: Configure mbuf clusters/jclusters limits
Sepherosa Ziehau [Sat, 25 Jul 2015 12:58:08 +0000 (20:58 +0800)]
netif: Configure mbuf clusters/jclusters limits

Default mbuf clusters limit work for most of the network device
drivers.  The drivers modified by this commit:
- Use mbuf jclusters.
- Size of the reception queues could be configured.
- Support multiple reception queues.

et(4) and mxge(4) are special; they use non-cluster mbuf for small
packets reception, so we adjust non-cluster mbuf limit manually in
these two drivers.

8 years agoifnet: Allow drivers to adjust mbuf cluster/jcluster limits
Sepherosa Ziehau [Sat, 25 Jul 2015 08:02:59 +0000 (16:02 +0800)]
ifnet: Allow drivers to adjust mbuf cluster/jcluster limits

This is mainly for raising mbuf clusters/jclusters limits to a high
enough value for device reception queues, e.g. modern network devices
w/ multiple reception queues and each reception queue could consume
>=512 mbuf clusters.

8 years agopatch - Remove RCS and SCCS auto-checkout support
Matthew Dillon [Sat, 25 Jul 2015 02:40:41 +0000 (19:40 -0700)]
patch - Remove RCS and SCCS auto-checkout support

* Remove stale RCS and SCCS support which involves the patch(1) program
  constructing a system() command using filename data supplied from the
  file.  DragonFly deems this to be too dangerous, quoted or not.

Security: CVE-2015-1416
Reported-by: Xin Li, Martin Natano
8 years agokernel/route: Use the netisr threads to initialize the route tables.
Nuno Antunes [Tue, 21 Jul 2015 07:34:24 +0000 (15:34 +0800)]
kernel/route: Use the netisr threads to initialize the route tables.

Reviewed-by: sephe

8 years agosbin/hammer: Enable AssertOnFailure on -d for hammer show/checkmap
Tomohiro Kusumi [Fri, 24 Jul 2015 19:37:04 +0000 (04:37 +0900)]
sbin/hammer: Enable AssertOnFailure on -d for hammer show/checkmap

8 years agosbin/hammer: Cleanup hammer checkmap
Tomohiro Kusumi [Fri, 24 Jul 2015 19:32:00 +0000 (04:32 +0900)]
sbin/hammer: Cleanup hammer checkmap

8 years agosbin/hammer: Make hammer checkmap support zone4
Tomohiro Kusumi [Fri, 24 Jul 2015 17:23:30 +0000 (02:23 +0900)]
sbin/hammer: Make hammer checkmap support zone4

- It's kind of obvious that zone4 never fails on checkmap tests,
  but it was a missing zone as it already supports btree and undos.

- Note that this commit changes condition of error=-5 case in
  blockmap_lookup() by adding "HAMMER_ZONE_FREEMAP_INDEX != zone &&".
  This is necessary as zone4 is really just zone2 and all the
  blockmap offsets have 0x02 in the upper 4 bits which means
  blockmap lookup for zone4 offset always hits this assertion.
  Normal filesystem operations (including other hammer commands
  and newfs_hammer) never need this condition change as they never
  lookup zone4 offset, and in fact blockmap lookup in kernel space
  doesn't have this, however this commit needs it. This should make
  sense though as zone4 really is an exceptional case where all
  data is just a bunch of metadata that is made to effectively
  map storage chunks to zone2.

- Update hammer(8). Now it supports all possible zones but
  it only mentions btree elements.

8 years agosbin/hammer: Use bitmaps for zone statistics
Tomohiro Kusumi [Thu, 23 Jul 2015 20:41:51 +0000 (05:41 +0900)]
sbin/hammer: Use bitmaps for zone statistics

- Didn't squash this with the previous commit in order to be able
  to go back to the previous one (rbtree version) for some reason.

8 years agosbin/hammer: Make hammer show support zone statistics
Tomohiro Kusumi [Thu, 23 Jul 2015 20:35:50 +0000 (05:35 +0900)]
sbin/hammer: Make hammer show support zone statistics

- Update zone statistics while iterating btree and
  print them after btree-walk is done.

- The zone statistics is enabled when -v is specified just
  like hammer checkmap.

- hammer show's statistics use elm->leaf.data_len for used
  bytes, so it could have different number from blockmap/
  checkmap statistics (blockmap/checkmap statistics will
  have the same or higher used bytes as well as percentage).

- Newly added item count is always 0 on blockmap/checkmap
  statistics while it has >0 for zone 8,9,10,11 for show.
  Both hammer blockmap/checkmap are not aware of items in
  each big-block so they can't count items. The idea of
  item is countable only when iterating btree.