about summary refs log tree commit diff
path: root/src/libstd/os
AgeCommit message (Collapse)AuthorLines
2016-04-07Fix libstd on DragonFlyMichael Neumann-10/+0
Following changes: * birthtime does not exist on DragonFly * errno: __dfly_error is no more. Use #[thread_local] static errno. * clock_gettime expects a c_ulong (use a type alias) These changes are required to build DragonFly snapshots again.
2016-03-08Auto merge of #31986 - ashleysommer:emscripten_fixes, r=alexcrichtonbors-5/+225
Fix building libstd on emscripten targets. The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. This commit also depends needs https://github.com/ashleysommer/rust/commit/f1575cff2d631e977038fdba3fa3422ba5f8f2fe applied in order to successfully build libstd with emscripten target.
2016-03-07Fix building libstd on on emscripten targets.ashleysommer-5/+225
Squashed 10 commits: 1) The main cause of the problem is that libstd/os/mod.rs treats emscripten targets as an alias of linux targets, whereas liblibc treats emscripten targets as musl-compliant, so it gets a slightly different struct stat64 defined. This commit adds conditional compilation checks to use the correct timestamp format on fs metadata functions in the case of compiling to emscripten targets. 2) Update previous commit to comply with rust formatting standards. Removed tab characters, remove trailing whitespaces. 3) Move emscripten changes into their own file under libstd/os/emscripten Put libstd/os/linux/fs back to the way it was. 4) Cannot use stat.st_ctim on emscripten to get created time. 5) Remove compile-time conditionals for target_env = musl, it looks like musl builds compile fine already. 6) Undone some formatting changes that are no longer needed, Removed some more target_env="musl" compilation checks that I missed from my previous commit. 7) upgrade to liblibc e19309c, it fixes the differences in the musl stat and stat64 definitions. 8) Undo the compile-time checks to check for emscripten (or musl targets) in the FileAttr struct. No longer needed after updating liblibc to e19309c. 9) Change the MetadataExt implementation of emscripten fs.rs module to match the changes in new liblibc. 10) remove a stray return statement, should have been removed in the previous commit.
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-02-22Auto merge of #31813 - nbaksalyar:solaris-fix, r=sanxiynbors-1/+1
A quick fix for several issues that break a Solaris/Illumos build. Also, adds a CPU target specification (as seen in a patch for OpenBSD #31727).
2016-02-22Fix broken Solaris buildNikita Baksalyar-1/+1
2016-02-21Fix `struct stat` usage on NetBSDSebastian Wicki-9/+4
Some struct members have a slighty different name on NetBSD. This has been fixed in the libc crate, but not in libstd. This also removes `st_spare` from MetadataExt, since it is private field reserved for future use.
2016-02-19Rollup merge of #31737 - dhuseby:netbsd_fixes, r=alexcrichtonSteve Klabnik-2/+2
this fixes a small compile error when building for netbsd.
2016-02-17fixes a small netbsd compile errorDave Huseby-2/+2
2016-02-17re-add freebsd paddingAli Clark-0/+3
reproduces the padding found here: https://svnweb.freebsd.org/base/release/10.1.0/sys/sys/stat.h?view=markup#l139
2016-02-17time_t is long on freebsd and dragonfly (and nsec should be long)Ali Clark-16/+20
This becomes less relevant for dragonfly a i686 support is dropped since release 40, but using long allows some compatibility for older versions.
2016-02-17unfork freebsd stat definitions, fixes x86Ali Clark-122/+50
2016-02-17remove unused import from dragonfly os rawAli Clark-3/+0
2016-02-14polish `std::os::*::raw` deprecation on openbsdSébastien Marie-1/+0
remove unused import that cause an error at compile-time.
2016-02-13std: Deprecate all std::os::*::raw typesAlex Crichton-373/+1922
This commit is an implementation of [RFC 1415][rfc] which deprecates all types in the `std::os::*::raw` modules. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1415-trim-std-os.md Many of the types in these modules don't actually have a canonical platform representation, for example the definition of `stat` on 32-bit Linux will change depending on whether C code is compiled with LFS support or not. Unfortunately the current types in `std::os::*::raw` are billed as "compatible with C", which in light of this means it isn't really possible. To make matters worse, platforms like Android sometimes define these types as *smaller* than the way they're actually represented in the `stat` structure itself. This means that when methods like `DirEntry::ino` are called on Android the result may be truncated as we're tied to returning a `ino_t` type, not the underlying type. The commit here incorporates two backwards-compatible components: * Deprecate all `raw` types that aren't in `std::os::raw` * Expand the `std::os::*::fs::MetadataExt` trait on all platforms for method accessors of all fields. The fields now returned widened types which are the same across platforms (consistency across platforms is not required, however, it's just convenient). and two also backwards-incompatible components: * Change the definition of all `std::os::*::raw` type aliases to correspond to the newly widened types that are being returned on each platform. * Change the definition of `std::os::*::raw::stat` on Linux to match the LFS definitions rather than the standard ones. The breaking changes here will specifically break code that assumes that `libc` and `std` agree on the definition of `std::os::*::raw` types, or that the `std` types are faithful representations of the types in C. An [audit] has been performed of crates.io to determine the fallout which was determined two be minimal, with the two found cases of breakage having been fixed now. [audit]: https://github.com/rust-lang/rfcs/pull/1415#issuecomment-180645582 --- Ok, so after all that, we're finally able to support LFS on Linux! This commit then simultaneously starts using `stat64` and friends on Linux to ensure that we can open >4GB files on 32-bit Linux. Yay! Closes #28978 Closes #30050 Closes #31549
2016-02-06Add the asmjs-unknown-emscripten triple. Add cfgs to libs.Brian Anderson-2/+17
Backtraces, and the compilation of libbacktrace for asmjs, are disabled. This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets* in the configure file. It disables stack protection.
2016-02-03Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichtonbors-0/+90
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: https://github.com/rust-lang-nursery/libc/pull/138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
2016-02-02Auto merge of #31312 - alexcrichton:no-le-in-powerpc64le, r=alexcrichtonbors-8/+4
Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the `target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the `powerpc64le` target does indeed set the `target_arch` as `powerpc64le`, causing a bit of inconsistency between theset two. As these are just the same instance of one instruction set, let's use `target_endian` to switch between them and only set the `target_arch` as one value. This should cut down on the number of `#[cfg]` annotations necessary and all around be a little more ergonomic.
2016-02-01Remove "powerpc64le" and "mipsel" target_archAlex Crichton-8/+4
Currently the `mipsel-unknown-linux-gnu` target doesn't actually set the `target_arch` value to `mipsel` but it rather uses `mips`. Alternatively the `powerpc64le` target does indeed set the `target_arch` as `powerpc64le`, causing a bit of inconsistency between theset two. As these are just the same instance of one instruction set, let's use `target_endian` to switch between them and only set the `target_arch` as one value. This should cut down on the number of `#[cfg]` annotations necessary and all around be a little more ergonomic.
2016-01-31Rename sunos to solarisNikita Baksalyar-1/+1
2016-01-31Add Illumos supportNikita Baksalyar-0/+90
2016-01-29add support for mips(el)-unknown-linux-muslJorge Aparicio-0/+9
This target covers MIPS devices that run the trunk version of OpenWRT. The x86_64-unknown-linux-musl target always links statically to C libraries. For the mips(el)-unknown-linux-musl target, we opt for dynamic linking (like most of other targets do) to keep binary size down. As for the C compiler flags used in the build system, we use the same flags used for the mips(el)-unknown-linux-gnu target.
2016-01-26Fix warnings during testsAlex Crichton-0/+1
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
2016-01-15Rollup merge of #30925 - semarie:blksize_t, r=alexcrichtonManish Goregaokar-1/+1
make `os::raw::tests::unix` test to pass again r? @alexcrichton
2016-01-14update blksize_t in raw to reflect libc change under openbsdSébastien Marie-1/+1
2016-01-13Add powerpc64 and powerpc64le supportAnton Blanchard-3/+10
This adds support for big endian and little endian PowerPC64. make check runs clean apart from one big endian backtrace issue.
2015-12-29Fix warnings when compiling stdlib with --testFlorian Hahn-1/+3
2015-12-04Add JoinHandleExt to get the pthread_t on unix platformsPeter Atashian-0/+24
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-11-18Fix buildbot failuresVadim Petrochenkov-9/+20
2015-11-18Add missing annotations and some testsVadim Petrochenkov-3/+9
2015-11-11Cleaner c_char cfg logicarcnmx-6/+6
2015-11-11Prefer raw::c_char or libc::c_char and fix armarcnmx-2/+6
2015-11-09std: Migrate to the new libcAlex Crichton-2/+2
* Delete `sys::unix::{c, sync}` as these are now all folded into libc itself * Update all references to use `libc` as a result. * Update all references to the new flat namespace. * Moves all windows bindings into sys::c
2015-10-28Port the standard crates to PNaCl/NaCl.Richard Diamond-239/+30
2015-10-13Make the Metadata struct CloneBen S-0/+18
This commit adds #[derive(Clone)] to std::fs::Metadata, making that struct cloneable. Although the exact contents of that struct differ between OSes, they all have it contain only value types, meaning that the data can be re-used without repercussions. It also adds #[derive(Clone)] to every type used by that struct across all OSes, including the various Unix `stat` structs and Windows's `WIN32_FILE_ATTRIBUTE_DATA`.
2015-10-06Replace multiple trailing newlines with a single trailing newlineCarlos Liam-1/+0
Sorry I didn’t get this in the last PR (#28864), I hadn’t thought of it.
2015-09-21Various fixes for NetBSD/amd64Sebastian Wicki-6/+7
2015-09-02Fix compile on DragonFly: Replace unknown uint32_t/in64_t by u32/i64.Michael Neumann-4/+4
2015-08-23New cross target: i686-linux-androidTim JIANG-1/+2
- All the libstd tests are now passing in the optimized build against a Zenfone2 and the x86 Android simulator.
2015-08-15std: Add issues to all unstable featuresAlex Crichton-2/+4
2015-07-28Fixes #25155 and fixes #27359 by fixing the stat defines for both freebsd ↵Dave Huseby-67/+124
10.1 x86_64 and i686
2015-07-01Add netbsd amd64 supportAlex Newman-0/+92
2015-06-09std: Stabilize a number of new fs featuresAlex Crichton-122/+518
This commit stabilizes the following APIs, slating them all to be cherry-picked into the 1.1 release. * fs::FileType (and transitively the derived trait implementations) * fs::Metadata::file_type * fs::FileType::is_dir * fs::FileType::is_file * fs::FileType::is_symlink * fs::DirEntry::metadata * fs::DirEntry::file_type * fs::DirEntry::file_name * fs::set_permissions * fs::symlink_metadata * os::raw::{self, *} * os::{android, bitrig, linux, ...}::raw::{self, *} * os::{android, bitrig, linux, ...}::fs::MetadataExt * os::{android, bitrig, linux, ...}::fs::MetadataExt::as_raw_stat * os::unix::fs::PermissionsExt * os::unix::fs::PermissionsExt::mode * os::unix::fs::PermissionsExt::set_mode * os::unix::fs::PermissionsExt::from_mode * os::unix::fs::OpenOptionsExt * os::unix::fs::OpenOptionsExt::mode * os::unix::fs::DirEntryExt * os::unix::fs::DirEntryExt::ino * os::windows::fs::MetadataExt * os::windows::fs::MetadataExt::file_attributes * os::windows::fs::MetadataExt::creation_time * os::windows::fs::MetadataExt::last_access_time * os::windows::fs::MetadataExt::last_write_time * os::windows::fs::MetadataExt::file_size The `os::unix::fs::Metadata` structure was also removed entirely, moving all of its associated methods into the `os::unix::fs::MetadataExt` trait instead. The methods are all marked as `#[stable]` still. As some minor cleanup, some deprecated and unstable fs apis were also removed: * File::path * Metadata::accessed * Metadata::modified Features that were explicitly left unstable include: * fs::WalkDir - the semantics of this were not considered in the recent fs expansion RFC. * fs::DirBuilder - it's still not 100% clear if the naming is right here and if the set of functionality exposed is appropriate. * fs::canonicalize - the implementation on Windows here is specifically in question as it always returns a verbatim path. Additionally the Unix implementation is susceptible to buffer overflows on long paths unfortunately. * fs::PathExt - as this is just a convenience trait, it is not stabilized at this time. * fs::set_file_times - this funciton is still waiting on a time abstraction.
2015-06-04support aarch64-android raw type definitionsSae-bom Kim-33/+82
2015-05-09Rollup merge of #25140 - kevinmehall:mips, r=steveklabnikManish Goregaokar-2/+2
Building with `--target=mipsel-unknown-linux-gnu` currently results in the following errors, fixed by this PR: ``` rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/mipsel-unknown-linux-gnu/lib/libstd /vol/rust/src/libstd/os/linux/raw.rs:76:21: 76:28 error: use of undeclared type name `c_ulong` /vol/rust/src/libstd/os/linux/raw.rs:76 pub st_dev: c_ulong, ^~~~~~~ /vol/rust/src/libstd/os/linux/raw.rs:83:22: 83:29 error: use of undeclared type name `c_ulong` /vol/rust/src/libstd/os/linux/raw.rs:83 pub st_rdev: c_ulong, ^~~~~~~ /vol/rust/src/libstd/sys/common/net2.rs:210:52: 210:70 error: unresolved name `libc::TCP_KEEPIDLE` /vol/rust/src/libstd/sys/common/net2.rs:210 setsockopt(&self.inner, libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, ```
2015-05-07std: Rename sys::foo2 modules to sys::fooAlex Crichton-9/+9
Now that `std::old_io` has been removed for quite some time the naming real estate here has opened up to allow these modules to move back to their proper names.
2015-05-05Fix MIPS build errors in libstd/os/linux/raw.rsKevin Mehall-2/+2
2015-04-30remove denied unused import: pid_t in rawSébastien Marie-4/+4
- unbreak the build under openbsd - while here, apply same modification to dragonfly, freebsd, ios (pid_t imported, but not used in raw.rs)
2015-04-27std: Expand the area of std::fsAlex Crichton-0/+971
This commit is an implementation of [RFC 1044][rfc] which adds additional surface area to the `std::fs` module. All new APIs are `#[unstable]` behind assorted feature names for each one. [rfc]: https://github.com/rust-lang/rfcs/pull/1044 The new APIs added are: * `fs::canonicalize` - bindings to `realpath` on unix and `GetFinalPathNameByHandle` on windows. * `fs::symlink_metadata` - similar to `lstat` on unix * `fs::FileType` and accessor methods as `is_{file,dir,symlink}` * `fs::Metadata::file_type` - accessor for the raw file type * `fs::DirEntry::metadata` - acquisition of metadata which is free on Windows but requires a syscall on unix. * `fs::DirEntry::file_type` - access the file type which may not require a syscall on most platforms. * `fs::DirEntry::file_name` - access just the file name without leading components. * `fs::PathExt::symlink_metadata` - convenience method for the top-level function. * `fs::PathExt::canonicalize` - convenience method for the top-level function. * `fs::PathExt::read_link` - convenience method for the top-level function. * `fs::PathExt::read_dir` - convenience method for the top-level function. * `std::os::raw` - type definitions for raw OS/C types available on all platforms. * `std::os::$platform` - new modules have been added for all currently supported platforms (e.g. those more specific than just `unix`). * `std::os::$platform::raw` - platform-specific type definitions. These modules are populated with the bare essentials necessary for lowing I/O types into their raw representations, and currently largely consist of the `stat` definition for unix platforms. This commit also deprecates `Metadata::{modified, accessed}` in favor of inspecting the raw representations via the lowering methods of `Metadata`.