aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
...
* LinuxKPI: pci.h add more constantsBjoern A. Zeeb2023-11-291-0/+2
| | | | | | | | | Add two more PCI_EXP_LNKSTA_CLS constants to the compat defines needed by wireless drivers. Sponsored by: The FreeBSD Foundation (cherry picked from commit f74c09f3ec69a6cdba46aa821ab665d2f87142f7)
* LinuxKPI: implement get_random_u32_inclusive()Bjoern A. Zeeb2023-11-291-2/+28
| | | | | | | | | Implementation of get_random_u32_inclusive(). This is needed by an update for wireless drivers. Sponsored by: The FreeBSD Foundation (cherry picked from commit 1dcd1a539275fe69173bfc4dfc32c963fc7dcdbe)
* LinuxKPI: list.h add list_count_nodes()Bjoern A. Zeeb2023-11-291-0/+14
| | | | | | | | | Implement list_count_nodes() using a simple loop. This is needed by an updated wireless driver. Sponsored by: The FreeBSD Foundation (cherry picked from commit 1b18fb7faa75cc6dfa2e253190b41e63a997ca9d)
* LinuxKPI: cast jiffies_to_msecs() resultBjoern A. Zeeb2023-11-291-1/+1
| | | | | | | | | | jiffies_to_msecs() is expected to return an uint_t. In order to avoid changing printf format strings, properly cast the result to the expected type. Sponsored by: The FreeBSD Foundation (cherry picked from commit 08bc2cc4c4d8e94ad1db63f97d923dee18bee668)
* LinuxKPI: add DMA_MAPPING_ERRORBjoern A. Zeeb2023-11-291-1/+5
| | | | | | | While we deal with 0 returned, some drivers directly use and check for DMA_MAPPING_ERROR. Add the case and check for both in dma_mapping_error(). (cherry picked from commit 0b9bc97342f98a911985ace5527aef97863dfd23)
* linuxkpi linux_work: use 'true' instead of 'non-zero'Konstantin Belousov2023-11-131-3/+3
| | | | (cherry picked from commit 96cb1d70008e6d42750e95135316cafd6899384f)
* linuxkpi: races between linux_queue_delayed_work_on() and ↵Konstantin Belousov2023-11-131-11/+25
| | | | | | linux_cancel_delayed_work_sync() (cherry picked from commit 05fe82455f263ad107a860ce20dd89e1a5c1619c)
* sysentvec: add SV_SIGSYS flagKonstantin Belousov2023-10-091-1/+2
| | | | (cherry picked from commit b82b4ae752501469053979393e33bbfa74fbc9d2)
* linuxolator: implement Linux' PROT_GROWSDOWNKonstantin Belousov2023-08-253-6/+12
| | | | (cherry picked from commit 9b65fa69407808e710748875b0af98902110f128)
* sys: Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-231-1/+0
| | | | | | | Remove /^\s*\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 78d146160dc5)
* sys: Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-236-6/+0
| | | | | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 031beb4e239b)
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-2395-189/+0
| | | | | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/ Similar commit in current: (cherry picked from commit 685dc743dc3b)
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-233-3/+0
| | | | | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/ Similar commit in current: (cherry picked from commit 71625ec9ad2a)
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-2319-19/+0
| | | | | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/ Similar commit in current: (cherry picked from commit 2ff63af9b88c)
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-23228-456/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 95ee2897e98f)
* linux(4): Fix linker warning about undefined vdso symbolsDmitry Chagin2023-08-221-3/+11
| | | | | | | Pointed out by: bz MFC after: 3 days (cherry picked from commit a129642ced9e6ceacf98c7663bc1178eb32a78be)
* linux(4): Fix MSG_CTRUNC handling in recvmsg()Dmitry Chagin2023-08-211-3/+2
| | | | | | | | | | | | The MSG_CTRUNC flag of the msg_flags member of the message header is set uppon successful completition if the control data was truncated. Upon return from a successful call msg_controllen should contain the length of the control message sequence. Fixes: 0eda2cea MFC after: 1 week (cherry picked from commit 2467ccddc0e0f5c719eddaece69a7aa0589b6449)
* linux(4): Add a comment explaining udata freeing on errorDmitry Chagin2023-08-211-0/+1
| | | | | | MFC after: 1 week (cherry picked from commit 9d0c9b6d6a6a90f626088308dfb895221bf6d36f)
* linux(4): Refactor recvmsgDmitry Chagin2023-08-211-37/+64
| | | | | | | | | As the amount of handled anxiliary messages grows move they handlers into a separate functions. MFC after: 1 week (cherry picked from commit de20eb26d014f7d9ba81fd1f84636609c8efa8e1)
* linux(4): Skip unsupported anxiliary messageDmitry Chagin2023-08-211-5/+10
| | | | | | | | | Instead of returning error, skip unsupported anxiliary messages and fail if no one handled. MFC after: 1 week (cherry picked from commit bbaa5523c01a11e1e322928639522b9ccfd19978)
* linux(4): Improve readability of recvmsg control buffer copyout codeDmitry Chagin2023-08-211-3/+2
| | | | | | MFC after: 1 week (cherry picked from commit a21238d843ebe02e696cdc30b008382dfca5612e)
* linux(4): Drop bogus empty line in linux_socket.cDmitry Chagin2023-08-211-1/+0
| | | | | | MFC after: 1 week (cherry picked from commit 43c3beb7414e1cf031fe8e32e7ec1876a5b20610)
* linux(4): Fix control message size calculation againDmitry Chagin2023-08-211-1/+1
| | | | | | | | | | | It looks Linux recvmsg allows msg_controllen size less then CMSG_SPACE buffer, at least for case with one cmsghdr. Glibc misc/tst-scm_rights test succed on Ubuntu 23.04 Fixes: 67116c69 "linux(4): Fix control message size calculation" MFC after: 1 week (cherry picked from commit 7d561928e65af6fe90ff9e316b2d50668c53b464)
* linuxkpi: advance platform_deviceCorvin Köhne2023-08-171-0/+10
| | | | | | | | | | | | These are required by some linux driver like: https://github.com/beckhoff/bbapi Reviewed by: manu MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D39554 (cherry picked from commit 740d76544ad8a59f1be53584a0aa5bbbe00833ee)
* linux(4): Fix control message size calculationDmitry Chagin2023-08-071-2/+2
| | | | | | | | | | | To determine the size in bytes needed to hold a control message and its contents of length len, CMSG_SPACE should be used. Reviewed by: Differential Revision: https://reviews.freebsd.org/D41224 MFC after: 1 week (cherry picked from commit 67116c69052d27dbd6d6c066104850d4d53f0041)
* linux(4): Use M_LINUX for malloc type of proc emuldataDmitry Chagin2023-08-071-3/+3
| | | | | | MFC after: 2 weeks (cherry picked from commit b834497c6d0cccaeebad8d94a32c8dd3ec0d3f9b)
* linux(4): Use M_LINUX for malloc type in getdentsDmitry Chagin2023-08-071-4/+4
| | | | | | MFC after: 2 weeks (cherry picked from commit 7729467781670a84059d50c4726dc94cbf4500e9)
* linux(4): Use M_LINUX for malloc type in getdents64Dmitry Chagin2023-08-071-4/+4
| | | | | | MFC after: 2 weeks (cherry picked from commit e27e3fa71c8f31304efa5e065876a34ee603a388)
* linux(4): Delete a useless variable in getdents64Dmitry Chagin2023-08-071-4/+3
| | | | | | MFC after: 2 weeks (cherry picked from commit b27f3237c82bde866cb24f7299eaa356e8b29eb2)
* linux(4): Use M_LINUX for malloc type in readdirDmitry Chagin2023-08-071-4/+4
| | | | | | MFC after: 2 weeks (cherry picked from commit 13d049ab8dd718d0723229d54062c91b2fc68fda)
* linux(4): Delete a useless variable in readdirDmitry Chagin2023-08-071-5/+4
| | | | | | MFC after: 2 weeks (cherry picked from commit fffb2e8de691ba6677616f7e0e5c442f4e7e722a)
* linux(4): Properly allocate buffer for kern_getdirentries in readdirDmitry Chagin2023-08-071-1/+1
| | | | | | | | | | | | Looks like prior to ino64 project the size of the struct linux_dirent was greater (or equal) to the size of the native struct dirent so the native dirent fit into the buffer. After ino64 project the size of the native struct dirent has increased. Spotted by gcc12. MFC after: 2 weeks (cherry picked from commit fc1c787aa0157090e765ebba484e6e290e99f177)
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-07-252-2/+2
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit b61a573019428cbdc38ed03be9ecd2482011ea66)
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-07-2561-61/+61
| | | | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix (cherry picked from commit 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
* linux(4): Implement close_range over nativeDmitry Chagin2023-06-293-1/+33
| | | | | | | | | | | Handling of the CLOSE_RANGE_UNSHARE flag is not implemented due to difference in fd unsharing mechanism in the Linux and FreeBSD. Reviewed by: mjg Differential revision: https://reviews.freebsd.org/D39398 MFC after: 2 weeks (cherry picked from commit 71bc17803edfaad545f0c1f1111ca892aed7a5c4)
* Revert "linux(4): The futex_wait operation should restart."Dmitry Chagin2023-06-291-0/+2
| | | | | | | This reverts commit 5eec19c8eb0e1afafd7290325c61611c9a13b621 due to its wrong. Linux interrupts futex syscall on signal and return EINTR. (cherry picked from commit 486459056822f080b1ae24600a4c6a7d8ff6f7d6)
* linux(4): Guard linux_fork.h by _KERNEL for use by libsysdecodeDmitry Chagin2023-06-291-0/+2
| | | | | | | | Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D40149 MFC after: 1 month (cherry picked from commit 3f1bfc136f8fb8c6a7c4dcccebd27962bc104670)
* linux(4): Make ptrace_pokeusr machine dependentDmitry Chagin2023-06-291-8/+0
| | | | | | | Differential Revision: https://reviews.freebsd.org/D40096 MFC after: 1 week (cherry picked from commit 3d0addcd35193461e927db6cfe4b6d9b579eed6b)
* linux(4): Make ptrace_peekusr machine dependendDmitry Chagin2023-06-291-43/+0
| | | | | | | | | And partially implement it for x86_64. Differential Revision: https://reviews.freebsd.org/D40095 MFC after: 1 week (cherry picked from commit dd2a6cd701aea5a6ced59b9947e087304f7d7238)
* linux(4): Move linux_debug decalration to linux_util.hDmitry Chagin2023-06-292-1/+2
| | | | | | | | | To avoid inclusion of linux_mib.h with linux_util.h in cases where we need rate limiting macro. MFC after: 1 week (cherry picked from commit 38a137f416203494f183cb2b309524102680105e)
* linux(4): Check fd passed to unlockpt()Dmitry Chagin2023-06-291-2/+6
| | | | | | | | | | | | | In our implementation, grantpt() and unlockpt() don't actually have any use, because PTY's are created on the fly and already have proper permissions upon creation. Atleast check that a proper fd passed to unlockpt(). For grantpt() Glibc calls TIOCGPTN ioctl which would fail if fd is not a master. Differential Revision: https://reviews.freebsd.org/D40100 MFC after: 1 week (cherry picked from commit 0f62290e7f749b7a453d413dd72c406129a9aba5)
* linux(4): Uniformly dev_t arguments translationDmitry Chagin2023-06-294-33/+91
| | | | | | | | | | | | | | | | | | | | 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. (cherry picked from commit 166e2e5a9e87d32dbfc7838903904673873f1e71)
* linux(4): Add a dedicated fstat() implementationDmitry Chagin2023-06-291-44/+31
| | | | | | | | | | In between kern_fstat() and translate_fd_major_minor(), another process having the same filedesc could modify or close fd. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D39763 (cherry picked from commit 994ed958ae0545faa86dd43b6e64bf7b64b9220b)
* linux(4): Add a dedicated statat() implementationDmitry Chagin2023-06-294-14/+43
| | | | | | | | | | Get rid of calling Linux stat translation hook and specific to Linux handling of non-vnode dirfd from kern_statat(), Reviewed by: kib, mjg Differential revision: https://reviews.freebsd.org/D35474 (cherry picked from commit cb858340dcbf214cc4c4d78dbb741620d7b3a252)
* linux(4): Move dev_t type declaration under /compat/linuxDmitry Chagin2023-06-291-0/+5
| | | | | | | 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. (cherry picked from commit 19973638bee2205be2a7eb07bc154b8afb1e44a3)
* linux(4): Rename obsolete old struct l_stat to struct l_old_statDmitry Chagin2023-06-291-4/+4
| | | | (cherry picked from commit a408fc097f43b80fd1477196e595edc796804520)
* linux(4): Move statx_copyout() close to linux_statx()Dmitry Chagin2023-06-291-33/+34
| | | | | | | | Just for future changes of the conditional Linuxulator build. We need a small refactoring of the MI code to help porting Linuxulator to other platforms. (cherry picked from commit e9204c5c2c5c471ad2182ec6358a46be74c9ebb6)
* linux(4): Move translate_vnhook_major_minor() into the Linux common moduleDmitry Chagin2023-06-293-24/+29
| | | | (cherry picked from commit 6072eea0c375fc3ab0cf5bb494c75d1beac7b8ba)
* linux(4): Sort includes in the linux_stats.cDmitry Chagin2023-06-291-1/+1
| | | | (cherry picked from commit 2a38f51c5b8a7cf38f0a29a59e7558d8aef91047)
* linux(4): Use inlined LINUX_KERNVER for tests to improve readabilityDmitry Chagin2023-06-294-10/+4
| | | | | | MFC after: 1 month (cherry picked from commit e185d83fc48ba0f28896a986104c02203005b533)