Skip to content

feat: implement cwd, umask, access, faccessat, ftruncate, fchmod, truncate #1826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 18, 2025

Conversation

zyuiop
Copy link
Contributor

@zyuiop zyuiop commented Jul 8, 2025

No description provided.

@mkroening mkroening self-assigned this Jul 8, 2025
@mkroening mkroening requested review from mkroening and stlankes July 8, 2025 18:03
Copy link
Contributor

@stlankes stlankes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have just to remove the merge conflicts.

@mkroening
Copy link
Member

Before merging I'd like to think about whether it makes sense to implement cwd functionality implemented more natively. This is a great starting point for reference, for sure, though, and maybe it would still make sense to merge this first. 🤔

@zyuiop zyuiop force-pushed the feat/fs-syscalls branch from 938d2d0 to 2f186bd Compare July 28, 2025 10:22
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark Results

Benchmark Current: fa03443 Previous: 11432b0 Performance Ratio
startup_benchmark Build Time 90.60 s 84.25 s 1.08
startup_benchmark File Size 0.89 MB 0.87 MB 1.03
Startup Time - 1 core 0.92 s (±0.03 s) 0.86 s (±0.02 s) 1.06
Startup Time - 2 cores 0.89 s (±0.04 s) 0.86 s (±0.03 s) 1.04
Startup Time - 4 cores 0.92 s (±0.03 s) 0.86 s (±0.02 s) 1.07
multithreaded_benchmark Build Time 90.28 s 82.44 s 1.10
multithreaded_benchmark File Size 0.99 MB 0.98 MB 1.01
Multithreaded Pi Efficiency - 2 Threads 3.48 % (±16.68 %) 3.19 % (±15.29 %) 1.09
Multithreaded Pi Efficiency - 4 Threads 1.73 % (±8.31 %) 1.64 % (±7.85 %) 1.06
Multithreaded Pi Efficiency - 8 Threads 0.93 % (±4.45 %) 0.96 % (±4.59 %) 0.97
micro_benchmarks Build Time 85.87 s 81.88 s 1.05
micro_benchmarks File Size 1.00 MB 0.99 MB 1.01
Scheduling time - 1 thread 2.24 ticks (±10.75 ticks) 2.19 ticks (±10.49 ticks) 1.02
Scheduling time - 2 threads 1.18 ticks (±5.66 ticks) 1.63 ticks (±7.82 ticks) 0.72
Micro - Time for syscall (getpid) 0.55 ticks (±2.64 ticks) 0.51 ticks (±2.46 ticks) 1.07
Memcpy speed - (built_in) block size 4096 1795.98 MByte/s (±8620.69 MByte/s) 1775.57 MByte/s (±8522.73 MByte/s) 1.01
Memcpy speed - (built_in) block size 1048576 754.94 MByte/s (±3623.74 MByte/s) 783.05 MByte/s (±3758.66 MByte/s) 0.96
Memcpy speed - (built_in) block size 16777216 215.34 MByte/s (±1033.63 MByte/s) 226.06 MByte/s (±1085.08 MByte/s) 0.95
Memset speed - (built_in) block size 4096 1578.95 MByte/s (±7578.95 MByte/s) 1846.15 MByte/s (±8861.54 MByte/s) 0.86
Memset speed - (built_in) block size 1048576 994.11 MByte/s (±4771.73 MByte/s) 993.86 MByte/s (±4770.54 MByte/s) 1.00
Memset speed - (built_in) block size 16777216 985.52 MByte/s (±4730.49 MByte/s) 956.85 MByte/s (±4592.90 MByte/s) 1.03
Memcpy speed - (rust) block size 4096 1363.64 MByte/s (±6545.45 MByte/s) 1411.76 MByte/s (±6776.47 MByte/s) 0.97
Memcpy speed - (rust) block size 1048576 735.59 MByte/s (±3530.84 MByte/s) 786.63 MByte/s (±3775.81 MByte/s) 0.94
Memcpy speed - (rust) block size 16777216 222.29 MByte/s (±1067.00 MByte/s) 225.87 MByte/s (±1084.17 MByte/s) 0.98
Memset speed - (rust) block size 4096 1967.21 MByte/s (±9442.62 MByte/s) 1818.18 MByte/s (±8727.27 MByte/s) 1.08
Memset speed - (rust) block size 1048576 993.22 MByte/s (±4767.46 MByte/s) 1029.71 MByte/s (±4942.59 MByte/s) 0.96
Memset speed - (rust) block size 16777216 950.75 MByte/s (±4563.58 MByte/s) 880.76 MByte/s (±4227.63 MByte/s) 1.08
alloc_benchmarks Build Time 85.78 s 80.35 s 1.07
alloc_benchmarks File Size 0.96 MB 0.94 MB 1.02
Allocations - Allocation success 2.00 % (±13.86 %) 2.00 % (±13.86 %) 1
Allocations - Deallocation success 1.39 % (±9.65 %) 1.40 % (±9.68 %) 1.00
Allocations - Pre-fail Allocations 2.00 % (±13.86 %) 2.00 % (±13.86 %) 1
Allocations - Average Allocation time 245.92 Ticks (±1704.11 Ticks) 231.88 Ticks (±1606.84 Ticks) 1.06
Allocations - Average Allocation time (no fail) 245.92 Ticks (±1704.11 Ticks) 231.88 Ticks (±1606.84 Ticks) 1.06
Allocations - Average Deallocation time 14.92 Ticks (±103.37 Ticks) 17.14 Ticks (±118.74 Ticks) 0.87
mutex_benchmark Build Time 85.50 s 79.99 s 1.07
mutex_benchmark File Size 1.00 MB 0.98 MB 1.01
Mutex Stress Test Average Time per Iteration - 1 Threads 0.28 ns (±1.94 ns) 0.24 ns (±1.66 ns) 1.17
Mutex Stress Test Average Time per Iteration - 2 Threads 0.32 ns (±2.22 ns) 0.26 ns (±1.80 ns) 1.23

This comment was automatically generated by workflow using github-action-benchmark.

@mkroening mkroening changed the title feat: add rudimentary implementation for some fs system calls feat: implement cwd, umask, access, faccessat, ftruncate, fchmod, truncate Jul 28, 2025
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks excellent for now. I only have one request. Also, do you have newlib patches for this available? It might make sense to merge both at the same time (it would also need to revert hermit-os/newlib#171).

src/fs/fuse.rs Outdated
Comment on lines 287 to 298
const FATTR_MODE = 1 << 0;
const FATTR_UID = 1 << 1;
const FATTR_GID = 1 << 2;
const FATTR_SIZE = 1 << 3;
const FATTR_ATIME = 1 << 4;
const FATTR_MTIME = 1 << 5;
const FATTR_FH = 1 << 6;
const FATTR_ATIME_NOW = 1 << 7;
const FATTR_MTIME_NOW = 1 << 8;
const FATTR_LOCKOWNER = 1 << 9;
const FATTR_CTIME = 1 << 10;
const FATTR_KILL_SUIDGID = 1 << 11;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the constants from fuse_abi::linux (already imported) on the right side here?

@zyuiop zyuiop force-pushed the feat/fs-syscalls branch from bd064dd to db6c38f Compare July 28, 2025 16:19
@zyuiop
Copy link
Contributor Author

zyuiop commented Jul 28, 2025

Good point, I have opened two PRs on newlib :)

hermit-os/newlib#172

Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have one more point for discussion before going over this one last time and merging.

@zyuiop zyuiop force-pushed the feat/fs-syscalls branch 2 times, most recently from b45340b to 8b134e2 Compare August 7, 2025 11:56
Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last round of comments :D

@zyuiop zyuiop force-pushed the feat/fs-syscalls branch 2 times, most recently from c960d19 to 60d73f5 Compare August 12, 2025 13:21
@zyuiop
Copy link
Contributor Author

zyuiop commented Aug 12, 2025

Here are my fixes :)

Copy link
Member

@mkroening mkroening left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will squash the fixup commits and make sure the CI passes for each commit and merge.

Thanks a lot! :)

@mkroening mkroening added this pull request to the merge queue Aug 18, 2025
Merged via the queue into hermit-os:main with commit 6f2b655 Aug 18, 2025
15 checks passed
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.

3 participants