about summary refs log tree commit diff
path: root/library/std/src/os/unix
AgeCommit message (Collapse)AuthorLines
2023-08-14mention /proc/self/fd with /proc/self/memRalf Jung-3/+3
2023-08-14wording; and explain some of the possible consequences of violating io-safetyRalf Jung-1/+1
2023-08-13add more explicit I/O safety documentationRalf Jung-1/+2
2023-08-05std/tests: disable ancillary tests on freebsd since the feature itself is.David CARLIER-1/+1
2023-07-28inline trivial (noop) flush callsThom Chiovoloni-0/+1
2023-07-26Auto merge of #102757 - pcc:android-std-tests, r=workingjubileebors-0/+18
Make std tests pass on newer Android Newer versions of Android forbid the creation of hardlinks as well as Unix domain sockets in the /data filesystem via SELinux rules, which causes several tests depending on this behavior to fail. So let's skip these tests on Android if we see an EACCES from one of these syscalls. To achieve this, introduce a macro with the horrible name of or_panic_or_skip_on_android_eacces (better suggestions welcome) which skips (returns from) the test if an EACCES return value is seen on Android.
2023-07-22Rollup merge of #113876 - darklyspaced:master, r=cuviperMatthias Krüger-1/+30
fix docs & example for `std::os::unix::prelude::FileExt::write_at` Changelog: * used `File::create` instead of `File::read` to get a writeable file * explicity mentioned the bug with `pwrite64` in docs Unfortunately, I don't think that there is really much we can do about this since the feature has already been stabilised. We could potentially add a clippy lint warning people on Linux that using `write_at` with the `O_APPEND` flag does not exhibit the behaviour that they would have assumed. fixes #113627
2023-07-20added a problematic exampledarklyspaced-3/+25
2023-07-20fix docs & example for FileExt::write_atdarklyspaced-1/+8
2023-06-25Stabilize chown functions (`unix_chown`)Yuki Okushi-6/+3
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-06-21Update tvOS support elsewhere in the stdlibThom Chiovoloni-1/+7
2023-06-21wip: Support Apple tvOS in libstdThom Chiovoloni-2/+9
2023-06-17Rollup merge of #112352 - dankm:fbsd_doc_fix, r=thomccMatthias Krüger-1/+7
Fix documentation build on FreeBSD After the socket ancillary data implementation was introduced, the documentation build was broken on FreeBSD hosts, add the same workaround as for the existing implementations. Fixes the doc build after #91793
2023-06-13Fix building the documentation on FreeBSD.MikaelUrankar-0/+1
It fixes the following error: error[E0412]: cannot find type `sockcred2` in module `libc` --> library/std/src/os/unix/net/ancillary.rs:211:29 | 211 | pub struct SocketCred(libc::sockcred2); | ^^^^^^^^^ not found in `libc`
2023-06-06Fix documentation build on FreeBSDDan McGregor-1/+7
After the socket ancillary data implementation was introduced, the build was broken on FreeBSD, add the same workaround as for the existing implementations.
2023-06-05Std support improvement for ps vita targetNikolay Arhipov-1/+1
2023-05-30add doc on From<OwnedFd/Handle> impl for ChildStd*Vincent Thiberville-0/+12
2023-05-30add FromOwnedFd/FromOwnedHandle for ChildStdin/out/errVincent Thiberville-0/+30
2023-05-08Rollup merge of #110638 - nikarh:vita, r=Mark-SimulacrumYuki Okushi-0/+2
STD support for PSVita This PR adds std support for `armv7-sony-vita-newlibeabihf` target. The work here is fairly similar to #95897, just for a different target platform. This depends on the following pull requests: rust-lang/backtrace-rs#523 rust-lang/libc#3209
2023-05-08Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, ↵bors-1/+1
r=Mark-Simulacrum enable `rust_2018_idioms` lint group for doctests With this change, `rust_2018_idioms` lint group will be enabled for compiler/libstd doctests. Resolves #106086 Resolves #99144 Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-07PS Vita std supportNikolay Arhipov-0/+2
2023-05-07enable `rust_2018_idioms` for doctestsozkanonur-1/+1
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-04-28replace version placeholdersPietro Albini-7/+7
2023-03-27socket ancillary data implementation for FreeBSD (from 13 and above).David CARLIER-21/+194
introducing new build config as well.
2023-03-18Stabilise `unix_socket_abstract`John Millikin-12/+7
Fixes https://github.com/rust-lang/rust/issues/85410
2023-03-04Auto merge of #89518 - a1phyr:unix_file_vectored_at, r=workingjubileebors-0/+87
Add vectored positioned I/O on Unix Add methods for vectored I/O with an offset on `File` for `unix` under `#![feature(unix_file_vectored_at)]`. The new methods are wrappers around `preadv` and `pwritev`. Tracking issue: #89517
2023-03-02Make std tests pass on newer AndroidPeter Collingbourne-0/+18
Newer versions of Android forbid the creation of hardlinks as well as Unix domain sockets in the /data filesystem via SELinux rules, which causes several tests depending on this behavior to fail. So let's skip these tests on Android with an #[ignore] directive.
2023-03-02Add basic testsBenoît du Garreau-0/+61
2023-03-02Take shared references as parameterBenoît du Garreau-12/+4
2023-02-28Add QNX Neutrino support to libstdFlorian Bartels-13/+28
Co-authored-by: gh-tr <troach@qnx.com>
2023-02-27Add vectored positioned I/O on UnixBenoît du Garreau-0/+34
2023-01-04relax reference requirement on from_abstract_namemllken-1/+1
2022-11-14Rollup merge of #101967 - jmillikin:linux-abstract-socket-addr, r=joshtriplettMatthias Krüger-83/+46
Move `unix_socket_abstract` feature API to `SocketAddrExt`. The pre-stabilized API for abstract socket addresses exposes methods on `SocketAddr` that are only enabled for `cfg(any(target_os = "android", target_os = "linux"))`. Per discussion in <https://github.com/rust-lang/rust/issues/85410>, moving these methods to an OS-specific extension trait is required before stabilization can be considered. This PR makes four changes: 1. The internal module `std::os::net` contains logic for the unstable feature `tcp_quickack` (https://github.com/rust-lang/rust/issues/96256). I moved that code into `linux_ext/tcp.rs` and tried to adjust the module tree so it could accommodate a second unstable feature there. 2. Moves the public API out of `impl SocketAddr`, into `impl SocketAddrExt for SocketAddr` (the headline change). 3. The existing function names and docs for `unix_socket_abstract` refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in *the* abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer. 4. I also tweaked `from_abstract_name` so it takes an `AsRef<[u8]>` instead of `&[u8]`, allowing `b""` literals to be passed directly. Issues: 1. The public module `std::os::linux::net` is marked as part of `tcp_quickack`. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature.
2022-09-30Standard library OS support for Apple WatchOSVladimir Michael Eatwell-0/+2
2022-09-29Rollup merge of #98368 - sunfishcode:sunfishcode/std-os-fd, r=joshtriplettYuki Okushi-20/+5
Make `std::os::fd` public. `std::os::fd` defines types like `OwnedFd` and `RawFd` and is common between Unix and non-Unix platforms that share a basic file-descriptor concept. Rust currently uses this internally to simplify its own code, but it would be useful for external users in the same way, so make it public. This means that `OwnedFd` etc. will all appear in three places, for example on unix platforms: - `std::os::fd::OwnedFd` - `std::os::unix::io::OwnedFd` - `std::os::unix::prelude::OwnedFd` r? `````@joshtriplett`````
2022-09-18Move `unix_socket_abstract` feature API to `SocketAddrExt`.John Millikin-83/+46
2022-09-12Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726Dylan DPC-14/+2
Remove manual <[u8]>::escape_ascii `@rustbot` label: +C-cleanup
2022-08-29Make `std::os::fd` public.Dan Gohman-20/+5
`std::os::fd` defines types like `OwnedFd` and `RawFd` and is common between Unix and non-Unix platforms that share a basic file-descriptor concept. Rust currently uses this internally to simplify its own code, but it would be useful for external users in the same way, so make it public. This means that `OwnedFd` etc. will all appear in three places, for example on unix platforms: - `std::os::fd::OwnedFd` - `std::os::unix::io::OwnedFd` - `std::os::unix::prelude::OwnedFd`
2022-08-29Rollup merge of #96334 - devnexen:socket_mark, r=dtolnayMatthias Krüger-0/+50
socket `set_mark` addition. to be able to set a marker/id on the socket for network filtering (iptables/ipfw here) purpose.
2022-08-23Rollup merge of #100835 - devnexen:listener_followups, r=devnexenDylan DPC-4/+2
net listen backlog update, follow-up from #97963. FreeBSD and using system limit instead for others.
2022-08-22net listen backlog update, follow-up from #97963.David CARLIER-4/+2
FreeBSD and using system limit instead for others.
2022-08-21Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcmMatthias Krüger-1/+1
Replace most uses of `pointer::offset` with `add` and `sub` As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts. This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things. r? ````@scottmcm```` _split off from #100746_
2022-08-21Replace most uses of `pointer::offset` with `add` and `sub`Maybe Waffle-1/+1
2022-08-20Rollup merge of #97963 - devnexen:net_listener_neg, r=the8472Matthias Krüger-2/+10
net listen backlog set to negative on Linux. it will be 4076 (from 5.4) or 128.
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-14/+2
2022-07-20Rollup merge of #98101 - vladimir-ea:stdlib_watch_os, r=thomccDylan DPC-3/+8
stdlib support for Apple WatchOS This is a follow-up to https://github.com/rust-lang/rust/pull/95243 (Add Apple WatchOS compiler targets) that adds stdlib support for Apple WatchOS. `@deg4uss3r` `@nagisa`
2022-07-20Library changes for Apple WatchOSVladimir Michael Eatwell-3/+8
2022-07-16Expand documentation for `process_group` Josh Triplett-1/+3
Explain PGID 0, and provide the acronym PGID.
2022-07-09Document and stabilize process_set_process_groupNiklas Fiekas-3/+28
Tracking issue: https://github.com/rust-lang/rust/issues/93857 FCP finished here: https://github.com/rust-lang/rust/issues/93857#issuecomment-1179551697
2022-07-07Fix doc build on unsupported osesDavid CARLIER-2/+16