summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Auto merge of #3041 - devnexen:linux_kernel_version, r=JohnTitorbors2022-12-211-0/+8
|\ | | | | | | adding KERNEL_VERSION macro for linux.
| * adding KERNEL_VERSION macro for linux.David Carlier2022-12-211-0/+8
| |
* | Add misc constants and functions for androidFrederick Mayle2022-12-205-0/+33
| | | | | | | | These are the main diffs present in the android opensource project.
* | Auto merge of #3038 - gh-tr:rebased/20221216, r=JohnTitorbors2022-12-205-49/+4839
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for QNX/Neutrino 7.1 Test cases (ctest2, all succeed): QNX/Neutrino 7.1 x86_64: 9884 QNX/Neutrino 7.1 aarch64: 9766 Co-authored-by: Tristan Roach <troach@qnx.com> Co-authored-by: Florian Bartels <Florian.Bartels@elektrobit.com>
| * | Add support for QNX/Neutrino 7.1Florian Bartels2022-12-165-49/+4839
| |/ | | | | | | | | | | | | | | | | Test cases (ctest2, all succeed): QNX/Neutrino 7.1 x86_64: 9884 QNX/Neutrino 7.1 aarch64: 9766 Co-authored-by: Tristan Roach <troach@qnx.com> Co-authored-by: Florian Bartels <Florian.Bartels@elektrobit.com>
* | Add ISO C functions atof, atol, atoll, strtoll, strtoullLegionMammal9782022-12-1412-10/+25
|/
* Auto merge of #3027 - Phantomical:auxval, r=JohnTitorbors2022-12-111-0/+4
|\ | | | | | | | | | | | | | | | | linux: Add AT_SYSINFO_EHDR constant When passed to [`getauxval(3)`][2] this is used to retrieve the base address of the vdso mapped into the current process. It is defined the architecture specific `auxvec.h` headers but [it is defined to the same value in all of them][1] so I've put it in `src/unix/linux_like/linux/mod.rs` instead of in the arch submodule. [1]: https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/torvalds/linux%24+%23define+AT_SYSINFO_EHDR&patternType=standard&sm=1 [2]: https://man7.org/linux/man-pages/man3/getauxval.3.html
| * Add AT_SYSINFO_EHDR constant for linuxPhantomical2022-12-041-0/+4
| |
* | Try readding all inotify flagscarbotaniuman2022-12-072-6/+6
|/
* Auto merge of #3024 - redox-os:redox-0.2.137, r=JohnTitorbors2022-12-031-4/+16
|\ | | | | | | | | | | | | | | redox: long is 32-bits on 32-bit systems This ensures that 32-bit systems use i32 for c_long and u32 for c_ulong. I have also adjusted off_t and time_t to be `long long`, which is what they are in `relibc` now.
| * redox: make off_t and time_t long longJeremy Soller2022-12-021-2/+2
| |
| * redox: long is 32-bits on 32-bit systemsJeremy Soller2022-12-011-2/+14
| |
* | Auto merge of #3021 - devnexen:getopt_long, r=JohnTitorbors2022-12-035-1/+71
|\ \ | | | | | | | | | adding getopt_long for unixes.
| * | adding getopt_long for unixes.David Carlier2022-12-015-1/+71
| | |
* | | Auto merge of #3023 - asomers:copy_file_range, r=JohnTitorbors2022-11-303-18/+9
|\ \ \ | | | | | | | | | | | | | | | | | | | | Enable copy_file_range on FreeBSD PR #2479 did this, but only in the freebsd13 and freebsd14 modules, which was incorrect. Those modules should only be used for functions that change across FreeBSD versions, and therefore need different ELF symbol versions. Functions that were newly added since FreeBSD 11 can still go in the base freebsd module. It will cause no problems for them to be there, and users will see an error at link time if they try to use such a function in an environment that is too old to support it.
| * | | Enable copy_file_range on FreeBSDAlan Somers2022-11-303-18/+9
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | PR #2479 did this, but only in the freebsd13 and freebsd14 modules, which was incorrect. Those modules should only be used for functions that change across FreeBSD versions, and therefore need different ELF symbol versions. Functions that were newly added since FreeBSD 11 can still go in the base freebsd module. It will cause no problems for them to be there, and users will see an error at link time if they try to use such a function in an environment that is too old to support it.
* | | Auto merge of #3022 - asomers:capsicum, r=JohnTitorbors2022-11-301-0/+6
|\ \ \ | | | | | | | | | | | | | | | | | | | | Add more capsicum functions for FreeBSD These have all been available since at least FreeBSD 9.2.
| * | | Add more capsicum functions for FreeBSDAlan Somers2022-11-291-0/+6
| |/ / | | | | | | | | | These have all been available since at least FreeBSD 9.2.
* | | Auto merge of #3003 - devnexen:musl_pidfd_nonblock, r=JohnTitorbors2022-11-301-0/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | linux musl adding `PIDFD_NONBLOCK` constant. closes #3002
| * | | linux musl adding `PIDFD_NONBLOCK` constant.David Carlier2022-11-201-0/+2
| | | | | | | | | | | | | | | | closes #3002
* | | | Auto merge of #3010 - stevenengler:sock-storage-repr, r=JohnTitorbors2022-11-302-4/+4
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rearrange `sockaddr_storage` padding/alignment fields on Linux and Fuchsia Part of #3004. Previously on Linux, the `sockaddr_storage` structure had padding bytes between the `ss_family` and `__ss_align` fields. The `__ss_align` field has now been moved to the end of the structure to eliminate these padding bytes, matching recent glibc versions: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/socket.h;h=4f1f810ea1d9bf00ff428e4e7c49a52c71620775;hb=c804cd1c00adde061ca51711f63068c103e94eef#l190 After the PR on Linux x86-64: ``` print-type-size type: `unix::linux_like::sockaddr_storage`: 128 bytes, alignment: 8 bytes print-type-size field `.ss_family`: 2 bytes print-type-size field `.__ss_pad2`: 118 bytes print-type-size field `.__ss_align`: 8 bytes ``` These moved fields are private but they are used in the `sockaddr_storage`s `PartialEq`, `Debug`, and `Hash` implementations, so the exact behaviour may change slightly, but I don't think anyone should be depending on this. ~(It looks like [Fuchsia](https://github.com/rust-lang/libc/blob/73c25f4e9d66054d1496c693b72d60caea00c4a9/src/fuchsia/mod.rs#L910) has the same issue, but I didn't modify its structure because I don't know much about it, or how to test it.)~
| * | | fixup! Rearrange `sockaddr_storage` padding/alignment fieldsSteven Engler2022-11-211-1/+1
| | | |
| * | | Rearrange `sockaddr_storage` padding/alignment fieldsSteven Engler2022-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously on Linux, the `sockaddr_storage` structure had padding bytes between the `ss_family` and `__ss_align` fields. The `__ss_align` field has now been moved to the end of the structure to eliminate these padding bytes, matching recent glibc versions: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/bits/socket.h;h=4f1f810ea1d9bf00ff428e4e7c49a52c71620775;hb=c804cd1c00adde061ca51711f63068c103e94eef#l190
* | | | Auto merge of #3013 - BelovDV:handle-c-circular-dependence, ↵bors2022-11-271-0/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r=JohnTitor,petrochenkov handle c circular dependence (linux gnu) Repeating libc allows solve [this fixme](https://github.com/rust-lang/rust/blob/master/compiler/rustc_codegen_ssa/src/back/link.rs#:~:text=//%20HACK/FIXME%3A%20Fixup,the%20libc%20crate.) in rust compiler.
| * | | | handle c circular dependence (linux gnu)Daniil Belov2022-11-161-0/+2
| | |/ / | |/| |
* | | | Auto merge of #3012 - devnexen:sys_pidfd_foruclibc, r=JohnTitorbors2022-11-271-0/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding SYS_pidfd_send_signal/SYS_pidfd_getfd constants to linux uclib… …c arm flavor. closes #3008
| * | | | adding SYS_pidfd_send_signal/SYS_pidfd_getfd constants to linux uclibc arm ↵David Carlier2022-11-211-0/+2
| | |/ / | |/| | | | | | | | | | | | | | | | | | flavor. closes #3008
* | | | Auto merge of #3007 - xen0n:fix-loong, r=JohnTitorbors2022-11-271-17/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the loongarch64 kernel ABI The initial loongarch64 support code went in too early, even before the upstream kernel ABI has finalized, and was not adjusted since then. No one with enough knowledge of LoongArch was involved in the initial review, so we have been shipping broken LoongArch support, but luckily the rustc port is not merged yet so no real damage has been done. Fix the following discrepancies: - There is no longer {g,s}etrlimit, only prlimit64. - There is no longer fstat and newfstatat, only statx. - MINSIGSTKSZ and SIGSTKSZ now have different values. - The binary sysctl syscall was removed from Linux long before the existence of upstream Linux/LoongArch port (5.5 vs 5.19) so even a wrapper does not make sense. There might be more but these are the most obvious. cc `@xry111` `@zhaixiaojuan`
| * | | | Fix the loongarch64 kernel ABIWANG Xuerui2022-11-201-17/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The initial loongarch64 support code went in too early, even before the upstream kernel ABI has finalized, and was not adjusted since then. No one with enough knowledge of LoongArch was involved in the initial review, so we have been shipping broken LoongArch support, but luckily the rustc port is not merged yet so no real damage has been done. Fix the following discrepancies: - There is no longer {g,s}etrlimit, only prlimit64. - There is no longer fstat and newfstatat, only statx. - MINSIGSTKSZ and SIGSTKSZ now have different values. - The binary sysctl syscall was removed from Linux long before the existence of upstream Linux/LoongArch port (5.5 vs 5.19) so even a wrapper does not make sense. There might be more but these are the most obvious.
* | | | mips32: fix missing __s64 type definitionXiaobo Liu2022-11-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ```shell $ cargo build hello --target mipsel-unknown-linux-uclibc ... error[E0412]: cannot find type `__s64` in the crate root --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.137/src/unix/linux_like/linux/mod.rs:601:23 | 601 | pub src_fd: ::__s64, | ^^^^^ help: a type alias with a similar name exists: `__u64` | ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.137/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:15:1 | 15 | pub type __u64 = ::c_ulonglong; | ------------------------------- similarly named type alias `__u64` defined here For more information about this error, try `rustc --explain E0412`. ``` Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
* | | | Add kexec_file_load system call for arm64 linuxDavid Tolnay2022-11-211-0/+1
|/ / /
* | | Auto merge of #3001 - dtolnay-contrib:aarch64, r=JohnTitorbors2022-11-201-0/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add sys/ucontext.h signatures for linux aarch64 glibc ### `getcontext`, `setcontext`, `makecontext`, `swapcontext` From \<sys/ucontext.h\>. The specification for these was removed from POSIX.1-2008 in favor of POSIX threads, but glibc continues to ship an implementation for aarch64 just as it does for x86_64. Libc crate's existing x86_64 binding with the same signatures added in this PR: https://github.com/rust-lang/libc/blob/bbf929d2c8355fa19384b3551c5874c866be465f/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs#L810-L813 Glibc implementation: - https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/getcontext.S - https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/setcontext.S - https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/makecontext.c - https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/swapcontext.S <br> ### ~~`iopl`, `ioperm`~~ ~~From \<sys/io.h\>. These are functions for accessing x86 I/O ports. ARM has no such I/O ports in the architecture. Linux's `man 2` for both functions contains: _"This call is mostly for the i386 architecture. On many other architectures it does not exist or will always return an error."_ Glibc ships one of these "always return an error" implementation of both functions for aarch64.~~ ~~Matching signatures from x86_64:~~ https://github.com/rust-lang/libc/blob/bbf929d2c8355fa19384b3551c5874c866be465f/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs#L814-L815 ~~Glibc implementation:~~ - ~~https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/ioperm.c~~ ~~The implementation has `unsigned int` for the argument of `iopl` but I've used int in the PR to match the Linux docs, which seems more authoritative. Unclear why glibc diverges from this but it doesn't make a difference in the ABI.~~
| * | | Add sys/ucontext.h signatures for linux aarch64 glibcDavid Tolnay2022-11-191-0/+7
| |/ /
* | | Auto merge of #2995 - carbotaniuman:rand48, r=JohnTitorbors2022-11-201-0/+10
|\ \ \ | | | | | | | | | | | | Add rand48 functions
| * | | Add rand48 functionscarbotaniuman2022-11-201-0/+10
| | | |
* | | | freebsd subset of memstat api additionDavid CARLIER2022-11-131-0/+25
| |/ / |/| |
* | | Auto merge of #2992 - devnexen:fbsd_procctl_upd, r=JohnTitorbors2022-11-101-0/+11
|\ \ \ | | | | | | | | | | | | freebsd procctl flags update
| * | | freebsd procctl flags updateDavid CARLIER2022-11-071-0/+11
| | | |
* | | | Auto merge of #2991 - SteveLauC:extattr_list_xx-on-NetBSD, r=JohnTitorbors2022-11-071-0/+18
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add extattr_list_xxx() on NetBSD Corresponds to [this](https://github.com/NetBSD/src/blob/ac36f3f9fee8aff1c69d653503149faaa531f752/sys/sys/extattr.h#L98-L103): ```c ssize_t extattr_list_fd(int _fd, int _attrnamespace, void *_data, size_t _nbytes); ssize_t extattr_list_file(const char *_path, int _attrnamespace, void *_data, size_t _nbytes); ssize_t extattr_list_link(const char *_path, int _attrnamespace, void *_data, size_t _nbytes); ```
| * | | | add extattr_list_xxx() on NetBSDSteve Lau2022-11-031-0/+18
| |/ / /
* | | | Auto merge of #2984 - spencercw:android-uinput, r=JohnTitorbors2022-11-071-0/+241
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | Add Android uinput bindings This is mostly copied from the Linux bindings.
| * | | | Add Android uinput bindingsChris Spencer2022-11-071-0/+241
| | |_|/ | |/| |
* | | | Add ucontext and clone_args for loongarch64zhaixiaojuan2022-11-051-0/+33
| |/ / |/| |
* | | Auto merge of #2988 - SteveLauC:XATTR-constants-on-NetBSD, r=JohnTitorbors2022-11-031-0/+6
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add extended attributes constants on NetBSD Add three EA-related constants on NetBSD: 1. [XATTR_CREATE](https://github.com/NetBSD/src/blob/ac36f3f9fee8aff1c69d653503149faaa531f752/sys/sys/xattr.h#L54) 2. [XATTR_REPLACE](https://github.com/NetBSD/src/blob/ac36f3f9fee8aff1c69d653503149faaa531f752/sys/sys/xattr.h#L55) 3. [EXTATTR_NAMESPACE_EMPTY](https://github.com/NetBSD/src/blob/ac36f3f9fee8aff1c69d653503149faaa531f752/sys/sys/extattr.h#L44) And include `sys/xattr.h` in the test.
| * | | add extended attributes constants on NetBSDSteve Lau2022-11-021-0/+6
| | | |
* | | | Auto merge of #2914 - SteveLauC:Wrong-getpwent_r-definition-on-solarish-os, ↵bors2022-11-032-14/+53
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r=JohnTitor fix wrong definitions of getpwent_r and getgrent_r on solarish os Closes #2908 * [man page for `getpwent_r`](https://illumos.org/man/3C/getpwnam) * [man page for `getgrent_r`](https://illumos.org/man/3C/getgrnam) You may find the definitions for `getpwnam_r/getpwuid_r/getgrnam_r/getgruid_r` exposed by `libc` are also wrong: ```c struct passwd *getpwnam_r(const char *name, struct passwd *pwd, char *buffer, int buflen); ``` ```rust pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, buf: *mut ::c_cha buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; ``` But actually they are **correct** as there are the POSIX-conforming definitions (see `Standard conforming` section of above man pages): ``` Standard conforming cc [ flag...] file... -D_POSIX_PTHREAD_SEMANTICS [ library... ] int getpwnam_r(const char *name, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, size_t bufsize, struct passwd **result); ``` `getpwent_r/getgrent_r` don't get lucky, they do not have the POSIX-conforming alternatives. To double check this, I searched its [source code](https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/gen/getpwnam_r.c): ```shell $ rg "__posix_getpwnam_r" port/mapfile-vers 1582: __posix_getpwnam_r; port/gen/getpwnam_r.c 152:__posix_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, $ rg "__posix_getpwent_r" $ ```
| * | | adopt the get[pw/gr]ent_r def used by FreeBSDSteve Lau2022-10-032-14/+53
| | | |
* | | | Auto merge of #2986 - dtolnay-contrib:ficlone, r=JohnTitorbors2022-11-011-1/+3
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add FICLONE ioctl for linux aarch64 The ioctl number is the same on aarch64 as on x86_64: - https://github.com/sunfishcode/linux-raw-sys/blob/v0.1.2/src/aarch64/ioctl.rs#L215-L216 - https://github.com/sunfishcode/linux-raw-sys/blob/v0.1.2/src/x86_64/ioctl.rs#L215-L216
| * | | | Add FICLONE ioctl for linux aarch64David Tolnay2022-10-311-1/+3
| | | | |
* | | | | fix: Order of all `s_*!` macro callsFlorian Bartels2022-10-284-48/+47
|/ / / /