⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

feat(pivot_root): add pivot_root utility#443

Open
sargas wants to merge 1 commit intouutils:mainfrom
sargas:pivot_root
Open

feat(pivot_root): add pivot_root utility#443
sargas wants to merge 1 commit intouutils:mainfrom
sargas:pivot_root

Conversation

@sargas
Copy link

@sargas sargas commented Dec 15, 2025

Implemented pivot_root, which is a simple wrapper for the pivot_root(2) syscall to enable changing the root filesystem.
Only Linux systems (including Android) have the needed syscall. I also tried to include descriptive error handling.

Implement the pivot_root(2) syscall wrapper for changing the root
filesystem. This utility is commonly used during container initialization
and system boot.

Features:
- Linux/Android support via direct syscall
- Graceful error on unsupported platforms
- Detailed error messages with errno-specific hints
- Non-UTF-8 path support via OsString

The implementation delegates all path validation to the kernel,
only checking for embedded null bytes which are invalid for C strings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant