dragonfly.git
8 years agoAlways build world under C/POSIX locale
John Marino [Sun, 15 Nov 2015 17:41:58 +0000 (18:41 +0100)]
Always build world under C/POSIX locale

8 years agogold linker: Fix SYSROOT definition (unbreaks world for some)
John Marino [Sun, 15 Nov 2015 23:11:53 +0000 (00:11 +0100)]
gold linker: Fix SYSROOT definition (unbreaks world for some)

The linkers are supposed to have a different system rool for the
crosstool versions, but this was not working for the gold linker.  As
a result, the host libraries are getting picked up instead of the
world object lib directories.

This commit fixes the build problem.  As a result, a local modification
to a gold source file is been removed (for 2.24 and 2.25)

8 years agoRemove offsetof definitions from binutils* sysdep.h
John Marino [Sun, 15 Nov 2015 16:23:21 +0000 (17:23 +0100)]
Remove offsetof definitions from binutils* sysdep.h

There's a guard to prevent redefinition of offsetof.  The problem is that
the <sys/cdefs.h> definition comes in just after, so it's still redefined.
Just remove the definition from sysdep.h and use the DF version (this
avoids a bunch of redefinition warnings during building)

8 years agoBlock out two more _Noreturn redefinitions
John Marino [Sun, 15 Nov 2015 14:30:40 +0000 (15:30 +0100)]
Block out two more _Noreturn redefinitions

8 years agoinpcb: Unbreak SO_REUSEPORT support.
Sepherosa Ziehau [Sun, 15 Nov 2015 14:58:53 +0000 (22:58 +0800)]
inpcb: Unbreak SO_REUSEPORT support.

inp_lport must not be whacked when inpcb is removed from local
port hash, since the inp_lport will be used to locate local group
Use inp_phd instead to detect whether the inpcb is on local port
hash or not.

This is a bug introduced by part of:
296c350d3c63a181744b80a4b7973dac5fc162a3

8 years agoudp: Fix bind races due to async close and random socket inital msgport
Sepherosa Ziehau [Sun, 15 Nov 2015 14:02:55 +0000 (22:02 +0800)]
udp: Fix bind races due to async close and random socket inital msgport

Bind for UDP sockets is now serialized by local port based netisr.  And
on detach path, the UDP inpcb is removed from local port hash before
other netisrs are synchronized, so that the local port for the detaching
UDP inpcb could be recycled timely.

8 years agotcp: Fix bind races due to async close and random socket inital msgport
Sepherosa Ziehau [Sun, 15 Nov 2015 12:19:11 +0000 (20:19 +0800)]
tcp: Fix bind races due to async close and random socket inital msgport

Bind for TCP sockets is now serialized by netisr0.  Add comment about
this bind race.

Reported-by: Justin Sherrill
8 years agolibstdc++ (5.0): Modify to allow clang 3.6+ to used C99 functions
John Marino [Sun, 15 Nov 2015 12:17:13 +0000 (13:17 +0100)]
libstdc++ (5.0): Modify to allow clang 3.6+ to used C99 functions

The "throw()" attributes in libstdc++ are unique to GCC, so when clang 3.6+
tries to use them, a prototype mismatch error comes up.  This modification
allows clang to use the entire libstdc++.

8 years agolibdiffutils: Don't "predefine" _Noreturn
John Marino [Sun, 15 Nov 2015 12:15:54 +0000 (13:15 +0100)]
libdiffutils: Don't "predefine" _Noreturn

Libdiffutils config.h defines _Noreturn which causes a redefinition warning
when <sys/cdefs> defines it afterward.  Comment it out to prevent the warnings.

8 years agoTweak cdefs.h (no functional change)
John Marino [Sun, 15 Nov 2015 10:49:21 +0000 (11:49 +0100)]
Tweak cdefs.h (no functional change)

This check was bothering me so I tighted it up.

We should think about removing all these GNUC version checks for at
least GCC 4.2.1 and below.  I suspect DF will not build with less
than GCC 4.4 in any case, but certainly GCC 3 and below could never
be used, so these definitions that depend on GCC 2, 3 will never
fail thus they should be set uncondionally to clean this header up.

8 years agoSwitch to using gold linker by default
John Marino [Sat, 14 Nov 2015 14:26:33 +0000 (15:26 +0100)]
Switch to using gold linker by default

DragonFly has always used the "GNU ld" linker to build itself.  Now that
the ELF boot loader has been fixed to handle zero-offset headers (seen
with zero-length ELF notes), the newer gold linker can handle being the
default.  That's what this commit does.

People can continue with the classic linker by putting the following in
/etc/make.conf:  WORLD_LDVER=ld.bfd
... and setting "LDVER=ld.bfd" in their environment.

The gold linker does not use the bfd library and thus is limited to the
ELF format (fine for DF).  It's code is much cleaner (c++), so it's easy
to understand and modify, and it reportedly links complex c++ object
files significantly faster than the BFD-based linker.  Both linkers are
written by the same person, Ian Lance Taylor.

8 years agoRestore buildworld from clang (adjust libm)
John Marino [Sat, 14 Nov 2015 17:12:05 +0000 (18:12 +0100)]
Restore buildworld from clang (adjust libm)

Functions like "isinff" come from GCC only, causes a missed reference when
the world is built with clang.  To solve, bring back FreeBSD versions of
round(|f|l).  An additional benefit is that these functions appear to be
improved over the OpenBSD versions (avoids unnecessary conversions).  The
FreeBSD roundl uses ENTERI/RETURNI macros so I left these off meaning DF
will still not able to raise exceptions on roundl.

Since isinff and friends are no longer used, clang can continue further with
building the world.

8 years agoRestore buildworld using clang (XZ)
John Marino [Sat, 14 Nov 2015 15:03:25 +0000 (16:03 +0100)]
Restore buildworld using clang (XZ)

The new XZ was configured using GCC and thus clang will fail when building
liblzma due to missing a gcc-specific header.  This added check will restore
building DragonFly with clang.

8 years agodrm: Fix previous commit
Imre Vadasz [Sat, 14 Nov 2015 14:06:43 +0000 (15:06 +0100)]
drm: Fix previous commit

8 years agodrm: Handle DRM_CAP IOCTLs for querying cursor width and height.
Imre Vadasz [Sat, 14 Nov 2015 14:06:43 +0000 (15:06 +0100)]
drm: Handle DRM_CAP IOCTLs for querying cursor width and height.

Fixes cursor corruption on my AMD Kaveri APU.

Taken-from: 8716ed4e7bed4e4c7e3f37940e950ddc0362f450 (linux)

8 years agodrm: Import memchr_inv() from NetBSD
François Tigeot [Sat, 14 Nov 2015 14:19:47 +0000 (15:19 +0100)]
drm: Import memchr_inv() from NetBSD

8 years agoboot loader: Improve code of elf header initialization
John Marino [Sat, 14 Nov 2015 13:26:11 +0000 (14:26 +0100)]
boot loader: Improve code of elf header initialization

This has been driving me crazy.  This change has no practical difference,
but I didn't like seeing the code loop through headers twice for no good
reason.  This moves all the initialization to a single loop.

8 years agodrm: Implement a few missing functions from linux/timer.h
François Tigeot [Sat, 14 Nov 2015 11:15:59 +0000 (12:15 +0100)]
drm: Implement a few missing functions from linux/timer.h

8 years agodrm: Add list_replace_init()
François Tigeot [Sat, 14 Nov 2015 11:11:38 +0000 (12:11 +0100)]
drm: Add list_replace_init()

Obtained from: drm/radeon's mkregtable.c

8 years agodrm: Implement signal_pending()
François Tigeot [Sat, 14 Nov 2015 10:44:23 +0000 (11:44 +0100)]
drm: Implement signal_pending()

8 years agotop: Fix system process cpu usage percentage display
Sepherosa Ziehau [Sat, 14 Nov 2015 09:02:46 +0000 (17:02 +0800)]
top: Fix system process cpu usage percentage display

Not accurate, but much better than 0.00%

8 years agotop: Fix 'c' for -S and -I
Sepherosa Ziehau [Sat, 14 Nov 2015 07:15:00 +0000 (15:15 +0800)]
top: Fix 'c' for -S and -I

8 years agostyle: Fix white spaces
Sepherosa Ziehau [Sat, 14 Nov 2015 07:12:02 +0000 (15:12 +0800)]
style: Fix white spaces

8 years agouipc: Port Unix socket domain GC from FreeBSD.
Sepherosa Ziehau [Fri, 6 Nov 2015 07:24:22 +0000 (15:24 +0800)]
uipc: Port Unix socket domain GC from FreeBSD.

The new GC code records struct file in unpcb when the unpcb
is used as one of the rights.  And GC only scans all unpcbs,
instead of all files, and GC only takes unpcbs used as rights
as targets.  Unlike FreeBSD:
- We don't scan sockets on so_comp, since they are on unpcb
  global lists.
- We don't allocate a temporary array for all unreachable
  Unix domain sockets, since it could be pretty large.
  Instead, the unreachable Unix domain sockets are processed
  chunk by chunk (in the same style as our original GC code).

The original GC code is still kept around for reference
(under UNP_GC_ALLFILES).

And optimize unp_discard() a little bit by calling fdrop()
directly, if the right is not a Unix domain socket.  This is
also taken from FreeBSD.

While I'm here, reorder unpcb fields (moving most commonly
used fields to the beginning of unpcb) and add more comment.

8 years agokernel - Fix comment type-o
Matthew Dillon [Sat, 14 Nov 2015 01:44:42 +0000 (17:44 -0800)]
kernel - Fix comment type-o

* Fix comment type-o

8 years agokernel - Fixes for usb modems
Matthew Dillon [Sat, 14 Nov 2015 01:39:46 +0000 (17:39 -0800)]
kernel - Fixes for usb modems

* Separate t_sc into t_sc and t_slsc to allow line disciplines to
  coexsist with USB serial.  This allows SLIP to work.  Please don't
  ask me why I still need to use SLIP.

* Fix several panics in usb_serial.c.  Missing initializations,
  deadlocks due to locks held during blocking operations,
  missing unlocks, etc.

* Fix improper signed-char promotion to int causing high-bits to be
  set in calls to linesw[].l_rint(), which prevented SLIP from recognizing
  packets.

* Allow flags to be adjusted for SLIPs sl%d interfaces, in particular
  allow them to be setup as broadcast interfaces instead of point-to-point
  interfaces if desired.  Settable via /boot/loader.conf.

* Still TODO: Bugs present related to detection of modem control bits.

8 years agoSome adjustments to the recent dsched removal.
Sascha Wildner [Fri, 13 Nov 2015 21:10:50 +0000 (22:10 +0100)]
Some adjustments to the recent dsched removal.

* Make 'options DSCHED_FQ' a no-op for now. It used to be in our
  default config, so give people some time to edit their custom
  configs derived from X86_64_GENERIC, like we did for other such
  options. It will be completely removed at a later point in time
  after the release.

* Add a quick note to UPGRADING about this.

* While here, remove associated manual pages and MLINKS too.

8 years agokernel/drm: Fix an unitialized variable warning when building with -O0.
François Tigeot [Mon, 9 Nov 2015 20:04:10 +0000 (21:04 +0100)]
kernel/drm: Fix an unitialized variable warning when building with -O0.

Reported-by: tuxillo
8 years agoRemove <malloc.h> from the system.
Sascha Wildner [Fri, 13 Nov 2015 17:24:00 +0000 (18:24 +0100)]
Remove <malloc.h> from the system.

Originally, I wanted to follow FreeBSD which errors if __STDC__ is
defined and silently includes <stdlib.h>, which has the malloc()
and friends prototypes, if it is not defined. The only case where
__STDC__ isn't defined used to be when -traditional was passed to
GCC, which used to attempt an emulation of a pre-standard compiler.
But -traditional has since been made a cpp(1) specific option in
newer releases of GCC, so it becomes more and more pointless to
support <malloc.h>, even if we went with FreeBSD's version.

Therefore, remove it completely.

Also disable its usage in a number of contrib/ software which
expected it due to its presence at the time when the software was
configured.

Suggested-by: marino, who also fixed the resultant dports breakage
8 years agosys/dev/disk/dm: Don't expect destroy() to set config to NULL
Tomohiro Kusumi [Thu, 12 Nov 2015 11:04:43 +0000 (20:04 +0900)]
sys/dev/disk/dm: Don't expect destroy() to set config to NULL

Having a comment like below in dm core that expects programmers
to code their dm targets in a certain way is not efficient.
They may not read such a rule written in the source.

  /*
   * Remove target specific config data. After successfull
   * call table_en->target_config must be set to NULL.
   */

Just check a return value of destroy() and set config to NULL
on dm core side since it's also visible to dm core. There is
nothing targets can/would do with the config pointer other than
setting it to NULL considering targets have just freed it.

8 years agosys/dev/disk/dm: Add a comment on race on unload
Tomohiro Kusumi [Wed, 11 Nov 2015 11:46:25 +0000 (20:46 +0900)]
sys/dev/disk/dm: Add a comment on race on unload

There is a minor race window in dm_modcmd() after the below
conditional on unloading dm.ko. It's possible to create a new
device after it gets beyond the conditional with 0.

    if (dm_dev_counter > 0)
        return EBUSY;

Running the below a.sh and then b.sh concurrently causes
kernel panic. Avoiding this race seems to be difficult using
the existing locks that are all file local ones. The panic
can be reproduced with or without the previous commit.

===== a.sh
  #!/usr/local/bin/bash
  while [ 1 ]; do
      kldload dm
      kldunload dm
  done

===== b.sh
  #!/usr/local/bin/bash
  kldload dm
  while [ 1 ]; do
      dmsetup create zero1 --table '0 100 zero'
      dmsetup remove /dev/mapper/zero1
  done

8 years agosys/dev/disk/dm: Fix device counter handling
Tomohiro Kusumi [Tue, 10 Nov 2015 12:57:14 +0000 (21:57 +0900)]
sys/dev/disk/dm: Fix device counter handling

dm_dev_list and its element counter dm_dev_counter should be
protected by the same lock dm_dev_mutex. Having these updated
separately makes code logic more complex than it should.

If dm_dev_counter is protected by dm_dev_mutex, then no need
to care if dm_dev_counter++/-- are atomic or not.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [6/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 11:37:36 +0000 (20:37 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [6/6]

Rename dm_target_rem() to dm_target_remove() for consistency.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [5/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 11:25:52 +0000 (20:25 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [5/6]

Add dm_target_free().

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [4/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 10:51:21 +0000 (19:51 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [4/6]

dm_target_alloc() takes char *name, but does nothing with it.
Add strlcpy and remove strlcpy from each target's init().

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [3/6]
Tomohiro Kusumi [Wed, 11 Nov 2015 10:02:10 +0000 (19:02 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [3/6]

dm_dev_alloc()/free()
* Make them static.
* Make alloc() take name and uuid just like dm_pdev_alloc().
* Refactoring.

dm_pdev_alloc()/free()
* Fix memory leak.
* Rename dm_pdev_rem() to dm_pdev_free().
  A simple kfree function should be xxx_free() but not xxx_rem().
  xxx_rem() isn't necessarily a name used for just kfree() in
  other files, which makes naming very confusing.
* Refactoring.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [2/6]
Tomohiro Kusumi [Tue, 10 Nov 2015 11:50:13 +0000 (20:50 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [2/6]

Rename dm_dev_rem() to dm_dev_lookup_evict(). There is
dm_dev_remove(), and having remove()/rem() is confusing.

Refactor dm_dev_lookup()/dm_dev_lookup_evict() using a common
lookup function.

Disable dm_dev_lookup_evict() by #if0. This function is only
used for renaming, but renaming is not implemented.

8 years agosys/dev/disk/dm: Fix/refactor alloc/free functions [1/6]
Tomohiro Kusumi [Tue, 10 Nov 2015 11:02:49 +0000 (20:02 +0900)]
sys/dev/disk/dm: Fix/refactor alloc/free functions [1/6]

There are way too many functions with similar names that do
something related to removing and/or freeing dm device.

dm_dev_rem_dev() doesn't need to be a function so get rid of it.
dm_dev_destroy() can be a static function.

8 years agoRemove dsched_bfq.4 manual page from the Makefile too.
Sascha Wildner [Thu, 12 Nov 2015 12:44:26 +0000 (13:44 +0100)]
Remove dsched_bfq.4 manual page from the Makefile too.

8 years agoFix module name in the drm.4 manual page.
Sascha Wildner [Thu, 12 Nov 2015 12:36:57 +0000 (13:36 +0100)]
Fix module name in the drm.4 manual page.

8 years agoRemove no longer used dsched modules & manpage via 'make upgrade'.
Sascha Wildner [Thu, 12 Nov 2015 12:36:03 +0000 (13:36 +0100)]
Remove no longer used dsched modules & manpage via 'make upgrade'.

8 years agouipc: Release token in the proper order on unconnected DGRAM send path
Sepherosa Ziehau [Thu, 12 Nov 2015 10:39:38 +0000 (18:39 +0800)]
uipc: Release token in the proper order on unconnected DGRAM send path

Reported-by: zrj
8 years agoUpdate some generated collate definitions
John Marino [Thu, 12 Nov 2015 08:22:48 +0000 (09:22 +0100)]
Update some generated collate definitions

Likely due to recently fixed bugs, four colldef files generated slightly
differently than before.  The changes look correct so let's just take the
latest version.

8 years agocldr2def: Use explicit target files when generating symlinks
John Marino [Thu, 12 Nov 2015 08:19:31 +0000 (09:19 +0100)]
cldr2def: Use explicit target files when generating symlinks

Update the generated makefiles to use a target filename on symlinks.
This avoids creating a directory symlink with the target directory
does not exist.

Taken from: FreeBSD

8 years agoRemove obsolete references to libedit from gdb
John Marino [Wed, 11 Nov 2015 21:50:19 +0000 (22:50 +0100)]
Remove obsolete references to libedit from gdb

We removed libedit from gdb a long time ago (readline is mandatory
so we used bundled version) but apparently these references were
missed.

8 years agokernel - Remove dsched
Matthew Dillon [Wed, 11 Nov 2015 18:52:23 +0000 (10:52 -0800)]
kernel - Remove dsched

* After consultation, remove dsched from the kernel.  The original idea
  is still valid but the current implementation has had lingering bugs for
  several years now and we've determined that it's just got its fingers into
  too many structures.

  Also, the implementation was designed before SSDs, and doesn't play well
  with SSDs.

* Leave various empty entry points in so we can revisit at some
  future date.

8 years agodrm - Fix kldload issue
Matthew Dillon [Wed, 11 Nov 2015 18:06:05 +0000 (10:06 -0800)]
drm - Fix kldload issue

drm_setsarea() -> drm_legacy_getsarea() in one place, fixed kldload issue
w/haswell graphics.

8 years agodrm/i915: Remove old i915kms.ko modules
François Tigeot [Wed, 11 Nov 2015 08:06:27 +0000 (09:06 +0100)]
drm/i915: Remove old i915kms.ko modules

8 years agodrm: Add nsecs_to_jiffies()
François Tigeot [Wed, 11 Nov 2015 07:49:16 +0000 (08:49 +0100)]
drm: Add nsecs_to_jiffies()

8 years agosystat/pv: Avoid systat pvmmeter crashing for refresh rates <1s.
Imre Vadász [Tue, 10 Nov 2015 20:09:00 +0000 (21:09 +0100)]
systat/pv: Avoid systat pvmmeter crashing for refresh rates <1s.

Also fixes values displayed for non-integral refresh-rate values.

8 years agotop: Actually implement DragonFly code for the interactive 'c' command.
Imre Vadász [Tue, 10 Nov 2015 21:18:28 +0000 (22:18 +0100)]
top: Actually implement DragonFly code for the interactive 'c' command.

Using the 'c' command now allows filtering displayed processes by
command name, as documented in top(1). Filtering by command name displays
only processes whose command contains the given substring.
This matches thte behaviour of the 'g' option in OpenBSD's top.

Using 'c' again and just pressing enter without entering a command name,
disables filtering and displays all processes again.

8 years agoSync col(1) with FreeBSD.
Sascha Wildner [Tue, 10 Nov 2015 18:32:03 +0000 (19:32 +0100)]
Sync col(1) with FreeBSD.

* Multibyte character support.

* Misc bug fixes and code cleanup.

8 years agoRemove unnecessary whitespace in macro arguments in some manual pages.
Sascha Wildner [Tue, 10 Nov 2015 18:01:05 +0000 (19:01 +0100)]
Remove unnecessary whitespace in macro arguments in some manual pages.

8 years agoAdd README for basic locale source file generation
John Marino [Tue, 10 Nov 2015 08:40:17 +0000 (09:40 +0100)]
Add README for basic locale source file generation

Bapt wrote this README for FreeBSD, let's bring it in as a starting point.

8 years agonl_langinfo(CODESET): Again return "US-ASCII" for C/POSIX
John Marino [Tue, 10 Nov 2015 08:09:15 +0000 (09:09 +0100)]
nl_langinfo(CODESET): Again return "US-ASCII" for C/POSIX

Reflecting that the "C"/"POSIX" locale has a different encoding (8-bit)
than "US-ASCII" (7-bit) resulted in immediate fallout on ports,
particularly on python.

Looking at glibc, nl_langinfo returns "ANSI_X3.4-1968" for both "C" and
"POSIX" locales, which is the Linux equivalent of US-ASCII.

Despite it being impossible to distinguish between C/POSIX and US-ASCII
with this change, it needs to be reverted for the sake of third-party
software compatibility.  (Remember nl_langinfo has no standard)

8 years agokernel - Improve tcp starting window
Matthew Dillon [Tue, 10 Nov 2015 00:21:14 +0000 (16:21 -0800)]
kernel - Improve tcp starting window

* The tcp sender inflight management was forcing a starting window that
  was way too small for international connections, causing a bulk fetch
  to take several seconds to ramp up.  This management is enabled by default.

* Add net.inet.tcp.inflight_start to set the starting window and set the
  default to something more reasonable, 33792.  Inflight management previously
  used net.inet.tcp.inflight_min as the starting value, which was 6144 and
  way too small.

* This will significantly improve the performance of small fetches, e.g.
  pkg install's, update's, and upgrades, and the performance of small web
  server fetches occuring over high latency connections.

Reported-by: tuxillo
8 years agonl_langinfo: Simplify case ladder
John Marino [Mon, 9 Nov 2015 22:22:11 +0000 (23:22 +0100)]
nl_langinfo: Simplify case ladder

The NONE:US-ASCII case isn't necessary.  The "NONE:" case will handle
US-ASCII, so let's remove the redundant handling.

8 years agolocales: Enforce US-ASCII encoding (limited to 7-bit)
John Marino [Mon, 9 Nov 2015 21:50:27 +0000 (22:50 +0100)]
locales: Enforce US-ASCII encoding (limited to 7-bit)

The US-ASCII format was getting treated identically to POSIX.  It is
supposed to throw an ILSEQ errno if a value of 0x80 or greater is
encountered, so let's bring back the "ASCII" handling.

While here, change nl_codeset to return US-ASCII only when the encoding
really is "US-ASCII".  Before "C" and "POSIX" encoding returned this
string, so now they return "POSIX".

8 years agolocaledef(1): Remove GCC pragmas on two source files
John Marino [Mon, 9 Nov 2015 16:39:06 +0000 (17:39 +0100)]
localedef(1): Remove GCC pragmas on two source files

Taken-from: FreeBSD

8 years agouipc: Use taskqueue to run GC.
Sepherosa Ziehau [Mon, 9 Nov 2015 14:01:41 +0000 (22:01 +0800)]
uipc: Use taskqueue to run GC.

And revoke no longer used unp_gcing.

8 years agouipc: No need to call sorflush() before unp_gc()
Sepherosa Ziehau [Mon, 9 Nov 2015 13:07:45 +0000 (21:07 +0800)]
uipc: No need to call sorflush() before unp_gc()

And move unp_gc() to the end of unp_detach().

8 years agotest: Add test for unix socket cross/self reference
Sepherosa Ziehau [Fri, 6 Nov 2015 15:58:28 +0000 (23:58 +0800)]
test: Add test for unix socket cross/self reference

cross ref: s1 on s2 rcvbuf, while s2 on s1 rcvbuf.
self ref: s1 on s1 rcvbuf, while s2 on s2 rcvbuf.

8 years agosys/dev/disk/dm: Check if target has registered handlers
Tomohiro Kusumi [Mon, 9 Nov 2015 10:54:55 +0000 (19:54 +0900)]
sys/dev/disk/dm: Check if target has registered handlers

Define which handlers are mandatory or optional.
init(), destroy(), strategy() are (or should be) mandatory.
Others aren't needed by all targets hence should be optional.

Add sanity checks in dm_target_insert() to make sure targets
have implemented and registered mandatory handlers.

Cleanup struct dm_target by removing obvious comments and
adding comments on mandatory/optional handlers.

8 years agosys/dev/disk/dm: Rename aprint_debug() to dmdebug()
Tomohiro Kusumi [Mon, 9 Nov 2015 10:21:17 +0000 (19:21 +0900)]
sys/dev/disk/dm: Rename aprint_debug() to dmdebug()

Not sure what aprint is, but dmdebug() is better considering
this macro does
    if (dm_debug_level) kprintf(...);

8 years agosys/dev/disk/dm: Add dm_alloc_string()
Tomohiro Kusumi [Mon, 9 Nov 2015 09:56:38 +0000 (18:56 +0900)]
sys/dev/disk/dm: Add dm_alloc_string()

Add dm_alloc_string() which kmallocs char* from M_DM.

It was confusing that targets had to use M_DM for status
purpose while targets had their own M_DMXXX. Using this
wrapper function makes target code less error prone when
allocating a string without an extra comment on usage.

8 years agosys/dev/disk/dm: Remove misleading code/comment on linear target arg
Tomohiro Kusumi [Mon, 9 Nov 2015 09:50:48 +0000 (18:50 +0900)]
sys/dev/disk/dm: Remove misleading code/comment on linear target arg

The offset arg is mandatory.
Remove code and comment that makes it sounds like it's optional.

8 years agodrm: Don't leak memory from linux_workqueue.c
Imre Vadász [Sun, 8 Nov 2015 16:06:53 +0000 (17:06 +0100)]
drm: Don't leak memory from linux_workqueue.c

8 years agocldr2def: Pad CJK short months
John Marino [Sun, 8 Nov 2015 16:47:44 +0000 (17:47 +0100)]
cldr2def: Pad CJK short months

Since 2001, FreeBSD has padded the first 9 abbreviated month names
with a space for the CJK locales.  This allows them to line up.
This alternation will return the padding to avoid a regression
for users (and avoid having to hand-edit the source files)

8 years agosys/dev/disk/dm: Fix/refactor TAILQ_HEAD structure
Tomohiro Kusumi [Sun, 8 Nov 2015 07:41:12 +0000 (16:41 +0900)]
sys/dev/disk/dm: Fix/refactor TAILQ_HEAD structure

Some minor fixes.

Initialize TAILQs in init() since they are removed and freed
in uninit(). Not doing it in init() works only when init() is
guaranteed to be called once.

8 years agosys/dev/disk/dm: Fix table/info priority
Tomohiro Kusumi [Sat, 7 Nov 2015 22:46:43 +0000 (07:46 +0900)]
sys/dev/disk/dm: Fix table/info priority

Fix conditional in dm_table_status() added in e243a4fb to
avoid a potential bug, where DM_STATUS_TABLE_FLAG is set,
but table() handler is NULL, and results calling info().

Currently there are no target that implements info() but
does not implement table() (see f134a703 and 54b60c60).
Therefore this isn't likely to happen, but should be fixed
to avoid a potential bug.

8 years agosys/dev/disk/dm: Use uint32_t for flags
Tomohiro Kusumi [Sat, 7 Nov 2015 22:17:01 +0000 (07:17 +0900)]
sys/dev/disk/dm: Use uint32_t for flags

since libprop uses uint32 APIs for this.

8 years agosys/dev/disk/dm: Change DM_XXX_FLAG() to inline functions
Tomohiro Kusumi [Sat, 7 Nov 2015 21:49:04 +0000 (06:49 +0900)]
sys/dev/disk/dm: Change DM_XXX_FLAG() to inline functions

These shouldn't be macros IMO.

8 years agosys/dev/disk/dm: Cleanup dm_dbg_print_flags()
Tomohiro Kusumi [Sat, 7 Nov 2015 21:25:40 +0000 (06:25 +0900)]
sys/dev/disk/dm: Cleanup dm_dbg_print_flags()

Some minor fixes.

8 years agosys/dev/disk/dm: Whitespace cleanups
Tomohiro Kusumi [Sat, 7 Nov 2015 21:16:31 +0000 (06:16 +0900)]
sys/dev/disk/dm: Whitespace cleanups

8 years agosys/dev/disk/dm: Fix typo
Tomohiro Kusumi [Sat, 7 Nov 2015 22:09:01 +0000 (07:09 +0900)]
sys/dev/disk/dm: Fix typo

"striped" is the name of this target.

8 years agolocaledef: Replace avl tree (cddl) with RB tree, plus ...
John Marino [Sat, 7 Nov 2015 19:45:40 +0000 (20:45 +0100)]
localedef: Replace avl tree (cddl) with RB tree, plus ...

When FreeBSD adopted DragonFly's locales, the AVL tree code was replaced
with an RB tree equivalent. While cddl wasn't an issue here, let's bring
in FreeBSD's changes since they did the work.

Some other changes:
 * replace (safe) strcpy+strncat with snprintf
 * rework charmap types/prototypes to remove GCC pragmas
 * Support case where wchar_t is an unsigned int (ARM)
 * Change -D "DragonFly-style" option description to -D "BSD-style"

8 years agotree.h: Restore ability to generate static functions
John Marino [Sat, 7 Nov 2015 23:42:43 +0000 (00:42 +0100)]
tree.h: Restore ability to generate static functions

These two functions were hardcodes as "static" before the previous
commit which removed the qualifier.  Instead, "static" should have
been changed to the the STORQUAL macro argument.

Doing so now fixes static RB function generation.

8 years agosys/dev/disk/dm: Refactor dm_table_status_ioctl()
Tomohiro Kusumi [Sat, 7 Nov 2015 17:55:24 +0000 (02:55 +0900)]
sys/dev/disk/dm: Refactor dm_table_status_ioctl()

dm_table_status_ioctl() is getting messy, so separate
table/info handler related part into a different function.

prop_dictionary_set_cstring(target_dict, DM_TABLE_PARAMS, "");
is necessary when table/info handlers aren't supported or
handlers return NULL. See a6cf5418.

8 years agosys/dev/disk/dm: Don't force targets to implement table handler
Tomohiro Kusumi [Sat, 7 Nov 2015 17:37:59 +0000 (02:37 +0900)]
sys/dev/disk/dm: Don't force targets to implement table handler

All targets implementing table handler is redundant as some
of them don't need to do anything. Avoid it by a simple NULL
check, just like what's been done to other handlers.

8 years agodrm: Add ktime_get_raw_ns()
François Tigeot [Sat, 7 Nov 2015 16:11:27 +0000 (17:11 +0100)]
drm: Add ktime_get_raw_ns()

8 years agosys/dev/disk/dm: Remove unnecessary dump=NULL;
Tomohiro Kusumi [Sat, 7 Nov 2015 14:55:00 +0000 (23:55 +0900)]
sys/dev/disk/dm: Remove unnecessary dump=NULL;

8 years agosys/dev/disk/dm: Remove upcall handler
Tomohiro Kusumi [Sat, 7 Nov 2015 14:05:09 +0000 (23:05 +0900)]
sys/dev/disk/dm: Remove upcall handler

dm target's upcall() handler
  int (*upcall)(dm_table_entry_t *, struct buf *);
implemented by dm targets acutally do nothing other than
returning 0. Also note that upcall() is not used by dm core.

The targets that are supposed to be relying on this api are
obviously not working at the moment, however things aren't
as simple as just implementing missing upcall() handler.

upcall() is supposed to be something to do with targets like
snapshot, but it lacks documentation and purpose of this api
is not clear at all. Whoever tries to implement snapshot/etc
will have to re-design dm core and appropriate handlers from
scratch anyway without using the existing one.

8 years agodrm/i915: Rename the kernel module to i915.ko
François Tigeot [Sat, 7 Nov 2015 12:49:36 +0000 (13:49 +0100)]
drm/i915: Rename the kernel module to i915.ko

* Giving it the same name than on Linux

* Bump __DragonFly_version

8 years agodrm: Make dev.dri.X node creation work properly with multiple drm devices.
Imre Vadász [Fri, 6 Nov 2015 21:14:18 +0000 (22:14 +0100)]
drm: Make dev.dri.X node creation work properly with multiple drm devices.

Just use the device unit number for the sysctl node name.

8 years agocorepower: Use rdmsr_safe to check availibility of the MSRs first.
Imre Vadász [Thu, 5 Nov 2015 21:16:06 +0000 (22:16 +0100)]
corepower: Use rdmsr_safe to check availibility of the MSRs first.

This should avoid panic-ing in virtual machines where the RAPL MSRs are
not available.

8 years agoReplace our soelim(1) with FreeBSD's.
Sascha Wildner [Sat, 7 Nov 2015 08:32:05 +0000 (09:32 +0100)]
Replace our soelim(1) with FreeBSD's.

Before, DragonFly used Bill Joy's original UCB version, which we inherited
from FreeBSD 4. We never switched to groff's version like they did later.
A year ago they replaced groff's version with one written by bapt.

dports needs features from it which our version doesn't provide.

Pointed-out-by: marino
8 years agokernel/if_re: Add support for the Realtek 8168H.
Sascha Wildner [Fri, 6 Nov 2015 23:20:28 +0000 (00:20 +0100)]
kernel/if_re: Add support for the Realtek 8168H.

It is found in the Intel NUC5CPYH, for example.

Adapted from FreeBSD.

Reported-and-tested-by: Michael Iline <michael.iline@yahoo.com>
8 years ago<sys/cdefs.h>: Align some indent (no functional change).
Sascha Wildner [Thu, 5 Nov 2015 19:41:51 +0000 (20:41 +0100)]
<sys/cdefs.h>: Align some indent (no functional change).

8 years agosys/dev/disk/dm: Disable 2nd level bio_done handler for striped target
Tomohiro Kusumi [Thu, 5 Nov 2015 14:59:53 +0000 (23:59 +0900)]
sys/dev/disk/dm: Disable 2nd level bio_done handler for striped target

Disable 2nd level bio added by the previous commit for now.

All it does is count # of i/o error if any, and it probably
doesn't worth imposing 2 levels of callback for each stripe
device just to do this. Changing netiobuf makes it possible
to do this without using stacked bios, but that requires
(not large but) modification to netiobuf in vfs.

8 years agosys/dev/disk/dm: Add 2nd level bio_done handler for striped target
Tomohiro Kusumi [Wed, 4 Nov 2015 13:03:05 +0000 (22:03 +0900)]
sys/dev/disk/dm: Add 2nd level bio_done handler for striped target

As mentioned in b48c316c, dm-striped target needs to have its
own callback in order to make use of error counter. It could
be done by either modifying netiobuf code or using stacked bio,
but using stacked bio seems to be the right approach here as
it doesn't modify the existing netiobuf bio code.

This commit adds bio_done handler for nbio (the 2nd level bio
after pushing the original bio), and make the handler increment
num_error field of a stripe device if i/o error is detected.

8 years agosys/kern/vfs: Add comment on buf(9) manpage
Tomohiro Kusumi [Thu, 5 Nov 2015 16:02:31 +0000 (01:02 +0900)]
sys/kern/vfs: Add comment on buf(9) manpage

man buf(9) is obsolete and doesn't reflect implementation
although the manpage doesn't say so.

8 years agosys/kern/vfs: Fix wrong function name in panic()
Tomohiro Kusumi [Thu, 5 Nov 2015 16:24:27 +0000 (01:24 +0900)]
sys/kern/vfs: Fix wrong function name in panic()

8 years agosys/kern/vfs: Fix wrong function name in kprintf/panic
Tomohiro Kusumi [Thu, 5 Nov 2015 13:35:03 +0000 (22:35 +0900)]
sys/kern/vfs: Fix wrong function name in kprintf/panic

ae8e83e6e in 2009 renamed biodone() to bpdone(), and made
bpdone() to be called by the new biodone() implementation
as well as other callers, but the function names used in
kprintf() and panic() were not updated to "bpdone:".

bpdone() isn't exclusively used by biodone(), so it should
use a proper function name.

8 years agosys/dev/disk/dm: Cleanups
Tomohiro Kusumi [Wed, 4 Nov 2015 14:10:48 +0000 (23:10 +0900)]
sys/dev/disk/dm: Cleanups

minor fix and typos.

8 years agosys/dev/disk/dm: Remove redundant kprintf in dm strategy
Tomohiro Kusumi [Wed, 4 Nov 2015 13:41:09 +0000 (22:41 +0900)]
sys/dev/disk/dm: Remove redundant kprintf in dm strategy

Having two kprintf("------...\n"); before and after debug
messages is redundant since they mostly end up printing
two consecutive lines. One of them could be removed.

8 years agosys/vfs/hammer: Add HAMMER_ITOB() macro
Tomohiro Kusumi [Tue, 3 Nov 2015 14:25:40 +0000 (23:25 +0900)]
sys/vfs/hammer: Add HAMMER_ITOB() macro

to hide explicit cast from C code so the impact will be small
on possible data structure change. No change in binary.

8 years agouipc: Use token for rights counting
Sepherosa Ziehau [Fri, 6 Nov 2015 08:04:16 +0000 (16:04 +0800)]
uipc: Use token for rights counting

This is mainly used to avoid races stemming from f_msgcount accessing
w/o unp_spin.

8 years agouipc: Factor out unp_{add,del}_right()
Sepherosa Ziehau [Fri, 6 Nov 2015 01:56:26 +0000 (09:56 +0800)]
uipc: Factor out unp_{add,del}_right()

8 years agocompilers.conf: nextclang => clangnext
John Marino [Thu, 5 Nov 2015 11:22:17 +0000 (12:22 +0100)]
compilers.conf: nextclang => clangnext

After thinking about it, we want to keep the clang compilers starting
with "clang" so that make can filter for it, e.g. ".if ${CC:Mclang*}".

8 years agocompilers.conf: Add the two latest clangs to options
John Marino [Thu, 5 Nov 2015 10:59:19 +0000 (11:59 +0100)]
compilers.conf: Add the two latest clangs to options

This adds "clang37" and "nextclang" defaults to compilers.conf.
Note that nextclang has a new port: devel/llvm-devel.  In fact
lang/clang37 is just a metaport that builds devel/llvm37.

"nextclang" will change over time.  Currently it's the precursor to
clang38, but once llvm3.8 is released, it will become the precursor
to clang 3.9 (or whatever comes after 3.8)