Skip to content

bugfix: dup2 closes target fd if open (as per POSIX spec) - #2753

Merged
mkroening merged 1 commit into
mainfrom
dup_obj
Oct 27, 2026
Merged

mkroening merged 1 commit into
mainfrom
dup_obj

Conversation

@jounathaen

Copy link
Copy Markdown
Member

From https://man7.org/linux/man-pages/man2/dup.2.html:

If the file descriptor newfd was previously open, it is closed before being reused; the close is performed silently (i.e., any errors during the close are not reported by dup2()).

@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: add8c66 Previous: 2e23902 Performance Ratio
startup_benchmark Build Time 87.32 s 80.34 s 1.09 ❗
startup_benchmark File Size 0.81 MB 0.80 MB 1.01 ❗
Startup Time - 1 core 0.74 s (±0.03 s) 0.75 s (±0.02 s) 0.99
Startup Time - 2 cores 0.73 s (±0.02 s) 0.74 s (±0.02 s) 1.00
Startup Time - 4 cores 0.74 s (±0.02 s) 0.74 s (±0.02 s) 0.99
multithreaded_benchmark Build Time 89.67 s 82.11 s 1.09 ❗
multithreaded_benchmark File Size 0.94 MB 0.86 MB 1.09 ❗
Multithreaded Pi Efficiency - 2 Threads 89.13 % (±9.26 %) 85.89 % (±6.61 %) 1.04
Multithreaded Pi Efficiency - 4 Threads 44.11 % (±2.95 %) 43.43 % (±2.56 %) 1.02
Multithreaded Pi Efficiency - 8 Threads 25.36 % (±1.82 %) 25.76 % (±1.53 %) 0.98
micro_benchmarks Build Time 88.54 s 80.40 s 1.10 ❗
micro_benchmarks File Size 0.94 MB 0.86 MB 1.09 ❗
Scheduling time - 1 thread 67.22 ticks (±2.84 ticks) 62.65 ticks (±4.06 ticks) 1.07
Scheduling time - 2 threads 37.63 ticks (±4.81 ticks) 34.08 ticks (±4.10 ticks) 1.10
Micro - Time for syscall (getpid) 4.42 ticks (±0.84 ticks) 3.45 ticks (±0.58 ticks) 1.28
Memcpy speed - (built_in) block size 4096 79860.93 MByte/s (±55429.43 MByte/s) 82448.38 MByte/s (±56997.13 MByte/s) 0.97
Memcpy speed - (built_in) block size 1048576 30192.20 MByte/s (±24322.69 MByte/s) 30585.98 MByte/s (±24707.84 MByte/s) 0.99
Memcpy speed - (built_in) block size 16777216 26030.44 MByte/s (±21636.52 MByte/s) 26340.06 MByte/s (±21720.96 MByte/s) 0.99
Memset speed - (built_in) block size 4096 80340.84 MByte/s (±55754.64 MByte/s) 82292.76 MByte/s (±56891.50 MByte/s) 0.98
Memset speed - (built_in) block size 1048576 30868.04 MByte/s (±24733.41 MByte/s) 31323.85 MByte/s (±25145.86 MByte/s) 0.99
Memset speed - (built_in) block size 16777216 26796.56 MByte/s (±22127.73 MByte/s) 27104.68 MByte/s (±22209.94 MByte/s) 0.99
Memcpy speed - (rust) block size 4096 71125.77 MByte/s (±49685.31 MByte/s) 74097.96 MByte/s (±51811.44 MByte/s) 0.96
Memcpy speed - (rust) block size 1048576 29974.39 MByte/s (±24354.30 MByte/s) 30361.60 MByte/s (±24602.37 MByte/s) 0.99
Memcpy speed - (rust) block size 16777216 27280.05 MByte/s (±22567.62 MByte/s) 27625.34 MByte/s (±22806.88 MByte/s) 0.99
Memset speed - (rust) block size 4096 71560.16 MByte/s (±50015.31 MByte/s) 74373.47 MByte/s (±51976.48 MByte/s) 0.96
Memset speed - (rust) block size 1048576 30708.86 MByte/s (±24775.83 MByte/s) 31110.89 MByte/s (±25033.24 MByte/s) 0.99
Memset speed - (rust) block size 16777216 28046.09 MByte/s (±23036.51 MByte/s) 28386.93 MByte/s (±23265.03 MByte/s) 0.99
alloc_benchmarks Build Time 83.47 s 74.76 s 1.12 ❗
alloc_benchmarks File Size 0.89 MB 0.87 MB 1.01 ❗
Allocations - Allocation success 91.37 % 91.31 % 1.00 ❗
Allocations - Deallocation success 100.00 % 100.00 % 1
Allocations - Pre-fail Allocations 61.61 % 61.44 % 1.00 ❗
Allocations - Average Allocation time 6408.18 Ticks (±144.00 Ticks) 5860.58 Ticks (±98.43 Ticks) 1.09 ❗
Allocations - Average Allocation time (no fail) 6995.87 Ticks (±169.24 Ticks) 6554.81 Ticks (±92.86 Ticks) 1.07 ❗
Allocations - Average Deallocation time 1434.57 Ticks (±333.66 Ticks) 1805.01 Ticks (±250.35 Ticks) 0.79
mutex_benchmark Build Time 84.27 s 79.82 s 1.06 ❗
mutex_benchmark File Size 0.94 MB 0.86 MB 1.09 ❗
Mutex Stress Test Average Time per Iteration - 1 Threads 12.24 ns (±0.47 ns) 12.10 ns (±0.41 ns) 1.01
Mutex Stress Test Average Time per Iteration - 2 Threads 69.68 ns (±3.44 ns) 40.26 ns (±1.68 ns) 1.73 ❗

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

@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.

Introduced in 5bec244.

LGTM 👍

@mkroening
mkroening enabled auto-merge October 27, 2026 15:24
@mkroening
mkroening added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 073df55 Oct 27, 2026
24 checks passed
@mkroening
mkroening deleted the dup_obj branch October 27, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants