about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2016-10-16impl Debug for ReadDirDavid Henningsson-0/+16
It is good practice to implement Debug for public types, and indicating what directory you're reading seems useful. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2016-10-14Auto merge of #35704 - tbu-:pr_pread_pwrite, r=alexcrichtonbors-7/+250
Implement `read_offset` and `write_offset` These functions allow to read from and write to a file from multiple threads without changing the per-file cursor, avoiding the race between the seek and the read.
2016-10-14Android: Fix unused-imports warningTobias Bucher-1/+2
2016-10-14Only use Android fallback for {ftruncate,pread,pwrite} on 32 bitTobias Bucher-0/+24
2016-10-12Rollup merge of #36995 - nrc:stable, r=@nikomatsakisAlex Crichton-3/+2
stabilise ?, attributes on stmts, deprecate Reflect r? @nikomatsakis
2016-10-12Remove unnecessary `unsafe` blockTobias Bucher-20/+16
2016-10-12Deprecate `Reflect`Nick Cameron-3/+2
[tracking issue](https://github.com/rust-lang/rust/issues/27749)
2016-10-11Fix Android compilation `io::Error` -> `io::ErrorKind`Tobias Bucher-2/+2
2016-10-09use MSG_NOSIGNAL on all relevant platformsMathieu Poumeyrol-6/+18
2016-10-09Use `try_into` and move some functionsTobias Bucher-29/+37
2016-10-09Dynamically detect presence of `p{read,write}64` on AndroidTobias Bucher-23/+68
2016-10-09Implement reading and writing atomically at certain offsetsTobias Bucher-1/+170
These functions allow to read from and write to a file in one atomic action from multiple threads, avoiding the race between the seek and the read. The functions are named `{read,write}_at` on non-Windows (which don't change the file cursor), and `seek_{read,write}` on Windows (which change the file cursor).
2016-10-08Use less `size_t` casts in libstd since it's now defined as `usize`Tobias Bucher-37/+31
2016-10-06Rollup merge of #36965 - kallisti5:master, r=alexcrichtonJonathan Turner-1/+1
Haiku: Fix IPv6 target_os check
2016-10-05Auto merge of #36944 - brson:modos, r=alexcrichtonbors-3/+3
Fix mod declarations on untested platforms r? @alexcrichton
2016-10-04Haiku: Fix IPv6 target_os checkAlexander von Gluck IV-1/+1
2016-10-04Rollup merge of #36902 - ollie27:stab_impls, r=alexcrichtonManish Goregaokar-8/+8
std: Correct stability attributes for some implementations These are displayed by rustdoc so should be correct.
2016-10-03Fix mod declarations on untested platformsBrian Anderson-3/+3
2016-10-02Move platform-specific arg handling to sys::argsBrian Anderson-278/+290
2016-10-02Add a platform-abstraction tidy scriptBrian Anderson-1/+2
This is intended to maintain existing standards of code organization in hopes that the standard library will continue to be refactored to isolate platform-specific bits, making porting easier; where "standard library" roughly means "all the dependencies of the std and test crates". This generally means placing restrictions on where `cfg(unix)`, `cfg(windows)`, `cfg(target_os)` and `cfg(target_env)` may appear, the basic objective being to isolate platform-specific code to the platform-specific `std::sys` modules, and to the allocation, unwinding, and libc crates. Following are the basic rules, though there are currently exceptions: - core may not have platform-specific code - liballoc_system may have platform-specific code - liballoc_jemalloc may have platform-specific code - libpanic_abort may have platform-specific code - libpanic_unwind may have platform-specific code - other crates in the std facade may not - std may have platform-specific code in the following places - sys/unix/ - sys/windows/ - os/ There are plenty of exceptions today though, noted in the whitelist.
2016-10-01std: Correct stability attributes for some implementationsOliver Middleton-8/+8
These are displayed by rustdoc so should be correct.
2016-10-01std: Move platform specific stdio code into sysBrian Anderson-0/+4
2016-10-01std: Move platform specific memchr code into sysBrian Anderson-0/+305
2016-10-01std: Move platform specific env code into sysBrian Anderson-0/+194
2016-10-01std: Move platform specific path code into sysBrian Anderson-0/+139
2016-10-01Auto merge of #36824 - kali:master, r=alexcrichtonbors-5/+27
SO_NOSIGPIPE and MSG_NOSIGNAL (rebased #36426) I'm not sure what happened when I pushed a rebased branch on #36426 , github closed it...
2016-09-30Call emcc with ERROR_ON_UNDEFINED_SYMBOLSBrian Anderson-5/+18
2016-09-30Ignore various entire test modules on emscriptenBrian Anderson-19/+3
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+18
2016-09-28use MSG_NOSIGNAL from liblibcMathieu Poumeyrol-10/+6
2016-09-28MSG_NOSIGNAL on linuxMathieu Poumeyrol-4/+18
2016-09-28set SO_NOSIGPIPE on apple platformsMathieu Poumeyrol-1/+13
2016-09-28[breaking-change] std: change `encode_utf{8,16}()` to take a buffer and ↵tormol-9/+12
return a slice They panic if the buffer is too small.
2016-09-26Rollup merge of #36754 - tmiasko:getaddrinfo-errors, r=alexcrichtonJonathan Turner-2/+7
When getaddrinfo returns EAI_SYSTEM retrieve actual error from errno. Fixes issue #36546. This change also updates libc to earliest version that includes EAI_SYSTEM constant. Previously, in cases where `EAI_SYSTEM` has been returned from getaddrinfo, the resulting `io::Error` would be broadly described as "System error": Error { repr: Custom(Custom { kind: Other, error: StringError("failed to lookup address information: System error") }) } After change a more detailed error is crated based on particular value of errno, for example: Error { repr: Os { code: 64, message: "Machine is not on the network" } } The only downside is that the prefix "failed to lookup address information" is no longer included in the error message.
2016-09-26When getaddrinfo returns EAI_SYSTEM retrieve actual error from errno.Tomasz Miąsko-2/+7
Fixes issue #36546. This change also updates libc to earliest version that includes EAI_SYSTEM constant.
2016-09-26Haiku: Use common thread set_name stubAlexander von Gluck IV-7/+5
2016-09-25Haiku: Work around the lack of the FIOCLEX ioctlNiels Sascha Reedijk-2/+8
* Hand rebased from Niels original work on 1.9.0
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-11/+70
* Hand rebased from Niels original work on 1.9.0
2016-09-11Use question_mark feature in libstd.Ahmed Charles-2/+2
2016-09-09Add s390x supportUlrich Weigand-4/+10
This adds support for building the Rust compiler and standard library for s390x-linux, allowing a full cross-bootstrap sequence to complete. This includes: - Makefile/configure changes to allow native s390x builds - Full Rust compiler support for the s390x C ABI (only the non-vector ABI is supported at this point) - Port of the standard library to s390x - Update the liblibc submodule to a version including s390x support - Testsuite fixes to allow clean "make check" on s390x Caveats: - Resets base cpu to "z10" to bring support in sync with the default behaviour of other compilers on the platforms. (Usually, upstream supports all older processors; a distribution build may then chose to require a more recent base version.) (Also, using zEC12 causes failures in the valgrind tests since valgrind doesn't fully support this CPU yet.) - z13 vector ABI is not yet supported. To ensure compatible code generation, the -vector feature is passed to LLVM. Note that this means that even when compiling for z13, no vector instructions will be used. In the future, support for the vector ABI should be added (this will require common code support for different ABIs that need different data_layout strings on the same platform). - Two test cases are (temporarily) ignored on s390x to allow passing the test suite. The underlying issues still need to be fixed: * debuginfo/simd.rs fails because of incorrect debug information. This seems to be a LLVM bug (also seen with C code). * run-pass/union/union-basic.rs simply seems to be incorrect for all big-endian platforms. Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-08Auto merge of #36322 - uweigand:nonblocking, r=alexcrichtonbors-1/+1
Fix argument to FIONBIO ioctl The FIONBIO ioctl takes as argument a pointer to an integer, which should be either 0 or 1 to indicate whether nonblocking mode is to be switched off or on. The type of the pointed-to variable is "int". However, the set_nonblocking routine in libstd/sys/unix/net.rs passes a pointer to a libc::c_ulong variable. This doesn't matter on all 32-bit platforms and on all litte-endian platforms, but it will break on big-endian 64-bit platforms. Found while porting Rust to s390x (a big-endian 64-bit platform). Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-08Auto merge of #36048 - GuillaumeGomez:code_clean, r=brsonbors-12/+9
Clean code a bit
2016-09-07Fix argument to FIONBIO ioctlUlrich Weigand-1/+1
The FIONBIO ioctl takes as argument a pointer to an integer, which should be either 0 or 1 to indicate whether nonblocking mode is to be switched off or on. The type of the pointed-to variable is "int". However, the set_nonblocking routine in libstd/sys/unix/net.rs passes a pointer to a libc::c_ulong variable. This doesn't matter on all 32-bit platforms and on all litte-endian platforms, but it will break on big-endian 64-bit platforms. Found while porting Rust to s390x (a big-endian 64-bit platform). Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
2016-09-04Replace `_, _, _` with `..`Vadim Petrochenkov-1/+1
2016-08-30Auto merge of #35048 - tmiasko:monotonic-wait-timeout, r=alexcrichtonbors-8/+69
Use monotonic time in condition variables. Configure condition variables to use monotonic time using pthread_condattr_setclock on systems where this is possible. This fixes the issue when thread waiting on condition variable is woken up too late when system time is moved backwards.
2016-08-29Avoid using pthread_condattr_setclock on Android.Tomasz Miąsko-4/+4
The pthread_condattr_setclock is available only since Android 5.0 and API level 21.
2016-08-28Improve Demangling of Rust SymbolsChristopher Serr-19/+47
This turns `..` into `::`, handles some more escapes and gets rid of unwanted underscores at the beginning of path elements. ![Image of Diff](http://puu.sh/qQIN3.png)
2016-08-27Clean code a bitGuillaume Gomez-12/+9
2016-08-25Auto merge of #35906 - jseyfried:local_prelude, r=eddybbors-77/+0
Use `#[prelude_import]` in `libcore` and `libstd` r? @eddyb
2016-08-25Auto merge of #35884 - habnabit:freebsd-arc4rand, r=alexcrichtonbors-30/+77
Use arc4rand(9) on FreeBSD From rust-lang-nursery/rand#112: >After reading through #30691 it seems that there's general agreement that using OS-provided facilities for seeding rust userland processes is fine as long as it doesn't use too much from libc. FreeBSD's `arc4random_buf(3)` is not only a whole lot of libc code, but also not even currently exposed in the libc crate. Fortunately, the mechanism `arc4random_buf(3)` et al. use for getting entropy from the kernel ([`arc4rand(9)`](https://www.freebsd.org/cgi/man.cgi?query=arc4random&apropos=0&sektion=9&manpath=FreeBSD+10.3-RELEASE&arch=default&format=html)) is exposed via `sysctl(3)` with constants that are already in the libc crate. >I haven't found too much documentation on `KERN_ARND`—it's missing or only briefly described in most of the places that cover sysctl mibs. But, from digging through the kernel source, it appears that the sysctl used in this PR is very close to just calling `arc4rand(9)` directly (with `reseed` set to 0 and no way to change it). I expected [rand](/rust-lang-nursery/rand) to reply quicker, so I tried submitting it there first. It's been a few weeks with no comment, so I don't know the state of it, but maybe someone will see it here and have an opinion. This is basically the same patch. It pains me to duplicate the code but I guess it hasn't been factored out into just one place yet.