Commit Graph

6083 Commits

Author SHA1 Message Date
bors f026a6ed2b Auto merge of #3041 - devnexen:linux_kernel_version, r=JohnTitor
adding KERNEL_VERSION macro for linux.
2022-12-21 12:54:30 +00:00
David Carlier 01af5fd730 adding KERNEL_VERSION macro for linux. 2022-12-21 12:46:21 +00:00
bors c9dec3d0dd Auto merge of #2758 - fkm3:master, r=JohnTitor
Add misc constants and functions for android

These are the main diffs present in the downstream android opensource
project repo.
2022-12-21 11:05:54 +00:00
Frederick Mayle f87bf23e6f Add misc constants and functions for android
These are the main diffs present in the android opensource project.
2022-12-20 15:49:38 -08:00
bors 03d7b43ce1 Auto merge of #3038 - gh-tr:rebased/20221216, r=JohnTitor
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>
2022-12-20 11:57:29 +00:00
bors dc7e57be37 Auto merge of #3036 - LegionMammal978:iso-c-funcs, r=JohnTitor
Add missing string-to-number functions from ISO C

These should be the observable API changes:

- ISO C90 function `atol()` is added to all `fuchsia`, `unix`, `vxworks`, `wasi`, and `windows` targets.
- ISO C90 function `atof()` is added to `android`, `redox`, and `vxworks`.
- ISO C99 functions `atoll()`, `strtoll()`, and `strtoull()` are added to all `fuchsia`, `unix`, `vxworks`, `wasi`, and `windows` targets.

Also, I wasn't exactly sure where to insert the new functions, so I just tried to place them near related functions.
2022-12-20 10:07:51 +00:00
Florian Bartels a778985104 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>
2022-12-16 09:13:16 -05:00
LegionMammal978 f5a92ac64c Add ISO C functions atof, atol, atoll, strtoll, strtoull 2022-12-14 10:09:03 -05:00
bors d08276cb6c Auto merge of #3027 - Phantomical:auxval, r=JohnTitor
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
2022-12-11 02:31:05 +00:00
bors 23d62768dd Auto merge of #3030 - carbotaniuman:inotify-flags, r=JohnTitor
Try readding all inotify flags

Adds back some inotify flags that were once too new, but it appears the inexorable process of time has made the tests pass now.
2022-12-11 01:22:50 +00:00
bors 04993f298f Auto merge of #3028 - asomers:fbsd12.4, r=JohnTitor
Update FreeBSD 12 CI environment to 12.4

12.3 will soon be EoL.
2022-12-08 07:28:24 +00:00
carbotaniuman c1b40f0b85 Try readding all inotify flags 2022-12-07 08:31:03 -06:00
Alan Somers 381ee6bd6e Update FreeBSD 12 CI environment to 12.4 2022-12-05 16:53:31 -07:00
Phantomical e069c23d7d Add AT_SYSINFO_EHDR constant for linux 2022-12-04 17:29:27 -08:00
bors 5fb82c90d8 Auto merge of #2994 - SteveLauC:libc-02138, r=JohnTitor
bump to 0.2.138

Bump version to 0.2.138 🚀
2022-12-03 02:26:31 +00:00
bors afba8bcd7b Auto merge of #3024 - redox-os:redox-0.2.137, r=JohnTitor
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.
2022-12-03 01:22:57 +00:00
bors 2670873b19 Auto merge of #3021 - devnexen:getopt_long, r=JohnTitor
adding getopt_long for unixes.
2022-12-03 00:18:45 +00:00
Jeremy Soller b4fa2a0002 redox: make off_t and time_t long long 2022-12-02 07:35:14 -07:00
Jeremy Soller a9d77e8347 redox: long is 32-bits on 32-bit systems 2022-12-01 18:31:59 -07:00
David Carlier 8b16715d40 adding getopt_long for unixes. 2022-12-01 12:34:38 +00:00
bors f0e6c80e39 Auto merge of #3023 - asomers:copy_file_range, r=JohnTitor
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.
2022-11-30 22:57:15 +00:00
Alan Somers e0cd169455 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.
2022-11-30 10:13:28 -07:00
bors 3d514980c6 Auto merge of #3022 - asomers:capsicum, r=JohnTitor
Add more capsicum functions for FreeBSD

These have all been available since at least FreeBSD 9.2.
2022-11-30 12:44:39 +00:00
bors 7e14ba55f0 Auto merge of #3003 - devnexen:musl_pidfd_nonblock, r=JohnTitor
linux musl adding `PIDFD_NONBLOCK` constant.

closes #3002
2022-11-30 11:24:00 +00:00
bors c317ddc2eb Auto merge of #3010 - stevenengler:sock-storage-repr, r=JohnTitor
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/e101db2785fa471540e66d8d3d897009ee5cced1/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.)~
2022-11-30 10:16:44 +00:00
Alan Somers 82865f1cda Add FreeBSD's capsicum functions to semver 2022-11-29 17:14:34 -07:00
Alan Somers b21ffa281f Add more capsicum functions for FreeBSD
These have all been available since at least FreeBSD 9.2.
2022-11-29 17:10:49 -07:00
bors f6faf69af2 Auto merge of #3020 - ehuss:highfive-triagebot2, r=JohnTitor
Migrate from highfive to triagebot

This migrates this repository from using the highfive bot to using triagebot (aka rustbot).

This is ready to merge now, feel free to merge to re-enable auto-assignment.
2022-11-27 22:51:23 +00:00
Eric Huss 39a4ef7e84 Migrate from highfive to triagebot 2022-11-27 07:00:52 -08:00
bors 8ddefc3741 Auto merge of #3013 - BelovDV:handle-c-circular-dependence, 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.
2022-11-27 10:39:19 +00:00
bors cb4d1bd564 Auto merge of #3012 - devnexen:sys_pidfd_foruclibc, r=JohnTitor
adding SYS_pidfd_send_signal/SYS_pidfd_getfd constants to linux uclib…

…c arm flavor.

closes #3008
2022-11-27 09:36:23 +00:00
bors ecbf3521e4 Auto merge of #3007 - xen0n:fix-loong, r=JohnTitor
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`
2022-11-27 07:20:24 +00:00
bors 55c16979a2 Auto merge of #3019 - JohnTitor:revert-triagebot-assign, r=JohnTitor
Revert "Auto merge of #3018 - ehuss:highfive-triagebot, r=JohnTitor"

This reverts commit c586abb54c, reversing changes made to 968ac320bf.

Ref. https://github.com/rust-lang/libc/pull/3018#issuecomment-1328154387
2022-11-27 04:22:57 +00:00
Yuki Okushi fbfc75c689 Revert "Auto merge of #3018 - ehuss:highfive-triagebot, r=JohnTitor"
This reverts commit c586abb54c, reversing
changes made to 968ac320bf.
2022-11-27 12:46:33 +09:00
bors 74b2bbebfe Auto merge of #3016 - cppcoffee:master, r=JohnTitor
mips32: fix missing __s64 type definition

The compilation error message:

```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>
2022-11-27 02:36:34 +00:00
bors c586abb54c Auto merge of #3018 - ehuss:highfive-triagebot, r=JohnTitor
Migrate from highfive to triagebot

This migrates this repository from using the highfive bot to using triagebot (aka rustbot).

This should not be merged without coordinating the removal of the highfive webhook and/or merging https://github.com/rust-lang/highfive/pull/433.
2022-11-27 00:43:26 +00:00
Xiaobo Liu 9f73be9ef1 mips32: fix missing __s64 type definition
```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>
2022-11-26 21:33:10 +08:00
bors 968ac320bf Auto merge of #3009 - dtolnay-contrib:aarch64, r=JohnTitor
Add kexec_file_load system call for arm64 linux

This syscall was introduced in Linux 5.0. References:

- https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=43329&state=%2A&archive=both
- https://github.com/torvalds/linux/commit/4e21565b7fd4d9045765f697887e74a704135fe2
- https://github.com/sunfishcode/linux-raw-sys/blob/v0.1.2/src/aarch64/general.rs#L2118
- https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/arch-syscall.h#l110
2022-11-22 22:18:30 +00:00
David Carlier cbac5ffe1b adding SYS_pidfd_send_signal/SYS_pidfd_getfd constants to linux uclibc arm flavor.
closes #3008
2022-11-21 21:59:58 +00:00
Steven Engler 0a4068b23a fixup! Rearrange sockaddr_storage padding/alignment fields 2022-11-21 15:32:40 -05:00
Steven Engler 2ce84b13b9 Rearrange sockaddr_storage padding/alignment fields
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
2022-11-21 14:45:18 -05:00
David Tolnay 5bbff9863a Add kexec_file_load system call for arm64 linux 2022-11-21 10:40:04 -08:00
David Carlier ad6842c0cc linux musl adding PIDFD_NONBLOCK constant.
closes #3002
2022-11-20 12:08:06 +00:00
WANG Xuerui 7d2df11854 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.
2022-11-20 14:34:08 +08:00
bors e101db2785 Auto merge of #3006 - JohnTitor:pr-template, r=JohnTitor
Add pull request template

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-20 05:37:34 +00:00
bors a2f7b68be1 Auto merge of #3001 - dtolnay-contrib:aarch64, r=JohnTitor
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/af8187f9a17e839c4f1a15835c73e772a4453462/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/af8187f9a17e839c4f1a15835c73e772a4453462/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.~~
2022-11-20 04:34:24 +00:00
Yuki Okushi b5999a4b95 Add pull request template
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-11-20 13:29:42 +09:00
David Tolnay e9ef4a83ea Add sys/ucontext.h signatures for linux aarch64 glibc 2022-11-19 19:47:35 -08:00
bors d75e23a16f Auto merge of #2995 - carbotaniuman:rand48, r=JohnTitor
Add rand48 functions
2022-11-20 03:28:04 +00:00
carbotaniuman 3bf74363fe Add rand48 functions 2022-11-20 12:09:29 +09:00