diff --git a/lib/libc/locale/xlocale.3 b/lib/libc/locale/xlocale.3 index daa754dfc473..3af7a38a76d1 100644 --- a/lib/libc/locale/xlocale.3 +++ b/lib/libc/locale/xlocale.3 @@ -1,275 +1,275 @@ .\" Copyright (c) 2011 The FreeBSD Foundation .\" .\" This documentation was written by David Chisnall under sponsorship from .\" the FreeBSD Foundation. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (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 September 17, 2011 .Dt XLOCALE 3 .Os .Sh NAME .Nm xlocale .Nd Thread-safe extended locale support .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In xlocale.h .Sh DESCRIPTION The extended locale support includes a set of functions for setting thread-local locales, as well convenience functions for performing locale-aware calls with a specified locale. .Pp The core of the xlocale API is the .Fa locale_t type. This is an opaque type encapsulating a locale. Instances of this can be either set as the locale for a specific thread or passed directly to the .Fa _l suffixed variants of various standard C functions. Two special .Fa locale_t values are available: .Bl -bullet -offset indent .It NULL refers to the current locale for the thread, or to the global locale if no locale has been set for this thread. .It LC_GLOBAL_LOCALE refers to the global locale. .El .Pp The global locale is the locale set with the .Xr setlocale 3 function. .Sh SEE ALSO .Xr duplocale 3 , .Xr freelocale 3 , .Xr localeconv 3 , .Xr newlocale 3 , .Xr querylocale 3 , .Xr uselocale 3 .Sh CONVENIENCE FUNCTIONS The xlocale API includes a number of .Fa _l suffixed convenience functions. These are variants of standard C functions that have been modified to take an explicit .Fa locale_t parameter as the final argument or, in the case of variadic functions, as an additional argument directly before the format string. Each of these functions accepts either NULL or LC_GLOBAL_LOCALE. In these functions, NULL refers to the C locale, rather than the thread's current locale. If you wish to use the thread's current locale, then use the unsuffixed version of the function. .Pp These functions are exposed by including .In xlocale.h .Em after including the relevant headers for the standard variant. For example, the .Xr strtol_l 3 function is exposed by including .In xlocale.h after .In stdlib.h , which defines .Xr strtol 3 . .Pp For reference, a complete list of the locale-aware functions that are available in this form, along with the headers that expose them, is provided here: .Bl -tag -width " " .It In wctype.h .Xr iswalnum_l 3 , .Xr iswalpha_l 3 , .Xr iswcntrl_l 3 , .Xr iswctype_l 3 , .Xr iswdigit_l 3 , .Xr iswgraph_l 3 , .Xr iswlower_l 3 , .Xr iswprint_l 3 , .Xr iswpunct_l 3 , .Xr iswspace_l 3 , .Xr iswupper_l 3 , .Xr iswxdigit_l 3 , .Xr towlower_l 3 , .Xr towupper_l 3 , .Xr wctype_l 3 , .It In ctype.h .Xr digittoint_l 3 , .Xr isalnum_l 3 , .Xr isalpha_l 3 , .Xr isblank_l 3 , .Xr iscntrl_l 3 , .Xr isdigit_l 3 , .Xr isgraph_l 3 , .Xr ishexnumber_l 3 , .Xr isideogram_l 3 , .Xr islower_l 3 , .Xr isnumber_l 3 , .Xr isphonogram_l 3 , .Xr isprint_l 3 , .Xr ispunct_l 3 , .Xr isrune_l 3 , .Xr isspace_l 3 , .Xr isspecial_l 3 , .Xr isupper_l 3 , .Xr isxdigit_l 3 , .Xr tolower_l 3 , .Xr toupper_l 3 .It In inttypes.h .Xr strtoimax_l 3 , .Xr strtoumax_l 3 , .Xr wcstoimax_l 3 , .Xr wcstoumax_l 3 .It In langinfo.h .Xr nl_langinfo_l 3 .It In monetary.h .Xr strfmon_l 3 .It In stdio.h .Xr asprintf_l 3 , .Xr fprintf_l 3 , .Xr fscanf_l 3 , .Xr printf_l 3 , .Xr scanf_l 3 , .Xr snprintf_l 3 , .Xr sprintf_l 3 , .Xr sscanf_l 3 , .Xr vasprintf_l 3 , .Xr vfprintf_l 3 , .Xr vfscanf_l 3 , .Xr vprintf_l 3 , .Xr vscanf_l 3 , .Xr vsnprintf_l 3 , .Xr vsprintf_l 3 , .Xr vsscanf_l 3 .It In stdlib.h -.Xr atof_l 3 , -.Xr atoi_l 3 , -.Xr atol_l 3 , -.Xr atoll_l 3 , +.\".Xr atof_l 3 , +.\".Xr atoi_l 3 , +.\".Xr atol_l 3 , +.\".Xr atoll_l 3 , .Xr mblen_l 3 , .Xr mbstowcs_l 3 , .Xr mbtowc_l 3 , .Xr strtod_l 3 , .Xr strtof_l 3 , .Xr strtol_l 3 , .Xr strtold_l 3 , .Xr strtoll_l 3 , .Xr strtoul_l 3 , .Xr strtoull_l 3 , .Xr wcstombs_l 3 , .Xr wctomb_l 3 .It In string.h .Xr strcoll_l 3 , .Xr strxfrm_l 3 , .Xr strcasecmp_l 3 , .Xr strcasestr_l 3 , .Xr strncasecmp_l 3 .It In time.h .Xr strftime_l 3 .Xr strptime_l 3 .It In wchar.h .Xr btowc_l 3 , .Xr fgetwc_l 3 , .Xr fgetws_l 3 , .Xr fputwc_l 3 , .Xr fputws_l 3 , .Xr fwprintf_l 3 , .Xr fwscanf_l 3 , .Xr getwc_l 3 , .Xr getwchar_l 3 , .Xr mbrlen_l 3 , .Xr mbrtowc_l 3 , .Xr mbsinit_l 3 , .Xr mbsnrtowcs_l 3 , .Xr mbsrtowcs_l 3 , .Xr putwc_l 3 , .Xr putwchar_l 3 , .Xr swprintf_l 3 , .Xr swscanf_l 3 , .Xr ungetwc_l 3 , .Xr vfwprintf_l 3 , .Xr vfwscanf_l 3 , .Xr vswprintf_l 3 , .Xr vswscanf_l 3 , .Xr vwprintf_l 3 , .Xr vwscanf_l 3 , .Xr wcrtomb_l 3 , .Xr wcscoll_l 3 , .Xr wcsftime_l 3 , .Xr wcsnrtombs_l 3 , .Xr wcsrtombs_l 3 , .Xr wcstod_l 3 , .Xr wcstof_l 3 , .Xr wcstol_l 3 , .Xr wcstold_l 3 , .Xr wcstoll_l 3 , .Xr wcstoul_l 3 , .Xr wcstoull_l 3 , .Xr wcswidth_l 3 , .Xr wcsxfrm_l 3 , .Xr wctob_l 3 , .Xr wcwidth_l 3 , .Xr wprintf_l 3 , .Xr wscanf_l 3 .It In wctype.h .Xr iswblank_l 3 , .Xr iswhexnumber_l 3 , .Xr iswideogram_l 3 , .Xr iswnumber_l 3 , .Xr iswphonogram_l 3 , .Xr iswrune_l 3 , .Xr iswspecial_l 3 , .Xr nextwctype_l 3 , .Xr towctrans_l 3 , .Xr wctrans_l 3 .It In xlocale.h .Xr localeconv_l 3 .El .Sh STANDARDS The functions conform to .St -p1003.1-2008 . .Sh HISTORY The xlocale APIs first appeared in Darwin 8.0. This implementation was written by David Chisnall, under sponsorship from the FreeBSD Foundation and first appeared in .Fx 9.1 . .Sh CAVEATS The .Xr setlocale 3 function, and others in the family, refer to the global locale. Other functions that depend on the locale, however, will take the thread-local locale if one has been set. This means that the idiom of setting the locale using .Xr setlocale 3 , calling a locale-dependent function, and then restoring the locale will not have the expected behavior if the current thread has had a locale set using .Xr uselocale 3 . You should avoid this idiom and prefer to use the .Fa _l suffixed versions instead. diff --git a/share/man/man4/lagg.4 b/share/man/man4/lagg.4 index b2ca5a02b4a9..4eaed2cf3a88 100644 --- a/share/man/man4/lagg.4 +++ b/share/man/man4/lagg.4 @@ -1,251 +1,251 @@ .\" $OpenBSD: trunk.4,v 1.18 2006/06/09 13:53:34 jmc Exp $ .\" .\" Copyright (c) 2005, 2006 Reyk Floeter .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd January 16, 2023 .Dt LAGG 4 .Os .Sh NAME .Nm lagg .Nd link aggregation and link failover interface .Sh SYNOPSIS To compile this driver into the kernel, place the following line in your kernel configuration file: .Bd -ragged -offset indent .Cd "device lagg" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent if_lagg_load="YES" .Ed .Sh DESCRIPTION The .Nm interface allows aggregation of multiple network interfaces as one virtual .Nm interface for the purpose of providing fault-tolerance and high-speed links. .Pp Each .Nm interface is created at runtime using interface cloning. This is most easily done with the .Xr ifconfig 8 .Cm create command or using the .Va cloned_interfaces variable in .Xr rc.conf 5 . .Pp A .Nm interface can be created using the .Ic ifconfig lagg Ns Ar N Ic create command. It can use different link aggregation protocols specified using the .Ic laggproto Ar proto option. Child interfaces can be added using the .Ic laggport Ar child-iface option and removed using the .Ic -laggport Ar child-iface option. .Pp The driver currently supports the aggregation protocols .Ic failover (the default), .Ic lacp , .Ic loadbalance , .Ic roundrobin , .Ic broadcast , and .Ic none . The protocols determine which ports are used for outgoing traffic and whether a specific port accepts incoming traffic. The interface link state is used to validate if the port is active or not. .Bl -tag -width loadbalance .It Ic failover Sends traffic only through the active port. If the master port becomes unavailable, the next active port is used. The first interface added is the master port; any interfaces added after that are used as failover devices. .Pp By default, received traffic is only accepted when it is received through the active port. This constraint can be relaxed by setting the .Va net.link.lagg.failover_rx_all .Xr sysctl 8 variable to a nonzero value, which is useful for certain bridged network setups. .It Ic lacp Supports the IEEE 802.1AX (formerly 802.3ad) Link Aggregation Control Protocol (LACP) and the Marker Protocol. LACP will negotiate a set of aggregable links with the peer in to one or more Link Aggregated Groups. Each LAG is composed of ports of the same speed, set to full-duplex operation. The traffic will be balanced across the ports in the LAG with the greatest total speed, in most cases there will only be one LAG which contains all ports. In the event of changes in physical connectivity, Link Aggregation will quickly converge to a new configuration. .It Ic loadbalance Balances outgoing traffic across the active ports based on hashed protocol header information and accepts incoming traffic from any active port. This is a static setup and does not negotiate aggregation with the peer or exchange frames to monitor the link. The hash includes the Ethernet source and destination address, and, if available, the VLAN tag, and the IP source and destination address. .It Ic roundrobin Distributes outgoing traffic using a round-robin scheduler through all active ports and accepts incoming traffic from any active port. Using .Ic roundrobin mode can cause unordered packet arrival at the client. Throughput might be limited as the client performs CPU-intensive packet reordering. .It Ic broadcast Sends frames to all ports of the LAG and receives frames on any port of the LAG. .It Ic none This protocol is intended to do nothing: it disables any traffic without disabling the .Nm interface itself. .El .Pp The MTU of the first interface to be added is used as the lagg MTU. All additional interfaces are required to have exactly the same value. .Pp The .Ic loadbalance and .Ic lacp modes will use the RSS hash from the network card if available to avoid computing one, this may give poor traffic distribution if the hash is invalid or uses less of the protocol header information. Local hash computation can be forced per interface by setting the .Cm -use_flowid .Xr ifconfig 8 flag. The default for new interfaces is set via the .Va net.link.lagg.default_use_flowid .Xr sysctl 8 . .Pp When creating a .Nm interface, the .Ic laggtype can be specified as either .Cm ethernet or .Cm infiniband . If neither is specified then the default is .Cm ethernet . .Sh EXAMPLES Create a link aggregation using LACP with two .Xr bge 4 Gigabit Ethernet interfaces: .Bd -literal -offset indent # ifconfig bge0 up # ifconfig bge1 up # ifconfig lagg0 create # ifconfig lagg0 laggproto lacp laggport bge0 laggport bge1 \e 192.168.1.1 netmask 255.255.255.0 .Ed .Pp Create a link aggregation using ROUNDROBIN with two .Xr bge 4 Gigabit Ethernet interfaces and set a stride of 500 packets per interface: .Bd -literal -offset indent # ifconfig bge0 up # ifconfig bge1 up # ifconfig lagg0 create # ifconfig lagg0 laggproto roundrobin laggport bge0 laggport bge1 \e 192.168.1.1 netmask 255.255.255.0 # ifconfig lagg0 rr_limit 500 .Ed .Pp The following example uses an active failover interface to set up roaming between wired and wireless networks using two network devices. Whenever the wired master interface is unplugged, the wireless failover device will be used: .Bd -literal -offset indent # ifconfig em0 ether 00:11:22:33:44:55 up # ifconfig wlan0 create wlandev ath0 ssid my_net up # ifconfig lagg0 create # ifconfig lagg0 laggproto failover laggport em0 laggport wlan0 \e 192.168.1.1 netmask 255.255.255.0 .Ed .Pp (Note the MAC address of the wired device is forced to match that of the wireless device, .Sq 00:11:22:33:44:55 in this example, as some common wireless devices will not allow MAC addresses to be changed.) .Pp The following example shows how to create an infiniband failover interface. .Bd -literal -offset indent # ifconfig ib0 up # ifconfig ib1 up # ifconfig lagg0 create laggtype infiniband # ifconfig lagg0 laggproto failover laggport ib0 laggport ib1 \e 1.1.1.1 netmask 255.255.255.0 .Ed .Pp Configure two ethernets for failover with static IP in -.Xr /etc/rc.conf 5 : +.Pa /etc/rc.conf : .Bd -literal -offset indent cloned_interfaces="lagg0" ifconfig_lagg0="laggproto failover laggport bge0 laggport bge1 \e 10.1.29.21/24" ifconfig_bge0="up" ifconfig_bge1="up" .Ed .Sh SEE ALSO .Xr ng_one2many 4 , .Xr rc.conf 5 , .Xr ifconfig 8 , .Xr sysctl 8 .Sh HISTORY The .Nm device first appeared in .Fx 6.3 . .Sh AUTHORS .An -nosplit The .Nm driver was written under the name .Nm trunk by .An Reyk Floeter Aq Mt reyk@openbsd.org . The LACP implementation was written by .An YAMAMOTO Takashi for .Nx . .Sh BUGS There is no way to configure LACP administrative variables, including system and port priorities. The current implementation always performs active-mode LACP and uses 0x8000 as system and port priorities. diff --git a/share/man/man9/buf.9 b/share/man/man9/buf.9 index 975a1bf2074f..ecd4a1487735 100644 --- a/share/man/man9/buf.9 +++ b/share/man/man9/buf.9 @@ -1,144 +1,142 @@ .\" Copyright (c) 1998 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (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 December 22, 1998 .Dt BUF 9 .Os .Sh NAME .Nm buf .Nd "kernel buffer I/O scheme used in FreeBSD VM system" .Sh DESCRIPTION The kernel implements a KVM abstraction of the buffer cache which allows it to map potentially disparate vm_page's into contiguous KVM for use by (mainly file system) devices and device I/O. This abstraction supports block sizes from DEV_BSIZE (usually 512) to upwards of several pages or more. It also supports a relatively primitive byte-granular valid range and dirty range currently hardcoded for use by NFS. The code implementing the VM Buffer abstraction is mostly concentrated in .Pa /usr/src/sys/kern/vfs_bio.c . .Pp One of the most important things to remember when dealing with buffer pointers (struct buf) is that the underlying pages are mapped directly from the buffer cache. No data copying occurs in the scheme proper, though some file systems such as UFS do have to copy a little when dealing with file fragments. The second most important thing to remember is that due to the underlying page mapping, the b_data base pointer in a buf is always *page* aligned, not *block* aligned. When you have a VM buffer representing some b_offset and b_size, the actual start of the buffer is (b_data + (b_offset & PAGE_MASK)) and not just b_data. Finally, the VM system's core buffer cache supports valid and dirty bits (m->valid, m->dirty) for pages in DEV_BSIZE chunks. Thus a platform with a hardware page size of 4096 bytes has 8 valid and 8 dirty bits. These bits are generally set and cleared in groups based on the device block size of the device backing the page. Complete page's worth are often referred to using the VM_PAGE_BITS_ALL bitmask (i.e., 0xFF if the hardware page size is 4096). .Pp VM buffers also keep track of a byte-granular dirty range and valid range. This feature is normally only used by the NFS subsystem. I am not sure why it is used at all, actually, since we have DEV_BSIZE valid/dirty granularity within the VM buffer. If a buffer dirty operation creates a 'hole', the dirty range will extend to cover the hole. If a buffer validation operation creates a 'hole' the byte-granular valid range is left alone and will not take into account the new extension. Thus the whole byte-granular abstraction is considered a bad hack and it would be nice if we could get rid of it completely. .Pp A VM buffer is capable of mapping the underlying VM cache pages into KVM in order to allow the kernel to directly manipulate the data associated with the (vnode,b_offset,b_size). The kernel typically unmaps VM buffers the moment they are no longer needed but often keeps the 'struct buf' structure instantiated and even bp->b_pages array instantiated despite having unmapped them from KVM. If a page making up a VM buffer is about to undergo I/O, the system typically unmaps it from KVM and replaces the page in the b_pages[] array with a place-marker called bogus_page. The place-marker forces any kernel subsystems referencing the associated struct buf to re-lookup the associated page. I believe the place-marker hack is used to allow sophisticated devices such as file system devices to remap underlying pages in order to deal with, for example, re-mapping a file fragment into a file block. .Pp VM buffers are used to track I/O operations within the kernel. Unfortunately, the I/O implementation is also somewhat of a hack because the kernel wants to clear the dirty bit on the underlying pages the moment it queues the I/O to the VFS device, not when the physical I/O is actually initiated. This can create confusion within file system devices that use delayed-writes because you wind up with pages marked clean that are actually still dirty. If not treated carefully, these pages could be thrown away! Indeed, a number of serious bugs related to this hack were not fixed until the 2.2.8/3.0 release. The kernel uses an instantiated VM buffer (i.e., struct buf) to place-mark pages in this special state. The buffer is typically flagged B_DELWRI. When a device no longer needs a buffer it typically flags it as B_RELBUF. Due to the underlying pages being marked clean, the B_DELWRI|B_RELBUF combination must be interpreted to mean that the buffer is still actually dirty and must be written to its backing store before it can actually be released. In the case where B_DELWRI is not set, the underlying dirty pages are still properly marked as dirty and the buffer can be completely freed without losing that clean/dirty state information. (XXX do we have to check other flags in regards to this situation ???) .Pp The kernel reserves a portion of its KVM space to hold VM Buffer's data maps. Even though this is virtual space (since the buffers are mapped from the buffer cache), we cannot make it arbitrarily large because instantiated VM Buffers (struct buf's) prevent their underlying pages in the buffer cache from being freed. This can complicate the life of the paging system. -.\" .Sh SEE ALSO -.\" .Xr 9 .Sh HISTORY The .Nm manual page was originally written by .An Matthew Dillon and first appeared in .Fx 3.1 , December 1998.