| #
607f1105
|
| 08-Dec-2025 |
Gleb Smirnoff <glebius@FreeBSD.org> |
linux: store Linux Ethernet interface number in struct ifnet
The old approach where we go through the list of interfaces and count them has bugs. One obvious bug with this dynamic translation is th
linux: store Linux Ethernet interface number in struct ifnet
The old approach where we go through the list of interfaces and count them has bugs. One obvious bug with this dynamic translation is that once an Ethernet interface in the middle of the list goes away, all interfaces following it would change their Linux names.
A bigger problem is the ifnet arrival and departure times. For example linsysfs has event handler for ifnet_arrival_event, and of course it wants to resolve the name. This accidentially works, due to a bug in if_attach() where we call if_link_ifnet() before invoking all the event handlers. Once the bug is fixed linsysfs won't be able to resolve the old way. The other side is ifnet_departure_event, where there is no bug, the eventhandlers are called after the if_unlink_ifnet(). This means old translation won't work for departure event handlers. One example is netlink. This change gives the Netlink a chance to emit a proper Linux interface departure message.
However, there is another problem in Netlink, that the ifnet pointer is lost in the Netlink translation layer. Plug this with a cookie in netlink writer structure that can be set by the route layer and used by the Netlink Linux translation layer. This part of the diff seems unrelated, but it is hard to make it a separate change, as the old KPI goes away and to use the new one we need the pointer.
Differential Revision: https://reviews.freebsd.org/D54077
show more ...
|
| #
fbf05d21
|
| 08-Dec-2025 |
Gleb Smirnoff <glebius@FreeBSD.org> |
linux: separate all ifnet(9) related code into linux_ifnet.c
Remove linux_use_real_ifname(). It is no longer used outside of the file since 3ab3c9c29cf0. There is no functional change.
Reviewed b
linux: separate all ifnet(9) related code into linux_ifnet.c
Remove linux_use_real_ifname(). It is no longer used outside of the file since 3ab3c9c29cf0. There is no functional change.
Reviewed by: melifaro, dchagin Differential Revision: https://reviews.freebsd.org/D54076
show more ...
|
| #
481d5a48
|
| 15-Oct-2024 |
Warner Losh <imp@FreeBSD.org> |
linux.h: don't redefine lower_32_bits if already defined
systrace.c fails to build if we're using a common compiler.h for both openzfs and linuxkpi. The issue is easy enough to fix: don't redefined
linux.h: don't redefine lower_32_bits if already defined
systrace.c fails to build if we're using a common compiler.h for both openzfs and linuxkpi. The issue is easy enough to fix: don't redefined lower_32_bits if it's already defined in linux.h, since it's the least 'standardized'. This will allow systrace.c to build using an equivalent macro.
MFC After: 3 days Sponsored by: Netflix
show more ...
|
| #
c47116e9
|
| 17-Aug-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Update my copyrights, add SPDX tag
|
| #
95ee2897
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
166e2e5a
|
| 28-Apr-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Uniformly dev_t arguments translation
The two main uses of dev_t are in struct stat and as a parameter of the mknod system calls. As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit
linux(4): Uniformly dev_t arguments translation
The two main uses of dev_t are in struct stat and as a parameter of the mknod system calls. As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit quantity with 12 bits set asaid for the major number and 20 for the minor number. The in-kernel dev_t encoded as MMMmmmmm, where M is a hex digit of the major number and m is a hex digit of the minor number. The user-space dev_t encoded as mmmM MMmm, where M and m is the major and minor numbers accordingly. This is downward compatible with legacy systems where dev_t is 16 bits wide, encoded as MMmm. In glibc dev_t is a 64-bit quantity, with 32-bit major and minor numbers, encoded as MMMM Mmmm mmmM MMmm. This is downward compatible with the Linux kernel and with legacy systems where dev_t is 16 bits wide. In the FreeBSD dev_t is a 64-bit quantity. The major and minor numbers are encoded as MMMmmmMm, therefore conversion of the device numbers between Linux user-space and FreeBSD kernel required.
show more ...
|
| #
19973638
|
| 28-Apr-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Move dev_t type declaration under /compat/linux
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer on all platforms. Move it into the MI linux.h under /compat/linu
linux(4): Move dev_t type declaration under /compat/linux
As of version 2.6.0 of the Linux kernel, dev_t is a 32-bit unsigned integer on all platforms. Move it into the MI linux.h under /compat/linux.
show more ...
|
| #
6c5786fd
|
| 04-Mar-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Migrate to IfAPI
Migrate linux and linprocfs to use the IfAPI interfaces instead of direct ifnet accesses. The code initially writed by jhibbits@, and adapted by me to 3ab3c9c2.
Reviewed
linux(4): Migrate to IfAPI
Migrate linux and linprocfs to use the IfAPI interfaces instead of direct ifnet accesses. The code initially writed by jhibbits@, and adapted by me to 3ab3c9c2.
Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D38735
show more ...
|
| #
e9e637bf
|
| 21-Feb-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Revert "Port Linuxulator to IfAPI"
Revert pending netlink fixes, and further fixes to this.
This reverts commit 52d984831d82d97dc132d0d57fca6ee89572799b.
Requested by: dchagin
|
| #
52d98483
|
| 01-Feb-2023 |
Justin Hibbits <jhibbits@FreeBSD.org> |
Port Linuxulator to IfAPI
Reviewed by: dchagin Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38349
|
| #
32fdc75f
|
| 14-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Move use_real_names knob to the linux.c
MI linux.[c|h] are the module independent in terms of the Linux emulation layer (ie, intended for both ISA - 32 & 64 bit), analogue of MD linux.h. T
linux(4): Move use_real_names knob to the linux.c
MI linux.[c|h] are the module independent in terms of the Linux emulation layer (ie, intended for both ISA - 32 & 64 bit), analogue of MD linux.h. There must be a code here that cannot be placed into the corresponding by common sense MI source and header files, i.e., code is machine independent, but ISA dependent. For the use_real_names knob, the code must be placed into the linux_socket.[c|h], however linux_socket is ISA dependent.
MFC after: 2 weeks
show more ...
|
| #
00798671
|
| 14-Feb-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Cleanup sys/queue.h from linux.h
Leftover after converting futexes to the umtx API.
NFC after: 2 weeks
|
| #
9922bccb
|
| 28-Jan-2023 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Convert mount exported flags for statfs system calls.
MFC after: 1 week
|
| #
7c40e2d5
|
| 26-Aug-2022 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
linuxolator: add netlink support
Add the glue code to support netlink in Linuxolator. linux_common(4) now depends on netlink(4).
All netlink protocol constants are consistent with the Linux version
linuxolator: add netlink support
Add the glue code to support netlink in Linuxolator. linux_common(4) now depends on netlink(4).
All netlink protocol constants are consistent with the Linux version. However, certain OS-specific constants such as AF_INET6, interface flags or default routing table id, are different between FreeBSD and Linux. Thus, it may be needed to rewrite some message parts or even rewrite the whole message, adding or removing some TLVs. The core netlink implementation code provides efficient rewriting callbacks which Linuxolator now uses.
Reviewed by: dchagin Differential Revision: https://reviews.freebsd.org/D36361 MFC after: 2 months
show more ...
|
| #
93107373
|
| 22-Jun-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Trace Linux l_sigset_t.
MFC after: 2 weeks
|
| #
669516a1
|
| 30-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Fix the type of a constant in the signal mask macro
Since l_sigset_t is 64-bit unsigned on all Linuxulators, fix the type of a constant in the signal mask manipulation macro. The suffix L
linux(4): Fix the type of a constant in the signal mask macro
Since l_sigset_t is 64-bit unsigned on all Linuxulators, fix the type of a constant in the signal mask manipulation macro. The suffix L indicates type long which is 32-bit on i386, therefore, bitwise operations between a 32-bit constant and 64-bit signal mask lead to the wrong result.
Pointy hat to: dchagin MFC after: 2 weeks
show more ...
|
| #
2ca34847
|
| 30-May-2022 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Reduce duplication between MD parts of the Linuxulator
Move sigprocmask actions defines under compat/linux, they are identical across all Linux architectures.
MFC after: 2 weeks
|
| #
1f70a85b
|
| 08-Jan-2022 |
Alexander V. Chernikov <melifaro@FreeBSD.org> |
linux: add sysctl to pass untranslated interface names
Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33792
|
| #
0a4b664a
|
| 12-Aug-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Add struct clone_args for future clone3 system call.
In preparation for clone3 system call add struct clone_args and use it in clone implementation. Move all of clone related bits to the n
linux(4): Add struct clone_args for future clone3 system call.
In preparation for clone3 system call add struct clone_args and use it in clone implementation. Move all of clone related bits to the newly created linux_fork.h header.
Differential revision: https://reviews.freebsd.org/D31474 MFC after: 2 weeks
show more ...
|
| #
0dc38e33
|
| 29-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Reimplement futexes using umtx.
Differential Revision: https://reviews.freebsd.org/D31236 MFC after: 2 weeks
|
| #
cf8d74e3
|
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Allow musl brand to use FUTEX_REQUEUE op.
Initial patch from submitter was adapted by me to prevent unconditional FUTEX_REQUEUE use.
PR: 255947 Submitted by: Philippe Michaud-Boudreaul
linux(4): Allow musl brand to use FUTEX_REQUEUE op.
Initial patch from submitter was adapted by me to prevent unconditional FUTEX_REQUEUE use.
PR: 255947 Submitted by: Philippe Michaud-Boudreault Differential Revision: https://reviews.freebsd.org/D30332
show more ...
|
| #
1ca6b15b
|
| 20-Jul-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
Drop "All rights reserved" from my copyright statements.
Add email and fixup years while here.
Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30912 MFC after: 2 weeks
|
| #
26795a03
|
| 22-Jun-2021 |
Dmitry Chagin <dchagin@FreeBSD.org> |
linux(4): Rework Linux ppoll system call.
For now the Linux emulation layer uses in kernel ppoll(2) without conversion of user supplied fd 'events', and does not convert the kernel supplied fd 'reve
linux(4): Rework Linux ppoll system call.
For now the Linux emulation layer uses in kernel ppoll(2) without conversion of user supplied fd 'events', and does not convert the kernel supplied fd 'revents'.
At least POLLRDHUP is handled by FreeBSD differently than by Linux. Seems that Linux silencly ignores POLLRDHUP on non socket fd's unlike FreeBSD, which does more strictly check and fails.
Rework the Linux ppoll, using kern_poll and converting 'events' and 'revents' values. While here, move poll events defines to the MI part of code as they mostly identical on all arches except arm.
Differential Revision: https://reviews.freebsd.org/D30716 MFC after: 2 weeks
show more ...
|
| #
2362ad45
|
| 08-Jun-2021 |
Philippe Michaud-Boudreault <pitwuu@gmail.com> |
linux: implement statx(2)
PR: 252106 Reviewed By: dchagin Differential Revision: https://reviews.freebsd.org/D30466
|
| #
9e47480e
|
| 03-Nov-2020 |
Conrad Meyer <cem@FreeBSD.org> |
linux(4): Improve netlink diagnostics
Add some missing netlink_family definitions and produce vaguely human-readable error messages for those definitions, like we used to do for just ROUTE and KOBJE
linux(4): Improve netlink diagnostics
Add some missing netlink_family definitions and produce vaguely human-readable error messages for those definitions, like we used to do for just ROUTE and KOBJECT_UEVENTS.
Additionally, if we know it's a netfilter socket but didn't find it in the table, fall back to printing that instead of the generic handler ("socket domain 16, ...").
No change to the emulator correctness, just mildly improved diagnostics for gaps.
show more ...
|