Skip to content

Commit ab20774

Browse files
authored
Rollup merge of #76758 - adamlesinski:clone_clock, r=tmandry
[fuchsia] Propagate the userspace UTC clock On Fuchsia, spawning a subprocess does not automatically clone all of the parent process' capabilities. UTC time on Fuchsia is managed by a top-level userspace clock capability that is cloned and passed to subprocesses. This change ensures that any Rust subprocess gets access to the UTC clock, if the parent had access to it. This is critical for tests, which on Fuchsia, use panic=abort and spawn subprocesses per test.
2 parents a6c4d30 + fafb2e9 commit ab20774

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

library/std/src/sys/unix/process/process_fuchsia.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ impl Command {
118118
FDIO_SPAWN_CLONE_JOB
119119
| FDIO_SPAWN_CLONE_LDSVC
120120
| FDIO_SPAWN_CLONE_NAMESPACE
121-
| FDIO_SPAWN_CLONE_ENVIRON, // this is ignored when envp is non-null
121+
| FDIO_SPAWN_CLONE_ENVIRON // this is ignored when envp is non-null
122+
| FDIO_SPAWN_CLONE_UTC_CLOCK,
122123
self.get_program().as_ptr(),
123124
self.get_argv().as_ptr(),
124125
envp,

library/std/src/sys/unix/process/zircon.rs

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ pub const FDIO_SPAWN_CLONE_LDSVC: u32 = 0x0002;
138138
pub const FDIO_SPAWN_CLONE_NAMESPACE: u32 = 0x0004;
139139
pub const FDIO_SPAWN_CLONE_STDIO: u32 = 0x0008;
140140
pub const FDIO_SPAWN_CLONE_ENVIRON: u32 = 0x0010;
141+
pub const FDIO_SPAWN_CLONE_UTC_CLOCK: u32 = 0x0020;
141142
pub const FDIO_SPAWN_CLONE_ALL: u32 = 0xFFFF;
142143

143144
// fdio_spawn_etc actions

0 commit comments

Comments
 (0)