freebsd.git
20 hours agoifdef RACCT ui_racct_foreach and struct uidinfo's ui_racct master github/master
mjg [Sun, 23 Nov 2014 08:25:44 +0000 (08:25 +0000)]
ifdef RACCT ui_racct_foreach and struct uidinfo's ui_racct

Change racct_ create and destroy to macros evaluating to nothing without RACCT
so that their callers passing ui_racct don't have to be ifdefed.

28 hours agobuf.h is not needed here, and pollutes when ufsmount.h is included
glebius [Sun, 23 Nov 2014 01:02:19 +0000 (01:02 +0000)]
buf.h is not needed here, and pollutes when ufsmount.h is included
from userland code.

Sponsored by: Nginx, Inc.

28 hours agoInclude required files directly instead of pollution via ufs/ufsmount.h.
glebius [Sun, 23 Nov 2014 01:01:14 +0000 (01:01 +0000)]
Include required files directly instead of pollution via ufs/ufsmount.h.

Sponsored by: Nginx, Inc.

28 hours agoFix comments
bapt [Sun, 23 Nov 2014 00:30:32 +0000 (00:30 +0000)]
Fix comments

28 hours agofiledesc: plug a test for impossible condition in fgetvp_rights
mjg [Sun, 23 Nov 2014 00:12:27 +0000 (00:12 +0000)]
filedesc: plug a test for impossible condition in fgetvp_rights

29 hours agoFix typo
bapt [Sun, 23 Nov 2014 00:08:43 +0000 (00:08 +0000)]
Fix typo

29 hours agoChange man(1) to use mandoc to render manpages
bapt [Sun, 23 Nov 2014 00:08:04 +0000 (00:08 +0000)]
Change man(1) to use mandoc to render manpages

man(1) now first test the manpage to run with mandoc to make sure it can be
rendered.
In case groff cannot be found (because base has been built WITHOUT_GROFF) it
recommands to install groff from the packages

29 hours agoFix the following -Werror warnings from clang 3.5.0, while building
dim [Sat, 22 Nov 2014 23:50:18 +0000 (23:50 +0000)]
Fix the following -Werror warnings from clang 3.5.0, while building
bsnmpd's snmp_hostres module:

usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                          ^
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: note: use function 'labs' instead
        str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600);
                          ^~~
                          labs
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                            ^
usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: note: use function 'labs' instead
        str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60);
                            ^~~
                            labs

Since tm::tm_gmtoff is a long, use labs(3) instead.

MFC after: 3 days

29 hours agosh: Prepend "$0: " to error messages if there is no command name.
jilles [Sat, 22 Nov 2014 23:28:41 +0000 (23:28 +0000)]
sh: Prepend "$0: " to error messages if there is no command name.

30 hours agoFix the following -Werror warnings from clang 3.5.0, while building
dim [Sat, 22 Nov 2014 23:04:33 +0000 (23:04 +0000)]
Fix the following -Werror warnings from clang 3.5.0, while building
usr.sbin/rtadvd:

usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) {
                    ^~~
usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^
usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative
                    abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) {
                    ^~~
2 errors generated.

These warnings occur because both preferred_time and pfx_pltimeexpire
are uint32_t's, so the subtraction expression is also unsigned, and
calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by: hrs
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1197

30 hours agoLower warnings to fix build with gcc
bapt [Sat, 22 Nov 2014 22:13:00 +0000 (22:13 +0000)]
Lower warnings to fix build with gcc

30 hours agoLower warning to allow building with gcc
bapt [Sat, 22 Nov 2014 22:11:35 +0000 (22:11 +0000)]
Lower warning to allow building with gcc

31 hours agoAdd the demandoc utility from the mandoc project
bapt [Sat, 22 Nov 2014 21:11:17 +0000 (21:11 +0000)]
Add the demandoc utility from the mandoc project

This is a modern version of the deroff utility, useful for example to do
spellchecking on manpages

32 hours agoDefine LIBSQLITE3 and LIBMANDOC
bapt [Sat, 22 Nov 2014 21:03:05 +0000 (21:03 +0000)]
Define LIBSQLITE3 and LIBMANDOC

32 hours agoAdd the preconv utility from mandoc project
bapt [Sat, 22 Nov 2014 20:55:36 +0000 (20:55 +0000)]
Add the preconv utility from mandoc project

it recodes multibyte UNIX manual files into mandoc(1)

32 hours agoRework mandoc Makefile to ease maintainance
bapt [Sat, 22 Nov 2014 20:48:21 +0000 (20:48 +0000)]
Rework mandoc Makefile to ease maintainance
Add compat_reallocarray into libmandoc given other mandoc components will use
it.

32 hours agoRework makefile in something closer to upstream Makefile to ease maintainance
bapt [Sat, 22 Nov 2014 20:42:32 +0000 (20:42 +0000)]
Rework makefile in something closer to upstream Makefile to ease maintainance

32 hours agoThere never was a PC Card joystick attachment that worked. Kill the
imp [Sat, 22 Nov 2014 20:31:20 +0000 (20:31 +0000)]
There never was a PC Card joystick attachment that worked. Kill the
current stub one until such time as one shows up.

32 hours agoAdd missing bits svn merge did not catch
bapt [Sat, 22 Nov 2014 20:18:38 +0000 (20:18 +0000)]
Add missing bits svn merge did not catch

33 hours agoForgot to update libmandoc
bapt [Sat, 22 Nov 2014 19:48:14 +0000 (19:48 +0000)]
Forgot to update libmandoc

33 hours agoPromote SQLite3 as a privatelib as it will also be used by mandoc
bapt [Sat, 22 Nov 2014 19:44:49 +0000 (19:44 +0000)]
Promote SQLite3 as a privatelib as it will also be used by mandoc

While here ensure sqlite3 is using pread(2) and enable the suppot for FTS4

33 hours agoUpdate sqlite3 to 3.8.7.2
bapt [Sat, 22 Nov 2014 19:18:08 +0000 (19:18 +0000)]
Update sqlite3 to 3.8.7.2

33 hours agoAdd missing dependencies on pthread (sqlite being built with threadsafety on)
bapt [Sat, 22 Nov 2014 19:17:05 +0000 (19:17 +0000)]
Add missing dependencies on pthread (sqlite being built with threadsafety on)

34 hours agoUpdate mandoc to 1.13.1
bapt [Sat, 22 Nov 2014 18:57:23 +0000 (18:57 +0000)]
Update mandoc to 1.13.1

34 hours agoRetire old, transition code for managing the FreeBSD 5 -> 6 migration.
imp [Sat, 22 Nov 2014 18:40:14 +0000 (18:40 +0000)]
Retire old, transition code for managing the FreeBSD 5 -> 6 migration.

34 hours agoThe size value should be asserted when it is known.
kib [Sat, 22 Nov 2014 18:15:02 +0000 (18:15 +0000)]
The size value should be asserted when it is known.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation

35 hours agoImport mandoc 1.13.1
bapt [Sat, 22 Nov 2014 18:08:25 +0000 (18:08 +0000)]
Import mandoc 1.13.1

35 hours agoBy the time that vm_reserv_init() runs, vm_phys_segs[] is initialized. Use
alc [Sat, 22 Nov 2014 17:46:30 +0000 (17:46 +0000)]
By the time that vm_reserv_init() runs, vm_phys_segs[] is initialized.  Use
it instead of phys_avail[].

Discussed with: Svatopluk Kraus

35 hours agoFix the host mode ISOCHRONOUS transfer interval programming in the
hselasky [Sat, 22 Nov 2014 17:26:43 +0000 (17:26 +0000)]
Fix the host mode ISOCHRONOUS transfer interval programming in the
SAF1761 OTG driver. Currently the driver logic is very simple and
double buffering the USB transactions is not done.  Also you need to
use an external USB high speed USB HUB for reliable FULL speed
outgoing ISOCHRONOUS traffic, because the internal one chokes on
so-called split transfers above 188 bytes.

36 hours agoImplement "automount -c".
trasz [Sat, 22 Nov 2014 16:48:29 +0000 (16:48 +0000)]
Implement "automount -c".

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

36 hours agoCross-reference autounmountd(8) from umount(8).
trasz [Sat, 22 Nov 2014 16:46:00 +0000 (16:46 +0000)]
Cross-reference autounmountd(8) from umount(8).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

36 hours agoCross-reference automount(8) from mount(8).
trasz [Sat, 22 Nov 2014 16:43:36 +0000 (16:43 +0000)]
Cross-reference automount(8) from mount(8).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

36 hours agoAvoid undefined behaviour in gas's rotate_left() macro for n == 0.
dim [Sat, 22 Nov 2014 16:30:31 +0000 (16:30 +0000)]
Avoid undefined behaviour in gas's rotate_left() macro for n == 0.
Otherwise, clang can effectively remove the first iteration of the for
loops where this macro is invoked, and as a result, "cmp r0, #99" fails
to assemble.

Obtained from: joerg at netbsd
MFC after: 3 days

37 hours agosh: Use DQSYNTAX only while expanding, not SQSYNTAX.
jilles [Sat, 22 Nov 2014 16:03:18 +0000 (16:03 +0000)]
sh: Use DQSYNTAX only while expanding, not SQSYNTAX.

Quoting during expansion only cares about CCTL, which is the same for
DQSYNTAX and SQSYNTAX.

37 hours agoFor both iSCSI initiator and target increase socket buffer sizes before
mav [Sat, 22 Nov 2014 15:09:18 +0000 (15:09 +0000)]
For both iSCSI initiator and target increase socket buffer sizes before
establishing connection.

This is a workaround for Chelsio TOE driver, that does not update socket
buffer size in hardware after connection established, and unless that is
done beforehand, kernel code will stuck, attempting to send/receive full
PDU at once.

MFC after: 1 week

38 hours agoFix build with asr driver
smh [Sat, 22 Nov 2014 14:59:50 +0000 (14:59 +0000)]
Fix build with asr driver

This was broken by r274819 as asr is not in GENERIC because its not 64bit
safe.

MFC after: 1 month
X-MFC-With: r274819
Sponsored by: Multiplay

38 hours agoAdd libm to eliminate "undefined reference to sqrt" on arm 'softfp' builds.
ian [Sat, 22 Nov 2014 14:53:50 +0000 (14:53 +0000)]
Add libm to eliminate "undefined reference to sqrt" on arm 'softfp' builds.

40 hours agoEnforce -lpthread and -lc to always be the 2 last components of the link list
bapt [Sat, 22 Nov 2014 12:48:09 +0000 (12:48 +0000)]
Enforce -lpthread and -lc to always be the 2 last components of the link list

Differential Revision: https://reviews.freebsd.org/D1118
Suggested by: kib

40 hours agoFix the following -Werror warnings from clang 3.5.0, while building
dim [Sat, 22 Nov 2014 12:13:05 +0000 (12:13 +0000)]
Fix the following -Werror warnings from clang 3.5.0, while building
usr.bin/locate:

usr.bin/locate/locate/util.c:249:29: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                            MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
                                                 ^
usr.bin/locate/locate/util.c:249:29: note: remove the call to 'abs' since unsigned values cannot be negative
                            MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
                                                 ^~~
usr.bin/locate/locate/util.c:274:32: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                            MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
                                                    ^
usr.bin/locate/locate/util.c:274:32: note: remove the call to 'abs' since unsigned values cannot be negative
                            MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
                                                    ^~~

The problem is that ntohl() always returns an unsigned quantity.  In
this case, it's expected to be cast back to a signed integer, but to
stop complaints about abs() we just store it into an integer, and don't
call ntohl() again.

Reviewed by: ngie
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1196

40 hours agoFix the following -Werror warning from clang 3.5.0, while building
dim [Sat, 22 Nov 2014 12:10:09 +0000 (12:10 +0000)]
Fix the following -Werror warning from clang 3.5.0, while building
usr.bin/cpio on amd64 (or any arch with 64-bit time_t):

contrib/libarchive/cpio/cpio.c:1143:6: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
        if (abs(mtime - now) > (365/2)*86400)
            ^
contrib/libarchive/cpio/cpio.c:1143:6: note: use function 'labs' instead
        if (abs(mtime - now) > (365/2)*86400)
            ^~~
            labs
1 error generated.

This is because time_t is a long on amd64. To avoid the warning, just
copy the equivalent test from a few lines before, which is used in the
Windows case, and which is type safe.

Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1198

43 hours agoFix use-after-free introduced in r274843.
mav [Sat, 22 Nov 2014 09:45:32 +0000 (09:45 +0000)]
Fix use-after-free introduced in r274843.

I've missed that iscsi_outstanding_remove() frees the second pointer,
so it should no longer be used.  And in fact we don't really need to.

MFC after: 2 weeks

44 hours agoMove icl_pdu_get_data() and xpt_done() out of initiator's session lock.
mav [Sat, 22 Nov 2014 09:05:54 +0000 (09:05 +0000)]
Move icl_pdu_get_data() and xpt_done() out of initiator's session lock.

During heavy reads data copying in icl_pdu_get_data() may consume large
percent of CPU time.  Moving it out of the lock significantly reduces
lock hold time and respectively lock congestion on read operations.

MFC after: 2 weeks

44 hours agoUse correct length mask for split transactions. The hardware would
hselasky [Sat, 22 Nov 2014 08:47:04 +0000 (08:47 +0000)]
Use correct length mask for split transactions. The hardware would
sometimes put non-zero values in the upper length bits, which are
available for high-speed-only USB transactions, breaking the reception
of data.

44 hours agoRemove examples of gif_interfaces and gifconfig. These have already been
hrs [Sat, 22 Nov 2014 08:09:26 +0000 (08:09 +0000)]
Remove examples of gif_interfaces and gifconfig.  These have already been
marked as deprecated in rc.conf(5) manual page but these examples
were still here.

Spotted by: jmg

2 days agoMake iSCSI frontend less chatty while waiting for tasks termination.
mav [Sat, 22 Nov 2014 04:40:24 +0000 (04:40 +0000)]
Make iSCSI frontend less chatty while waiting for tasks termination.

MFC after: 1 week

2 days agoWhen doing a PREREAD sync of an mbuf-type dma buffer, do a writeback of
ian [Sat, 22 Nov 2014 03:03:11 +0000 (03:03 +0000)]
When doing a PREREAD sync of an mbuf-type dma buffer, do a writeback of
the first cacheline if the buffer start address is not on a cacheline
boundary.  Normally a buffer which is not cacheline-aligned is bounced,
but a special rule applies for mbufs, which are always misaligned due to
the header.  We know the cpu will not write to the header while dma is in
progress (so we've been told anyway), but it may have written to the
header shortly before starting a read, so we need to flush that write out
to memory before invalidating the whole buffer.

In collaboration with Mical Meloun and Svata Kraus.

2 days agoRevert accidently message Makefile from 274836 and connect soeliminate(1)
bapt [Sat, 22 Nov 2014 01:27:45 +0000 (01:27 +0000)]
Revert accidently message Makefile from 274836 and connect soeliminate(1)

2 days agoAdd a new soeliminate(1) command
bapt [Sat, 22 Nov 2014 01:22:03 +0000 (01:22 +0000)]
Add a new soeliminate(1) command

mandoc(1) does not provide an equivalent of the GNU groff's soelim(1) as an
external binary. It does provide the funcitonnality but internally.

Lots if manpages in ports uses ".so" directives to include the content of
another manpage, which works properly if the manpages are not compressed.
With compressed manpages it will fail. So we need to preprocess those manpages
with soelim(1) before compressing them.

soeliminate(1) add the minimum functionnality from soelim(1) required for that
task, in order to still be able to prepare properly those manpages in case we
ship the base system only with mandoc as a manpage renderer.

soeliminate(1) accept all the arguments from soelim(1) for compatibility but
only '-I dir' is really functionnal.

Name it soeliminate and not soelim, so groff from base or ports can still call
soelim(1) for its internal use and avoid potential incompatibilities

MFC after: 1 month

2 days agoUse the correct variable name.
davide [Sat, 22 Nov 2014 00:42:30 +0000 (00:42 +0000)]
Use the correct variable name.

2 days agoMake ufs_dirhashreclaimperc a percentage for real and
davide [Sat, 22 Nov 2014 00:37:37 +0000 (00:37 +0000)]
Make ufs_dirhashreclaimperc a percentage for real and
rename it to ufs_dirhashreclaimpercent, as suggested
by jhb@. As an added bonus this avoids divide-by-zero
errors.

Requested by: jhb, markj
Reviewied by: jhb, markj

2 days agoSort -K option before -k rather than at the top.
imp [Fri, 21 Nov 2014 23:04:12 +0000 (23:04 +0000)]
Sort -K option before -k rather than at the top.

MFC after: 1 week

2 days agoMerge from CheriBSD:
brooks [Fri, 21 Nov 2014 21:34:19 +0000 (21:34 +0000)]
Merge from CheriBSD:

commit 6d3c4c09226ad6bdd662e3e52489ef294a6ce298
    Add terasic_mtl vt(4) framebuffer driver

    terasic_mtl can be built with syscons(4) and vt(4) attachments, selected
    at compile time.

commit 33240259b47a7c990a5a88a19f133a5600432a4c
    Clear terasic_mtl text buffer on attach

commit d188c2d2412953f949624aa35cd07082830943c9
    Update terasic vt(4) driver for FreeBSD r269783

commit d1cc54eee852fa4fc9d359d5bb2171d24ec73369
    Safety belt to ensure vt(4) fb parameters are correct

commit 76e6d468ef45711d7952786095fc4791289ebb4b
    Improve terasic_mtl_vt fdt parsing

    - Use OF_getencprop to avoid need for explicit endian handling
      (submitted by ray@freebsd.org)
    - Check for expected length and correct pointer type

commit 3e2524b8995ab66e8a9295e4c87cbc7126eeddf4
    Correct device_printf usage

commit 9e53e3c8e0766414e25662c95b09cc51c92443b0
    Switch framebuffer to match host endianness

    Xorg and xf86-video-scfb work much better with a native-endian
    framebuffer.

commit 0f49259d596321ed85288ac0e1fb4ee1c966df48
    Switch DE4 to vt(4) and enable kbdmux

commit 5bc96ebc89db7d134ad478335090c8477c1677c7
    Add missing \n in device_printf calls

Submitted by: emaste
Sponsored by: DARPA, AFRL

2 days agoDocument the recent enhancements for configuring bus speed in iicbus(4).
ian [Fri, 21 Nov 2014 21:30:08 +0000 (21:30 +0000)]
Document the recent enhancements for configuring bus speed in iicbus(4).

Differential Revision:        https://reviews.freebsd.org/D1182
PR: 195009

2 days agoMerge from CheriBSD:
brooks [Fri, 21 Nov 2014 21:14:05 +0000 (21:14 +0000)]
Merge from CheriBSD:

commit d0c7d235c09fc65dbdb278e7016a96f79c6a49cc
    Make the Altera JTAG UART device driver slightly more forgiving of
    the foibles of a sub-par hrdware interface by increasing the timeout
    for spotting JTAG polling from one to two seconds.

commit 19ed45a18832560dab967c179d83b71081c3a220
    Update comment.

commit 8edfe803f033cc8e33229f99894c2b7496a44d5f
    Add a comment about a device-driver race condition that could cause the BERI
    pipeline to wedge awaiting JTAG in the event that both the low-level console
    and the tty layer decide to write to the JTAG FIFO just before JTAG is
    disconnected.  Resolving this race is a bit tricky as it looks like there
    isn't a way to 'give the character back' to the tty layer when we discover
    the race.  The easy fix is to drop the character, which we don't yet do, but
    perhaps should as that is a better outcome than wedging the pipeline.

commit 2ea26cf579c9defcf31e413e7c9b0fbc159237fc
    Add a comment about an inherent race with hardware in the Altera JTAG
    UART's low-level console code.

Submitted by: rwatson
MFC after: 1 week
Sponsored by: DARPA, AFRL

2 days agoMerge from CheriBSD (2e28d2a3090239b30481f35dc452ad95a5c57389)
brooks [Fri, 21 Nov 2014 21:10:02 +0000 (21:10 +0000)]
Merge from CheriBSD (2e28d2a3090239b30481f35dc452ad95a5c57389)

Remove initalized, but unused devname variable

MFC after: 1 week
Sponsored by: DARPA, AFRL

2 days agoPrevent overflow issues in timeout processing
smh [Fri, 21 Nov 2014 21:01:24 +0000 (21:01 +0000)]
Prevent overflow issues in timeout processing

Previously, any timeout value for which (timeout * hz) will overflow the
signed integer, will give weird results, since callout(9) routines will
convert negative values of ticks to '1'. For unsigned integer overflow we
will get sufficiently smaller timeout values than expected.

Switch from callout_reset, which requires conversion to int based ticks
to callout_reset_sbt to avoid this.

Also correct isci to correctly resolve ccb timeout.

This was based on the original work done by Eygene Ryabinkin
<rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid
the overlow.

Differential Revision: https://reviews.freebsd.org/D1157
Reviewed by: mav, davide
MFC after: 1 month
Sponsored by: Multiplay

2 days agoMerge from CheriBSD (3422ebe71b6c06fe78b1be73623b240c219e08e3):
brooks [Fri, 21 Nov 2014 20:54:12 +0000 (20:54 +0000)]
Merge from CheriBSD (3422ebe71b6c06fe78b1be73623b240c219e08e3):

Rename beripic to beripic0.

MFC after: 1 week
Sponsored by: DARPA, AFRL

2 days agoImprove support for XSAVE with debuggers.
jhb [Fri, 21 Nov 2014 20:53:17 +0000 (20:53 +0000)]
Improve support for XSAVE with debuggers.
- Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed
  to match what Linux does in that 1) it dumps the entire XSAVE area
  including the fxsave state, and 2) it stashes a copy of the current
  xsave mask in the unused padding between the fxsave state and the
  xstate header at the same location used by Linux.
- Teach readelf() to recognize NT_X86_XSTATE notes.
- Change PT_GET/SETXSTATE to take the entire XSAVE state instead of
  only the extra portion. This avoids having to always make two
  ptrace() calls to get or set the full XSAVE state.
- Add a PT_GET_XSTATE_INFO which returns the length of the current
  XSTATE save area (so the size of the buffer needed for PT_GETXSTATE)
  and the current XSAVE mask (%xcr0).

Differential Revision: https://reviews.freebsd.org/D1193
Reviewed by: kib
MFC after: 2 weeks

2 days agoAdd FPU support for MIPS setjmp(3)/longjmp(3).
brooks [Fri, 21 Nov 2014 20:02:06 +0000 (20:02 +0000)]
Add FPU support for MIPS setjmp(3)/longjmp(3).

This change saves/restores the callee-saved MIPS floating point
registers as documented by the o32/n32/n64 spec ("MIPSpro N32
ABI Handbook", Table 2-1) for the _setjmp(3), _longjmp(3),
setjmp(3) and longjmp(3) C library functions.  This is only
included when the C library is built with hardware floating point
support (or when "SOFTFLOAT" is not defined).

Submitted by: sson
MFC after: 1 month
Sponsored by: DARPA, AFRL

2 days agoSlightly alter the handling of LOCAL_LIB_DIRS to skip addition of
brooks [Fri, 21 Nov 2014 18:35:48 +0000 (18:35 +0000)]
Slightly alter the handling of LOCAL_LIB_DIRS to skip addition of
directories in LOCAL_LIB_DIRS if they are subdirectories of directories
listed in LOCAL_DIRS.  This allows a hierarchy like:

foo
foo/lib
foo/usr.bin
foo/usr.sbin

to be supported with LOCAL_DIRS=foo LOCAL_DIRS=foo/lib.

MFC after: 1 week
Sponsored by: DARPA, AFRL

2 days agoAdd a guard against attempting to invoke the buildenv target with -j# as
brooks [Fri, 21 Nov 2014 18:18:37 +0000 (18:18 +0000)]
Add a guard against attempting to invoke the buildenv target with -j# as
that silently exits rather than doing something useful.

MFC after: 1 week
Sponsored by: DARPA, AFRL

2 days agoMake cfiscsi_offline() synchronous, waiting for connections termination
mav [Fri, 21 Nov 2014 18:05:02 +0000 (18:05 +0000)]
Make cfiscsi_offline() synchronous, waiting for connections termination
before return.  This should make ctld restart more clean and predictable.

MFC after: 2 weeks

2 days agoIn conf_apply() remove iSCSI ports from kernel before removing LUNs.
mav [Fri, 21 Nov 2014 18:00:00 +0000 (18:00 +0000)]
In conf_apply() remove iSCSI ports from kernel before removing LUNs.

Previous order confused initiators with messages about "removed" LUNs
during simple ctld restart without any real config change.  After this
commit initiators only reestablish lost connection, receive "Power on
occurred" UNIT ATTENTION status and continue normal operation.

MFC after: 1 month

2 days agoCreate a vimage.9 link to vnet.9
rodrigc [Fri, 21 Nov 2014 17:57:37 +0000 (17:57 +0000)]
Create a vimage.9 link to vnet.9

Requested by: glebius

2 days agoMake MLINKS text match text in bsd.man.mk added by wosch@ in 1996.
rodrigc [Fri, 21 Nov 2014 17:55:38 +0000 (17:55 +0000)]
Make MLINKS text match text in bsd.man.mk added by wosch@ in 1996.

2 days agoFix error handling.
trasz [Fri, 21 Nov 2014 16:14:32 +0000 (16:14 +0000)]
Fix error handling.

MFC after: 1 month
Coverity CID: 1249768
Sponsored by: The FreeBSD Foundation

2 days agoDocument use of wildcards (*) and ampersands (&) in autofs map files.
trasz [Fri, 21 Nov 2014 15:49:41 +0000 (15:49 +0000)]
Document use of wildcards (*) and ampersands (&) in autofs map files.

Differential Revision: https://reviews.freebsd.org/D1199
Reviewed by: wblock@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

2 days agoClose race between cfiscsi_offline() and new connection arrival.
mav [Fri, 21 Nov 2014 15:38:31 +0000 (15:38 +0000)]
Close race between cfiscsi_offline() and new connection arrival.

Incoming connection should be either rejected or accepted and terminated.

2 days agoSimply remove the tmp dir before creating the symlink. We are doing
n_hibma [Fri, 21 Nov 2014 14:53:42 +0000 (14:53 +0000)]
Simply remove the tmp dir before creating the symlink. We are doing
chroots all over the place, so there is bound to be a stale file lying
around in there (in my case samba lock files from creating accounts). If
we don't do that, the symlink later will fail.

2 days agoAdd missing error checking for kernel_port_{add,remove}(). Both can fail
trasz [Fri, 21 Nov 2014 12:35:18 +0000 (12:35 +0000)]
Add missing error checking for kernel_port_{add,remove}().  Both can fail
for reasons yet unknown; don't make it increment cumulated_error as a kind
of temporary workaround.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

2 days agoRemove bunch of unused lun variables.
mav [Fri, 21 Nov 2014 11:21:39 +0000 (11:21 +0000)]
Remove bunch of unused lun variables.

MFC after: 1 week

2 days agoReduce race between LUN destruction and request arrival.
mav [Fri, 21 Nov 2014 11:20:24 +0000 (11:20 +0000)]
Reduce race between LUN destruction and request arrival.

MFC after: 1 week

2 days agoFix build for certain MIPS kernels hiding an unused variable under #ifndef.
bz [Fri, 21 Nov 2014 10:47:29 +0000 (10:47 +0000)]
Fix build for certain MIPS kernels hiding an unused variable under #ifndef.

2 days agoLog errors for absent LUNs too.
mav [Fri, 21 Nov 2014 08:24:37 +0000 (08:24 +0000)]
Log errors for absent LUNs too.

MFC after: 1 week

2 days agoPartially reconstruct Active/Standby clusting.
mav [Fri, 21 Nov 2014 06:27:37 +0000 (06:27 +0000)]
Partially reconstruct Active/Standby clusting.

In this mode one head is in Active state, supporting all commands, while
another is in Standby state, supporting only minimal LUN discovery subset.

It is still incomplete since Standby state requires reservation support,
which is impossible to do right without having interlink between heads.
But it allows to run some basic experiments.

2 days agoFix smbfs to not zero out statfs f_flags field. Previously, this
trasz [Fri, 21 Nov 2014 06:21:39 +0000 (06:21 +0000)]
Fix smbfs to not zero out statfs f_flags field. Previously, this
made getmntinfo() return empty flags for smbfs filesystems when
called with MNT_WAIT. It's not visible with mount(8), since it uses
MNT_NOWAIT, but broke autounmount(8) operation.

PR: 195161
Differential Revision: https://reviews.freebsd.org/D1194
Reviewed by: kib@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation

3 days agoFix the powerpc64 build.
jhibbits [Fri, 21 Nov 2014 02:45:39 +0000 (02:45 +0000)]
Fix the powerpc64 build.

Pointy-hat to: me
X-MFC-with: r274735

3 days agoUse canonical __PIC__ flag
emaste [Fri, 21 Nov 2014 02:05:48 +0000 (02:05 +0000)]
Use canonical __PIC__ flag

It is automatically set when -fPIC is passed to the compiler.

Reviewed by: dim, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1179

3 days agoRecommit r274750.
imp [Fri, 21 Nov 2014 01:43:55 +0000 (01:43 +0000)]
Recommit r274750.

3 days agoClamp too-large hwpmc callchaindepth to the maximum
emaste [Thu, 20 Nov 2014 23:16:19 +0000 (23:16 +0000)]
Clamp too-large hwpmc callchaindepth to the maximum

If the depth requested by the user is too large, it's better to provide
the maximum than the smaller default.

Sponsored by: The FreeBSD Foundation

3 days agoBack our r274750 until discussions on proper fix are over.
imp [Thu, 20 Nov 2014 21:18:19 +0000 (21:18 +0000)]
Back our r274750 until discussions on proper fix are over.

3 days agoLock the scsi_low code and the drivers which use it along with other
jhb [Thu, 20 Nov 2014 20:50:05 +0000 (20:50 +0000)]
Lock the scsi_low code and the drivers which use it along with other
related cleanups:
- Require each driver to initalize a mutex in the scsi_low_softc that
  is shared with the scsi_low code.  This mutex is used for CAM SIMs,
  timers, and interrupt handlers.
- Replace the osdep function switch with direct calls to the relevant
  CAM functions and direct manipulation of timers via callout(9).
- Collapse the CAM-specific scsi_low_osdep_interface substructure
  directly into scsi_low_softc.
- Use bus_*() instead of bus_space_*().
- Return BUS_PROBE_DEFAULT from probe routines instead of 0.
- No need to zero softcs.
- Pass 0ul and ~0ul instead of 0 and ~0 to bus_alloc_resource().
- Spell "dettach" as "detach".
- Remove unused 'dvname' variables.
- De-spl().

Tested by: no one

3 days agoLock spic(4) and mark it MPSAFE:
jhb [Thu, 20 Nov 2014 20:24:30 +0000 (20:24 +0000)]
Lock spic(4) and mark it MPSAFE:
- Add a per-softc mutex as a driver lock.
- Use callout(9) instead of timeout(9).
- Set softc pointer in si_drv1 of cdev instead of looking softc
  up via devclass in cdev methods.

Tested by: no one

3 days agoVarious fixes for wl(4):
jhb [Thu, 20 Nov 2014 20:09:18 +0000 (20:09 +0000)]
Various fixes for wl(4):
- Don't recurse driver mutex.
- Don't hold driver mutex across fubyte/subyte.
- Replace fubyte/subyte loops with copyin/copyout calls.
- Use relatively sane locking in wl_ioctl().
- Use bus space accessors instead of in*()/out*().
- Use callout(9) instead of timeout(9).
- Stop watchdog timer in detach and don't hold mutex across
  bus_teardown_intr().
- Use device_printf() and if_printf().
- De-spl().

Tested by: no one

3 days agoRemove residual xpt_release_device() call left after r272406 cleanup.
mav [Thu, 20 Nov 2014 19:28:42 +0000 (19:28 +0000)]
Remove residual xpt_release_device() call left after r272406 cleanup.

Excessive release here could trigger use-after-free condition and kernel
panic on LUN 0 disconnect.

MFC after: 1 week

3 days agoActually, that was a bad idea. Go back to MAXPARTITIONS.
imp [Thu, 20 Nov 2014 17:31:25 +0000 (17:31 +0000)]
Actually, that was a bad idea. Go back to MAXPARTITIONS.

Submitted by: bruce

3 days agoAdd L2-cache writeback/flush operations. Supported 32,128-byte line-size,
br [Thu, 20 Nov 2014 17:06:41 +0000 (17:06 +0000)]
Add L2-cache writeback/flush operations. Supported 32,128-byte line-size,
else ignored. Cavium Networks also ignored as it has non-standard config
registers.

Obtained from: NetBSD
Sponsored by: DARPA, AFRL

3 days agoThe ranges parent bus address may just be a tag to the entry in the parent
andrew [Thu, 20 Nov 2014 17:03:40 +0000 (17:03 +0000)]
The ranges parent bus address may just be a tag to the entry in the parent
node. Take this in to account by searching until we find the range for the
root node.

Differential Revision: https://reviews.freebsd.org/D1160
Reviewed by: ian
Obtained from: ABT Systems Ltd
Sponsored by: The FreeBSD Foundation

3 days agoUse geom attribute "PART::type" to determine partition type and choose
ae [Thu, 20 Nov 2014 16:31:31 +0000 (16:31 +0000)]
Use geom attribute "PART::type" to determine partition type and choose
relevant fsck_xxx utility.

MFC after: 1 week

3 days agoSpell out "Windows" - no need to censor it in a man page
emaste [Thu, 20 Nov 2014 14:18:07 +0000 (14:18 +0000)]
Spell out "Windows" - no need to censor it in a man page

3 days agoMFp4: @179066
rodrigc [Thu, 20 Nov 2014 09:56:34 +0000 (09:56 +0000)]
MFp4: @179066

Add page which describes VNET network stack virtualization infrastructure.

Submitted by: bz
Sponsored by: The FreeBSD Foundation
Sponsored by: CK Software GmbH

3 days agoSet the current vnet inside the ioctl handler for ipfilter.
rodrigc [Thu, 20 Nov 2014 08:11:54 +0000 (08:11 +0000)]
Set the current vnet inside the ioctl handler for ipfilter.

Without this fix, the vnet was NULL and would crash.
This fix is similar to what was done inside the ioctl handler for PF.

Tested by:
   (1) Boot a kernel with "options VIMAGE" enabled
   (2) Type:

   echo "map lo0 from 10.0.0.0/24 to ! 10.0.0.0/24 -> 127.0.0.1/32" > /etc/ipnat.rules ; service ipnat onerestart

PR: 176992
Differential Revision: https://reviews.freebsd.org/D1191
Reviewed by: cy

3 days agocpudep_ap_early_bootstrap() takes no arguments, so no need to give it one.
jhibbits [Thu, 20 Nov 2014 06:32:47 +0000 (06:32 +0000)]
cpudep_ap_early_bootstrap() takes no arguments, so no need to give it one.

MFC after: 3 weeks

3 days agoUniformly refer to a file system as "file system".
trasz [Thu, 20 Nov 2014 06:14:40 +0000 (06:14 +0000)]
Uniformly refer to a file system as "file system".

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

3 days agoAdd example on how to use gpart before growfs. While here, reorder examples
trasz [Thu, 20 Nov 2014 06:12:11 +0000 (06:12 +0000)]
Add example on how to use gpart before growfs.  While here, reorder examples
so that the simplest one comes first.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

3 days ago* Add a random device
adrian [Thu, 20 Nov 2014 05:54:29 +0000 (05:54 +0000)]
* Add a random device
* Use the same rootdev path as MALTA, so the same emulator setups
  can be used with minimal fuss.

3 days agoInclude a random device.
adrian [Thu, 20 Nov 2014 05:52:48 +0000 (05:52 +0000)]
Include a random device.

3 days agoDocument growfs(8) feature apparently nobody knows about.
trasz [Thu, 20 Nov 2014 05:31:41 +0000 (05:31 +0000)]
Document growfs(8) feature apparently nobody knows about.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

3 days agoUse proper ordering in EXAMPLES section in growfs(8).
trasz [Thu, 20 Nov 2014 05:25:52 +0000 (05:25 +0000)]
Use proper ordering in EXAMPLES section in growfs(8).

MFC after: 1 month
Sponsored by: The FreeBSD Foundation

4 days agoI agree w/ tedu that this isn't a Bug.. it's like complaining that
jmg [Thu, 20 Nov 2014 04:15:58 +0000 (04:15 +0000)]
I agree w/ tedu that this isn't a Bug.. it's like complaining that
you can't use an ssh client to fetch a web page...

Submitted by: tedu (via -tech)