Commit Graph

2300 Commits

Author SHA1 Message Date
Stefan Lankes
aa53a037a2 Revert "changes to pass the format check"
This reverts commit 9d596b50f1.
2020-06-15 08:43:08 +02:00
Stefan Lankes
810ba39563 remove obsolete line 2020-06-15 08:07:56 +02:00
Stefan Lankes
9d596b50f1 changes to pass the format check 2020-06-15 07:28:53 +02:00
Stefan Lankes
d221ffc68e simplify conversion to IpAddr::V6 2020-06-14 23:43:54 +02:00
Stefan Lankes
c99116afe3 remove unused function 2020-06-14 00:38:31 +02:00
Stefan Lankes
71d41d9e9f add TcpListener support for HermitCore
Add basic support of TcpListerner for HermitCore.
In addition, revise TcpStream to support peer_addr.
2020-06-13 20:51:00 +02:00
Lzu Tao
fff822fead Migrate to numeric associated consts 2020-06-10 01:35:47 +00:00
Jethro Beekman
ea48f2e4da Enable LVI hardening for x86_64-fortanix-unknown-sgx 2020-06-07 12:12:30 +02:00
Mark Rousskov
7139342249 Bump to 1.46 2020-06-03 15:27:51 -04:00
bors
2679c38fc3 Auto merge of #72472 - LeSeulArtichaut:sync-command, r=dtolnay
Implement `Sync` for `process::Command on unix and vxworks

Closes #72387.
r? @cuviper
2020-05-25 02:48:55 +00:00
LeSeulArtichaut
01630b26dd Implement Sync for `process::Command on unix and vxworks 2020-05-22 18:33:12 +02:00
Ralf Jung
53d0046983 Rollup merge of #72123 - jsgf:stabilize-arg0, r=sfackler
Stabilize process_set_argv0 feature for Unix

This stabilizes process_set_argv0 targeting 1.45.0. It has been
useful in practice and seems useful as-is.

The equivalent feature could be implemented for Windows, but as far as I
know nobody has. That can be done separately.

Tracking issue: #66510
2020-05-22 16:58:24 +02:00
bors
9e2a6a29ce Auto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum
abort_internal is safe

`sys::abort_internal` is stably exposed as a safe function. Forward that assumption "inwards" to the `sys` module by making the function itself safe, too.

This corresponds to what https://github.com/rust-lang/rust/pull/72204 did for the intrinsic. We should probably wait until that lands because some of the intrinsic calls in this PR might then need adjustments.
2020-05-18 11:11:19 +00:00
Stefan Lankes
3f47d9d2e6 minor changes to pass the format check 2020-05-18 00:06:32 +02:00
Stefan Lankes
06d692febd use new interface to initialize Condvar
HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-17 23:49:18 +02:00
Ralf Jung
2764673dca abort_internal is safe 2020-05-17 23:38:31 +02:00
Jeremy Fitzhardinge
ff9646c0ad Stabilize process_set_argv0 feature for Unix
This stabilizes process_set_argv0 targeting 1.45.0. It has been
useful in practice and seems useful as-is.

The equivalent feature could be implemented for Windows, but as far as I
know nobody has. That can be done separately.

Tracking issue: #66510
2020-05-12 09:34:23 -07:00
Dylan DPC
c818e84821 Rollup merge of #71980 - steveklabnik:warnings-fixes, r=Mark-Simulacrum
Allow a few warnings.

On Windows, these types were causing warnings to be emitted during the
build. These types are allowed to not have idiomatic names, so the
warning should be supressed.
2020-05-07 17:59:00 +02:00
Steve Klabnik
d14f000ccc Allow a few warnings.
On Windows, these types were causing warnings to be emitted during the
build. These types are allowed to not have idiomatic names, so the
warning should be supressed.
2020-05-07 07:23:06 -05:00
Dylan DPC
a6a7c755fa Rollup merge of #71591 - hermitcore:thread_create, r=hanna-kruppe
use new interface to create threads on HermitCore

- the new interface allows to define the stack size
- increase the default stack size to 1 MByte
2020-05-06 16:58:53 +02:00
Dylan DPC
b86620a558 Rollup merge of #71921 - RalfJung:open-mode, r=hanna-kruppe
explain the types used in the open64 call

Fixes https://github.com/rust-lang/rust/issues/71915, where I learned about this quirk. I don't actually know what I am talking about here. ;)
2020-05-06 13:22:22 +02:00
Ralf Jung
fbf791bd52 explain the types used in the open64 call 2020-05-05 17:08:22 +02:00
Ralf Jung
f9866f95af rely on rdlock/wrlock not returning anything but the specified error codes 2020-05-05 09:08:00 +02:00
Ralf Jung
3f50292edc edit Mutex comment 2020-05-04 20:47:46 +02:00
Ralf Jung
40a6b8c339 explain our rwlock implementation (and fix a potential data race) 2020-05-04 19:37:55 +02:00
Ralf Jung
61fdd3e2be expand comment on default mutex behavior 2020-05-04 19:17:58 +02:00
Markus Reiter
39a97900be Replace cfg macro with attribute. 2020-05-02 17:06:16 +02:00
Steven Fackler
c68f23ff6d fix wasi 2020-04-27 04:50:03 -07:00
Stefan Lankes
2c43746758 use nicer code style to define DEFAULT_MIN_STACK_SIZE 2020-04-27 13:18:33 +02:00
Steven Fackler
b00afb5782 fix wasm build 2020-04-26 16:34:14 -07:00
Stefan Lankes
4d3cf5bd9b use new interface to create threads on HermitCore
- the new interface allows to define the stack size
2020-04-26 19:47:46 +02:00
Steven Fackler
4bad27a467 Fix stragglers 2020-04-26 04:24:16 -07:00
Steven Fackler
07443f17d4 Update name 2020-04-26 04:24:16 -07:00
Steven Fackler
15262ec6be Add Read/Write::can_read/write_vectored
When working with an arbitrary reader or writer, code that uses vectored
operations may end up being slower than code that copies into a single
buffer when the underlying reader or writer doesn't actually support
vectored operations. These new methods allow you to ask the reader or
witer up front if vectored operations are efficiently supported.

Currently, you have to use some heuristics to guess by e.g. checking if
the read or write only accessed the first buffer. Hyper is one concrete
example of a library that has to do this dynamically:
0eaf304644/src/proto/h1/io.rs (L582-L594)
2020-04-26 04:23:39 -07:00
Patrick Mooney
dda5c97675 Use fcntl() to set nonblock for solarish sockets
The ioctl(FIONBIO) method of setting a file descriptor to be
non-blocking does not notify the underlying resource in the same way
that fcntl(F_SETFL, O_NONBLOCK) does on illumos and Solaris.
2020-04-15 01:10:22 +00:00
Patrick Mooney
b77aefb76e Add illumos triple
Co-Authored-By: Jason King <jason.brian.king@gmail.com>
Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>
2020-04-14 20:36:07 +00:00
Youngsuk Kim
de143312f8 Add missing comma 2020-04-14 09:29:39 -04:00
Mazdak Farrokhzad
e89cb0733a Rollup merge of #67705 - lzutao:wmemchr, r=wesleywiser
Use unrolled loop for searching NULL in [u16] on Windows
2020-04-09 05:29:36 +02:00
Dylan DPC
cf0432a5f5 Rollup merge of #70134 - hermitcore:osstrext, r=dtolnay
add basic support of OsStrExt for HermitCore

- this patch increases the compatibility to other operating systems
- in principle `ffi.rs` is derived from `src/libstd/sys/unix/ext/ffi.rs`
2020-04-08 23:33:38 +02:00
Josh Stone
f854070bb8 Forward OsStr::clone_into to the inner Vec
Despite OS differences, they're all just `Vec<u8>` inside, so we can
just forward `clone_into` calls to that optimized implementation.
2020-04-06 18:26:37 -07:00
Mazdak Farrokhzad
534f8dadb3 Rollup merge of #70808 - hermitcore:tls, r=dtolnay
Simplify dtor registration for HermitCore by using a list of destructors

The implementation is similar to the macOS version and doesn't depend on additional OS support
2020-04-06 00:53:50 +02:00
Mazdak Farrokhzad
be93b1cdc5 Rollup merge of #70553 - hermitcore:abi, r=dtolnay
move OS constants to platform crate

to reduce platform specific constants move O_RDONLY etc. and the definition of thread priorities to hermit-abi
2020-04-06 00:53:42 +02:00
Stefan Lankes
935683bd9c Simplify dtor registration for HermitCore by using a list of destructors
The implementation is similiar to macOS solution doesn't
depend on additional OS support
2020-04-05 13:41:17 +02:00
Linus Färnstrand
101085ad9f Stop importing integer modules in libstd 2020-04-05 11:22:01 +02:00
Stefan Lankes
e2780b3919 Merge branch 'master' into abi 2020-04-04 16:19:40 +02:00
bors
1b521f5773 Auto merge of #70136 - hermitcore:network_tcp, r=dtolnay
add basic IP support in HermitCore

- add initial version to support sockets
- use TcpStream as test case
- HermitCore uses smoltcp as IP stack for pure Rust applications
- further functionalities (e.g. UDP support) will be added step by step
- in principle, the current PR is a revision of #69404
2020-04-04 06:04:32 +00:00
Stefan Lankes
aa223304dc Merge branch 'master' into abi 2020-04-04 07:41:05 +02:00
Mazdak Farrokhzad
1ea8653d01 Rollup merge of #70597 - vakaras:thread_new_double_free_bug_fix, r=Amanieu
Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new

While working on concurrency support for Miri, I found that the `libstd::syn::unix::Thread::new` method has two potential problems: double-free and undefined behaviour.

**Double-free** could occur if the following events happened (credit for pointing this out goes to @RalfJung):

1.  The call to `pthread_create` successfully launched a new thread that executed to completion and deallocated `p`.
2.  The call to `pthread_attr_destroy` returned a non-zero value causing the `assert_eq!` to panic.
3.  Since `mem::forget(p)` was not yet executed, the destructor of `p` would be executed and cause a double-free.

As far as I understand, this code also violates the stacked-borrows aliasing rules and thus would result in **undefined behaviour** if these rules were adopted.  The problem is that the ownership of `p` is passed to the newly created thread before the call to `mem::forget`. Since the call to `mem::forget` is still a call, it counts as a use of `p` and triggers UB.

This pull request changes the code to use `mem::ManuallyDrop` instead of `mem::forget`. As a consequence, in case of a panic, `p` would be potentially leaked, which while undesirable is probably better than double-free or undefined behaviour.
2020-04-03 22:55:05 +02:00
Vytautas Astrauskas
d512b22f8b Delete unnecessary stub stack overflow handler for cloudabi. 2020-04-03 10:13:49 -07:00
Vytautas Astrauskas
d637d6e7a8 Delete unnecessary stub stack overflow handler for hermit. 2020-04-03 10:07:40 -07:00