dragonfly.git
8 years agoboot - Fix CD booting
Matthew Dillon [Wed, 19 Aug 2015 19:23:26 +0000 (12:23 -0700)]
boot - Fix CD booting

* Recent changes to move the loader's heap to high-memory broke the
  CD I/O code due to being beyond the BIOS'es segmentation range.  The
  HDD code was already using bounce buffers, but the CD code was not.

* Adjust the CD I/O code to use bounce buffers too.

Reported-by: numerous.
Testing-by: swildner
8 years agocorepower.4: Explain what the package power usage value means.
Imre Vadász [Tue, 18 Aug 2015 20:40:02 +0000 (22:40 +0200)]
corepower.4: Explain what the package power usage value means.

8 years agopowerd: Restore backlight when powerd exits
Sepherosa Ziehau [Mon, 17 Aug 2015 12:46:10 +0000 (20:46 +0800)]
powerd: Restore backlight when powerd exits

8 years agoinet6: Limit the # of fragments in addition to the # of fragmented packets
Sepherosa Ziehau [Mon, 17 Aug 2015 12:38:59 +0000 (20:38 +0800)]
inet6: Limit the # of fragments in addition to the # of fragmented packets

Obtained-from: KAME via FreeBSD

8 years agoinet6: Send initial NS in a timely fashion.
Sepherosa Ziehau [Mon, 17 Aug 2015 12:31:01 +0000 (20:31 +0800)]
inet6: Send initial NS in a timely fashion.

The call of nd6_rtrequest() in nd6_output() sets the newly created
neighbor cache entry expire to time_uptime, which prevents the NS
output at the end of nd6_output().  Though the NS will be sent when
the neighbor cache times out, it will cause large delay (0~1s).

8 years agondp: Fix neighbor cache entry expire time logging
Sepherosa Ziehau [Mon, 17 Aug 2015 12:27:51 +0000 (20:27 +0800)]
ndp: Fix neighbor cache entry expire time logging

8 years agokernel/vmm: Use "(a & b) == 0" instead of "!(a & b)".
Sascha Wildner [Mon, 17 Aug 2015 18:58:59 +0000 (20:58 +0200)]
kernel/vmm: Use "(a & b) == 0" instead of "!(a & b)".

Poked-by: dillon
8 years agokernel/vmm: Use __func__ and adjust whitespace.
Sascha Wildner [Mon, 17 Aug 2015 18:46:03 +0000 (20:46 +0200)]
kernel/vmm: Use __func__ and adjust whitespace.

8 years agokernel/vmm: Untangle a too deeply nested if/else.
Sascha Wildner [Mon, 17 Aug 2015 17:23:18 +0000 (19:23 +0200)]
kernel/vmm: Untangle a too deeply nested if/else.

Get rid of if/goto/else cases. Check errors first and return early where
possible.

8 years ago<sys/vmm.h>: Fix include guard and adjust indent/whitespace a bit.
Sascha Wildner [Mon, 17 Aug 2015 17:02:24 +0000 (19:02 +0200)]
<sys/vmm.h>: Fix include guard and adjust indent/whitespace a bit.

8 years agokernel/hammer: Simplify an if/goto/else construct.
Sascha Wildner [Mon, 17 Aug 2015 16:45:48 +0000 (18:45 +0200)]
kernel/hammer: Simplify an if/goto/else construct.

8 years agosys/vfs/hammer: Cleanups
Tomohiro Kusumi [Sun, 16 Aug 2015 23:26:35 +0000 (08:26 +0900)]
sys/vfs/hammer: Cleanups

Remaining minor ones.

8 years agosys/vfs/hammer: Cleanup volume-add|del ioctl [3/3]
Tomohiro Kusumi [Sun, 16 Aug 2015 13:31:54 +0000 (22:31 +0900)]
sys/vfs/hammer: Cleanup volume-add|del ioctl [3/3]

This commit is 3/3 of a series of commits that extract
common procedures on updating volumes header into a function.

Add hammer_update_volumes_header().

8 years agosys/vfs/hammer: Cleanup volume-add|del ioctl [2/3]
Tomohiro Kusumi [Sun, 16 Aug 2015 13:28:48 +0000 (22:28 +0900)]
sys/vfs/hammer: Cleanup volume-add|del ioctl [2/3]

This commit is 2/3 of a series of commits that extract
common procedures on updating volumes header into a function.

Changing bigblock_stat fields to signed is ok (or even better)
since the original ondisk fields are int64_t.

8 years agosys/vfs/hammer: Cleanup volume-add|del ioctl [1/3]
Tomohiro Kusumi [Sun, 16 Aug 2015 11:30:29 +0000 (20:30 +0900)]
sys/vfs/hammer: Cleanup volume-add|del ioctl [1/3]

This commit is 1/3 of a series of commits that extract
common procedures on updating volumes header into a function.

Reordering hammer_format_freemap() and updating volume count
doesn't affect behavior of volume-add since it's independent
of each other. Also note that these all must succeed anyway
as assertions show.

8 years agosys/vfs/hammer: Remove duplicated vfs code
Tomohiro Kusumi [Sun, 16 Aug 2015 05:05:55 +0000 (14:05 +0900)]
sys/vfs/hammer: Remove duplicated vfs code

Much of the code in sys/vfs/hammer/hammer_volume.c is taken
from the existing code, and some of them could be integrated
into mainstream hammer code. This commit does that without
messing up interface or making functional changes.

This greatly reduces and simplifies code, and also gets rid
of extra (and unnecessary) vfs open/close operations that
existed only to initialize or erase volume header while in
kernel space on ioctl.

8 years agosbin/hammer: Fix hammer show output format
Tomohiro Kusumi [Sat, 15 Aug 2015 07:54:36 +0000 (16:54 +0900)]
sbin/hammer: Fix hammer show output format

Sync with formats of other fields.

8 years agohammer: Cleanups
Tomohiro Kusumi [Fri, 14 Aug 2015 03:12:59 +0000 (12:12 +0900)]
hammer: Cleanups

Unfold lines (that aren't intentionally separated
into different lines) that fit in 80 chars.

Fold lines that are way too long.

8 years agohammer: Conform to style(9)
Tomohiro Kusumi [Wed, 12 Aug 2015 10:36:39 +0000 (19:36 +0900)]
hammer: Conform to style(9)

Also
* Remove header includes that are already included by
  common hammer headers (of either userspace or kernel).
* Add "#include <sys/vnode.h>" to sys/vfs/fifofs/fifo.h.

8 years agosys/gnu/vfs/ext2fs: Remove unused ioctl call and variables
Tomohiro Kusumi [Tue, 11 Aug 2015 23:24:22 +0000 (08:24 +0900)]
sys/gnu/vfs/ext2fs: Remove unused ioctl call and variables

In addition to 30b14d35.
(Also see r98542 and r104697 of FreeBSD)

8 years agosys/vfs/ufs: Remove unused ioctl call and variables
Tomohiro Kusumi [Tue, 11 Aug 2015 23:22:46 +0000 (08:22 +0900)]
sys/vfs/ufs: Remove unused ioctl call and variables

Similar to 30b14d35.
(Also see r98542 and r104697 of FreeBSD)

8 years agosbin/hammer: Add init_boot|mem_area_size()
Tomohiro Kusumi [Tue, 11 Aug 2015 21:00:52 +0000 (06:00 +0900)]
sbin/hammer: Add init_boot|mem_area_size()

Integrate copy-pasted code by 6f3076af into functions.

8 years agosys/vfs/hammer: Cleanup volume# iteration
Tomohiro Kusumi [Tue, 11 Aug 2015 10:24:22 +0000 (19:24 +0900)]
sys/vfs/hammer: Cleanup volume# iteration

if (volume == NULL && error == ENOENT) {...
can be removed since now that vol_no must exist.

If error==ENOENT and hits the assertion right after this,
then the code has a bug.

8 years agosys/vfs/hammer: Fix wrong function name in kprintf
Tomohiro Kusumi [Mon, 10 Aug 2015 10:27:07 +0000 (19:27 +0900)]
sys/vfs/hammer: Fix wrong function name in kprintf

It used to be "hammer_mountroot" according to 104cb849.
"hammer_mount" still isn't name of a function, but this
is what other kprintfs around here use.

8 years agosys/vfs/hammer: Fix inconsistent function prototypes
Tomohiro Kusumi [Sun, 9 Aug 2015 21:07:15 +0000 (06:07 +0900)]
sys/vfs/hammer: Fix inconsistent function prototypes

Should use either of the type name or typedef'd name
for both function prototype and the function itself.

(hammer mostly uses hammer_mount_t rather than struct
hammer_mount in this case)

8 years agosys/vfs/hammer: Avoid volume# inconsistency on mount
Tomohiro Kusumi [Sun, 9 Aug 2015 19:35:41 +0000 (04:35 +0900)]
sys/vfs/hammer: Avoid volume# inconsistency on mount

hammer_vfs_mount() should check and compare # of volumes
to mount (# of volumes in mount_hammer arg in blkdevs format)
and vol_count field in volume header.

mount_hammer should fail if they don't match even if it's
technically possible to mount at the moment after newfs.

In the following Example1, it's possible to safely mount
/dev/da1 without /dev/da2:/dev/da3 or
/dev/da1:/dev/da2 without /dev/da3 or
/dev/da1:/dev/da3 without /dev/da2 at this point because
both /dev/da2 and /dev/da3 has no data (only layer2 big-block)
right after newfs_hammer, however if filesystem has enough
data that zone2 next_offset has already reached the missing
volume before unmount, there is going to be inconsistency
between blockmap and actual mounted volumes, which results
in kernel panic. mount needs to avoid this by checking #
of volumes as the Example2 shows.

Example 1. - newfs 3 volumes and then mount 2 volumes
  # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null
  # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
  # mount | grep /HAMMER
  TEST on /HAMMER (hammer, local)
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2:/dev/da3
  # umount /HAMMER
  # mount_hammer /dev/da1:/dev/da2 /HAMMER
  # mount | grep /HAMMER
  TEST on /HAMMER (hammer, local)
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2

Example 2. - with this commit it fails to mount
  # newfs_hammer -L TEST /dev/da1 /dev/da2 /dev/da3 > /dev/null
  # mount_hammer /dev/da1:/dev/da2:/dev/da3 /HAMMER
  # mount | grep /HAMMER
  TEST on /HAMMER (hammer, local)
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2:/dev/da3
  # umount /HAMMER
  # mount_hammer /dev/da1:/dev/da2 /HAMMER
  mount_hammer: Unknown error: Invalid argument
  # dmesg | tail -1
  hammer_mount: volume header says 3 volumes, but 2 installed
  # mount_hammer /dev/da1 /HAMMER
  mount_hammer: Unknown error: Invalid argument
  # dmesg | tail -1
  hammer_mount: volume header says 3 volumes, but 1 installed

8 years agosys/vfs/hammer: Fix error check on mount
Tomohiro Kusumi [Sun, 9 Aug 2015 18:16:24 +0000 (03:16 +0900)]
sys/vfs/hammer: Fix error check on mount

Since it already has failed: that does the same thing,
goto failed; on each error case makes code more clear.

Remove error==0 from the first if() conditional since
error isn't 0 when hmp->rootvol==NULL.

8 years agosys/vfs/hammer: Fix comments
Tomohiro Kusumi [Mon, 17 Aug 2015 10:58:14 +0000 (19:58 +0900)]
sys/vfs/hammer: Fix comments

These functions return 1 or 0, but not TRUE or FALSE macros.
(there are also existing comments that use 1/0)

8 years agohammer: Fix unusual line break style
Tomohiro Kusumi [Sun, 9 Aug 2015 16:46:59 +0000 (01:46 +0900)]
hammer: Fix unusual line break style

8 years agosys/vfs/hammer: Fix volume-del issue with >1 pfs
Tomohiro Kusumi [Sun, 9 Aug 2015 03:29:12 +0000 (12:29 +0900)]
sys/vfs/hammer: Fix volume-del issue with >1 pfs

Since 5e1e1454 hammer reblock supports a new option that
can reblock all pfses within filesystem.

hammer volume-del needs to use this when it finds the volume
not empty and needs to reblock. Otherwise it only reblocks a
single pfs (pfs 0 in this case) and may end up ignoring data
in other pfses that should have been reblocked from that volume
(remember that pfs has nothing to do with which volume pfs
data/inodes/etc are stored in).

As the following examples show, hammer volume-del results in
failure if the above situation occurs. It fails because data
in non-pfs0 remains in that volume without being reblocked.
If one is lucky that the volume doesn't have non-pfs0 data,
then hammer volume-del won't fail even without allpfs=1 set
(of course given that the whole filesystem has enough space
for reblock to succeed).

--
Create filesystem that consists of 3 volumes and >1 pfses.
The root volume can't be removed, so fill up non-zero pfses
till it gets to the second volume while keeping enough space
for reblock to succeed. Then try to remove a non-root volume
that isn't empty which is /dev/da2 in this case.

  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da2:/dev/da3    /* /dev/da1 is root volume */
  # ls -l /HAMMER               /* data exists in pfs 1 to 12 */
  total 0
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:24 master1 -> @@-1:00001
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:31 master10 -> @@-1:00010
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:32 master11 -> @@-1:00011
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:33 master12 -> @@-1:00012
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:25 master2 -> @@-1:00002
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:26 master3 -> @@-1:00003
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:27 master4 -> @@-1:00004
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:28 master5 -> @@-1:00005
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:29 master6 -> @@-1:00006
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:29 master7 -> @@-1:00007
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:30 master8 -> @@-1:00008
  lrwxr-xr-x  1 root  wheel  10 Aug  9 13:31 master9 -> @@-1:00009
  # df -Th /HAMMER
  Filesystem  Type     Size   Used  Avail Capacity  Mounted on
  TEST        hammer   334G   118G   216G    35%    /HAMMER
  # hammer -f /dev/da1:/dev/da2:/dev/da3 blockmap | grep -A2 layer1
    layer1 4000000000000000 @2000000000800000 blocks-free 0
          4000000000000000 zone=4  app=8388608 free=0
          4000000000800000 zone=4  app=8388608 free=0
  --
    layer1 4010000000000000 @2010000000000000 blocks-free 13449
          4010000000000000 zone=4  app=8388608 free=0
          4010000000800000 zone=10 app=8388608 free=0
  --
    layer1 4020000000000000 @2020000000000000 blocks-free 14268
          4020000000000000 zone=4  app=8388608 free=0
          4020000000800000 zone=0  app=0       free=8388608
/* /dev/da1 is 100% used,
   /dev/da2 is partially used,
   /dev/da3 is 0% used */

Example 1. - without allpfs=1 fails in a second because
there isn't really anything it can do as there's no data
in pfs0 except for some inodes and btree nodes, etc.
  # time hammer volume-del /dev/da2 /HAMMER
  hammer volume-del ioctl: Device busy

  real    0m0.017s
  user    0m0.000s
  sys     0m0.000s
  # dmesg | tail -2
  reblock started
  Failed to free volume: Volume 1 not empty

Example 2. - this commit with allpfs=1 takes 15 min because
it reblocks all the data in all pfses (mostly from non-pfs0),
but successfully removes /dev/da2.
  # time hammer volume-del /dev/da2 /HAMMER

  real    15m7.664s
  user    0m0.000s
  sys     7m36.270s
  # hammer volume-blkdevs /HAMMER
  /dev/da1:/dev/da3

8 years agosys/vfs/hammer: Add (missing)debug print for data reblock
Tomohiro Kusumi [Sun, 9 Aug 2015 02:34:15 +0000 (11:34 +0900)]
sys/vfs/hammer: Add (missing)debug print for data reblock

Add debug kprintf for data reblock since leaf/internal
node have it in the same format as this.

Also add "%08x",elm->base.localization to above and the
existing debug kprintfs.

8 years agocorepower(4): Sensor for Intel CPUs' power usage via the RAPL MSRs
Imre Vadász [Mon, 17 Aug 2015 07:53:19 +0000 (09:53 +0200)]
corepower(4): Sensor for Intel CPUs' power usage via the RAPL MSRs

8 years agosensors: Add SENSOR_WATTS support to sysctl(8) and systat(1)
Imre Vadász [Mon, 17 Aug 2015 07:52:47 +0000 (09:52 +0200)]
sensors: Add SENSOR_WATTS support to sysctl(8) and systat(1)

8 years agoinet: Don't accept fragments if maxfragsperpacket is 0.
Sepherosa Ziehau [Sun, 16 Aug 2015 14:26:59 +0000 (22:26 +0800)]
inet: Don't accept fragments if maxfragsperpacket is 0.

Obtained-from: FreeBSD

8 years agopowerd: Set backlight to the specified value, if AC line is unplugged.
Sepherosa Ziehau [Sun, 16 Aug 2015 13:22:35 +0000 (21:22 +0800)]
powerd: Set backlight to the specified value, if AC line is unplugged.

8 years agoUTF-8 locales: Change all to use single master CTYPE file
John Marino [Sun, 16 Aug 2015 22:58:10 +0000 (00:58 +0200)]
UTF-8 locales: Change all to use single master CTYPE file

The xx_Comm_US locale has been removed.  It's CTYPE file has moved
to en_US.UTF-8, and all other UTF-8 locales' CTYPE links to it.

The non-UTF8 locales remain essentially the same.  They have tailored
CTYPES per the CLDR definition, just as before.

8 years agolocale gen tools: Set all UTF-8 to same rollup CTYPE
John Marino [Sun, 16 Aug 2015 22:54:44 +0000 (00:54 +0200)]
locale gen tools: Set all UTF-8 to same rollup CTYPE

The CLDR CTYPE definitions are still used for non-UTF8 encodings,
but all UTF-8 locales now share a single "master" CTYPE that knows
all reasonable character sets.

8 years agolocale - Add two new API functions
Matthew Dillon [Sun, 16 Aug 2015 22:03:03 +0000 (15:03 -0700)]
locale - Add two new API functions

* Add wcrtombin() and mbintowcr(), powerful buffer-to-buffer functions
  to translate UTF8, which can also perform escaping and de-escaping,
  allow legacy parsing, and do checks with varying levels of strictness.

  NOTE: If no locale or "C" locale, these functions are 1:1 (do not do
UTF8 processing).  A UTF8 locale must be used to access these
functions.

* Add wcrtoutf8() and utf8towcr().  These work exactly the same as
  the above functions but are locale-agnostic.  They always operate in
  UTF8 and locale initialization is not necessary.

* Escaping and de-escaping for 8-bit-clean round-trips with two of the
  modes.

* Can construct UTF8B from unescaped 8-bit-clean data, can deconstruct
  UTF8B (restore the original clean data), and can also be flagged
  generically to take already-escaped UTF8B or wchars as input.

* Can be used to perform strict checks.

* Very powerful incremental buffer validation and processing capabilities.
  Far more visibility to the caller rather than hiding state in a tracking
  state structure.  No tracking state structure.

* Does not do idiotic nul buffer termination.  Caller passes explicitly
  sized data, can opt to include or not include a terminator (depending
  on what is desired), and the byte buffers can contain any 8-bit code
  including 0x00.

8 years agorollup UTF-8: Manually add NO-BREAK_SPACE
John Marino [Sun, 16 Aug 2015 20:46:22 +0000 (22:46 +0200)]
rollup UTF-8: Manually add NO-BREAK_SPACE

Move this definition from cldr2def to manual UTF8 definition.
It was omitted in the first draft accidentally.

8 years agoUpdate common UTF-8 src file with generated one.
John Marino [Sun, 16 Aug 2015 19:12:59 +0000 (21:12 +0200)]
Update common UTF-8 src file with generated one.

8 years agoAdd locale tool to generate "rollup" UTF-8 src file
John Marino [Sun, 16 Aug 2015 19:06:50 +0000 (21:06 +0200)]
Add locale tool to generate "rollup" UTF-8 src file

The first version of the "common" UTF-8 file was hand-assembled by myself.
This is obviously prone to error and is very hard to maintain (the
previous incarnation was never maintained; not once after it was added).

To address these issues, create a new tool (using cldr2def as inspiration)
to create a composite UTF-8 source files using all available POSIX input
from CLDR.  What can't be generated still comes from a manual fragment
that is added to the common source file at the end.

This allows periodic maintenance when CLDR issues new releases.  We are
converging on using this composite (aka "rollup") file for all UTF-8
locales.

8 years agoutf8.c: Fix second error of two-line patch
John Marino [Sun, 16 Aug 2015 18:49:12 +0000 (20:49 +0200)]
utf8.c: Fix second error of two-line patch

Embarrassing.

8 years agokernel/iwn: Grab the WLAN serializer around ieee80211_ifdetach()
Johannes Hofmann [Sun, 16 Aug 2015 11:46:22 +0000 (13:46 +0200)]
kernel/iwn: Grab the WLAN serializer around ieee80211_ifdetach()

This fixes a panic on kldunload.

8 years agoutf8.c: Fix typo
John Marino [Sun, 16 Aug 2015 08:11:21 +0000 (10:11 +0200)]
utf8.c: Fix typo

reported-by: Yellow Rabbit

8 years agolibc/locale: limit utf8 illegal input detection to 10FF FFFF
John Marino [Sun, 16 Aug 2015 07:51:02 +0000 (09:51 +0200)]
libc/locale: limit utf8 illegal input detection to 10FF FFFF

This had been mostly done but we missed these two changes.

Discovered-by: dillon
8 years agoAdd 6 Arabic locales: AE EG JO MA QA SA
John Marino [Sat, 15 Aug 2015 15:11:11 +0000 (17:11 +0200)]
Add 6 Arabic locales: AE EG JO MA QA SA

The lack of Arabic support on BSD seems to be a glaring omission, so
lets help rectify that by adding since 6 locales:
ar_AE: United Arab Emirates
ar_EG: Egypt
ar_JO: Jordan
ar_MA: Morocco
ar_QA: Qatar
ar_SA: Saudi Arabia

There are obviously more (e.g. Iraq, Kuwait, Algeria, Libya, Tunisia,
Syria, etc.) but I selected these as being the most likely to be
used in my limited opinion.

They are UTF-8 locales only. Most of them are identical to ar_SA except
for the monetary definitions (each has a different currency)

8 years agocldr2def: Add 6 Arabic locales: AE EG JO MA QA SA
John Marino [Sat, 15 Aug 2015 14:52:20 +0000 (16:52 +0200)]
cldr2def: Add 6 Arabic locales: AE EG JO MA QA SA

The lack of Arabic support on BSD seems to be a glaring omission, so
lets help rectify that by adding since 6 locales to the cldr2def tool:
ar_AE: United Arab Emirates
ar_EG: Egypt
ar_JO: Jordan
ar_MA: Morocco
ar_QA: Qatar
ar_SA: Saudi Arabia

There are obviously more (e.g. Iraq, Kuwait, Algeria, Libya, Tunisia,
Syria, etc.) but I selected these as being the most likely to be
used in my limited opinion.

They are UTF-8 locales only.

8 years agoctypedef: Replace entire "print" sections with one element
John Marino [Sat, 15 Aug 2015 13:10:32 +0000 (15:10 +0200)]
ctypedef: Replace entire "print" sections with one element

With a recent change to localedef, the "print" section became completely
redundant.  Since it can consume several hundred thousand bytes, removing
it makes the ctype src files much smaller, usually by 33% - 50%.

However, non-breaking spaces have not been previously defined despite
being used in monetary definitions. To correct this mistake, the
non-breaking space has been introduced to ctype as a printable blank
character.  Localedef considers "blanks" as "spaces" so there is no need
to explicitly define this as a space as well.

8 years agocldr2def: Slim down ctype src files
John Marino [Sat, 15 Aug 2015 13:04:22 +0000 (15:04 +0200)]
cldr2def: Slim down ctype src files

I originally modified the tool to use "ranges" to define the CTYPE,
e.g. "<a>;...;<z>" rather than "<a>;<b>;<c> ... <z>".  This worked
great on UTF-8 but converting to other encodings is not supported
because part of the range may not exist, or the upper boundary may
come before the lower boundary in the target encoding.  Thus I had
to remove that work, but I was able to retain the removal of the now
redundant "print" section.

I confirmed that the output without "print" section was identical to
before, and then I added back "print" section with a single element:
NO-BREAK_SPACE. This character is used in quite a few monetary
defintions, but it was never mapped to CTYPE, which I believe is a
mistake.  NO-BREAK_SPACE is also defined as a blank, which is considered
a space as well by localedef tool (so there's no need to also define a
"space" section").

The net change is multibyte encodings now have non-breaking spaces
1) recognized and 2) defined as printable.

8 years agolocaledef(1): eliminate need for "print" definition
John Marino [Sat, 15 Aug 2015 12:03:22 +0000 (14:03 +0200)]
localedef(1): eliminate need for "print" definition

By having space automatically classified as "print" type, we can
eliminate the print section from ctype src files completely (they
are just "graph" plus "<space>".

8 years agoinet6: Set rtentry properly in nd6_output()
Sepherosa Ziehau [Sat, 15 Aug 2015 12:34:39 +0000 (20:34 +0800)]
inet6: Set rtentry properly in nd6_output()

8 years agoinet6/nd6: Join and leave solicited node mcast group once on cpu0
Sepherosa Ziehau [Sat, 15 Aug 2015 08:58:46 +0000 (16:58 +0800)]
inet6/nd6: Join and leave solicited node mcast group once on cpu0

8 years agoinet/arp: Announce proxied ARP once on cpu0
Sepherosa Ziehau [Sat, 15 Aug 2015 08:58:18 +0000 (16:58 +0800)]
inet/arp: Announce proxied ARP once on cpu0

8 years agoinet6: Dispatch mcast routing expire upcalls to netisr0 to run
Sepherosa Ziehau [Sat, 15 Aug 2015 08:35:46 +0000 (16:35 +0800)]
inet6: Dispatch mcast routing expire upcalls to netisr0 to run

8 years agoinet6: Dispatch route timeouts to netisr to run
Sepherosa Ziehau [Sat, 15 Aug 2015 08:03:53 +0000 (16:03 +0800)]
inet6: Dispatch route timeouts to netisr to run

While I'm here, remove unnecessary crit sections.

8 years agoinet6: Avoid excessive calling of in6_addr2zoneid()
Sepherosa Ziehau [Sat, 15 Aug 2015 03:47:01 +0000 (11:47 +0800)]
inet6: Avoid excessive calling of in6_addr2zoneid()

Obtained-from: FreeBSD

8 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sat, 15 Aug 2015 11:13:41 +0000 (13:13 +0200)]
Update the pciconf(8) database.

July 31, 2015 snapshot from http://pciids.sourceforge.net/

8 years agokernel/lagg: Use __printflike().
Sascha Wildner [Sat, 15 Aug 2015 10:50:13 +0000 (12:50 +0200)]
kernel/lagg: Use __printflike().

8 years agokernel/ddb: Change some function definitions to static.
Sascha Wildner [Sat, 15 Aug 2015 09:31:29 +0000 (11:31 +0200)]
kernel/ddb: Change some function definitions to static.

All these were already declared static.

8 years agoi386 removal, part 35/x: Remove the i386 specific vesa(4) code.
Sascha Wildner [Sat, 15 Aug 2015 08:09:11 +0000 (10:09 +0200)]
i386 removal, part 35/x: Remove the i386 specific vesa(4) code.

Clean up vga(4) too.

8 years agokernel/vga: Remove unused code.
Sascha Wildner [Thu, 10 Jul 2014 06:48:06 +0000 (08:48 +0200)]
kernel/vga: Remove unused code.

8 years agopatch - Fix shell injection vulnerability
Matthew Dillon [Sat, 15 Aug 2015 03:29:32 +0000 (20:29 -0700)]
patch - Fix shell injection vulnerability

* Fix shell injection vulnerability in patch(1) via ed(1) by
  tightening sanity check of the input. [1]

* While I'm there also replace ed(1) with red(1) because we do
  not need the unrestricted functionality.

Obtained from: Bitrig [1], and discussions w/ FreeBSD
Security: CVE-2015-1418 [1]

8 years agoSync zoneinfo database with tzdata2015f from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Thu, 13 Aug 2015 16:15:56 +0000 (18:15 +0200)]
Sync zoneinfo database with tzdata2015f from ftp://ftp.iana.org/tz/releases

* asia: North Korea switches to +0830 on 2015-08-15. (Thanks to
    Steffen Thorsen.) The abbreviation remains "KST". (Thanks to
    Robert Elz.)

* europe: Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC.
    (Thanks to Roman Tudos.) Also mention that Herbert Samuel
    introduced the term "Summer Time".

* northamerica: Comments for America/Halifax and America/Glace_Bay have
    been improved. (Thanks to Brian Inglis.)

* southamerica: Uruguay no longer observes DST. (Thanks to
    Steffen Thorsen and Pablo Camargo.)

* Theory: The Theory file mentions naming issues earlier, as these seem
    to be poorly publicized (thanks to Gilmore Davidson for reporting
    the problem).

* Various: Data entries have been simplified for Atlantic/Canary,
    Europe/Simferopol, Europe/Sofia, and Europe/Tallinn.  This yields
    slightly smaller installed data files for Europe/Simferopol and
    Europe/Tallinn. It does not affect timestamps. (Thanks to
    Howard Hinnant.)

8 years agognu man(1): Recognize locales with Scripts in name
John Marino [Thu, 13 Aug 2015 12:05:51 +0000 (14:05 +0200)]
gnu man(1): Recognize locales with Scripts in name

Our GNU man considered locales out of the form of xx_YY (where x is
anything except "_" and Y isn't checked) to be invalid.

However, we have valid locales like sr_Cyrl_RS which were being
rejected.  Adjust the validation code to handle these names.

It also appears that man requires a codeset to be specified, e.g.
fr_FR would be ignored but fr_FR.UTF-8 would be accepted.  I didn't
do anything about this.

8 years agoRegenerate locales (common.UTF-8 => xx_Comm_US.UTF-8)
John Marino [Thu, 13 Aug 2015 10:57:40 +0000 (12:57 +0200)]
Regenerate locales (common.UTF-8 => xx_Comm_US.UTF-8)

A rename is required because some applications check the format of the
locale name, so we need to use a legal one (e.g. xx_Yyyy_ZZ.<encoding>)

8 years agocldr2def: Change locale from common.UTF-8 to xx_Comm_US.UTF-8
John Marino [Thu, 13 Aug 2015 10:55:50 +0000 (12:55 +0200)]
cldr2def: Change locale from common.UTF-8 to xx_Comm_US.UTF-8

Some applications check the format of the locale so we need to stick
to the xx_Yyyy_ZZ format.

8 years agoinet6: Change scope to zone and use in6_clearscope() whenever possible
Sepherosa Ziehau [Thu, 13 Aug 2015 01:37:05 +0000 (09:37 +0800)]
inet6: Change scope to zone and use in6_clearscope() whenever possible

Obtained-from: KAME via FreeBSD

8 years agosocket: Fix soabort() race if crfree() blocks in soinherit().
Sepherosa Ziehau [Thu, 13 Aug 2015 01:30:23 +0000 (09:30 +0800)]
socket: Fix soabort() race if crfree() blocks in soinherit().

In soinherit(), if the accepted socket was on the temp list
and crfree() blocked, the owner netisr's soabort() would cause
use-after-free.

After this commit, we move one accepted socket each time, so
that the potential blocking crfree() will not cause trouble
for us.  And we no longer allow inheritting incomplete queue,
which could be dropped by definition.

Pointed-out-by: dillon@
8 years agolocales: Add "common.UTF-8" locale
John Marino [Thu, 13 Aug 2015 00:02:13 +0000 (02:02 +0200)]
locales: Add "common.UTF-8" locale

See previous commit message.  This locale is en_US.UTF-8 with a new
LC_CTYPE that covers all common charactersets (not the full UTF-8, but
a very good chunk of it).  This LC_CTYPE source file is manually
created, unfortunately, so it can slowly rot if not updated.

Other locales can use the versatile support of UTF-8 by setting
LC_CTYPE to "common.UTF-8" in the environment.

8 years agocldr2def: Modify tool to create a "common" UTF-8 locale
John Marino [Wed, 12 Aug 2015 23:54:31 +0000 (01:54 +0200)]
cldr2def: Modify tool to create a "common" UTF-8 locale

With the switch to CLDR definitions, each locale has specific encoding.
E.g. en_US, fr_FR has latin characters, el_GR has Greek characters,
etc.  Seeing a filename written in Chinese characters while in en_US.UTF-8
will result in a bunch of "???" because the characters are illegal for
the locale's CTYPE definition.

Previously there was one shared CTYPE for all locales.  This was handy
but incorrect.  It was also not updated and became slightly bitrotted.

I am going to create a "fake" locale called "common.UTF-8".  It is the
same as en_US.UTF-8, but with an LC_CTYPE that is practically universal
in that all common character sets (and symbols) are defined.  To use it,
one can do either:
  1) Set LANG env. variable to "common.UTF-8"
  2) Set LC_CTYPE env. variable to "common.UTF-8"

e.g. "env LANG=fr_FR.UTF-8 LC_CTYPE=common.UTF-8 ls"

This commit only updates the tool.  The locale comes later.
In addition to making changes that support the "common" base, the tool
was also tweaked to favor en_US.UTF-8 as the "LOCALES+=" value.  This
should reduce a lot of the renaming churn we've been seeing on new
generations.

8 years agoi386 removal, part 34/x: Remove some i386 traces from the kernel.
Sascha Wildner [Wed, 12 Aug 2015 21:48:11 +0000 (23:48 +0200)]
i386 removal, part 34/x: Remove some i386 traces from the kernel.

8 years agokernel/acpica: Adjust comments in the OS Services Layer.
Sascha Wildner [Wed, 12 Aug 2015 17:20:06 +0000 (19:20 +0200)]
kernel/acpica: Adjust comments in the OS Services Layer.

Remove (outdated) chapter numbers and give precise chapter names, in
order to better find our way around the "ACPICA User Guide and
Programmer Reference".

8 years agokernel/orm: Use bus_alloc_resource_any() and improve description.
Sascha Wildner [Wed, 12 Aug 2015 17:13:05 +0000 (19:13 +0200)]
kernel/orm: Use bus_alloc_resource_any() and improve description.

Taken-from: FreeBSD

8 years agoMove lnc(4) manual page to the right place.
Sascha Wildner [Wed, 12 Aug 2015 14:56:41 +0000 (16:56 +0200)]
Move lnc(4) manual page to the right place.

8 years agomdoc.local: Release engineering. Allow .Dx 4.3.
Sascha Wildner [Wed, 12 Aug 2015 14:56:22 +0000 (16:56 +0200)]
mdoc.local: Release engineering. Allow .Dx 4.3.

8 years agoi386 removal, part 33/x: Remove LongRun and GLXSB support.
Sascha Wildner [Wed, 12 Aug 2015 11:16:51 +0000 (13:16 +0200)]
i386 removal, part 33/x: Remove LongRun and GLXSB support.

LongRun was the Transmeta Crusoe's power saving modes, similar to
Intel SpeedStep.

GLXSB was the AMD Geode LX's crypto accelerator.

8 years agoinet6: Accept non-neighbor NA if nd6_onlink_ns_rfc4861 is off.
Sepherosa Ziehau [Mon, 10 Aug 2015 13:34:20 +0000 (21:34 +0800)]
inet6: Accept non-neighbor NA if nd6_onlink_ns_rfc4861 is off.

Reported-by: Markus Pfeiffer
8 years agolocales: stop creating @euro alias for 8 locales
John Marino [Tue, 11 Aug 2015 20:30:57 +0000 (22:30 +0200)]
locales: stop creating @euro alias for 8 locales

These (dangling symlinks) were left to be created by mistake and then
removed by "make upgrade". Stop creating them.

8 years agoi386 removal, part 32/x: Update getconf(1) manpage for platform removal.
Sascha Wildner [Tue, 11 Aug 2015 17:53:46 +0000 (19:53 +0200)]
i386 removal, part 32/x: Update getconf(1) manpage for platform removal.

8 years agoi386 removal, part 31/x: Remove i386 definitions from getconf(1).
Sascha Wildner [Tue, 11 Aug 2015 17:39:08 +0000 (19:39 +0200)]
i386 removal, part 31/x: Remove i386 definitions from getconf(1).

Remove some other platforms too and error if the platform is not
explicitly handled in progenv.gperf.

8 years agogetconf(1): Sync with FreeBSD and bump WARNS to 6.
Sascha Wildner [Tue, 11 Aug 2015 17:33:29 +0000 (19:33 +0200)]
getconf(1): Sync with FreeBSD and bump WARNS to 6.

8 years agogetconf(1): Remove hand-rolled intmax_t types.
Sascha Wildner [Tue, 11 Aug 2015 17:06:37 +0000 (19:06 +0200)]
getconf(1): Remove hand-rolled intmax_t types.

8 years agokernel/syscons: Set kern.syscons_async default to 0.
Sascha Wildner [Tue, 11 Aug 2015 16:19:08 +0000 (18:19 +0200)]
kernel/syscons: Set kern.syscons_async default to 0.

Also document it.

Approved-by: dillon
8 years agokernel - Reduce slab allocator fragmentation
Matthew Dillon [Tue, 11 Aug 2015 02:08:00 +0000 (19:08 -0700)]
kernel - Reduce slab allocator fragmentation

* Restores the intent of the original z_Next test removed by the last
  commit and adjusts the related code comments.  This allows fully free
  zones at the head to be moved to the free list as long as other slabs
  are present for the chunking.

* Switch the zone management from LIST to TAILQ so we can manipulate the
  tail of the list.

* Define the head of a zone list as being more 'mature' zones, potentially
  freeable by any code which tends to cycle allocations.  The tail of the
  zone list is less mature and subject to reuse more quickly.

  - The allocator allocates from the tail (least mature).

  - Fully free zones are moved to the head (most mature).

  - First free of a fully allocated zone relists the zone at the head
    (the zone is considered mature).

  - Additional frees do not move the zone.

* TODO - We could also possibly shift the zone within the list based on
  NFree vs the NFree of adjacent zones, in order to heuristically allocate
  from the least-free zones and give the most-free zones a better chance
  to become fully free.

Reported-by: Adrian Drzewiecki <z@drze.net>
8 years agokernel/sysctl: Rename SYSCTL_ASSERT_XLOCKED -> SYSCTL_ASSERT_LOCKED.
Sascha Wildner [Mon, 10 Aug 2015 18:46:21 +0000 (20:46 +0200)]
kernel/sysctl: Rename SYSCTL_ASSERT_XLOCKED -> SYSCTL_ASSERT_LOCKED.

6f1a15dc79a822710cc37e99f6a8bd9910e5e3f1 added shared locking and the
macro is intended to cover both cases, so use a better name.

8 years agokdump(1): Adjust comment in mkioctls script.
Sascha Wildner [Mon, 10 Aug 2015 18:42:41 +0000 (20:42 +0200)]
kdump(1): Adjust comment in mkioctls script.

8 years agokernel - Remove unused z_Next field, fix comments & debug helper
Matthew Dillon [Mon, 10 Aug 2015 18:10:45 +0000 (11:10 -0700)]
kernel - Remove unused z_Next field, fix comments & debug helper

* The kernel slab allocator no longer uses the z_Next field, remove it.

* Remove a useless z_Next test in two places and adjust the comments to
  describe the actual operation of the zone free case.  It doesn't hurt for
  us to leave one fully free zone structure on the main per-cpu ZoneAry[]
  for each zone, there might even be a cache-locality-of-reference advantage.

* Fix the 'zoneinfo' code in test/debug so it properly reports the
  kernel slab allocators topology.

Reported-by: Adrian Drzewiecki <z@drze.net>
8 years agokdump(1): Exclude more symlinks in the ioctl search.
Sascha Wildner [Mon, 10 Aug 2015 17:43:04 +0000 (19:43 +0200)]
kdump(1): Exclude more symlinks in the ioctl search.

8 years agoioctl.9: Add procfs subsystem ID.
Sascha Wildner [Mon, 10 Aug 2015 17:42:25 +0000 (19:42 +0200)]
ioctl.9: Add procfs subsystem ID.

8 years agoioctl.9: Expand the list of subsystem IDs a bit.
Sascha Wildner [Mon, 10 Aug 2015 16:42:42 +0000 (18:42 +0200)]
ioctl.9: Expand the list of subsystem IDs a bit.

8 years agokdump(1): Catch mixer ioctls too.
Sascha Wildner [Mon, 10 Aug 2015 16:42:22 +0000 (18:42 +0200)]
kdump(1): Catch mixer ioctls too.

8 years agokdump(1): Add test for duplicated ioctl cmd values to the Makefile.
Sascha Wildner [Mon, 10 Aug 2015 16:15:13 +0000 (18:15 +0200)]
kdump(1): Add test for duplicated ioctl cmd values to the Makefile.

'make test' tries to build kdump but runs the mkioctls script with -s
which generates a switch() that lets the compiler perform this test.

8 years agolocales polish: Remove ISO-8859-1 encoding from 27 locales
John Marino [Mon, 10 Aug 2015 15:48:40 +0000 (17:48 +0200)]
locales polish: Remove ISO-8859-1 encoding from 27 locales

The ISO-8859-1 encoding is considered obsolete compared to ISO-8859-19
(which in itself is obsolete compared to UTF-8).  To help avoid some
potential mismatches, remove the ISO-8859-1 encoding in the following
cases:

1) European localities that already have ISO-8859-15 (25 of 27)
   * ca_(AD|ES|FR|IT)
   * da_dk
   * de_(AT|CH|DE)
   * en_GB
   * (es|eu)_ES
   * fi_FI
   * fr_(BE|CH|FR)
   * is_IS
   * it_(CH|IT)
   * (nb|nn)_NO
   * nl_(BE|NL)
   * pt_PT
   * sv_(FI|SE)

2) Localities where ISO-8859-1 can't represent local currency symbol
   * en_PH (PH Peso)
   * es_CR (Colon)

8 years agolocales polish: Remove ISO8859-15 from 8 non-European places
John Marino [Mon, 10 Aug 2015 14:13:22 +0000 (16:13 +0200)]
locales polish: Remove ISO8859-15 from 8 non-European places

Let's limit usage of the "obsolete" ISO-8859-15 to countries in
Europe.  Users of the eight locales affected should use UTF-8 instead.

8 years agolocale polishing: pl_PL, sk_SK, sl_SI, tr_TR, uk_UA, sv_FI changes
John Marino [Mon, 10 Aug 2015 12:41:57 +0000 (14:41 +0200)]
locale polishing: pl_PL, sk_SK, sl_SI, tr_TR, uk_UA, sv_FI changes

pl_PL: Change shortname alias from ISO8859-2 to UTF-8.  The former can not
       show the Polish currency symbol.
sk_SK: Same as pl_PL, but for the Euro symbol
sl_SI: Same as pl_PL, but for the Euro Symbol
tr_TR: Switch shortname to UTF-8 to handle currency symbol
uk_UA: Same as tr_TR
sv_FI: Switch shortname to ISO-15 for consistency in Europe

8 years agolocale polishing: lt_LT, et_EE, and en_IE changes
John Marino [Mon, 10 Aug 2015 11:55:39 +0000 (13:55 +0200)]
locale polishing: lt_LT, et_EE, and en_IE changes

lt_LT: Remove ISO8859-4.  If an ISO encoding is needed, -13 would be
       used instead.
et_EE: Estonia could use ISO8859-4 (not present), the newer ISO8859-13
       (not present) or ISO8859-15 (present).  To be uniform with other
       European countries that use -15, change the default from UTF-8
       to ISO8859-15.  Do not bring in -4 or -13.
en_IE: Ireland only had UTF-8.  To be uniform with the UK and Western
       Europe, bring in ISO8859-15 and set that as the alias for the
       shortname.  Do not bring in -1.

8 years agokernel/drm: Fix definition of the DRM_IOCTL_I915_GET_SPRITE_COLORKEY ioctl.
Sascha Wildner [Mon, 10 Aug 2015 13:17:51 +0000 (15:17 +0200)]
kernel/drm: Fix definition of the DRM_IOCTL_I915_GET_SPRITE_COLORKEY ioctl.

This is more or less cosmetic, but it helps eliminate duplicates in
kdump(1)'s ioctl list.

Linux did the same in 2c60fae1489c70206e66c28d72b69a3e496c313d.

8 years agovkernel - Fix build
Antonio Huete Jimenez [Mon, 10 Aug 2015 12:12:35 +0000 (05:12 -0700)]
vkernel - Fix build

8 years agolocales: Switch several shortnames away from ISO-8859-1
John Marino [Mon, 10 Aug 2015 10:35:09 +0000 (12:35 +0200)]
locales: Switch several shortnames away from ISO-8859-1

For all western European countries that have their short names aliased
to ISO-8859-1, this is against POLA.  Once the decision to not use UTF-8
is made, the short names should be linked to ISO-8859-15, the one with
the Euro symbol and other common characters that ISO-8859-1 lacks.

While here, change en_PH to UTF-8 since the Peso sign can't be represented
and do the same for Costa Rica and it's Colon currency.

8 years agolocales: Remove new ISO-8859-15@euro symlinks
John Marino [Mon, 10 Aug 2015 09:44:49 +0000 (11:44 +0200)]
locales: Remove new ISO-8859-15@euro symlinks

We're in the process of thinking hard about locale symlinks.  These
new ISO-8859-15@euro symlinks (to their ISO8859-15 counterparts) were
a bad idea that I copied from Linuxland.  Let's reverse this before it
gets released in DragonFly.

It doesn't even make sense. @euro is basically shorthand for ISO8859-15,
so what value does it have to "modify" that encoding? Stop the Linuxanity
now ...