Merge branch 'freebsd/current/main' into hardened/current/master

This commit is contained in:
HardenedBSD Sync Services 2024-11-04 12:01:25 -07:00
commit d120f9f918
No known key found for this signature in database
33 changed files with 301 additions and 97 deletions

View File

@ -51,6 +51,9 @@
# xargs -n1 | sort | uniq -d;
# done
# 20241104: remove the outdated c2x.7 symlink in favor of c23.7
OLD_FILES+=usr/share/man/man7/c2x.7.gz
# 20241023: new clang import which bumps version from 18 to 19
OLD_FILES+=usr/lib/clang/18/include/__clang_cuda_builtin_vars.h
OLD_FILES+=usr/lib/clang/18/include/__clang_cuda_cmath.h

View File

@ -585,5 +585,5 @@ as mentor.
.Sh AUTHORS
Kyle Kneitinger, mentored as above.
.Pp
Post-GSoC changes were written by
Post-GSoC changes were written by
.An Kyle Evans (kevans) Aq Mt kevans@freebsd.org .

View File

@ -175,7 +175,7 @@ All network numbers and local address parts are
returned as machine byte order integer values.
.Sh INTERNET ADDRESSES (IP VERSION 4)
The
.Fn inet_aton
.Fn inet_aton
and
.Fn inet_addr
functions accept IPv4

View File

@ -204,7 +204,7 @@ If no mount is found, NULL is returned.
.Pp
The
.Fn chkdoreload
function takes a pointer to a
function takes a pointer to a
.Vt "struct statfs" .
If the filesystem associated with the mount point is mounted read-only,
.Fn chkdoreload

View File

@ -822,7 +822,7 @@ for the
.Cm connect
command.
.Ss telemetry-log
Extract the telemetry log associated with
Extract the telemetry log associated with
.Ar device-id ,
using the specified parameters:
.Bl -tag -width 6n

View File

@ -182,8 +182,8 @@ OSSL_DECODER_INSTANCE_get_input_structure
\& int OSSL_DECODER_CTX_set_input_structure(OSSL_DECODER_CTX *ctx,
\& const char *input_structure);
\& int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder);
\& int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
\& OSSL_LIB_CTX *libctx,
\& int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
\& OSSL_LIB_CTX *libctx,
\& const char *propq);
\& int OSSL_DECODER_CTX_get_num_decoders(OSSL_DECODER_CTX *ctx);
\&

View File

@ -172,7 +172,7 @@ with the \fBX509_STORE_CTX\fR to call the \fBSSL_set_retry_verify()\fR function:
\&
\& /* this should not happen but check anyway */
\& if (idx < 0
\& || (ssl = X509_STORE_CTX_get_ex_data(ctx, idx)) == NULL)
\& || (ssl = X509_STORE_CTX_get_ex_data(ctx, idx)) == NULL)
\& return 0;
\&
\& if (/* we need to retry verification callback */)

View File

@ -321,7 +321,7 @@ or \s-1NULL\s0 on error.
0 on error.
.PP
\&\fBX509_LOOKUP_ctrl()\fR returns \-1 if the \fBX509_LOOKUP\fR doesn't have an
associated \fBX509_LOOKUP_METHOD\fR, or 1 if the
associated \fBX509_LOOKUP_METHOD\fR, or 1 if the
doesn't have a control function.
Otherwise, it returns what the control function in the
\&\fBX509_LOOKUP_METHOD\fR returns, which is usually 1 on success and 0 in

View File

@ -221,7 +221,7 @@ Run benchmarks for \fInum\fR seconds.
.IP "\fB\-bytes\fR \fInum\fR" 4
.IX Item "-bytes num"
Run benchmarks on \fInum\fR\-byte buffers. Affects ciphers, digests and the \s-1CSPRNG.\s0
The limit on the size of the buffer is \s-1INT_MAX\s0 \- 64 bytes, which for a 32\-bit
The limit on the size of the buffer is \s-1INT_MAX\s0 \- 64 bytes, which for a 32\-bit
int would be 2147483583 bytes.
.IP "\fB\-mr\fR" 4
.IX Item "-mr"

View File

@ -369,7 +369,7 @@ bits in the array of
bits referenced by
.Fa name ,
at or after the zero-based bit index
.Fa start
.Fa start
in which all bits have the value
.Fa match .
If no sequence of contiguous such bits of the specified

View File

@ -52,7 +52,7 @@
.Ft int
.Fo pthread_condattr_getpshared
.Fa "pthread_condattr_t * restrict attr" "int * restrict pshared"
.Fc
.Fc
.Ft int
.Fn pthread_condattr_setpshared "pthread_condattr_t *attr" "int pshared"
.Sh DESCRIPTION

View File

@ -16,7 +16,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd February 4, 2023
.Dd February 4, 2023
.Dt U3G 4
.Os
.Sh NAME

View File

@ -42,7 +42,8 @@ MLINKS+= c.7 c95.7
MLINKS+= c.7 c99.7
MLINKS+= c.7 c11.7
MLINKS+= c.7 c17.7
MLINKS+= c.7 c2x.7
MLINKS+= c.7 c23.7
MLINKS+= c.7 c2y.7
.if ${MK_INET} != "no"
MAN+= networking.7

View File

@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd April 20, 2021
.Dd November 4, 2024
.Dt C 7
.Os
.Sh NAME
@ -34,7 +34,8 @@
.Nm c99 ,
.Nm c11 ,
.Nm c17 ,
.Nm c2x
.Nm c23 ,
.Nm c2y
.Nd The C programming language
.Sh DESCRIPTION
C is a general purpose programming language, which has a strong connection
@ -112,9 +113,12 @@ development of the language did not stop.
.Pp
The ISO C standard was later extended with an amendment as
ISO/IEC 9899/AMD1 in 1995.
This contained, for example, the wide-character support in <wchar.h> and
<wctype.h>, and also restricted character set support via diagraphs and
<iso646.h>.
This contained, for example, the wide-character support in
.In wchar.h
and
.In wctype.h ,
and also restricted character set support via diagraphs and
.In iso646.h .
This amendment is usually referred to as C95.
Two technical corrigenda were also published: Technical Corrigendum 1 as
ISO/IEC 9899/COR1 in 1994 and Technical Corrigendum 2 as ISO/IEC 9899/COR2
@ -130,18 +134,23 @@ The improvements include (but are not limited to) the following:
.Bl -bullet -offset indent
.It
digraphs, trigraphs, and alternative spellings for the operators that
use non-ISO646 characters in <iso646.h>
use non-ISO646 characters in
.In iso646.h
.It
extended multibyte and wide character library support in <wchar.h> and
<wctype.h>
extended multibyte and wide character library support in
.In wchar.h
and
.In wctype.h
.It
variable length arrays
.It
flexible array members
.It
complex (and imaginary) number arithmetic support in <complex.h>
complex (and imaginary) number arithmetic support in
.In complex.h
.It
type-generic math macros in <tgmath.h>
type-generic math macros in
.In tgmath.h
.It
the long long int type and library functions
.It
@ -157,15 +166,24 @@ BCPL style single-line comments
.It
allow mixed declarations and code
.It
the vscanf family of functions in <stdio.h> and <wchar.h>
the
.Fn vscanf
family of functions in
.In stdio.h
and
.In wchar.h
.It
allow trailing comma in enum declaration
.It
inline functions
.It
the snprintf family of functions in <stdio.h>
the
.Fn snprintf
family of functions in
.In stdio.h
.It
boolean type and macros in <stdbool.h>
boolean type and macros in
.In stdbool.h
.It
empty macro arguments
.It
@ -173,7 +191,8 @@ _Pragma preprocessing operator
.It
__func__ predefined identifier
.It
va_copy macro in <stdarg.h>
va_copy macro in
.In stdarg.h
.It
additional strftime conversion specifiers
.El
@ -185,24 +204,34 @@ and ISO/IEC 9899:1999/COR3:2007.
The improvements include (but are not limited to) the following:
.Bl -bullet -offset indent
.It
support for multiple threads of execution and atomic operations in <threads.h>
and <stdatomic.h>
support for multiple threads of execution and atomic operations in
.In threads.h
and
.In stdatomic.h
.It
additional floating-point characteristic macros in <float.h>
additional floating-point characteristic macros in
.In float.h
.It
querying and specifying alignment of objects in <stdalign.h> and <stdlib.h>
querying and specifying alignment of objects in
.In stdalign.h
and
.In stdlib.h
.It
Unicode character types and functions in <uchar.h>
Unicode character types and functions in
.In uchar.h
.It
type-generic expressions
.It
static assertions in <assert.h>
static assertions in
.In assert.h
.It
anonymous structures and unions
.It
remove the gets function from <stdio.h>
remove the gets function from
.In stdio.h
.It
add the aligned_alloc, at_quick_exit, and quick_exit functions in <stdlib.h>
add the aligned_alloc, at_quick_exit, and quick_exit functions in
.In stdlib.h
.El
.Pp
C11 was later superseded by ISO/IEC 9899:2018, also known as C17 which was
@ -211,17 +240,154 @@ It incorporates the Technical Corrigendum 1 (ISO/IEC 9899:2011/COR1:2012)
which was published in 2012.
It addressed defects and deficiencies in C11 without introducing new features,
only corrections and clarifications.
Since there were no major changes in C17, the current standard for
Programming Language C, is still considered C11 \(em ISO/IEC 9899:2011, published
2011-12-08.
.Pp
The next standard, the fifth, is currently referred to as C2x and is scheduled
to be adopted by the end of 2021, with a publication date of 2022.
When published, it will cancel and replace the fourth edition, ISO/IEC
9899:2018.
C23, formally ISO/IEC 9899:2024, is the current standard with significant
updates that supersede C17 (ISO/IEC 9899:2018).
The standardization effort began in 2016, informally as C2x, with the first
WG14 meeting in 2019, and was officially published on October 31, 2024.
C23 was originally anticipated for an earlier release, but the timeline was
extended due to COVID-19 pandemic.
With C23, the value of __STDC_VERSION__ has been updated from 201710L to
202311L.
Key changes include (but are not limited to) the following:
.Bl -bullet -offset indent
.It
Add null pointer type nullptr_t and the nullptr keyword
.It
Add constexpr keyword as a storage-class specifier for objects
.It
Redefine the usage of the auto keyword to support type inference while also
retaining its previous functionality as a storage-class specifier when used
with a type
.It
Add %b binary conversion specifier to the
.Fn printf
and
.Fn scanf
function families
.It
Add binary conversion support (0b and 0B) to the
.Fn strtol
and
.Fn wcstol
function families
.It
Add the #embed directive for binary resource inclusion and __has_embed to
check resource availability with preprocessor directives
.It
Add the #warning directive for diagnostics
.It
Add the #elifdef and #elifndef directives
.It
Add the u8 prefix for character literals to represent UTF-8 encoding,
compatible with C++17
.It
Add the char8_t type for UTF-8 encoded data and update the types of u8
character constants and string literals to char8_t
.It
Add functions
.Fn mbrtoc8
and
.Fn c8rtomb
to convert between narrow multibyte
characters and UTF-8 encoding
.It
Define all char16_t strings and literals as UTF-16 encoded and char32_t
strings and literals as UTF-32 encoded unless specified otherwise
.It
Allow storage-class specifiers within compound literals
.It
Support the latest IEEE 754 standard, ISO/IEC 60559:2020, with binary and
(optional) decimal floating-point arithmetic
.It
Add single-argument _Static_assert for compatibility with C++17
.It
Add _Decimal32, _Decimal64, _Decimal128 keywords for (optional) decimal
floating-point arithmetic
.It
Add digit separator ' (the single quote character) for literals
.It
Enable specification of the underlying type of an enum
.It
Standardize the
.Fn typeof
operator
.It
Add
.Fn memset_explicit
in
.In string.h
to securely erase sensitive data
regardless of optimizations
.It
Add
.Fn memccpy
in
.In string.h
for efficient string concatenation
.It
Add
.Fn memalignment
in
.In stdlib.h
to determine pointer alignment
.It
Add
.Fn strdup
and
.Fn strndup
in
.In string.h
to allocate string copies
.It
Introduce bit utility functions, macros, and types in the new header
.In stdbit.h
.It
Add
.Fn timegm
in
.In time.h
for converting time structures to calendar time
values
.It
Add __has_include for header availability checking via preprocessor
directives
.It
Add __has_c_attribute to check attribute availability via preprocessor
directives
.It
Add _BitInt(N) and unsigned _BitInt(N) for bit-precise integers, and
BITINT_MAXWIDTH for maximum bit width
.It
Elevate true and false to proper keywords (previously macros from
.In stdbool.h )
.It
Add keywords alignas, alignof, bool, static_assert, thread_local; previously
defined keywords remain available as alternative spellings
.It
Enable zero initialization with {} (including initialization of VLAs)
.It
Introduce C++11 style attributes using [[]], with adding [[deprecated]],
[[fallthrough]], [[maybe_unused]], [[nodiscard]], and [[noreturn]]
.It
Deprecate _Noreturn, noreturn, header
.In stdnoreturn.h
features introduced
in C11
.It
Remove trigraph support
.It
Remove K&R function definitions and declarations
.It
Remove non-two's-complement representations for signed integers
.El
.Pp
Some useful features have been provided as extensions by some compilers, but
they cannot be considered as standard features.
The next version of the C Standard, informally named C2y, is anticipated
to release within the next six years, targeting 2030 at the latest.
A charter for C2y is still being drafted and discussed, with several
papers under debate from the January 2024 meeting in Strasbourg, France
indicating that this new version may address long-standing requests and
deficiencies noted by the C community, while preserving its core strengths.
.Pp
ISO/IEC JTC1/SC22/WG14 committee is responsible for the ISO/IEC 9899,
C Standard.
@ -349,6 +515,11 @@ C Standard.
.%A ISO/IEC
.%T 9899:2018 (aka C17)
.Re
.Pp
.Rs
.%A ISO/IEC
.%T 9899:2024 (aka C23)
.Re
.Sh HISTORY
This manual page first appeared in
.Fx 9.0 .
@ -356,8 +527,6 @@ This manual page first appeared in
.An -nosplit
This manual page was originally written by
.An Gabor Kovesdan Aq Mt gabor@FreeBSD.org .
It was updated for
.Fx 14.0
by
It was updated by
.An Faraz Vahedi Aq Mt kfv@kfv.io
with information about more recent C standards.

View File

@ -101,7 +101,7 @@ are ignored, they just allow for symmetry with calls to
The optional
.Ar rc
value will be returned rather than the default of 0.
Thus if
Thus if
.Fn DebugOff
is the last operation in a function,
.Ar rc

View File

@ -193,7 +193,7 @@ These macros are meant to be used in the kernel and are visible if
or
.In sys/bitset.h
are included in a program.
Userland programs must define
Userland programs must define
.Dv _WANT_FREEBSD_BITSET
before including these files to make the macros visible.
.Pp

View File

@ -370,7 +370,7 @@ LRO system.
So for example if LRO pushed three in-order acknowledgements into
one acknowledgement the variable would be set to three.
.Pp
The
The
.Va labc
variable is used in conjunction with the CCF_USE_LOCAL_ABC flag
to override what labc variable the congestion controller will use

View File

@ -360,7 +360,7 @@ installations, setups and situations.
In this section, paths that are all lower case are Unix paths.
Paths that are all upper case are relative to the ESP mount point,
though they may appear as lower case on your system because the
FAT filesystem of the ESP is case insensitive.
FAT filesystem of the ESP is case insensitive.
.Pp
Locate the ESP, which has its own partition type of
.Dq efi :

View File

@ -40,36 +40,36 @@
#include "amdvi_priv.h"
#include "ivhd_if.h"
struct amdiommu_softc {
struct amdviiommu_softc {
struct resource *event_res; /* Event interrupt resource. */
void *event_tag; /* Event interrupt tag. */
int event_rid;
};
static int amdiommu_probe(device_t);
static int amdiommu_attach(device_t);
static int amdiommu_detach(device_t);
static int amdviiommu_probe(device_t);
static int amdviiommu_attach(device_t);
static int amdviiommu_detach(device_t);
static int ivhd_setup_intr(device_t, driver_intr_t, void *,
const char *);
static int ivhd_teardown_intr(device_t);
static device_method_t amdiommu_methods[] = {
static device_method_t amdviiommu_methods[] = {
/* device interface */
DEVMETHOD(device_probe, amdiommu_probe),
DEVMETHOD(device_attach, amdiommu_attach),
DEVMETHOD(device_detach, amdiommu_detach),
DEVMETHOD(device_probe, amdviiommu_probe),
DEVMETHOD(device_attach, amdviiommu_attach),
DEVMETHOD(device_detach, amdviiommu_detach),
DEVMETHOD(ivhd_setup_intr, ivhd_setup_intr),
DEVMETHOD(ivhd_teardown_intr, ivhd_teardown_intr),
DEVMETHOD_END
};
static driver_t amdiommu_driver = {
"amdiommu",
amdiommu_methods,
sizeof(struct amdiommu_softc),
static driver_t amdviiommu_driver = {
"amdviiommu",
amdviiommu_methods,
sizeof(struct amdviiommu_softc),
};
static int
amdiommu_probe(device_t dev)
amdviiommu_probe(device_t dev)
{
int error;
int capoff;
@ -99,7 +99,7 @@ amdiommu_probe(device_t dev)
}
static int
amdiommu_attach(device_t dev)
amdviiommu_attach(device_t dev)
{
device_set_desc(dev, "AMD-Vi/IOMMU PCI function");
@ -107,7 +107,7 @@ amdiommu_attach(device_t dev)
}
static int
amdiommu_detach(device_t dev)
amdviiommu_detach(device_t dev)
{
return (0);
@ -117,7 +117,7 @@ static int
ivhd_setup_intr(device_t dev, driver_intr_t handler, void *arg,
const char *desc)
{
struct amdiommu_softc *sc;
struct amdviiommu_softc *sc;
int error, msicnt;
sc = device_get_softc(dev);
@ -158,7 +158,7 @@ fail:
static int
ivhd_teardown_intr(device_t dev)
{
struct amdiommu_softc *sc;
struct amdviiommu_softc *sc;
sc = device_get_softc(dev);
@ -176,5 +176,5 @@ ivhd_teardown_intr(device_t dev)
}
/* This driver has to be loaded before ivhd */
DRIVER_MODULE(amdiommu, pci, amdiommu_driver, 0, 0);
MODULE_DEPEND(amdiommu, pci, 1, 1, 1);
DRIVER_MODULE(amdviiommu, pci, amdviiommu_driver, 0, 0);
MODULE_DEPEND(amdviiommu, pci, 1, 1, 1);

View File

@ -40,6 +40,9 @@
#ifndef _ICE_LIB_H_
#define _ICE_LIB_H_
/* include kernel options first */
#include "ice_opts.h"
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/rman.h>

View File

@ -68,14 +68,6 @@ CTASSERT(ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE >= RSS_KEYSIZE);
#define RSS_HASHTYPE_RSS_UDP_IPV6 (1 << 9) /* IPv6 UDP 4-tuple */
#define RSS_HASHTYPE_RSS_UDP_IPV6_EX (1 << 10) /* IPv6 UDP 4-tuple + ext hdrs */
#define ICE_DEFAULT_RSS_HASH_CONFIG \
((u_int)(RSS_HASHTYPE_RSS_IPV4 | \
RSS_HASHTYPE_RSS_TCP_IPV4 | \
RSS_HASHTYPE_RSS_UDP_IPV4 | \
RSS_HASHTYPE_RSS_IPV6 | \
RSS_HASHTYPE_RSS_TCP_IPV6 | \
RSS_HASHTYPE_RSS_UDP_IPV6))
#define rss_getkey(key) ice_get_default_rss_key(key)
#define rss_getnumbuckets() (mp_ncpus)
#define rss_get_indirection_to_bucket(index) (index)
@ -113,4 +105,12 @@ rss_hash2bucket(uint32_t hash_val, uint32_t hash_type, uint32_t *bucket_id)
#endif /* !RSS */
#define ICE_DEFAULT_RSS_HASH_CONFIG \
((u_int)(RSS_HASHTYPE_RSS_IPV4 | \
RSS_HASHTYPE_RSS_TCP_IPV4 | \
RSS_HASHTYPE_RSS_UDP_IPV4 | \
RSS_HASHTYPE_RSS_IPV6 | \
RSS_HASHTYPE_RSS_TCP_IPV6 | \
RSS_HASHTYPE_RSS_UDP_IPV6))
#endif /* _ICE_COMMON_COMPAT_H_ */

View File

@ -2225,16 +2225,14 @@ void
crcopy(struct ucred *dest, struct ucred *src)
{
/*
* Ideally, 'cr_ngroups' should be moved out of 'struct ucred''s bcopied
* area, but this would break the ABI, so is deferred until there is
* a compelling need to change it.
*/
bcopy(&src->cr_startcopy, &dest->cr_startcopy,
(unsigned)((caddr_t)&src->cr_endcopy -
(caddr_t)&src->cr_startcopy));
/*
* Avoids an assertion in crsetgroups() -> crextend(). Ideally,
* 'cr_ngroups' should be moved out of 'struct ucred''s bcopied area,
* but this would break the ABI, so is deferred until there is a real
* need to change the ABI.
*/
dest->cr_ngroups = 0;
dest->cr_flags = src->cr_flags;
crsetgroups(dest, src->cr_ngroups, src->cr_groups);
uihold(dest->cr_uidinfo);
@ -2483,6 +2481,13 @@ crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups)
if (ngrp > ngroups_max + 1)
ngrp = ngroups_max + 1;
/*
* crextend() asserts that groups are not set, as it may allocate a new
* backing storage without copying the content of the old one. Since we
* are going to install a completely new set anyway, signal that we
* consider the old ones thrown away.
*/
cr->cr_ngroups = 0;
crextend(cr, ngrp);
crsetgroups_internal(cr, ngrp, groups);
groups_normalize(&cr->cr_ngroups, cr->cr_groups);

View File

@ -5033,6 +5033,7 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
xso->so_uid = so->so_cred->cr_uid;
xso->so_pgid = so->so_sigio ? so->so_sigio->sio_pgid : 0;
SOCK_LOCK(so);
xso->so_fibnum = so->so_fibnum;
if (SOLISTENING(so)) {
xso->so_qlen = so->sol_qlen;
xso->so_incqlen = so->sol_incqlen;

View File

@ -110,7 +110,7 @@ SRCS+= ept.c \
# amd-specific files
.PATH: ${SRCTOP}/sys/amd64/vmm/amd
SRCS+= vmcb.c \
amdiommu.c \
amdviiommu.c \
ivhd_if.c \
ivhd_if.h \
svm.c \

View File

@ -576,8 +576,10 @@ static bool
pf_is_loopback(sa_family_t af, struct pf_addr *addr)
{
switch (af) {
#ifdef INET
case AF_INET:
return IN_LOOPBACK(ntohl(addr->v4.s_addr));
#endif
case AF_INET6:
return IN6_IS_ADDR_LOOPBACK(&addr->v6);
default:

View File

@ -2224,6 +2224,7 @@ pf_scrub(struct pf_pdesc *pd)
}
/* random-id, but not for fragments */
#ifdef INET
if (pd->af == AF_INET &&
pd->act.flags & PFSTATE_RANDOMID && !(h->ip_off & ~htons(IP_DF))) {
uint16_t ip_id = h->ip_id;
@ -2231,5 +2232,6 @@ pf_scrub(struct pf_pdesc *pd)
ip_fillid(h);
h->ip_sum = pf_cksum_fixup(h->ip_sum, ip_id, h->ip_id, 0);
}
#endif
}
#endif

View File

@ -615,7 +615,8 @@ struct xsocket {
uint32_t so_qlimit;
pid_t so_pgid;
uid_t so_uid;
int32_t so_spare32[8];
int32_t so_fibnum;
int32_t so_spare32[7];
int16_t so_type;
int16_t so_options;
int16_t so_linger;

View File

@ -25,7 +25,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd July 9, 2024
.Dd October 15, 2024
.Dt SOCKSTAT 1
.Os
.Sh NAME
@ -33,7 +33,7 @@
.Nd list open sockets
.Sh SYNOPSIS
.Nm
.Op Fl 46CcIiLlnqSsUuvw
.Op Fl 46CcfIiLlnqSsUuvw
.Op Fl j Ar jail
.Op Fl p Ar ports
.Op Fl P Ar protocols
@ -59,6 +59,8 @@ Display the congestion control module, if applicable.
This is currently only implemented for TCP.
.It Fl c
Show connected sockets.
.It Fl f
Show the FIB number of each socket.
.It Fl I
Show the local address of the socket to which the current socket is spliced, if
any.
@ -228,6 +230,7 @@ $ sockstat -6 -P tcp
.Xr fstat 1 ,
.Xr netstat 1 ,
.Xr procstat 1 ,
.Xr setfib 1 ,
.Xr inet 4 ,
.Xr inet6 4 ,
.Xr protocols 5

View File

@ -82,6 +82,7 @@ static int opt_4; /* Show IPv4 sockets */
static int opt_6; /* Show IPv6 sockets */
static int opt_C; /* Show congestion control */
static int opt_c; /* Show connected sockets */
static int opt_f; /* Show FIB numbers */
static int opt_I; /* Show spliced socket addresses */
static int opt_i; /* Show inp_gencnt */
static int opt_j; /* Show specified jail */
@ -140,6 +141,7 @@ struct sock {
int family;
int proto;
int state;
int fibnum;
const char *protoname;
char stack[TCP_FUNCTION_NAME_LEN_MAX];
char cc[TCP_CA_NAME_MAX];
@ -771,6 +773,7 @@ gather_inet(int proto)
sock->splice_socket = so->so_splice_so;
sock->proto = proto;
sock->inp_gencnt = xip->inp_gencnt;
sock->fibnum = so->so_fibnum;
if (xip->inp_vflag & INP_IPV4) {
sock->family = AF_INET;
sockaddr(&laddr->address, sock->family,
@ -1204,6 +1207,12 @@ displaysock(struct sock *s, int pos)
default:
abort();
}
if (opt_f) {
while (pos < offset)
pos += xprintf(" ");
pos += xprintf("%d", s->fibnum);
offset += 7;
}
if (opt_I) {
if (s->splice_socket != 0) {
struct sock *sp;
@ -1329,6 +1338,9 @@ display(void)
"USER", "COMMAND", "PID", "FD", "PROTO",
opt_w ? 45 : 21, "LOCAL ADDRESS",
opt_w ? 45 : 21, "FOREIGN ADDRESS");
if (opt_f)
/* RT_MAXFIBS is 65535. */
printf(" %-6s", "FIB");
if (opt_I)
printf(" %-*s", opt_w ? 45 : 21, "SPLICE ADDRESS");
if (opt_i)
@ -1453,9 +1465,8 @@ jail_getvnet(int jid)
static void
usage(void)
{
fprintf(stderr,
"usage: sockstat [-46CcIiLlnqSsUuvw] [-j jid] [-p ports] [-P protocols]\n");
exit(1);
errx(1,
"usage: sockstat [-46CcfIiLlnqSsUuvw] [-j jid] [-p ports] [-P protocols]");
}
int
@ -1469,7 +1480,7 @@ main(int argc, char *argv[])
int o, i;
opt_j = -1;
while ((o = getopt(argc, argv, "46CcIij:Llnp:P:qSsUuvw")) != -1)
while ((o = getopt(argc, argv, "46CcfIij:Llnp:P:qSsUuvw")) != -1)
switch (o) {
case '4':
opt_4 = 1;
@ -1483,6 +1494,9 @@ main(int argc, char *argv[])
case 'c':
opt_c = 1;
break;
case 'f':
opt_f = 1;
break;
case 'I':
opt_I = 1;
break;

View File

@ -168,7 +168,7 @@ Scan the default bus (/dev/iic0) for devices:
.Pp
i2c -s
.It
Scan the default bus (/dev/iic0) for devices and skip addresses
Scan the default bus (/dev/iic0) for devices and skip addresses
0x45 to 0x47 (inclusive) and 0x56.
.Pp
i2c -s -n 0x56,45-47

View File

@ -951,7 +951,7 @@ A list of ZFS datasets to be attached to the jail.
This requires
.Va allow.mount.zfs
to be set.
See
See
.Xr zfs-jail 8
for information on how to configure a ZFS dataset to be operated from
within a jail.

View File

@ -305,7 +305,7 @@ flag is mostly useful in conjunction with
.Cm B
flag to prevent
.Xr newsyslog 8
from inserting an informational
from inserting an informational
.Tn ASCII
message into the new file.
.It Cm G

View File

@ -2,6 +2,6 @@ header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec
argument,1,0x1c,domain
argument,2,0x2,type
argument,3,0x0,protocol
subject,root,root,wheel,root,wheel,7053,4724,37636,10.0.2.2
subject,0,0,0,0,0,7053,4724,37636,10.0.2.2
return,success,3
trailer,113