Commit Graph

2300 Commits

Author SHA1 Message Date
ljedrz
49c8ba91c7 Change single char str patterns to chars 2018-07-23 15:32:57 +02:00
Tatsuyuki Ishi
72e2c00af4 Fix redox libstd leftover 2018-07-13 11:29:51 +02:00
Taylor Cramer
a6fa656555 Use fast TLS on Fuchsia 2018-07-11 18:11:53 -07:00
bors
66787e0524 Auto merge of #51553 - jD91mZM2:uds, r=sfackler
Unix sockets on redox

This is done using the ipcd daemon. It's not exactly like unix sockets because there is not actually a physical file for the path, but it's close enough for a basic implementation :)
This allows mio-uds and tokio-uds to work with a few modifications as well, which is exciting!
2018-07-11 14:15:01 +00:00
ljedrz
b29a6fbabc Add missing dyn for cloudabi, redox, unix and wasm 2018-07-10 20:52:29 +02:00
ljedrz
560d8079ec Deny bare trait objects in src/libstd. 2018-07-10 20:35:36 +02:00
jD91mZM2
0b56e7f1a9 Delete leftover files 2018-07-08 20:48:11 +02:00
jD91mZM2
c007a78d23 Add is_unnamed 2018-07-07 06:52:03 +02:00
jD91mZM2
abac5e722f Revert unification of interfaces 2018-07-07 06:50:55 +02:00
Pietro Albini
a3fc979b6b Rollup merge of #51809 - drrlvn:rw_exact_all_at, r=alexcrichton
Add read_exact_at and write_all_at methods to FileExt on unix

This PR adds `FileExt::read_exact_at()` and `FileExt::write_all_at()`, which are to `read_at()` and `write_at()` as `read_exact()` and `write_all()` are to `read()` and `write()`. This allows the user to not have to deal with `ErrorKind::Interrupted` and calling the functions in a loop.

I was unsure as to how to mark these new methods so I marked them `unstable`, please let me know if I should have done it differently.

I asked in Discord and was told that as this change is small it does not require an RFC.
2018-07-03 11:30:59 +02:00
jD91mZM2
ea6f9f9c55 Remove stability attributes on private types and leftover docs 2018-07-03 11:13:16 +02:00
Dror Levin
73166f751b Fill in tracking issue number for read_exact_at/write_all_at 2018-07-02 17:38:15 +03:00
moxian
be7f619870 Change traits to bare FnMut where possible. 2018-06-28 21:57:08 +00:00
moxian
9d426ac387 Make msvc symbol extraction/printing functions generic. 2018-06-28 21:57:03 +00:00
moxian
a0b15012a1 Make stackwalking generic instead of matching on enum variants. 2018-06-28 21:56:58 +00:00
moxian
c0b280f5f5 Load backtrace-related functions only once
.. and pass them around in BacktraceContext.
2018-06-28 21:56:53 +00:00
moxian
3245a475ab Split separate stackwalk variants into their own functions
.. rather than having them be one giant match statement.
2018-06-28 21:56:48 +00:00
moxian
d39c66bf4f Add a fallback for stacktrace printing for older Windows versions.
PR #47252 switched stack inspection functions of dbghelp.dll
to their newer alternatives that also capture inlined context.
Unfortunately, said new alternatives are not present in older
dbghelp.dll versions.
In particular Windows 7 at the time of writing has dbghelp.dll
version 6.1.7601 from 2010, that lacks StackWalkEx and friends.

Fixes #50138
2018-06-28 21:56:42 +00:00
jD91mZM2
c986310757 Add is_unnamed on redox 2018-06-27 18:37:44 +02:00
Adam Barth
a9f7cc3b49 [fuchsia] Update zx_cprng_draw to target semantics
This change is the final step in improving the semantics of
zx_cprng_draw. Now the syscall always generates the requested number of
bytes. If the syscall would have failed to generate the requested number
of bytes, the syscall either terminates the entire operating system or
terminates the calling process, depending on whether the error is a
result of the kernel misbehaving or the userspace program misbehaving.
2018-06-27 08:56:19 -07:00
jD91mZM2
79bf00f406 Fix tidy checks 2018-06-27 15:10:00 +02:00
jD91mZM2
a4e190546c Horrible attempt at cleaning things up that probably just made it worse 2018-06-27 10:12:34 +02:00
jD91mZM2
916f7c864a Revert "Remove functions that always error"
This reverts commit 21d09b983de87fec2e98832f4c30b52f12d6342f.
2018-06-26 20:31:35 +02:00
jD91mZM2
c86a7a01e2 Mention redox' behavior in doc comments 2018-06-26 20:31:35 +02:00
jD91mZM2
4bebd24fca Remove functions that always error 2018-06-26 20:31:35 +02:00
jD91mZM2
4286ad7f0d Disallow constructing SocketAddr from third-party code 2018-06-26 20:31:35 +02:00
jD91mZM2
2161254d8a Make feature unstable 2018-06-26 20:31:35 +02:00
jD91mZM2
c5977e3ea7 Custom feature gate (I think?) 2018-06-26 20:31:35 +02:00
jD91mZM2
419500710d Trim all lines to 100 2018-06-26 20:31:35 +02:00
jD91mZM2
3b866b0ea4 Make UnixStream::take_error return None on redox 2018-06-26 20:31:34 +02:00
jD91mZM2
2394549af5 Unix sockets on redox! 2018-06-26 20:31:34 +02:00
Dror Levin
7015dfd1b9 Add read_exact_at and write_all_at methods to FileExt on unix 2018-06-26 16:07:24 +03:00
Pietro Albini
2348dc5b3f Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum
Remove unnecessary stat64 pointer casts

In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.
2018-06-26 11:35:41 +02:00
Pietro Albini
1215965a12 Rollup merge of #51642 - GuillaumeGomez:fix-unknown-windows-build, r=oli-obk
Fix unknown windows build

Fixes #51618.
2018-06-26 11:35:35 +02:00
bors
7d2fa4a4d2 Auto merge of #50630 - sharkdp:fix-50619, r=sfackler
Fix possibly endless loop in ReadDir iterator

Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream.

This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`.

fixes #50619
2018-06-26 03:49:37 +00:00
Josh Stone
490f49fd2a Remove unnecessary stat64 pointer casts
In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.
2018-06-25 12:34:33 -07:00
Josh Stone
65d31d7269 Use fstatat64 where available 2018-06-25 11:42:27 -07:00
Guillaume Gomez
3c6c18d095 Add missing \[allow(missing_docs)\] 2018-06-25 20:38:29 +02:00
Guillaume Gomez
d259f43647 Fix doc build on unknown windows target 2018-06-20 00:07:41 +02:00
Adam Barth
03a40b31a7 Update zx_cprng_draw_new on Fuchsia
Fuchsia is changing the semantics for zx_cprng_draw and
zx_cprng_draw_new is a temporary name for the new semantics.
2018-06-19 09:46:51 -07:00
bors
86a8f1a637 Auto merge of #51529 - nodakai:improve-sys_common-mutex, r=oli-obk
libstd: add an RAII utility for sys_common::mutex::Mutex

It is indeed debatable whether or not we should introduce more sophistication like this to the lowest layer of a system library. In fact, `Drop::drop()` cannot be `unsafe` (IIRC there was a discussion on introducing an unsafe variant of `Drop` whose entire scope must be within `unsafe`)
2018-06-17 20:11:35 +00:00
bors
2b973e6532 Auto merge of #51555 - ccesare:remove_unused_variables_redox_os, r=kennytm
Removed two unused variables in os.rs

Issue #51419 suggested removing two unused variables in `libstd/sys/redox/os.rs`. This PR implements that change.

It compiles for me locally, but I haven't run any other tests.
2018-06-17 18:06:31 +00:00
NODA, Kai
b81da27862 libstd: add an RAII utility for sys_common::mutex::Mutex
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2018-06-17 15:18:32 +08:00
Guillaume Gomez
6a03884ce9 Fix issue on unix 2018-06-15 10:00:57 +02:00
Chris Cesare
8f0909c979 Removed two unused variables 2018-06-14 11:39:28 -04:00
Guillaume Gomez
231c61a76b Add missing allow_missing_docs 2018-06-13 23:30:35 +02:00
sharkdp
af75314ecd Fix possibly endless loop in ReadDir iterator
Certain directories in `/proc` can cause the `ReadDir`
iterator to loop indefinitely. We get an error code (22) when
calling libc's `readdir_r` on these directories, but `entry_ptr`
is `NULL` at the same time, signalling the end of the directory
stream.

This change introduces an internal state to the iterator such
that the `Some(Err(..))` value will only be returned once when
calling `next`. Subsequent calls will return `None`.

fixes #50619
2018-06-12 21:03:27 +02:00
bors
40f20b5327 Auto merge of #51359 - cramertj:fdio_spawn, r=sfackler
[fuchsia] Migrate from launchpad to fdio_spawn_etc

fdio_spawn_etc is the preferred way of creating processes on Fuchsia
now.

cc @abarth
2018-06-09 03:41:31 +00:00
Adam Barth
0c6cd26aec [fuchsia] Migrate from launchpad to fdio_spawn_etc
fdio_spawn_etc is the preferred way of creating processes on Fuchsia
now.
2018-06-07 09:22:59 -07:00
Mark Simulacrum
753e8f328f Rollup merge of #51255 - avdv:patch-1, r=kennytm
Fix confusing error message for sub_instant

When subtracting an Instant from another, the function will panick when `RHS > self`, but the error message confusingly displays a different error:

```rust
let i = Instant::now();
let other = Instant::now();
if other > i {
    println!("{:?}", i - other);
}
```
This results in a panic:
```
thread 'test_instant' panicked at 'other was less than the current instant', libstd/sys/unix/time.rs:292:17
```
But clearly, `other` was actually greater than the current instant.
2018-06-05 08:33:46 -06:00