Containers · Course contents
Machine not started
30 min·Intermediate

Create the child with clone

Move from shell commands to the process creation system call.

Jump to code and terminal ↓

One syscall, several relationships

clone can create a process while choosing which kernel objects it shares. A separate stack belongs to the child; CLONE_NEWUTS gives it a new hostname namespace. SIGCHLD asks Linux to notify the parent when it exits.

A runtime must report failure

The launcher accepts the desired child exit status. A program that always returns zero hides failures. Wait for the child, then distinguish a normal exit from termination by a signal.

Your change

Add the UTS namespace flag without losing SIGCHLD, and return the collected exit status. The tests launch successful and failing commands and verify the parent hostname after each.

Your goal

Use clone to create a UTS-isolated child and propagate its exit status to the caller.

What the tests observe

  • C clone callback
  • Private child hostname
  • Exact child exit status

Need a nudge?

Hint 1

CLONE_NEWUTS | SIGCHLD requests a new namespace and ordinary waitable-child semantics.

Hint 2

The clone callback return value becomes the child exit code.

Hint 3

WIFEXITED(status) and WEXITSTATUS(status) decode a normal wait result; a raw wait status is not an exit code.

What happens inside Linux

The shell unshare exercises were wrappers around system calls. This launcher now owns stack allocation, namespace flags, waiting, and error propagation—the central lifecycle contract of a runtime.

Optional account sync. Exercises work without an account.

C/work/spawn.cLoading local work…
Restoring your workspace…
⌘ / Ctrl ↵
TerminalRISC-V 64 · root · /work

Your Linux machine is ready to start.

Boot a disposable environment in this browser. You’ll get a real root shell, with no remote server or account required.

Isolation checks

Observed inside Linux

Run tests to inspect namespace identities, process visibility, and the hostname. Each check reports the behavior your program produced.