The libusb set debug level by libusb_log_level instead of
libusb_debug_level. We switch to libusb_log_level for better
compatibility with the upstream libusb.
Additionally, The upstream libusb has an option allows user to override the log
function with a user-defined callback.
To support the callback function with a single string without va_arg, we
refactor the log facility as a function instead of a macro and parse all
va_args inside.
The legacy debug_level enum has been removed to enforce maintainer migrate from their
deprecated source code.
Reviewed by: kevans
Approved by: markj (mentor), lwhsu (mentor)
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50680
If the calling process has used SIG_IGN as handler or set the
SA_NOCLDWAIT flag for SIGCHLD, processes will be automatically reaped on
exit and calls to waitpid(3) will therefore fail with ECHILD.
We waitpid primarily to reap our child so that the caller does not have
to worry about it. ECHILD indicates that there is no child to reap, so
we can just treat that as a success and move on.
Signed-off-by: Kenny Levinsen <kl@kl.wtf>
Tested by: Jan Beich
Pull Request: https://github.com/freebsd/freebsd-src/pull/1675
* Add test cases for opendir() and fdopendir().
* Drop O_NONBLOCK from opendir(); it was added a long time ago to avoid
blocking if given a closed named pipe, but now we use O_DIRECTORY,
which ensures that we get ENOTDIR in that case.
* While here, remove unused #includes left over from the split.
Sponsored by: Klara, Inc.
Reviewed by: kevans, markj
Differential Revision: https://reviews.freebsd.org/D51126
__uexterr_format: return empty string on no error, instead of "No error"
err(): check for the first symbol of the exterr to decide if there is
anything to print.
Requested and reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D51204
THe member bNumDeviceCapabilities is referred to as bNumDeviceCaps in
the upstream libusb project.
To improve compatibility, we are renaming the member accordingly.
For backward compatibility, a mocro will be defined to map
bNumDeviceCapabilities to bNumDeviceCaps.
See: 02ebafc85d
Reviewed by: kevans
Approved by: markj (mentor)
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50740
If the extended error string is provided by kernel, return only the
string, which is supposedly enough to identify exact cause of the error.
If the string is not provided, print the technically looking gibberish
which still allows to identify location with kernel sources.
Reviewed by: asomers, brooks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D51141
The frequency range 5745-5865 (channels 149-173) wrongly has a
VHT160 channel listed (going up to 5885/177 which is not avail in
ETSI) but no 11a, 11na listed. Add the 11a and 11na in addition to
the 11ac 20/40 and 80.
Turns out the VHT40 entry for 5805-5845 was also missing. We already
had the neccessary setting for taiwan, so just adjust the freqband ref.
The problem is that without the 11a base channel ieee80211_find_channel()
in ieee80211_lookup_channel_rxstatus() will fail and sta_recv_mgmt() will
not get the correct channel but will use ic->ic_curchan (which is not
updated on scan offloading) and the scan result entry will be added as
channel 1.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian (previous version)
Differential Revision: https://reviews.freebsd.org/D51163
clang-scan-deps is used to generate dependency information from C++20
modules according to proposed standard ISO/IEC WG21 P1689R5[0]. It is
required by common build tools (e.g., CMake) to build C++ sources
that use modules.
Since this is a core build tool, install it by default, not gated
behind MK_CLANG_EXTRAS.
[0] https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2022/p1689r5.html
MFC after: 3 days
Reviewed by: kevans, dim
Approved by: kevans (mentor)
Requested by: jbo
Differential Revision: https://reviews.freebsd.org/D51044
Commit afd5bc6309 added a new pathconf name
_PC_HAS_HIDDENSYSTEM.
This patch documents this new name.
This is a content change.
Reviewed by: kib, ziaee (manpages)
Differential Revision: https://reviews.freebsd.org/D51175
Fixes: afd5bc6309 ("pathconf: Add a new variable for hidden/system")
The new ifconfig options 'tagged', '+tagged' and '-tagged' allow the
vlan access list of a bridge interface to be configured:
- Incoming tagged frames will be dropped if the vlan tag isn't in the
interface's access list.
- Outgoing frames will be dropped if the vlan tag isn't in the
interface's access list (e.g., for BUM traffic).
This has no effect if vlan filtering is not enabled on the interface.
Since we now add a tag to untagged frames at ingress, remove the
vlan argument from bridge_vfilter_out() and use VLANTAGOF instead.
Reviewed by: des, kp, adrian
Approved by: des (mentor)
Differential Revision: https://reviews.freebsd.org/D50503
Include the two new syscalls in the symbol map.
Reviewed by: kib
MFC after: 3 months
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50315
inotify_init() and inotify_init1() are implemented using __specialfd(2).
inotify_add_watch() is implemented in terms of inotify_add_watch_at(2).
Reviewed by: kib
MFC after: 3 months
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D50315
Since phk rewrote the block layer ~2 decades ago, write(2) can return
EINVAL when the target is a block device and nbytes, the write size, is
not a multiple of the sector's block size.
From the original PR:
When coming from Linux, people are surprised by the fact
that write(2) to a device must be aligned to block size.
Writing a non-aligned block onto a raw device is a case
where EINVAL is also returned but the manpage does not mention this.
MFC after: 3 days
PR: 227185
Reported by: riggs
Reviewed by: imp, Pau Amma <pauamma@gundo.com>
Differential Revision: https://reviews.freebsd.org/D51138
Allow pf to limit packets to a specified maximum size. This applies to all
packets, and if reassembly is enabled, looks at the reassembled size, not the
size of individual fragments.
Sponsored by: Rubicon Communications, LLC ("Netgate")
Currently, if `readdir()` fails, `scandir()` simply returns a partial
result (or a null result if it fails before any entries were selected).
There is no way within the current API design to return both a partial
result and an error indicator, so err on the side of caution: if an
error occurs, discard any partial result and return the error instead.
MFC after: 1 week
Reported by: Maxim Suhanov <dfirblog@gmail.com>
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D51046
allows things like
pass in proto icmp max-pkt-rate 100/10
all packets matching the rule in the direction the state was created are
taken into consideration (typically: requests, but not replies).
Just like with the other max-*, the rule stops matching if the maximum is
reached, so in typical scenarios the default block rule would kick in then.
with input from Holger Mikolon
ok mikeb
Obtained from: OpenBSD, henning <henning@openbsd.org>, 5a4ae9a9cb
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D50798
Application can use libusb_get_pollfds to get pollfds from libusb then
close the fd themselves. This cause the hotplug thread unable to leave
because it will be consider as a invalid event then loop forever instead
of a broken event that should be quit immediately.
Reviewed by: bapt
Sponsored by: FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50959
The flag was added in b75a1171d8 for the sake of Varnish. However, that
idea didn't work. Quoting email from Poul-Henning:
"We had to give up sendfile(), the overhead of keeping track of everything
between the network stack and VM system made ate any gain we saw. ... I
dont think we ever shipped a version where sendfile was enabled by
default."
PR: 287348
The O_RESOLVE_BENEATH openat(2) flag restricts name lookups such that
they remain under the directory referenced by the dirfd. This commit
introduces an implicit version of the flag, FD_RESOLVE_BENEATH, stored
in the file descriptor entry. When the flag is set, any lookup relative
to that fd automatically has O_RESOLVE_BENEATH semantics. Furthermore,
the flag is sticky, meaning that it cannot be cleared, and it is copied
by dup() and openat().
File descriptors with FD_RESOLVE_BENEATH set may not be passed to
fchdir(2) or fchroot(2). Various fd lookup routines are modified to
return fd flags to the caller.
This flag will be used to address a case where jails with different root
directories and the ability to pass SCM_RIGHTS messages across the jail
boundary can transfer directory fds in such as way as to allow a
filesystem escape.
PR: 262180
Reviewed by: kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D50371
This seems to fit the pattern better (e.g. fdopendir()).
I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.
Fixes: deeebfdeca
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D50980
Most importantly, they need to run without privileges, since root is
allowed to read a directory regardless of its permission bits.
PR: 287694
Fixes: 4d7c31bca2
Sponsored by: Klara, Inc.
Reviewed by: bnovkov
Differential Revision: https://reviews.freebsd.org/D50965
It is up to the code that organizes the runtime to properly set the
signal handler, and to set %fsbase if libthr signal handler is to be
called. The change should leave the CPU state on the signal handler
entry identical to what it was before introduction of TLSBASE, for code
that provides its own startup and thread pointer, but still calls into
libthr as a hack.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
amd64 kernels don't have to be loaded at 2M physical anymore, they can
be anywhere in the lower 4G of the physical address space. The kernel
now provides its physical address in an ELF section in the dump, so
account for it.
Reviewed by: markj
Approved by: imp (mentor)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1706
In the previous commit, I removed the initial initialization of the
`names` array, not realizing that `scandir()` is expected to return
a non-null (but empty) array of entries if no entries matched.
Restore the historical behavior, document it, and add a test.
Fixes: deeebfdeca
Sponsored by: Klara, Inc.
Reviewed by: kevans, allanjude, markj
Differential Revision: https://reviews.freebsd.org/D50949
While here, clean up scandir() a bit and improve the documentation.
MFC after: never
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D50935
The practical scenario that leads to this is porch(1) spawning some
utility and sending it a SIGSTOP as a debugging aide. The user then
attaches a debugger and walks through how some specific input is
processed, then detaches to allow the script to continue. When ptrace
is detached, the process resumes execution but the parent is never
notified and may be stuck in wait(2) for it to continue or terminate.
Other platforms seem to re-suspend the process after the debugger is
detached, but neither behavior seems unreasonable. Just notifying the
parent that the child has resumed is a relatively low-risk departure
from our current behavior and had apparently been considered in the
past, based on pre-existing comments.
Move p_flag and p_xsig handling into childproc_continued(), as just
sending the SIGCHLD here isn't really useful without P_CONTINUED set
and the other caller already sets these up as well.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D50917