Skip to content

feat: stub inode numbers and fcntl result#2454

Open
zyuiop wants to merge 2 commits into
hermit-os:mainfrom
zyuiop:feat/systemcalls
Open

feat: stub inode numbers and fcntl result#2454
zyuiop wants to merge 2 commits into
hermit-os:mainfrom
zyuiop:feat/systemcalls

Conversation

@zyuiop

@zyuiop zyuiop commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

In the process of porting some applications (C) for Hermit, we had to implement a few stub values. I have gated them behind a compilation flag.
In addition, we also fix a few problems/incompatibilities.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Benchmark Results

Details
Benchmark Current: 75490fd Previous: 30cb3f9 Performance Ratio
startup_benchmark Build Time 78.31 s 78.59 s 1.00
startup_benchmark File Size 0.76 MB 0.76 MB 1.00
Startup Time - 1 core 0.74 s (±0.03 s) 0.73 s (±0.02 s) 1.01
Startup Time - 2 cores 0.74 s (±0.02 s) 0.75 s (±0.02 s) 0.99
Startup Time - 4 cores 0.74 s (±0.02 s) 0.76 s (±0.02 s) 0.98
multithreaded_benchmark Build Time 77.94 s 80.39 s 0.97
multithreaded_benchmark File Size 0.86 MB 0.82 MB 1.05
Multithreaded Pi Efficiency - 2 Threads 89.46 % (±6.94 %) 89.59 % (±5.95 %) 1.00
Multithreaded Pi Efficiency - 4 Threads 44.26 % (±2.30 %) 43.86 % (±2.44 %) 1.01
Multithreaded Pi Efficiency - 8 Threads 25.70 % (±1.11 %) 25.65 % (±1.39 %) 1.00
micro_benchmarks Build Time 82.23 s 87.27 s 0.94
micro_benchmarks File Size 0.86 MB 0.82 MB 1.05
Scheduling time - 1 thread 66.07 ticks (±2.43 ticks) 64.58 ticks (±2.95 ticks) 1.02
Scheduling time - 2 threads 38.19 ticks (±3.92 ticks) 35.27 ticks (±2.44 ticks) 1.08
Micro - Time for syscall (getpid) 3.34 ticks (±0.15 ticks) 2.72 ticks (±0.18 ticks) 1.23
Memcpy speed - (built_in) block size 4096 81693.10 MByte/s (±56430.32 MByte/s) 84336.36 MByte/s (±58124.47 MByte/s) 0.97
Memcpy speed - (built_in) block size 1048576 30798.10 MByte/s (±24876.78 MByte/s) 30954.90 MByte/s (±25149.11 MByte/s) 0.99
Memcpy speed - (built_in) block size 16777216 29957.70 MByte/s (±24637.55 MByte/s) 27618.34 MByte/s (±22854.11 MByte/s) 1.08
Memset speed - (built_in) block size 4096 82036.85 MByte/s (±56664.86 MByte/s) 84961.36 MByte/s (±58506.83 MByte/s) 0.97
Memset speed - (built_in) block size 1048576 31525.51 MByte/s (±25305.28 MByte/s) 31697.81 MByte/s (±25573.78 MByte/s) 0.99
Memset speed - (built_in) block size 16777216 30729.89 MByte/s (±25079.28 MByte/s) 28408.60 MByte/s (±23353.48 MByte/s) 1.08
Memcpy speed - (rust) block size 4096 74324.39 MByte/s (±51923.79 MByte/s) 74740.31 MByte/s (±52172.06 MByte/s) 0.99
Memcpy speed - (rust) block size 1048576 30799.08 MByte/s (±24913.16 MByte/s) 30989.85 MByte/s (±25131.37 MByte/s) 0.99
Memcpy speed - (rust) block size 16777216 29981.74 MByte/s (±24657.42 MByte/s) 27766.19 MByte/s (±22932.85 MByte/s) 1.08
Memset speed - (rust) block size 4096 74849.84 MByte/s (±52307.60 MByte/s) 75196.89 MByte/s (±52449.92 MByte/s) 1.00
Memset speed - (rust) block size 1048576 31547.94 MByte/s (±25346.19 MByte/s) 31748.80 MByte/s (±25574.00 MByte/s) 0.99
Memset speed - (rust) block size 16777216 30747.56 MByte/s (±25094.03 MByte/s) 28552.59 MByte/s (±23427.10 MByte/s) 1.08
alloc_benchmarks Build Time 80.97 s 81.63 s 0.99
alloc_benchmarks File Size 0.84 MB 0.84 MB 1.00
Allocations - Allocation success 100.00 % 100.00 % 1
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 100.00 % 100.00 % 1
Allocations - Average Allocation time 5458.83 Ticks (±77.42 Ticks) 5722.73 Ticks (±63.96 Ticks) 0.95
Allocations - Average Allocation time (no fail) 5458.83 Ticks (±77.42 Ticks) 5722.73 Ticks (±63.96 Ticks) 0.95
Allocations - Average Deallocation time 686.16 Ticks (±114.62 Ticks) 1530.42 Ticks (±212.44 Ticks) 0.45
mutex_benchmark Build Time 81.63 s 80.99 s 1.01
mutex_benchmark File Size 0.87 MB 0.82 MB 1.05
Mutex Stress Test Average Time per Iteration - 1 Threads 12.16 ns (±0.42 ns) 12.10 ns (±0.36 ns) 1.00
Mutex Stress Test Average Time per Iteration - 2 Threads 14.72 ns (±0.60 ns) 17.00 ns (±3.01 ns) 0.87

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

@mkroening mkroening self-assigned this Jun 1, 2026
@mkroening mkroening self-requested a review June 1, 2026 19:28

@mkroening mkroening left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! :)

Comment thread src/syscalls/mod.rs Outdated
Comment on lines +720 to +722
} else if cfg!(feature = "syscall-fake-values") {
warn!("[syscall-fake-values] Unknown fcntl flag {cmd} {arg}, returning 0");
0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What scenario needs this? Which command is provided?

Comment thread src/syscalls/mod.rs
Comment on lines -485 to -487
if access_option.contains(AccessOption::F_OK) && access_option != AccessOption::F_OK {
return -i32::from(Errno::Inval);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good find! 👍

Comment thread src/fs/mem.rs Outdated
Comment on lines +371 to +376
#[cfg(feature = "syscall-fake-values")]
st_nlink: 1,
#[cfg(feature = "syscall-fake-values")]
st_blksize: 4096,
#[cfg(feature = "syscall-fake-values")]
st_ino: VFS_INO_NUM.fetch_add(1, Ordering::AcqRel),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Which program needs these values? I wonder whether we should just fake them all the time.

@zyuiop

zyuiop commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Sadly I don't precisely remember which programs required these stubs :(

It has to be one of the following: Lighttpd, Valkey, or Axum.

Sorry for not being more precise

@mkroening

Copy link
Copy Markdown
Member

No worries! I have cherry-picked the noncontroversial changes:

Here, I'd also like to avoid the feature. I think it would be best to identify the programs that need the specific workarounds or argue that the stub values are always fine.

@zyuiop

zyuiop commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

I'll remove the feature flag, I only added it when making this PR public because I did not know if you would like having the stubs unconditionnally :)

@zyuiop

zyuiop commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

I'll update this branch to remove the three cherry picked commits, and remove the feature flag

@zyuiop zyuiop force-pushed the feat/systemcalls branch from 95cbe7b to 5be10a0 Compare June 17, 2026 10:46
@zyuiop zyuiop force-pushed the feat/systemcalls branch from 5be10a0 to 75490fd Compare June 17, 2026 10:50
@zyuiop zyuiop changed the title feat/fix: change a few system calls and add stub values feat: stub inode numbers and fnctl result Jun 17, 2026
@zyuiop zyuiop changed the title feat: stub inode numbers and fnctl result feat: stub inode numbers and fcntl result Jun 17, 2026
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.

2 participants