about summary refs log tree commit diff
path: root/src/libnative/io
AgeCommit message (Collapse)AuthorLines
2014-06-18Deprecate the bytes!() macro.Simon Sapin-4/+4
Replace its usage with byte string literals, except in `bytes!()` tests. Also add a new snapshot, to be able to use the new b"foo" syntax. The src/etc/2014-06-rewrite-bytes-macros.py script automatically rewrites `bytes!()` invocations into byte string literals. Pass it filenames as arguments to generate a diff that you can inspect, or `--apply` followed by filenames to apply the changes in place. Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-18Shorten endian conversion method namesBrendan Zabarauskas-4/+4
The consensus on #14917 was that the proposed names were too long.
2014-06-18Merge the Bitwise and ByteOrder traits into the Int traitBrendan Zabarauskas-3/+2
This reduces the complexity of the trait hierarchy.
2014-06-18Use ByteOrder methods instead of free-standing functionsBrendan Zabarauskas-4/+5
2014-06-16std: Improve pipe() functionalityAlex Crichton-85/+128
* os::pipe() now returns IoResult<os::Pipe> * os::pipe() is now unsafe because it does not arrange for deallocation of file descriptors * os::Pipe fields are renamed from input to reader and out to write. * PipeStream::pair() has been added. This is a safe method to get a pair of pipes. * Dealing with pipes in native process bindings have been improved to be more robust in the face of failure and intermittent errors. This converts a few fail!() situations to Err situations. Closes #9458 cc #13538 Closes #14724 [breaking-change]
2014-06-16auto merge of #14900 : alexcrichton/rust/snapshots, r=huonwbors-55/+55
Closes #14898 Closes #14918
2014-06-16auto merge of #14715 : vhbit/rust/ios-pr2, r=alexcrichtonbors-4/+30
2014-06-15Register new snapshotsAlex Crichton-55/+55
2014-06-13Fix all violations of stronger guarantees for mutable borrowsCameron Zwarich-3/+2
Fix all violations in the Rust source tree of the stronger guarantee of a unique access path for mutable borrows as described in #12624.
2014-06-13Rolling up PRs in the queueAlex Crichton-10/+15
Closes #14797 (librustc: Fix the issue with labels shadowing variable names by making) Closes #14823 (Improve error messages for io::fs) Closes #14827 (libsyntax: Allow `+` to separate trait bounds from objects.) Closes #14834 (configure: Don't sync unused submodules) Closes #14838 (Remove typo on collections::treemap::UnionItems) Closes #14839 (Fix the unused struct field lint for struct variants) Closes #14840 (Clarify `Any` docs) Closes #14846 (rustc: [T, ..N] and [T, ..N+1] are not the same) Closes #14847 (Audit usage of NativeMutex) Closes #14850 (remove unnecessary PaX detection) Closes #14856 (librustc: Take in account mutability when casting array to raw ptr.) Closes #14859 (librustc: Forbid `transmute` from being called on types whose size is) Closes #14860 (Fix `quote_pat!` & parse outer attributes in `quote_item!`)
2014-06-12Basic iOS supportValerii Hiora-4/+30
2014-06-10auto merge of #14764 : jbcrail/rust/fix-more-comments, r=alexcrichtonbors-2/+2
2014-06-10auto merge of #14696 : jakub-/rust/dead-struct-fields, r=alexcrichtonbors-4/+12
This uncovered some dead code, most notably in middle/liveness.rs, which I think suggests there must be something fishy with that part of the code. The #[allow(dead_code)] annotations on some of the fields I am not super happy about but as I understand, marker type may disappear at some point.
2014-06-10Fix more misspelled comments and strings.Joseph Crail-2/+2
2014-06-09Test fixes from rollupAlex Crichton-2/+2
2014-06-09native: add more info to the native unimplemented error.Huon Wilson-1/+1
This refers to green, which (AFAICT) has everything implemented. In particular, this will help guide people to get working signal handling via libgreen.
2014-06-09std: Remove the as_utf16_p functionsAlex Crichton-146/+151
These functions are all much better expressed via RAII using the to_utf16() method on strings. This refactoring also takes this opportunity to properly handle when filenames aren't valid unicode when passed through to the windows I/O layer by properly returning I/O errors. All previous users of the `as_utf16_p` or `as_utf16_mut_p` functions will need to convert their code to using `foo.to_utf16().append_one(0)` to get a null-terminated utf16 string. [breaking-change]
2014-06-08Mark relevant structs with repr(C)Jakub Wieczorek-0/+2
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-4/+10
2014-06-06libs: Fix miscellaneous fallout of librustrtAlex Crichton-134/+114
2014-06-06native: Deal with the rtio changesAlex Crichton-298/+304
2014-06-06rtio: Remove usage of `Path`Alex Crichton-10/+10
The rtio interface is a thin low-level interface over the I/O subsystems, and the `Path` type is a little too high-level for this interface.
2014-06-05Fallout from the libcollections movementAlex Crichton-6/+9
2014-05-30windows: Allow snake_case errors for now.Kevin Butler-1/+3
2014-05-30lib{std,core,debug,rustuv,collections,native,regex}: Fix snake_case errors.Kevin Butler-1/+2
A number of functions/methods have been moved or renamed to align better with rust standard conventions. std::reflect::MovePtrAdaptor => MovePtrAdaptor::new debug::reflect::MovePtrAdaptor => MovePtrAdaptor::new std::repr::ReprVisitor => ReprVisitor::new debug::repr::ReprVisitor => ReprVisitor::new rustuv::homing::HomingIO.go_to_IO_home => go_to_io_home [breaking-change]
2014-05-29auto merge of #14487 : arielb1/rust/fix-13933, r=alexcrichtonbors-17/+23
Fix issue #13933 in a few files. A more complete fix would require core::raw::MutSlice.
2014-05-28auto merge of #14477 : alexcrichton/rust/issue-14456, r=brsonbors-52/+78
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes #14456
2014-05-28Issue #13933: Remove transmute_mut from IOAriel Ben-Yehuda-17/+23
The IO libraries casted self to mut so they can pass it to seek(SEEK_CUR, 0). Fix this by introducing a private seek function that takes &self - of course one should be careful with it if he lacks an exclusive reference to self.
2014-05-28auto merge of #14455 : crabtw/rust/mips, r=alexcrichtonbors-12/+56
Because IPv4 address conversion doesn't consider big-endian target, I add functions to handle that. These function names may need to be changed, but I can't come up with a good one.
2014-05-27native: Ignore stdio fds with /dev/nullAlex Crichton-52/+78
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes #14456
2014-05-27std: Rename strbuf operations to stringRicho Healey-1/+1
[breaking-change]
2014-05-27std: Remove String's to_ownedRicho Healey-5/+5
2014-05-28fix MIPS targetJyun-Yan You-12/+56
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-6/+6
[breaking-change]
2014-05-23core: Finish stabilizing the `mem` module.Alex Crichton-5/+5
* All of the *_val functions have gone from #[unstable] to #[stable] * The overwrite and zeroed functions have gone from #[unstable] to #[stable] * The uninit function is now deprecated, replaced by its stable counterpart, uninitialized [breaking-change]
2014-05-22auto merge of #14357 : huonw/rust/spelling, r=pnkfelixbors-2/+2
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`. ```rust //! a //! b fn bar() {} ```
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-5/+7
[breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-2/+3
2014-05-22Spelling/doc formatting fixes.Huon Wilson-2/+2
2014-05-21auto merge of #14301 : alexcrichton/rust/remove-unsafe-arc, r=brsonbors-53/+39
This type can be built with `Arc<Unsafe<T>>` now that liballoc exists.
2014-05-21std,green: Mark some queue types as NoShareAlex Crichton-11/+11
2014-05-20core: Stabilize the mem moduleAlex Crichton-21/+21
Excluding the functions inherited from the cast module last week (with marked stability levels), these functions received the following treatment. * size_of - this method has become #[stable] * nonzero_size_of/nonzero_size_of_val - these methods have been removed * min_align_of - this method is now #[stable] * pref_align_of - this method has been renamed without the `pref_` prefix, and it is the "default alignment" now. This decision is in line with what clang does (see url linked in comment on function). This function is now #[stable]. * init - renamed to zeroed and marked #[stable] * uninit - marked #[stable] * move_val_init - renamed to overwrite and marked #[stable] * {from,to}_{be,le}{16,32,64} - all functions marked #[stable] * swap/replace/drop - marked #[stable] * size_of_val/min_align_of_val/align_of_val - these functions are marked #[unstable], but will continue to exist in some form. Concerns have been raised about their `_val` prefix. [breaking-change]
2014-05-19native: Remove UnsafeArc in favor of just ArcAlex Crichton-43/+29
2014-05-15Make `from_bits` in `bitflags!` safe; add `from_bits_truncate`Aaron Turon-6/+2
Previously, the `from_bits` function in the `std::bitflags::bitflags` macro was marked as unsafe, as it did not check that the bits being converted actually corresponded to flags. This patch changes the function to check against the full set of possible flags and return an `Option` which is `None` if a non-flag bit is set. It also adds a `from_bits_truncate` function which simply zeros any bits not corresponding to a flag. This addresses the concern raised in https://github.com/mozilla/rust/pull/13897
2014-05-14Process::new etc should support non-utf8 commands/argsAaron Turon-99/+93
The existing APIs for spawning processes took strings for the command and arguments, but the underlying system may not impose utf8 encoding, so this is overly limiting. The assumption we actually want to make is just that the command and arguments are viewable as [u8] slices with no interior NULLs, i.e., as CStrings. The ToCStr trait is a handy bound for types that meet this requirement (such as &str and Path). However, since the commands and arguments are often a mixture of strings and paths, it would be inconvenient to take a slice with a single T: ToCStr bound. So this patch revamps the process creation API to instead use a builder-style interface, called `Command`, allowing arguments to be added one at a time with differing ToCStr implementations for each. The initial cut of the builder API has some drawbacks that can be addressed once issue #13851 (libstd as a facade) is closed. These are detailed as FIXMEs. Closes #11650. [breaking-change]
2014-05-13io: Implement process wait timeoutsAlex Crichton-222/+648
This implements set_timeout() for std::io::Process which will affect wait() operations on the process. This follows the same pattern as the rest of the timeouts emerging in std::io::net. The implementation was super easy for everything except libnative on unix (backwards from usual!), which required a good bit of signal handling. There's a doc comment explaining the strategy in libnative. Internally, this also required refactoring the "helper thread" implementation used by libnative to allow for an extra helper thread (not just the timer). This is a breaking change in terms of the io::Process API. It is now possible for wait() to fail, and subsequently wait_with_output(). These two functions now return IoResult<T> due to the fact that they can time out. Additionally, the wait_with_output() function has moved from taking `&mut self` to taking `self`. If a timeout occurs while waiting with output, the semantics are undesirable in almost all cases if attempting to re-wait on the process. Equivalent functionality can still be achieved by dealing with the output handles manually. [breaking-change] cc #13523
2014-05-13Test Unicode support of process spawningPhil Ruffwind-0/+4
Added a run-pass test to ensure that processes can be correctly spawned using non-ASCII arguments, working directory, and environment variables. It also tests Unicode support of os::env_as_bytes. An additional assertion was added to the test for make_command_line to verify it handles Unicode correctly.
2014-05-13Fix make_command_line to handle Unicode correctlyPhil Ruffwind-7/+8
Previously, make_command_line iterates over each u8 in the string and then appends them as chars, so any non-ASCII string will get horribly mangled by this function. This fix should allow Unicode arguments to work correctly in native::io::process::spawn.
2014-05-13Use CreateProcessW instead of CreateProcessAPhil Ruffwind-7/+10
Changed libnative to use CreateProcessW instead of CreateProcessA. In addition, the lpEnvironment parameter now uses Unicode. Added a helper function os::win32::as_mut_utf16_p, which does basically the same thing as os::win32::as_utf16_p except the pointer is mutable.
2014-05-12Add `stat` method to `std::io::fs::File` to stat without a Path.Yuri Kunde Schlesner-10/+25
The `FileStat` struct contained a `path` field, which was filled by the `stat` and `lstat` function. Since this field isn't in fact returned by the operating system (it was copied from the paths passed to the functions) it was removed, as in the `fstat` case we aren't working with a `Path`, but directly with a fd. If your code used the `path` field of `FileStat` you will now have to manually store the path passed to `stat` along with the returned struct. [breaking-change]