Resync comments about scbus and pass for life after AHCI joined CAM.

Sponsored by: Netflix


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270912 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add the reverse part to rule #9. Also change its description in the
netstat(8) output.

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270927 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Explicitly free packet on PF_DROP, otherwise a "quick" rule with
"route-to" may still forward it.

PR:		177808
Submitted by:	Kajetan Staszkiewicz <kajetan.staszkiewicz innogames.de>
Sponsored by:	InnoGames GmbH


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270928 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Make SOCK_RAW sockets to be truly raw, not modifying received and sent
packets at all. Swapping byte order on SOCK_RAW was actually a bug, an
artifact from the BSD network stack, that used to convert a packet to
native byte order once it is received by kernel.

Other operating systems didn't follow this, and later other BSD
descendants fixed this, leaving us alone with the bug. Now it is
clear that we should fix the bug.

In collaboration with:	Olivier Cochard-Labbé <olivier cochard.me>
See also:		https://wiki.freebsd.org/SOCK_RAW
Sponsored by:		Nginx, Inc.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270929 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Do not generate unwind info in asm functions if _STANDALONE is defined.
The .fnend op causes the assembler to emit RELOC references to unwind
support functions that don't exist in libstand.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270930 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix typo (by -> be).

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix a tab that somehow became 8 spaces.

Remove parentheses in a return statement to be consistent with the
rest of the file.

Rename sin_pi() in the float version to sin_pif().

Remove large comment that precedes sin_pif().  The comment
duplicates a comment in e_lgamma_r.c where the algorithm
is documented.

Requested by:	bde


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270932 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add references to vt(4) to further man-pages.

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270933 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Final patches to the tools used to convert syscons keymaps for use with
vt.

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270934 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add vt(4) support to the console initialisation script, specifically:

- Identify the console driver used and print syscons or vt as appropriate.

- If vt is used and a keymap could not be loaded, then try to replace the
  keymap name configured in rc.conf based on a replacement list in this
  script. Warn about the fact, that a syscons keyname is configured and
  report the replacement used under vt.

- If no replacement keymap is found, no keymap is loaded and a warning
  is displayed, which points at the conversion script and allows the
  conversion of keymaps not part of the official distribution.

This patch has been sent to the -hackers list for review, but no comment
has been received, yet. It is tested to work under syscons and vt on my
system (on vt with either the syscons or vt keymap file name in rc.conf).

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270935 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add lock annotations to <sys/cdefs.h>.

Clang has support for annotating mutexes and code that uses mutexes to
validate certain aspects of thread safety:

- Whether acquiring/releasing locks is done properly (e.g., whether you
  unlock a mutex before leaving a function).
- Whether a lock is held while reading/writing data from/to memory.

Analysis is performed at the function level. Functions can be annotated
to indicate they:

- (try to) pick up a lock,
- release a lock,
- can only be called when (not) holding a lock,
- assert that a lock is held.

Variables and structure members can be annotated to indicate that they
are guarded by a certain lock. In C++, these annotations can refer
to both global variables, but also other class/structure members. In C,
it is only possible to refer to global variables.

This change adds wrappers for the annotations used by Clang to
<sys/cdefs.h>. They currently have no effect, but this is on purpose.
This change will be merged back to FreeBSD 9 and 10, which means we can
safely experiment with these annotations on HEAD without making it
harder to port changes back.

Reviewed by:	announced on arch@ and toolchain@
MFC after:	3 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270941 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Enable lock annotations on HEAD when using Clang.

MFC after:	never


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270942 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add lock annotations to the header files of our threading libraries.

This change extends all of the functions present in the <pthread.h> and
<threads.h> headers to have lock annotations. This will allow Clang to
warn about the following:

- Locking a function twice,
- Unlocking a function without a mutex being locked,
- Forgetting to unlock a mutex before returning,
- Destroying or reinitializing a mutex that is currenty locked,
- Using an unlocked mutex in combination with a condition variable.

Enabling these annotations already allowed me to catch a bug in one of
our userspace tools (r270749).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270943 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add lock annotations to the threading API used by hastd.

Approved by:	pjd@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270944 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().

Discussed with:	nwhitehorn


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270945 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
According to the ISO C standard, lgamma(-integer) returns
inf and raises the divided-by-zero exception.  Compilers
constant fold one/zero to inf but do not raise the exception.
Introduce a volatile vzero to prevent the constant folding.

Move the declaration of zero into the main declaration block.

While here, fix a nearby disordering of 'lx,ix'

Discussed with:	bde


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270947 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sdhci.h has grown a dependency on sysctl.h, include the latter where needed.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270948 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add lock annotations to libcuse.

- Add annotations to the lock/unlock function to indicate that the
  function is allowed to lock and unlock the underlying pthread mutex.

- Add __guarded_by() annotations to the global variables.

Approved by:	hselasky@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270950 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add -Wthread-safety to WARNS=6.

While there, add a NO_WTHREAD_SAFETY flag that can be used to disable
this specific warning flag. Disable it for auditdistd. We can easily
patch up auditdistd to have the right annotations to build, but as
auditdistd is intended to be portable across other operating systems,
it's not worth the effort.

Approved by:	brueffer@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270951 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add bsearch_b to the libc map and the stdlib header.

bsearch_b is the Apple blocks enabled version of bsearch(3).
This was added to libc in Revision 264042 but the commit
missed the declaration required to make use of it.

While here move some other block-related functions to the
BSD_VISIBLE block as these are non-standard.

Phabric:	D638
Reviewed by:	theraven, wollman


git-svn-id: svn+ssh://svn.freebsd.org/base/head@270952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f