Commit graph

16 commits

Author SHA1 Message Date
Richard Diamond
a7d93c939a Port the standard crates to PNaCl/NaCl. 2015-10-28 17:23:28 -05:00
Ben S
b40163beb9 Make the Metadata struct Clone
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-13 13:06:00 +01:00
Carlos Liam
aba267fd0d Replace multiple trailing newlines with a single trailing newline
Sorry I didn’t get this in the last PR (#28864), I hadn’t thought of it.
2015-10-06 13:06:39 -04:00
Sebastian Wicki
318cd843d1 Various fixes for NetBSD/amd64 2015-09-21 21:50:54 +02:00
Michael Neumann
52e7f5553e Fix compile on DragonFly: Replace unknown uint32_t/in64_t by u32/i64. 2015-09-02 10:57:57 +02:00
Tim JIANG
a1b2deb33b New cross target: i686-linux-android
- All the libstd tests are now passing in the optimized build against
  a Zenfone2 and the x86 Android simulator.
2015-08-23 15:38:11 +08:00
Alex Crichton
5f625620b5 std: Add issues to all unstable features 2015-08-15 18:09:17 -07:00
Dave Huseby
d088b67187 Fixes #25155 and fixes #27359 by fixing the stat defines for both freebsd 10.1 x86_64 and i686 2015-07-28 11:10:23 -07:00
Alex Newman
0b7c4f57f6 Add netbsd amd64 support 2015-07-01 19:09:14 -07:00
Alex Crichton
ec68c4a835 std: Stabilize a number of new fs features
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-09 17:44:13 -07:00
Sae-bom Kim
62f66a68da support aarch64-android raw type definitions 2015-06-04 14:25:05 +09:00
Manish Goregaokar
4c0f7fd6fc Rollup merge of #25140 - kevinmehall:mips, r=steveklabnik
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-09 00:37:42 +05:30
Alex Crichton
377b1adc36 std: Rename sys::foo2 modules to sys::foo
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-07 09:30:00 -07:00
Kevin Mehall
dff7676b7d Fix MIPS build errors in libstd/os/linux/raw.rs 2015-05-05 23:49:23 +00:00
Sébastien Marie
27bcd2ebc7 remove denied unused import: pid_t in raw
- 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-30 17:26:53 +02:00
Alex Crichton
9348700007 std: Expand the area of std::fs
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`.
2015-04-27 17:16:44 -07:00