| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2023-11-19 | Rollup merge of #117957 - the8472:pidfd-wait, r=Mark-Simulacrum | Michael Goulet | -0/+6 | |
| if available use a Child's pidfd for kill/wait This should get us closer to stabilization of pidfds since they now do something useful. And they're `CLOEXEC` now. ``` $ strace -ffe clone,sendmsg,recvmsg,execve,kill,pidfd_open,pidfd_send_signal,waitpid,waitid ./x test std --no-doc -- pidfd [...] running 1 tests strace: Process 816007 attached [pid 816007] pidfd_open(816006, 0) = 3 [pid 816007] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f0c6b787990) = 816008 strace: Process 816008 attached [pid 816007] recvmsg(3, <unfinished ...> [pid 816008] pidfd_open(816008, 0) = 3 [pid 816008] sendmsg(4, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="", iov_len=0}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[3]}], msg_controllen=24, msg_flags=0}, 0) = 0 [pid 816007] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="", iov_len=0}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[4]}], msg_controllen=24, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 0 [pid 816008] execve("/usr/bin/false", ["false"], 0x7ffcf2100048 /* 105 vars */) = 0 [pid 816007] waitid(P_PIDFD, 4, <unfinished ...> [pid 816008] +++ exited with 1 +++ [pid 816007] <... waitid resumed>{si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=816008, si_uid=1001, si_status=1, si_utime=0, si_stime=0}, WEXITED, NULL) = 0 [pid 816007] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=816008, si_uid=1001, si_status=1, si_utime=0, si_stime=0} --- [pid 816007] clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLDstrace: Process 816009 attached , child_tidptr=0x7f0c6b787990) = 816009 [pid 816007] recvmsg(3, <unfinished ...> [pid 816009] pidfd_open(816009, 0) = 3 [pid 816009] sendmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="", iov_len=0}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[3]}], msg_controllen=24, msg_flags=0}, 0) = 0 [pid 816007] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="", iov_len=0}], msg_iovlen=1, msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[5]}], msg_controllen=24, msg_flags=MSG_CMSG_CLOEXEC}, MSG_CMSG_CLOEXEC) = 0 [pid 816009] execve("/usr/bin/sleep", ["sleep", "1000"], 0x7ffcf2100048 /* 105 vars */) = 0 [pid 816007] waitid(P_PIDFD, 5, {}, WNOHANG|WEXITED, NULL) = 0 [pid 816007] pidfd_send_signal(5, SIGKILL, NULL, 0) = 0 [pid 816007] waitid(P_PIDFD, 5, <unfinished ...> [pid 816009] +++ killed by SIGKILL +++ [pid 816007] <... waitid resumed>{si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=816009, si_uid=1001, si_status=SIGKILL, si_utime=0, si_stime=0}, WEXITED, NULL) = 0 [pid 816007] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_KILLED, si_pid=816009, si_uid=1001, si_status=SIGKILL, si_utime=0, si_stime=0} --- [pid 816007] +++ exited with 0 +++ ``` | ||||
| 2023-11-17 | Rollup merge of #117338 - workingjubilee:asmjs-meets-thanatos, r=b-naber | Matthias Krüger | -1/+0 | |
| Remove asmjs Fulfills [MCP 668](https://github.com/rust-lang/compiler-team/issues/668). `asmjs-unknown-emscripten` does not work as-specified, and lacks essential upstream support for generating asm.js, so it should not exist at all. | ||||
| 2023-11-16 | if available use a Child's pidfd for kill/wait | The 8472 | -0/+6 | |
| 2023-10-28 | Remove asmjs from library | Jubilee Young | -1/+0 | |
| 2023-10-29 | Don't use LFS64 symbols on musl | git-bruh | -1/+8 | |
| Simplify #[cfg] blocks fmt don't try to use the more appropriate direntry on musl | ||||
| 2023-08-14 | add a csky-unknown-linux-gnuabiv2 target | Dirreke | -0/+1 | |
| 2023-07-18 | support for mips32r6 as a target_arch value | chenx97 | -1/+1 | |
| 2023-07-18 | support for mips64r6 as a target_arch value | chenx97 | -0/+1 | |
| 2023-05-01 | Inline AsRawFd implementations | Konrad Borowski | -0/+1 | |
| 2023-05-01 | Inline AsInner implementations | Konrad Borowski | -0/+1 | |
| 2023-04-28 | replace version placeholders | Pietro Albini | -2/+2 | |
| 2023-04-04 | library/std: Add support for loongarch64 | zhaixiaojuan | -0/+1 | |
| 2023-03-18 | Stabilise `unix_socket_abstract` | John Millikin | -2/+2 | |
| Fixes https://github.com/rust-lang/rust/issues/85410 | ||||
| 2023-01-25 | Remove 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-18 | Move `unix_socket_abstract` feature API to `SocketAddrExt`. | John Millikin | -0/+5 | |
| 2022-09-18 | Adjust `tcp_quickack` feature to allow other `os::linux::net` features. | John Millikin | -2/+2 | |
| 2022-08-13 | created tcpstream quickack trait | Berend-Jan Lange | -0/+5 | |
| for linux and android | ||||
| 2022-05-09 | Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errors | bors | -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-06 | Use statx's 64-bit times on 32-bit linux-gnu | Josh Stone | -3/+18 | |
| 2022-04-14 | Remove use of `#[rustc_deprecated]` | Jacob Pratt | -6/+6 | |
| 2022-01-09 | Compute most of Public/Exported access level in rustc_resolve | Lamb | -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-20 | Auto merge of #88321 - glaubitz:m68k-linux, r=wesleywiser | bors | -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-17 | modify std::os docs to be more consistent | Sachin Cherian | -2/+6 | |
| > add intra doc links > add a usage example for the os::windows module | ||||
| 2021-09-17 | libstd: Add m68k for raw type definitions on Linux | John Paul Adrian Glaubitz | -0/+1 | |
| 2021-08-19 | Update PidFd for the new I/O safety APIs. | Dan Gohman | -4/+22 | |
| 2021-08-04 | Re-use std::sealed::Sealed in os/linux/process. | Mara Bos | -12/+3 | |
| 2021-08-01 | Add dummy FileDesc struct for doc target | Dominik Stolz | -0/+4 | |
| 2021-07-21 | Add tracking issue and link to man-page | Dominik Stolz | -2/+3 | |
| 2021-07-21 | Add PidFd type and seal traits | Dominik 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-21 | Add Linux-specific pidfd process extensions | Aaron 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-03 | Cleanup `std::os` | Christiaan Dirkx | -1/+1 | |
| 2021-02-02 | Fix AArch64 types in std::os::raw | Amanieu d'Antras | -8/+8 | |
| 2020-10-09 | doc: disambiguate stat in MetadataExt::as_raw_stat | Josh 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-28 | library/std: Set OS raw type definitions for sparc-unknown-linux-gnu | John Paul Adrian Glaubitz | -0/+1 | |
| 2020-09-16 | library/std: linux: Add support for RISC-V 32-bit | Alistair Francis | -1/+2 | |
| Signed-off-by: Alistair Francis <alistair.francis@wdc.com> | ||||
| 2020-09-11 | Update `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-30 | fix broken trait method links | Andy Russell | -3/+3 | |
| 2020-08-27 | Rollup merge of #74730 - androm3da:fix_libstd_hexlinux_01, r=dtolnay | Dylan DPC | -24/+24 | |
| Hexagon libstd: update type defs | ||||
| 2020-08-11 | Revert #tymethods | Prabakaran Kumaresshan | -3/+3 | |
| 2020-08-11 | Switch to intra-doc links in library/std/src/os/*/fs.rs | Prabakaran Kumaresshan | -5/+5 | |
| 2020-07-27 | Hexagon libstd: update type defs | Brian Cain | -24/+24 | |
| 2020-07-27 | mv std libs to library/ | mark | -0/+747 | |
