Commit graph

5559 commits

Author SHA1 Message Date
Jeremy Soller 20b7e44baa
redox: add siginfo_t and rename sa_handler to sa_sigaction 2022-03-17 12:41:18 -06:00
bors f05cd2a191 Auto merge of #2723 - solid-rs:libc-02120, r=Amanieu
Bump version to 0.2.120

I'd like a new release because an upcoming PR to `rust-lang/rust` requires the merged PR: #2720
2022-03-14 11:16:57 +00:00
bors 1a311288a8 Auto merge of #2714 - AzureMarker:horizon-getrandom-and-fixes, r=Amanieu
Horizon (Nintendo 3DS) getrandom function and fixes

This PR adds `getrandom`, conforming to the [Linux spec](https://man7.org/linux/man-pages/man2/getrandom.2.html), to the `horizon` OS (Nintendo 3DS).

The 3DS doesn't have a full libc implementation, and its randomness API is pretty complicated: https://github.com/rust-random/getrandom/pull/248. For this reason (see the linked PR for more details), the randomness implementation is abstracted by using the Linux `getrandom` interface.

This PR also fixes some types on the horizon platform. See the commits and diff.

cc: `@ian-h-chamberlain` `@Meziu`
2022-03-14 10:08:37 +00:00
Tomoaki Kawada 4ba9d448db Bump version to 0.2.120 2022-03-14 10:34:53 +09:00
Mark Drobnak f25ae982ec
Fix style issues 2022-03-13 17:57:12 -07:00
Mark Drobnak 0c92066e21
Reorganize some newlib definitions into a "generic" module 2022-03-13 17:44:08 -07:00
Mark Drobnak b61fe73f3f
Merge remote-tracking branch 'rust-lang/master' into horizon-getrandom-and-fixes
# Conflicts:
#	src/unix/mod.rs
#	src/unix/newlib/horizon/mod.rs
2022-03-13 17:30:01 -07:00
bors 55cc85ff7f Auto merge of #2716 - slp:add-rseq, r=Amanieu
linux_like: add rseq syscall

Add the rseq syscall to all arches in linux_like.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2022-03-12 20:59:34 +00:00
bors 77426ba6e7 Auto merge of #2715 - AzureMarker:feature/horizon-pthread, r=Amanieu
Horizon (Nintendo 3DS) pthread functions and non-portable extensions

This PR adds some standard and nonstandard pthread/threading functions to the horizon (Nintendo 3DS) operating system. This will allow us to open a PR to std for std threads support.

The Nintendo 3DS doesn't have a full libc implementation, so there are some user libraries which implement part of libc, such as libctru:
https://github.com/devkitPro/libctru
For some more context on this situation, see https://github.com/rust-random/getrandom/pull/248

But std doesn't want to interface directly with anything that could be seen as using the "internal" interfaces of the 3DS or consoles in general:
https://github.com/rust-lang/rust/pull/88529#issuecomment-919938396

So we work around this by implementing standard pthread interfaces, plus some nonstandard ones as necessary, and expose that interface to std:
https://github.com/Meziu/pthread-3ds

Here's the justifications for the nonstandard interfaces:
* `pthread_attr_setprocessorid_np` (and the `get` version):
  The 3DS requires the core a thread runs on to be specified at thread creation time. I'm pretty sure you can't migrate threads across cores. Additionally, the cores act differently (ex. one core is cooperatively scheduled). This means we need to have an API to set the core to use in the thread attributes struct. We didn't find any relevant standard API for this, so we added a nonstandard one.
* `pthread_getprocessorid_np`:
  The 3DS lets you get the core/processor ID of the executing thread. But it doesn't have a function to get the core ID of any arbitrary thread. We didn't find any standard APIs which would match these semantics, so we added a nonportable one. Once place this API is used is to get the default core/processor ID when spawning a thread (spawn the thread on the current processor).

For more context, see:
* https://github.com/Meziu/rust-horizon/pull/10
  * Especially https://github.com/Meziu/rust-horizon/pull/10#issuecomment-1037026221
* https://github.com/rust-random/getrandom/pull/248

cc: `@ian-h-chamberlain` `@Meziu`
2022-03-12 19:45:43 +00:00
bors 331859198f Auto merge of #2708 - MabezDev:esp-idf-stat-types, r=Amanieu
Correct the size of certain types on espidf platform

This was initially discovered in https://github.com/esp-rs/rust/issues/92, the reason stat fails on the esp-idf platform is because the `stat` struct has a different layout on the Rust side compared to the C side.
2022-03-12 18:33:30 +00:00
bors bc9ea0bb6a Auto merge of #2706 - abalmos:add-j1939, r=Amanieu
Add SocketCan J1939 constants and structs

Add SocketCan J1939 constants and structs.

Blocking a PR to `nix` to wrap SocketCan's j1939 module.
2022-03-11 17:43:13 +00:00
bors 70e49b6936 Auto merge of #2720 - solid-rs:fix-solid-diverging, r=Amanieu
kmc-solid: Mark `abort`, `exit`, and `_Exit` as diverging

This PR marks these functions as diverging (`fn (...) -> !`) for the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) target, so that they are in line with the other targets (e.g., [`unix`](1708299c6b/src/unix/mod.rs (L496))).
2022-03-11 16:39:25 +00:00
Tomoaki Kawada c5c8f5934e kmc-solid: Mark abort, exit, and _Exit as diverging 2022-03-11 14:17:51 +09:00
Andrew Balmos 06a74e0308
Move typedefs into skip_types and clean up
Signed-off-by: Andrew Balmos <andrew@balmos.org>
2022-03-08 11:25:46 -05:00
Sergio Lopez 8ff52d72c1 linux_like: add rseq syscall
Add the rseq syscall to all arches in linux_like.

Signed-off-by: Sergio Lopez <slp@redhat.com>
2022-03-08 13:06:31 +01:00
bors 1708299c6b Auto merge of #2711 - devnexen:haiku_build_fix, r=Amanieu
haiku build fixes
2022-03-07 23:45:11 +00:00
bors d47792a2d2 Auto merge of #2710 - kraj:rv32, r=Amanieu
riscv32: Define O_LARGEFILE

Some applications (e.g. nix) use this define and expect it to come from libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-03-07 22:36:04 +00:00
David Carlier 8a729d59f3 haiku build fixes 2022-03-07 21:00:45 +00:00
bors db8c6776c4 Auto merge of #2709 - devnexen:obsd_search_upd, r=Amanieu
openbsd hash search api
2022-03-07 20:49:18 +00:00
Andrew Balmos 6991bfa691
Don't test J1939 on musl.
Kernel headers too old.

Signed-off-by: Andrew Balmos <andrew@balmos.org>
2022-03-07 12:43:06 -05:00
AzureMarker b62064be98
Rename "idealprocessor" attr functions to "processorid" 2022-03-06 12:31:33 -08:00
AzureMarker d38b04a4ea
Add nonstandard pthread_getprocessorid_np function 2022-03-06 12:31:32 -08:00
AzureMarker 9405ad6b77
Replace pthread_getpriority nonstandard function with standard ones
I chose the scheduler priorities based on
https://man7.org/linux/man-pages/man7/sched.7.html

I think the cooperative app cores are most like SCHED_FIFO, while the
sys core is similar to SCHED_RR.

However, I don't think our pthread implementation would be able to
accurately return the right policy since we need to know what processor
the thread is running on, and the only API to get that gets the ID for
the current thread. Since the pthread function passes in a thread ID, we
are unable to always get the processor ID and thus the policy.

In this case, I think we should just always return (and accept in set)
SCHED_FIFO. I don't think this will be used anyways.
2022-03-06 12:31:29 -08:00
AzureMarker cf92808120
Change wording to "ideal processor" and use "np" suffix
Also adds a get version, to keep consistency.
2022-03-06 12:31:06 -08:00
AzureMarker eef23c7017
Change to more standard priority function interfaces 2022-03-06 12:31:05 -08:00
AzureMarker 435f7c3374
Add some extensions to pthread for armv6k-nintendo-3ds
The pthread_attr_t type can have priority and affinity values set.
pthread_getpriority returns the priority of the current thread.

These are needed to enable std thread support. std can't link directly
with libctru so we go through pthread as an intermediate interface.
2022-03-06 12:31:03 -08:00
Ian Chamberlain c8208666bf
Add fixes from libc-test results
(cherry picked from commit 494fc865b0544851a9b18964abf2646628be3006)
2022-03-06 12:18:35 -08:00
Ian Chamberlain 4646be7a6b
Fix uid_t and gid_t sizes on horizon
(cherry picked from commit e84dbb7cb3a015c9f33db9b29019975c669113de)
2022-03-06 12:17:40 -08:00
Ian Chamberlain e99e36e8d1
Add constants for getrandom flags
(cherry picked from commit 4c03853dab634dccef9e5dd8b8f2177ee8c09195)
2022-03-06 12:16:57 -08:00
Ian Chamberlain 6716cdd58a
Add getrandom call on horizon OS
(cherry picked from commit ab957c0cbe1e08519df47180dba3f38a5681a79d)
2022-03-06 12:16:52 -08:00
Khem Raj 08e03530a1 riscv32: Define O_LARGEFILE
Some applications (e.g. nix) use this define and expect it to come from libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2022-03-05 22:16:36 -08:00
David Carlier 365ffa80e8 openbsd hash search api 2022-03-05 08:12:51 +00:00
bors ac40e640ce Auto merge of #2707 - devnexen:solarish_ninumericservconst, r=Amanieu
solarish adding newdb constants
2022-03-04 18:47:38 +00:00
Scott Mabin ab62380241 Correct the size of certain types on espidf platform 2022-03-04 14:58:35 +00:00
Andrew Balmos 99045cdc69
Re-add exceptions that are needed by old targets
Signed-off-by: Andrew Balmos <andrew@balmos.org>
2022-03-03 17:17:58 -05:00
David Carlier d046869d82 solarish adding newdb constants 2022-03-03 21:45:25 +00:00
Andrew Balmos 02042f05c2
Update src/unix/linux_like/linux/mod.rs
Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2022-03-03 15:36:32 -05:00
Andrew Balmos d590b80766
Exempt J1939 constants and remove old exceptions
Signed-off-by: Andrew Balmos <Andrew Balmos>
2022-03-03 14:17:10 -05:00
Andrew Balmos a5470ce96f
Add SocketCan J1939 constants and structs
Signed-off-by: Andrew Balmos <andrew@balmos.org>
2022-03-03 13:50:33 -05:00
bors 7650116c30 Auto merge of #2705 - devnexen:obsd_lsearch_lfind, r=Amanieu
openbsd add lsearch/lfind fn.
2022-03-03 10:42:45 +00:00
David Carlier 13eda020dc openbsd add lsearch/lfind fn. 2022-03-03 08:17:18 +00:00
bors cd875d3072 Auto merge of #2704 - devnexen:fbsd_libutil_upd, r=Amanieu
adding getlocalbase to freebsd 13
2022-03-02 22:28:56 +00:00
David CARLIER 921130a93f adding getlocalbase to freebsd 13 2022-03-02 22:07:20 +00:00
bors b9d0049b76 Auto merge of #2703 - devnexen:haiku_realhostname, r=Amanieu
haiku realhostname api
2022-03-02 01:00:40 +00:00
bors fd71b7d4cb Auto merge of #2702 - stefanha:blkiomin-blkioopt, r=Amanieu
Add Linux BLKIOMIN and BLKIOOPT ioctl constants

These ioctl constants are used to fetch the minimum and optimal I/O
sizes for block devices.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-03-01 23:34:00 +00:00
David Carlier b94d772a68 haiku realhostname api 2022-03-01 20:05:41 +00:00
Stefan Hajnoczi 496c9ccf4e Add Linux BLKIOMIN and BLKIOOPT ioctl constants
These ioctl constants are used to fetch the minimum and optimal I/O
sizes for block devices.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2022-03-01 17:12:53 +00:00
bors c029ff79e1 Auto merge of #2699 - devnexen:haiku_shadow, r=Amanieu
posix shadow api for haiku
2022-03-01 00:51:41 +00:00
bors 8933033325 Auto merge of #2701 - androm3da:hexagon_400_sys, r=Amanieu
Add 400-series syscalls to musl hexagon definitions
2022-02-28 23:49:54 +00:00
Brian Cain 356149406f Add 400-series syscalls to musl hexagon definitions 2022-02-27 22:44:37 -06:00