about summary refs log tree commit diff
path: root/library/std/src/sys/hermit
AgeCommit message (Collapse)AuthorLines
2024-01-11std: begin moving platform support modules into `pal`joboet-1981/+0
2023-10-19Auto merge of #116132 - darthunix:connect_poll, r=cuviperbors-0/+6
Make TCP connect handle EINTR correctly According to the [POSIX](https://pubs.opengroup.org/onlinepubs/009695399/functions/connect.html) standard, if connect() is interrupted by a signal that is caught while blocked waiting to establish a connection, connect() shall fail and set errno to EINTR, but the connection request shall not be aborted, and the connection shall be established asynchronously. When the connection has been established asynchronously, select() and poll() shall indicate that the file descriptor for the socket is ready for writing. The previous implementation differs from the recomendation: in a case of the EINTR we tried to reconnect in a loop and sometimes get EISCONN error (this problem was originally detected on MacOS). 1. More details about the problem in an [article](http://www.madore.org/~david/computers/connect-intr.html). 2. The original [issue](https://git.picodata.io/picodata/picodata/tarantool-module/-/issues/157).
2023-10-13Make TCP connect() handle EINTR correctlyDenis Smirnov-0/+6
According to the POSIX standard, if connect() is interrupted by a signal that is caught while blocked waiting to establish a connection, connect() shall fail and set errno to EINTR, but the connection request shall not be aborted, and the connection shall be established asynchronously. If asynchronous connection was successfully established after EINTR and before the next connection attempt, OS returns EISCONN that was handled as an error before. This behavior is fixed now and we handle it as success. The problem affects MacOS users: Linux doesn't return EISCONN in this case, Windows connect() can not be interrupted without an old-fashoin WSACancelBlockingCall function that is not used in the library. So current solution gives connect() as OS specific implementation.
2023-10-04std: abort instead of panicking if the global allocator uses TLSjoboet-1/+4
2023-10-03std: panic when the global allocator tries to register a TLS destructorjoboet-6/+5
2023-09-03Rollup merge of #115489 - saethlin:is-interrupted, r=thomccMatthias Krüger-2/+2
Use std::io::Error::is_interrupted everywhere In https://github.com/rust-lang/rust/pull/115228 I introduced this helper and started using it, this PR uses it to replace all applicable uses of `std::io::Error::kind`. The justification is the same; for whatever reason LLVM totally flops optimizing `Error::kind` so it's nice to use it less. FYI ``@mkroening`` I swear the hermit changes look good, but I was so sure about the previous PR.
2023-09-03Use std::io::Error::is_interrupted everywhereBen Kimock-2/+2
2023-08-29Auto merge of #115312 - hermitcore:hermit-is_interrupted, r=thomccbors-0/+5
fix(sys/hermit): add is_interrupted https://github.com/rust-lang/rust/pull/115228 broke compilation for Hermit by not adding a Hermit implementation of is_interrupted.
2023-08-28fix(sys/hermit): add is_interruptedMartin Kröning-0/+5
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-08-28fix(sys/hermit): remove obsolete network initializationMartin Kröning-8/+1
This function does not exist as of hermit-sys 0.4.1 [1]. Once std does not call this function, we can remove it entirely. [1]: https://github.com/hermitcore/hermit-rs/commit/e38f246e046c3ad50bd2f5e33d8d810d33891cbd#diff-a9b7fa816defab285f0d4fe69d4df4a0cbbcf1c89913000df3273aded949f257R10 Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
2023-08-12Rollup merge of #114132 - tamird:better-env-debug-impls, r=AmanieuMatthias Krüger-0/+28
Better Debug for Vars and VarsOs Display actual vars instead of two dots. The same was done for Args and ArgsOs in 275f9a04af6191e3aee3852a5a1713.
2023-08-07Better Debug for Vars and VarsOsTamir Duberstein-0/+28
Display actual vars instead of two dots. The same was done for Args and ArgsOs in 275f9a04af6191e3aee3852a5a1713.
2023-07-28inline trivial (noop) flush callsThom Chiovoloni-0/+1
2023-07-12fix usage of Timespec om the target hermitStefan Lankes-2/+2
2023-07-12add support of available_parallelism for target hermitStefan Lankes-2/+1
On RustyHermit, the function `get_processor_count` returns the number of activated processors.
2023-05-05Rollup merge of #103056 - beetrees:timespec-bug-fix, r=thomccDylan DPC-10/+2
Fix `checked_{add,sub}_duration` incorrectly returning `None` when `other` has more than `i64::MAX` seconds Use `checked_{add,sub}_unsigned` in `checked_{add,sub}_duration` so that the correct result is returned when adding/subtracting durations with more than `i64::MAX` seconds.
2023-05-01Inline AsRawFd implementationsKonrad Borowski-0/+2
2023-05-01Inline AsInner implementationsKonrad Borowski-0/+4
2023-04-03Rollup merge of #109722 - hermitcore:read, r=Mark-SimulacrumMatthias Krüger-7/+24
Implement read_buf for RustHermit In principle, this PR extends rust-lang/rust#108326 for RustyHermit.
2023-03-29Rollup merge of #107387 - joboet:hermit_random, r=ChrisDentonMatthias Krüger-2/+11
Use random `HashMap` keys on Hermit Initializing the keys with random data provided by the libOS avoids HashDOS attacks and similar issues. CC `@stlankes`
2023-03-29Implement read_buf for RustHermitStefan Lankes-7/+24
In principle, this PR extends rust-lang/rust#108326 for RustyHermit. Signed-off-by: Stefan Lankes <slankes@eonerc.rwth-aachen.de>
2023-03-29std: use `cvt` to handle errors from `read_entropy` on Hermitjoboet-9/+3
2023-03-19fix typo in the creation of OpenOptionStefan Lankes-1/+1
Due to this typo we have to build a workaround for issue hermitcore/libhermit-rs#191. RustyHermit is a tier 3 platform and backward compatibility does not have to be guaranteed.
2023-02-27use `as_ptr` to determine the address of atomicsStefan Lankes-3/+3
2023-02-26remove unused importsStefan Lankes-1/+0
2023-02-26std: use random HashMap keys on Hermitjoboet-2/+17
2023-02-24remove code duplicationsStefan Lankes-1/+56
2023-02-24move IO traits to std/src/os/hermitStefan Lankes-367/+12
By moving the IO traits, the RustyHermit support is harmonized to of other operating systems.
2023-02-24add support of RustyHermit's BSD socket layerStefan Lankes-455/+795
RustHermit publishs a new kernel interface and supports a common BSD socket layer. By supporting this interface, the implementation can be harmonized to other operating systems. To realize this socket layer, the handling of file descriptors is also harmonized to other operating systems.
2023-02-12Hermit: Remove floor symbolMartin Kröning-5/+0
This symbol should be provided by Hermit.
2023-01-17refactor[std]: do not use box syntaxjoboet-18/+9
2022-11-29hermit: Remove unused exportsMartin Kröning-3/+1
2022-11-29hermit: Fix fuzzy_provenance_castsMartin Kröning-1/+2
2022-11-06std: remove lock wrappers in `sys_common`joboet-3/+3
2022-10-14Fix `checked_{add,sub}_duration` incorrectly returning `None` when `other` ↵beetrees-10/+2
has more than `i64::MAX` seconds
2022-10-13std: use `sync::Mutex` for internal staticsjoboet-52/+26
2022-10-03Reduce CString allocations in std as much as possibleAlex Saveau-9/+4
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-09-09std: use futex-based locks and thread parker on Hermitjoboet-452/+47
2022-09-08Rollup merge of #101423 - mkroening:hermit-warnings, r=sanxiynMichael Goulet-4/+0
Fix hermit warnings This fixes two `unused_imprt` and one `dead_code` warning for hermit.
2022-09-08Rollup merge of #101422 - mkroening:hermit-file-time, r=joshtriplettDylan DPC-0/+12
Hermit: Add File::set_time stub This is not supported on hermit yet. This change is required for compiling std.
2022-09-04Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrumbors-3/+0
Make `ReentrantMutex` movable and `const` As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.
2022-09-05Hermit: Remove unused socklen_t (dead_code)Martin Kröning-2/+0
2022-09-05Hermit: Fix unused_importsMartin Kröning-2/+0
2022-09-05Hermit: Add File::set_time stubMartin Kröning-0/+12
This is not supported on hermit yet. This change is required for compiling std.
2022-09-03std: make `ReentrantMutex` movable and `const`; simplify `Stdout` initializationjoboet-3/+0
2022-08-28Support `#[unix_sigpipe = "inherit|sig_dfl|sig_ign"]` on `fn main()`Martin Nordholts-1/+1
This makes it possible to instruct libstd to never touch the signal handler for `SIGPIPE`, which makes programs pipeable by default (e.g. with `./your-program | head -n 1`) without `ErrorKind::BrokenPipe` errors.
2022-08-18Address reviewer commentsNick Cameron-1/+1
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-05non-linux platformsNick Cameron-3/+3
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-06-26Hermit: Make Mutex::init a no-opMartin Kröning-3/+1
2022-06-26Hermit: Fix initializing lazy locksMartin Kröning-6/+24