dragonfly.git
9 years ago<sys/signal.h>: Use __POSIX_VISIBLE, __XSI_VISIBLE and __BSD_VISIBLE.
Sascha Wildner [Wed, 7 Jan 2015 02:34:37 +0000 (03:34 +0100)]
<sys/signal.h>: Use __POSIX_VISIBLE, __XSI_VISIBLE and __BSD_VISIBLE.

Similar to what I did in <signal.h> and <machine/signal.h> in
d3240feb7df007 (replacing _POSIX_SOURCE and _ANSI_SOURCE checks).

It also should fix build breakage in a few ports which was seen after
d3240feb7df007.

Most of this is based on FreeBSD's checks.

Reported-by: marino
9 years agoif: Dispatch if_slowtimo() to netisr0 to run
Sepherosa Ziehau [Tue, 6 Jan 2015 15:06:53 +0000 (23:06 +0800)]
if: Dispatch if_slowtimo() to netisr0 to run

- Mark if_slowtimo callout MPSAFE.
- Rearrange the critical section in if_slowtimo().
- Accessing to ifnet global variable is now in netisr0.

9 years agoinet6: Dispatch in6_if_up() to netisr0 to run
Sepherosa Ziehau [Tue, 6 Jan 2015 13:44:02 +0000 (21:44 +0800)]
inet6: Dispatch in6_if_up() to netisr0 to run

- Processing of DAD, nd6 prefix and inet6 address on in6_if_up() code
  path are now in netisr0.
- Accessing of ifnet global variable on in6_if_up() code path is now
  in netisr0.

9 years agousb4bsd: Fixup some ucom issues.
Markus Pfeiffer [Tue, 6 Jan 2015 19:37:22 +0000 (19:37 +0000)]
usb4bsd: Fixup some ucom issues.

Implement some of the functionality in ucom. The tty code certainly
needs more work, testing, and bugfixing.

9 years agolibthread_xu: replace mktemp(3) with mkstemp(3) call
Johannes Hofmann [Tue, 6 Jan 2015 20:44:09 +0000 (21:44 +0100)]
libthread_xu: replace mktemp(3) with mkstemp(3) call

This avoids a warning about a possible unsafe use of mktemp(3)
when linking with libthread_xu.

9 years agoarcmsr: Make callout locking more robust
François Tigeot [Mon, 5 Jan 2015 22:29:35 +0000 (23:29 +0100)]
arcmsr: Make callout locking more robust

* The callout subsystem can deadlock if a callout function is holding
  a lock at the same time callout_stop() is called

* Use the new callout_init_lk() function from DragonFly 4.1
  to prevent this situation from occuring

Reviewed-by: swildner
9 years agosys/conf/files: Remove obsolete file (was part of ATM).
Sascha Wildner [Tue, 6 Jan 2015 05:28:26 +0000 (06:28 +0100)]
sys/conf/files: Remove obsolete file (was part of ATM).

9 years agokernel/pc64: Change all the remaining #if JG's to #if 0 (fixing -Wundef).
Sascha Wildner [Tue, 6 Jan 2015 03:28:51 +0000 (04:28 +0100)]
kernel/pc64: Change all the remaining #if JG's to #if 0 (fixing -Wundef).

9 years agokernel/if_ethersubr.c: Fix -Wundef.
Sascha Wildner [Tue, 6 Jan 2015 03:27:58 +0000 (04:27 +0100)]
kernel/if_ethersubr.c: Fix -Wundef.

9 years agokernel/mrsas: Fix -Wundef.
Sascha Wildner [Tue, 6 Jan 2015 03:27:15 +0000 (04:27 +0100)]
kernel/mrsas: Fix -Wundef.

9 years agokernel/syscons: Fix -Wundef.
Sascha Wildner [Tue, 6 Jan 2015 03:26:49 +0000 (04:26 +0100)]
kernel/syscons: Fix -Wundef.

9 years agokernel/ipmi: Fix -Wundef.
Sascha Wildner [Tue, 6 Jan 2015 03:26:16 +0000 (04:26 +0100)]
kernel/ipmi: Fix -Wundef.

9 years agokernel/adv: Fix -Wundef.
Sascha Wildner [Tue, 6 Jan 2015 03:25:39 +0000 (04:25 +0100)]
kernel/adv: Fix -Wundef.

9 years agotgmath.3: Fix a typo in a function name.
Sascha Wildner [Tue, 6 Jan 2015 01:55:30 +0000 (02:55 +0100)]
tgmath.3: Fix a typo in a function name.

9 years agosys/vfs/hammer: fix comments
Tomohiro Kusumi [Mon, 5 Jan 2015 10:03:25 +0000 (19:03 +0900)]
sys/vfs/hammer: fix comments

This patch fixes typo in comments. On-memory record structure hammer_record
is being removed from on-memory RB-Tree, not on-disk B-Tree.

9 years agohammer: Hide a warning message behind a debug flag
François Tigeot [Mon, 5 Jan 2015 21:07:48 +0000 (22:07 +0100)]
hammer: Hide a warning message behind a debug flag

Printing warning messages during regular operation frighten users.

9 years agodrm/i915: Fix a porting bug
François Tigeot [Mon, 5 Jan 2015 13:52:34 +0000 (14:52 +0100)]
drm/i915: Fix a porting bug

A kmalloc() was changed to a kzalloc() equivalent.

9 years agonewsyslog(8): Rename a variable (dirfd() is a macro too).
Sascha Wildner [Mon, 5 Jan 2015 09:40:49 +0000 (10:40 +0100)]
newsyslog(8): Rename a variable (dirfd() is a macro too).

9 years agoUse the dirfd() macro instead of accessing struct _dirdesc directly.
Sascha Wildner [Mon, 5 Jan 2015 09:38:31 +0000 (10:38 +0100)]
Use the dirfd() macro instead of accessing struct _dirdesc directly.

This is in preparation for making dirfd() a function (for POSIX
conformance) and struct _dirdesc private.

9 years agodevfs - Allow clone code to reuse an existing device (2)
Matthew Dillon [Mon, 5 Jan 2015 08:59:34 +0000 (00:59 -0800)]
devfs - Allow clone code to reuse an existing device (2)

* Included missing devfs.h changes.

9 years agodevfs - Allow clone code to reuse an existing device
Matthew Dillon [Mon, 5 Jan 2015 04:54:56 +0000 (20:54 -0800)]
devfs - Allow clone code to reuse an existing device

* Allow the clone code to set a replacement device which already exists
  in devfs.

* This will allow the sound code to cache virtual channel devices after
  use.

9 years agoinet/inet6: Merge SIOC[ADG]LIFADDR into {in,in6}_control_internal
Sepherosa Ziehau [Sun, 4 Jan 2015 12:30:20 +0000 (20:30 +0800)]
inet/inet6: Merge SIOC[ADG]LIFADDR into {in,in6}_control_internal

And remove the socket parameter from {in,in6}_control APIs.

This prepares to make ifnet glbal variable MPSAFE.

9 years agodrm/i915: Update to Linux 3.9.11
François Tigeot [Fri, 2 Jan 2015 12:51:10 +0000 (13:51 +0100)]
drm/i915: Update to Linux 3.9.11

* Various bug fixes and small improvements

* Better handling of GPU hangs, improved driver robustness

* Support for the display power well on Haswell GPUs

* Support for more Haswell GPU (PCI ID) models

9 years agolibc/sysvipc: Constify msgsnd()'s message pointer argument (per POSIX).
Sascha Wildner [Sun, 4 Jan 2015 04:13:56 +0000 (05:13 +0100)]
libc/sysvipc: Constify msgsnd()'s message pointer argument (per POSIX).

Also add a comment in <sys/msg.h> that our msgrcv() should really
return ssize_t.

9 years agoinet6: Remove redundant inet6 addresses deletion
Sepherosa Ziehau [Fri, 2 Jan 2015 13:14:01 +0000 (21:14 +0800)]
inet6: Remove redundant inet6 addresses deletion

All inet6 addresses must have been removed in the previous code segment;
use assertion in place of the old code.

9 years agoinet6: Dispatch in6_ifdetach to netisr0 to run
Sepherosa Ziehau [Fri, 2 Jan 2015 12:41:12 +0000 (20:41 +0800)]
inet6: Dispatch in6_ifdetach to netisr0 to run

- Default router and nd6 prefix ifdetach processing are now in netisr0.
  This steps toward moving all default router and nd6 prefix processing
  to netisr0.
- Multicast group leaving no longer needs to be explicitly dispatched
  to netisr0.
- ifindex2ifnet accessing is now in netisr (implicitly).

9 years agoinet6: ifp == ifindex2ifnet[ifp->if_index]
Sepherosa Ziehau [Fri, 2 Jan 2015 12:11:35 +0000 (20:11 +0800)]
inet6: ifp == ifindex2ifnet[ifp->if_index]

There is no need to go through extra indirection.

9 years agowlan: We already have the ifp; no need to go through several functions
Sepherosa Ziehau [Fri, 2 Jan 2015 11:45:27 +0000 (19:45 +0800)]
wlan: We already have the ifp; no need to go through several functions

Avoid unnecessary reference to ifindex2ifnet global variable.

9 years agoidr: Remove a wrong assertion in idr_get_new_above()
François Tigeot [Sat, 3 Jan 2015 17:37:47 +0000 (18:37 +0100)]
idr: Remove a wrong assertion in idr_get_new_above()

Calling idr_get_new_above() with a NULL ptr parameter is perfectly valid.

9 years agoRemove redundant __BSD_VISIBLE checks in various header files.
Sascha Wildner [Sat, 3 Jan 2015 00:15:08 +0000 (01:15 +0100)]
Remove redundant __BSD_VISIBLE checks in various header files.

When __BSD_VISIBLE is set to 1, we also set (in <sys/cdefs.h>):

#define __POSIX_VISIBLE 200809
#define __XSI_VISIBLE 700
#define __ISO_C_VISIBLE 2011

9 years ago<stddef.h>: Check __BSD_VISIBLE instead of !_ANSI_SOURCE && !_POSIX_SOURCE.
Sascha Wildner [Fri, 2 Jan 2015 21:20:15 +0000 (22:20 +0100)]
<stddef.h>: Check __BSD_VISIBLE instead of !_ANSI_SOURCE && !_POSIX_SOURCE.

9 years agolibc: Update Symbol.map for psiginfo().
Sascha Wildner [Fri, 2 Jan 2015 13:18:58 +0000 (14:18 +0100)]
libc: Update Symbol.map for psiginfo().

9 years ago<signal.h>: Add a change I forgot in d3240feb.
Sascha Wildner [Fri, 2 Jan 2015 13:17:29 +0000 (14:17 +0100)]
<signal.h>: Add a change I forgot in d3240feb.

9 years agolibc: Add the psiginfo() function.
Sascha Wildner [Thu, 1 Jan 2015 20:21:16 +0000 (21:21 +0100)]
libc: Add the psiginfo() function.

It is required by _POSIX_C_SOURCE == 200809.

9 years ago<signal.h>: Sanitize the feature tests.
Sascha Wildner [Thu, 1 Jan 2015 19:58:42 +0000 (20:58 +0100)]
<signal.h>: Sanitize the feature tests.

* Generally, in our headers, we don't check the (user-settable)
  _POSIX_SOURCE and _ANSI_SOURCE, but instead __XSI_VISIBLE,
  __POSIX_VISIBLE and __BSD_VISIBLE, which are set by <sys/cdefs.h>
  based on what the user chose. Do the same in the CPU specific
  signal headers.

* psignal() is now a standard function (per 200809).

* Add missing __restrict qualifiers.

9 years agodrm: Add hweight16()
François Tigeot [Fri, 2 Jan 2015 11:15:52 +0000 (12:15 +0100)]
drm: Add hweight16()

Obtained-from: OpenBSD

9 years agodrm: Add DIV_ROUND_CLOSEST()
François Tigeot [Fri, 2 Jan 2015 11:05:28 +0000 (12:05 +0100)]
drm: Add DIV_ROUND_CLOSEST()

Obtained-from: OpenBSD

9 years agodrm: Add BUILD_BUG_ON_NOT_POWER_OF_2()
François Tigeot [Fri, 2 Jan 2015 11:04:51 +0000 (12:04 +0100)]
drm: Add BUILD_BUG_ON_NOT_POWER_OF_2()

Obtained-from: NetBSD

9 years agodrm: Improve linux/wait.h
François Tigeot [Fri, 2 Jan 2015 10:46:11 +0000 (11:46 +0100)]
drm: Improve linux/wait.h

9 years agodrm: Add linux/sched.h
François Tigeot [Fri, 2 Jan 2015 10:41:53 +0000 (11:41 +0100)]
drm: Add linux/sched.h

9 years agodrm: Add linux/math64.h
François Tigeot [Fri, 2 Jan 2015 10:37:40 +0000 (11:37 +0100)]
drm: Add linux/math64.h

Obtained-from: FreeBSD's OFED subsystem

9 years agodrm: Improve linux/jiffies.h
François Tigeot [Fri, 2 Jan 2015 10:18:54 +0000 (11:18 +0100)]
drm: Improve linux/jiffies.h

9 years agodrm: Add linux/scatterlist.h
François Tigeot [Fri, 2 Jan 2015 10:12:01 +0000 (11:12 +0100)]
drm: Add linux/scatterlist.h

With some minimal adaptation to DragonFly

Obtained-from: FreeBSD's OFED subsystem

9 years agodrm: Add the atomic_set_mask() Linux function
François Tigeot [Fri, 2 Jan 2015 10:07:00 +0000 (11:07 +0100)]
drm: Add the atomic_set_mask() Linux function

9 years agodrm: Add the mutex_lock and _unlock() Linux functions
François Tigeot [Fri, 2 Jan 2015 10:06:40 +0000 (11:06 +0100)]
drm: Add the mutex_lock and _unlock() Linux functions

9 years agodrm: Add linux/log2.h
François Tigeot [Thu, 2 Jan 2014 09:13:38 +0000 (10:13 +0100)]
drm: Add linux/log2.h

Obtained-from: FreeBSD's OFED subsystem

9 years agodrm: Add linux/bug.h
François Tigeot [Thu, 2 Jan 2014 09:13:09 +0000 (10:13 +0100)]
drm: Add linux/bug.h

9 years agodrm/linux: Implement waitqueue_active()
François Tigeot [Fri, 2 Jan 2015 09:05:42 +0000 (10:05 +0100)]
drm/linux: Implement waitqueue_active()

9 years agodrm: Add linux/pm_qos.h
François Tigeot [Fri, 2 Jan 2015 08:46:53 +0000 (09:46 +0100)]
drm: Add linux/pm_qos.h

9 years agomfi.4: Remove description of no longer existing tunable.
Sascha Wildner [Fri, 2 Jan 2015 03:31:28 +0000 (04:31 +0100)]
mfi.4: Remove description of no longer existing tunable.

9 years ago<sys/time.h>: Revert my last change, which was wrong.
Sascha Wildner [Thu, 1 Jan 2015 15:39:17 +0000 (16:39 +0100)]
<sys/time.h>: Revert my last change, which was wrong.

9 years agosshlockout - Add sshlockout utility
Matthew Dillon [Thu, 1 Jan 2015 03:21:47 +0000 (19:21 -0800)]
sshlockout - Add sshlockout utility

* Add sshlockout utility, typically setup as a syslog pipe.  This utility
  monitors for failed ssh login attempts and excessive preauth failures
  and will add a rule via IPFW to block the originating IP.

  The operator also typically sets up a cron job to clean out the IPFW rules
  that have accumulated once a day.

* See man page for details.  Still under construction (feel free to submit
  additional features).

  TODO - IPV6

  TODO - Use a PF table instead of IPFW, which will greatly improve
 performance if a lot of rules have to be added.

9 years agoroute: Print protocol-cloned routes if -A is specified
Sepherosa Ziehau [Wed, 31 Dec 2014 14:09:44 +0000 (22:09 +0800)]
route: Print protocol-cloned routes if -A is specified

Else the out put of netstat -rnA looks weird if there are protocol-
cloned routes.

9 years agortsock: Const-fy rt_msgsize parameter
Sepherosa Ziehau [Wed, 31 Dec 2014 13:02:11 +0000 (21:02 +0800)]
rtsock: Const-fy rt_msgsize parameter

9 years agortsock: Factor out sysctl_rttable()
Sepherosa Ziehau [Wed, 31 Dec 2014 12:48:49 +0000 (20:48 +0800)]
rtsock: Factor out sysctl_rttable()

While I'm here, remove unnecessary critical section.

9 years agoBump our copyrights to 2015. Happy new year!
Sascha Wildner [Wed, 31 Dec 2014 19:45:55 +0000 (20:45 +0100)]
Bump our copyrights to 2015. Happy new year!

9 years agoMark some legacy XSI functions as no longer present in _XOPEN_SOURCE=700.
Sascha Wildner [Wed, 31 Dec 2014 07:33:23 +0000 (08:33 +0100)]
Mark some legacy XSI functions as no longer present in _XOPEN_SOURCE=700.

This applies if _XOPEN_SOURCE=700 is explicitly requested. Our default
environment still exposes the prototypes, of course.

9 years agousbconfig(8): Sync with FreeBSD (decodes bDeviceClass/bInterfaceClass).
Sascha Wildner [Wed, 31 Dec 2014 03:46:11 +0000 (04:46 +0100)]
usbconfig(8): Sync with FreeBSD (decodes bDeviceClass/bInterfaceClass).

9 years agoinet6: Simplify in6ifa_ functions
Sepherosa Ziehau [Tue, 30 Dec 2014 13:14:05 +0000 (21:14 +0800)]
inet6: Simplify in6ifa_ functions

And fix indentation of in6ifa_llaonifp() while I'm here.

9 years agoin_control: Merge two switch blocks and fix comment a little bit
Sepherosa Ziehau [Mon, 29 Dec 2014 13:55:28 +0000 (21:55 +0800)]
in_control: Merge two switch blocks and fix comment a little bit

9 years agoin6_control: Fix comment
Sepherosa Ziehau [Mon, 29 Dec 2014 13:55:03 +0000 (21:55 +0800)]
in6_control: Fix comment

9 years agoswapcache - Allow cleaning to proceed if disabled
Matthew Dillon [Tue, 30 Dec 2014 01:07:41 +0000 (17:07 -0800)]
swapcache - Allow cleaning to proceed if disabled

* Allow swapcache cleaning to proceed even if swapcache
  is disabled.

9 years agokernel - Fix a major (pageable) memory leak
Matthew Dillon [Tue, 30 Dec 2014 00:56:23 +0000 (16:56 -0800)]
kernel - Fix a major (pageable) memory leak

* Under certain relatively easy to reproduce conditions an extra ref_count
  can be added to a VM object during a fork(), preventing the object from
  ever being destroyed.  It's pages may even be paged out, but the system
  will eventually run out of swap space too.

* The actual fix is to assign 'map_object = object' in vm_map_insert()
  (see the diff).  The rest of this commit is conditionalized debugging
  code and code documentation.

* Because this change implements a relatively esoteric feature in the VM
  system by allowing an anonymous VM object to be extended to cover an
  area even though it might have a gap (so a new VM object does not have
  to be allocated), further testing is needed before we can MFC this to
  the RELEASE branch.

9 years agovkernel - Forward SIGTERM to the child vkernel process.
Antonio Huete Jimenez [Mon, 29 Dec 2014 14:42:47 +0000 (15:42 +0100)]
vkernel - Forward SIGTERM to the child vkernel process.

- Fixes a problem that occurred when sending SIGTERM to the
  parent vkernel process. It died and left child running in
  the background instead of initiating the shutdown.

9 years agodrm: Only define struct drm_sysctl_info once
François Tigeot [Mon, 29 Dec 2014 13:51:15 +0000 (14:51 +0100)]
drm: Only define struct drm_sysctl_info once

9 years agoin6_mask2len: Constfy parameters
Sepherosa Ziehau [Sun, 28 Dec 2014 13:38:11 +0000 (21:38 +0800)]
in6_mask2len: Constfy parameters

9 years agoinet6: Simplify in6ifa_ifpwithaddr()
Sepherosa Ziehau [Sun, 28 Dec 2014 13:13:35 +0000 (21:13 +0800)]
inet6: Simplify in6ifa_ifpwithaddr()

9 years agoin6_control: Cosmetic cleanup
Sepherosa Ziehau [Sun, 28 Dec 2014 12:44:51 +0000 (20:44 +0800)]
in6_control: Cosmetic cleanup

9 years agoin6_control: Serialize some SIOCs using netisr0
Sepherosa Ziehau [Sun, 28 Dec 2014 08:28:36 +0000 (16:28 +0800)]
in6_control: Serialize some SIOCs using netisr0

The serialized SIOCs are:
- IPv6 multicast routing.
- Source address selection policy (not used yet).
- Scope6.
- IPv6 address changes.

9 years agoCheck __BSD_VISIBLE's actual value, not just if it is defined.
Sascha Wildner [Sun, 28 Dec 2014 21:51:20 +0000 (22:51 +0100)]
Check __BSD_VISIBLE's actual value, not just if it is defined.

It could be defined to 0, per <sys/cdefs.h>. Only the few cases which
this commit fixes were wrong.

9 years agou4b - implement usb_filter_write(), fix issues w/apcupsd
Matthew Dillon [Sun, 28 Dec 2014 22:13:05 +0000 (14:13 -0800)]
u4b - implement usb_filter_write(), fix issues w/apcupsd

* Implement usb_filter_write() (poll, kqueue).

* This fixes a live loop in apcupsd when it is configured
  to talk to the UPS over a usb port.

9 years agodebug - Add -v option to vmobjinfo and memory/swap dump
Matthew Dillon [Sun, 28 Dec 2014 21:17:09 +0000 (13:17 -0800)]
debug - Add -v option to vmobjinfo and memory/swap dump

* If the -v option is used, the contents of the memory AND swap space
  associated with the VM object to be dumped.

* Allow swap devices to be specified on the command line.  If not specified,
  only active memory is dumped with -v.

* Fixups for new VM object hash table in the kernel.

9 years agoRemove <netinet6/in6_prefix.h> via make upgrade.
Sascha Wildner [Sun, 28 Dec 2014 16:37:04 +0000 (17:37 +0100)]
Remove <netinet6/in6_prefix.h> via make upgrade.

9 years agokernel/acpi: Some fixes from FreeBSD.
Sascha Wildner [Sun, 28 Dec 2014 03:59:29 +0000 (04:59 +0100)]
kernel/acpi: Some fixes from FreeBSD.

* OsdInterrupt.c: InterruptNumber is unsigned so remove unnecessary
    "< 0" check.

* acpi.c: Use correct size of the end tag in a resource buffer.

* acpi_acad.c: Don't hold the acad lock when changing the power
    profile.

9 years agoin6_control: Filter unsupported commands in earlier place.
Sepherosa Ziehau [Sun, 28 Dec 2014 03:25:18 +0000 (11:25 +0800)]
in6_control: Filter unsupported commands in earlier place.

9 years agokernel - Register CAM swi as MPSAFE
Matthew Dillon [Sun, 28 Dec 2014 00:50:31 +0000 (16:50 -0800)]
kernel - Register CAM swi as MPSAFE

* Register the CAM swi as being MPSAFE, which should improve disk
  performance when multiple drives are being hit concurrently.

Reported-by: Venkatesh Srinivas
9 years agovkernel - Add 'fsck' target to build
Matthew Dillon [Sun, 28 Dec 2014 00:49:22 +0000 (16:49 -0800)]
vkernel - Add 'fsck' target to build

* Add an fsck target to the /usr/src/test/vkernel Makefile.  This will
  fsck the rootfs image.

9 years agokernel - Remove vm_wait_nominal() from VM object cleaning path
Matthew Dillon [Sun, 28 Dec 2014 00:48:36 +0000 (16:48 -0800)]
kernel - Remove vm_wait_nominal() from VM object cleaning path

* Remove this call to vm_wait_nominal() which can wind up deadlocking
  the system in a low memory situation.

9 years agodrm - Add safety to ttm_eu_reserve_buffers()
Matthew Dillon [Sun, 28 Dec 2014 00:47:39 +0000 (16:47 -0800)]
drm - Add safety to ttm_eu_reserve_buffers()

* Add a safety to the unlock/relock sequence in ttm_eu_reserve_buffers().
  It is unclear whether all call paths are holding the lock.

9 years agohammer2 - Add debugging
Matthew Dillon [Sun, 28 Dec 2014 00:45:06 +0000 (16:45 -0800)]
hammer2 - Add debugging

* Dump bref->flags in hammer2 service debug output.

9 years agokernel - Fix old UFS optimization that should no longer be used
Matthew Dillon [Sun, 28 Dec 2014 00:41:06 +0000 (16:41 -0800)]
kernel - Fix old UFS optimization that should no longer be used

* Fix bcopy() calls which cover two fields in the UFS dinode.  Modern
  compilers may barf on the intentional field overflow.

* Also needed for UFS2 support (but we don't have it so this is more
  to fix possible future issues that might arise).

Submitted-by: Pedro Giffuni
9 years agokernel - Fix incorrect assertion in ffs_reallocblks()
Matthew Dillon [Sat, 27 Dec 2014 22:44:14 +0000 (14:44 -0800)]
kernel - Fix incorrect assertion in ffs_reallocblks()

* When softupdates is not enabled reallocblks should not try to free
  an unallocated block.  This appears to be possible if the reallocation
  range covers part of a file with a hole in it.  FSX appears to reveal
  this case.

* It is also possible that this case is due to some interaction between
  the DragonFly buffer cache and UFS that breaks b_offset assignment
  assumptions made by UFS, but I couldn't find any particular vector
  for the possibility.

9 years agoAllow reading with small uio->uio_resid or uio->uio_offset > 0 from /proc/X/map
Markus Pfeiffer [Sat, 27 Dec 2014 22:55:51 +0000 (22:55 +0000)]
Allow reading with small uio->uio_resid or uio->uio_offset > 0 from /proc/X/map

Currently map file in procfs cannot be read with programs like cat
sometimes. It happens if the buffer to be read into cannot hold the entire
content of map file. Call to read returns EFBIG on this occasion, which is
somewhat confusing.

Submitted-By: Vasily Postnicov <shamaz.mazum@gmail.com>
9 years agoinet6: Remove in6_prefix.[ch]
Sepherosa Ziehau [Sat, 27 Dec 2014 13:32:52 +0000 (21:32 +0800)]
inet6: Remove in6_prefix.[ch]

They have not been used for a while.

9 years agoinet: Merge in_control() and in_control_redispatch()
Sepherosa Ziehau [Sat, 27 Dec 2014 03:47:27 +0000 (11:47 +0800)]
inet: Merge in_control() and in_control_redispatch()

This also brings SIOC[DAG]LIFADDR ioctls back to the userland.

9 years agotcp: Enable path mtu discovery by default
Sepherosa Ziehau [Thu, 25 Dec 2014 11:55:41 +0000 (19:55 +0800)]
tcp: Enable path mtu discovery by default

This also eases the adoption of the RFC6864.

9 years agoinet/inet6: Don't allow different users to bind to the same port
Sepherosa Ziehau [Thu, 25 Dec 2014 11:34:38 +0000 (19:34 +0800)]
inet/inet6: Don't allow different users to bind to the same port

It is really wrong to allow different users to bind to the same port,
if the original 'reuseport' binding is using wildcard address and the
new binding is also using wildcard address; this serves no purpose and
imposes security risk (port theft).

9 years agosocket: Add KTR_SOWAKEUP
Sepherosa Ziehau [Thu, 25 Dec 2014 11:16:46 +0000 (19:16 +0800)]
socket: Add KTR_SOWAKEUP

Define 2 pairs of children nodes for this KTR, which are used to tracking
extra IPIs for accept(2).

Note:
The tracked sorwakeup() and the wakeup(so_timeo) does not generate extra
(wakeup) IPIs.

9 years agotools/accept_server: Add option to bind processes to CPUs
Sepherosa Ziehau [Thu, 25 Dec 2014 11:03:58 +0000 (19:03 +0800)]
tools/accept_server: Add option to bind processes to CPUs

According to the listen socket's CPU hint.

9 years agotools/kq_accept_server: Allow binding to a specific IPv4 address
Sepherosa Ziehau [Thu, 25 Dec 2014 11:02:41 +0000 (19:02 +0800)]
tools/kq_accept_server: Allow binding to a specific IPv4 address

9 years agoinet/inet6: Remove the v4-mapped address support
Sepherosa Ziehau [Thu, 18 Dec 2014 13:06:42 +0000 (21:06 +0800)]
inet/inet6: Remove the v4-mapped address support

This greatly simplies the code (even the IPv4 code) and avoids all kinds
of possible port theft.

INPCB:
- Nuke IN6P_IPV6_V6ONLY, which is always on after this commit.
- Change inp_vflag into inp_af (AF_INET or AF_INET6), since the socket
  is either IPv6 or IPv4, but never both.  Set inpcb.inp_af in
  in_pcballoc() instead of in every pru_attach methods.  Add INP_ISIPV4()
  and INP_ISIPV6() macros to check inpcb family (socket family and
  inpcb.inp_af are same).
- Nuke the convoluted code in in_pcbbind() and in6_pcbbind() which is used
  to allow wildcard binding to accepting IPv4 connections on IPv6 wildcard
  bound sockets.
- Nuke the code in in_pcblookup_pkthash() to match IPv4 faddr with IPv6
  wildcard bound socket.
- Nuke in6_mapped_{peeraddr,sockaddr,savefaddr}(); use in6_{setpeeraddr,
  setsockaddr,savefaddr}() directly.
- Nuke v4-mapped address convertion functions.
- Don't allow binding to v4-mapped address in in6_pcbind().
- Don't allow connecting to v4-mapped address in in6_pcbconnect().

TCP:
- Nuke the code in tcp_output() which takes care of the IP header TTL
  setting for v4-mapped IPv6 socket.
- Don't allow binding to v4-mapped address (through in6_pcbbind()).
- Don't allow connecting to v4-mapped address and nuke the related code
  (PRUC_NAMALLOC etc.).
- Nuke the code (PRUC_FALLBACK etc.) to fallback to IPv4 connection if
  IPv6 connection fails, which is wrong.
- Nuke the code for v4-mapped IPv6 socket in tcp6_soport().

UDP:
- Nuke the code for v4-mapped IPv6 socket in udp_input() and udp_append().
- Don't allow binding to v4-mapped address (through in6_pcbbind()).
- Don't allow connecting to v4-mapped address.
- Don't allow sending datagrams to v4-mapped address and nuke the related
  code in udp6_output().
- Nuke the code for v4-mapped IPv6 socket in udp6_disconnect()

RIP:
- Don't allow sending packets to v4-mapped address.
- Don't allow binding to v4-mapped address.
- Don't allow connecting to v4-mapped address.

Misc fixup:
- Don't force rip pru_attach method to return 0.  If in_pcballoc() fails,
  just return the error code.

9 years agohammer(8): Fix closing brace indent in 'show' output.
Sascha Wildner [Sat, 27 Dec 2014 00:53:35 +0000 (01:53 +0100)]
hammer(8): Fix closing brace indent in 'show' output.

Commit 39e88285cb81d7847bb54a08e0f50a61be890e08 extended the bad
indication to two chars ("B " or "BM") but forgot to adjust the
indent of the closing brace.

9 years agokernel - Add backlight sysctls to i915
Matthew Dillon [Wed, 24 Dec 2014 18:30:57 +0000 (10:30 -0800)]
kernel - Add backlight sysctls to i915

* Add sysctl hw.backlight_level and hw.backlight_max for i915
  (incls haswell chromebooks).

Submitted-by: yellowrabbit2010 / #2749
9 years agodrm/i915: Use struct pci_dev and Linux pci functions
François Tigeot [Wed, 24 Dec 2014 16:11:27 +0000 (17:11 +0100)]
drm/i915: Use struct pci_dev and Linux pci functions

9 years agodrm: Improve linux/pci.h
François Tigeot [Tue, 23 Dec 2014 19:57:23 +0000 (20:57 +0100)]
drm: Improve linux/pci.h

9 years agodrm: Add linux/io.h
François Tigeot [Tue, 23 Dec 2014 19:46:48 +0000 (20:46 +0100)]
drm: Add linux/io.h

9 years agodrm: Add linux/device.h
François Tigeot [Tue, 23 Dec 2014 19:23:05 +0000 (20:23 +0100)]
drm: Add linux/device.h

9 years agokernel/netmap: Switch sysctls over to dev.netmap like in FreeBSD.
Sascha Wildner [Mon, 22 Dec 2014 20:12:27 +0000 (21:12 +0100)]
kernel/netmap: Switch sysctls over to dev.netmap like in FreeBSD.

9 years ago<sys/sysctl.h>: Add missing declaration for dev.*
Sascha Wildner [Mon, 22 Dec 2014 20:11:59 +0000 (21:11 +0100)]
<sys/sysctl.h>: Add missing declaration for dev.*

9 years agokernel: Don't confuse kmalloc() and mbuf flags.
Sascha Wildner [Mon, 22 Dec 2014 11:49:03 +0000 (12:49 +0100)]
kernel: Don't confuse kmalloc() and mbuf flags.