about summary refs log tree commit diff
path: root/library/std/src/os/linux
AgeCommit message (Collapse)AuthorLines
2023-03-18Stabilise `unix_socket_abstract`John Millikin-2/+2
Fixes https://github.com/rust-lang/rust/issues/85410
2023-01-25Remove outdated cfg on `le32`Urgau-1/+0
See https://github.com/rust-lang/rust/pull/45041 for the removal of the target (le32-unknown-nacl).
2022-09-18Move `unix_socket_abstract` feature API to `SocketAddrExt`.John Millikin-0/+5
2022-09-18Adjust `tcp_quickack` feature to allow other `os::linux::net` features.John Millikin-2/+2
2022-08-13created tcpstream quickack traitBerend-Jan Lange-0/+5
for linux and android
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-6/+6
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-05-06Use statx's 64-bit times on 32-bit linux-gnuJosh Stone-3/+18
2022-04-14Remove use of `#[rustc_deprecated]`Jacob Pratt-6/+6
2022-01-09Compute most of Public/Exported access level in rustc_resolveLamb-0/+1
Mak DefId to AccessLevel map in resolve for export hir_id to accesslevel in resolve and applied in privacy using local def id removing tracing probes making function not recursive and adding comments Move most of Exported/Public res to rustc_resolve moving public/export res to resolve fix missing stability attributes in core, std and alloc move code to access_levels.rs return for some kinds instead of going through them Export correctness, macro changes, comments add comment for import binding add comment for import binding renmae to access level visitor, remove comments, move fn as closure, remove new_key fmt fix rebase fix rebase fmt fmt fix: move macro def to rustc_resolve fix: reachable AccessLevel for enum variants fmt fix: missing stability attributes for other architectures allow unreachable pub in rustfmt fix: missing impl access level + renaming export to reexport Missing impl access level was found thanks to a test in clippy
2021-09-20Auto merge of #88321 - glaubitz:m68k-linux, r=wesleywiserbors-0/+1
Add initial support for m68k This patch series adds initial support for m68k making use of the new M68k backend introduced with LLVM-13. Additional changes will be needed to be able to actually use the backend for this target.
2021-09-17modify std::os docs to be more consistentSachin Cherian-2/+6
> add intra doc links > add a usage example for the os::windows module
2021-09-17libstd: Add m68k for raw type definitions on LinuxJohn Paul Adrian Glaubitz-0/+1
2021-08-19Update PidFd for the new I/O safety APIs.Dan Gohman-4/+22
2021-08-04Re-use std::sealed::Sealed in os/linux/process.Mara Bos-12/+3
2021-08-01Add dummy FileDesc struct for doc targetDominik Stolz-0/+4
2021-07-21Add tracking issue and link to man-pageDominik Stolz-2/+3
2021-07-21Add PidFd type and seal traitsDominik Stolz-22/+124
Improve docs Split do_fork into two Make do_fork unsafe Add target attribute to create_pidfd field in Command Add method to get create_pidfd value
2021-07-21Add Linux-specific pidfd process extensionsAaron Hill-0/+48
Background: Over the last year, pidfd support was added to the Linux kernel. This allows interacting with other processes. In particular, this allows waiting on a child process with a timeout in a race-free way, bypassing all of the awful signal-handler tricks that are usually required. Pidfds can be obtained for a child process (as well as any other process) via the `pidfd_open` syscall. Unfortunately, this requires several conditions to hold in order to be race-free (i.e. the pid is not reused). Per `man pidfd_open`: ``` · the disposition of SIGCHLD has not been explicitly set to SIG_IGN (see sigaction(2)); · the SA_NOCLDWAIT flag was not specified while establishing a han‐ dler for SIGCHLD or while setting the disposition of that signal to SIG_DFL (see sigaction(2)); and · the zombie process was not reaped elsewhere in the program (e.g., either by an asynchronously executed signal handler or by wait(2) or similar in another thread). If any of these conditions does not hold, then the child process (along with a PID file descriptor that refers to it) should instead be created using clone(2) with the CLONE_PIDFD flag. ``` Sadly, these conditions are impossible to guarantee once any libraries are used. For example, C code runnng in a different thread could call `wait()`, which is impossible to detect from Rust code trying to open a pidfd. While pid reuse issues should (hopefully) be rare in practice, we can do better. By passing the `CLONE_PIDFD` flag to `clone()` or `clone3()`, we can obtain a pidfd for the child process in a guaranteed race-free manner. This PR: This PR adds Linux-specific process extension methods to allow obtaining pidfds for processes spawned via the standard `Command` API. Other than being made available to user code, the standard library does not make use of these pidfds in any way. In particular, the implementation of `Child::wait` is completely unchanged. Two Linux-specific helper methods are added: `CommandExt::create_pidfd` and `ChildExt::pidfd`. These methods are intended to serve as a building block for libraries to build higher-level abstractions - in particular, waiting on a process with a timeout. I've included a basic test, which verifies that pidfds are created iff the `create_pidfd` method is used. This test is somewhat special - it should always succeed on systems with the `clone3` system call available, and always fail on systems without `clone3` available. I'm not sure how to best ensure this programatically. This PR relies on the newer `clone3` system call to pass the `CLONE_FD`, rather than the older `clone` system call. `clone3` was added to Linux in the same release as pidfds, so this shouldn't unnecessarily limit the kernel versions that this code supports. Unresolved questions: * What should the name of the feature gate be for these newly added methods? * Should the `pidfd` method distinguish between an error occurring and `create_pidfd` not being called?
2021-05-03Cleanup `std::os`Christiaan Dirkx-1/+1
2021-02-02Fix AArch64 types in std::os::rawAmanieu d'Antras-8/+8
2020-10-09doc: disambiguate stat in MetadataExt::as_raw_statJosh Stone-1/+1
A few architectures in `os::linux::raw` import `libc::stat`, rather than defining that type directly. However, that also imports the _function_ called `stat`, which makes this doc link ambiguous: error: `crate::os::linux::raw::stat` is both a struct and a function --> library/std/src/os/linux/fs.rs:21:19 | 21 | /// [`stat`]: crate::os::linux::raw::stat | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous link | = note: `-D broken-intra-doc-links` implied by `-D warnings` help: to link to the struct, prefix with the item type | 21 | /// [`stat`]: struct@crate::os::linux::raw::stat | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to link to the function, add parentheses | 21 | /// [`stat`]: crate::os::linux::raw::stat() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ We want the `struct`, so it's now prefixed accordingly.
2020-09-28library/std: Set OS raw type definitions for sparc-unknown-linux-gnuJohn Paul Adrian Glaubitz-0/+1
2020-09-16library/std: linux: Add support for RISC-V 32-bitAlistair Francis-1/+2
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2020-09-11Update `std::os` module documentation.Christiaan Dirkx-2/+4
Adds missing descriptions for the modules std::os::linux::fs and std::os::windows::io. Also adds punctuation for consistency with other descriptions.
2020-08-30fix broken trait method linksAndy Russell-3/+3
2020-08-27Rollup merge of #74730 - androm3da:fix_libstd_hexlinux_01, r=dtolnayDylan DPC-24/+24
Hexagon libstd: update type defs
2020-08-11Revert #tymethodsPrabakaran Kumaresshan-3/+3
2020-08-11Switch to intra-doc links in library/std/src/os/*/fs.rsPrabakaran Kumaresshan-5/+5
2020-07-27Hexagon libstd: update type defsBrian Cain-24/+24
2020-07-27mv std libs to library/mark-0/+747