Skip to content

[syscall] Accept O_NONBLOCK flag in pipe2#26501

Open
thiblahute wants to merge 2 commits intoemscripten-core:mainfrom
thiblahute:pipe2_nonblock
Open

[syscall] Accept O_NONBLOCK flag in pipe2#26501
thiblahute wants to merge 2 commits intoemscripten-core:mainfrom
thiblahute:pipe2_nonblock

Conversation

@thiblahute
Copy link
Copy Markdown
Contributor

pipe2 only accepted O_CLOEXEC, rejecting O_NONBLOCK with ENOTSUP. Accept O_NONBLOCK and set it on the created pipe streams, it is a no-op in practice, but there is no reason to not allow it.

Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Can you update the test for pipe2 to include this flag?

Copy link
Copy Markdown
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

lgtm otherwise! Thanks for working on this

@thiblahute
Copy link
Copy Markdown
Contributor Author

Added a test

@sbc100 sbc100 enabled auto-merge (squash) March 20, 2026 20:38
auto-merge was automatically disabled March 23, 2026 18:22

Head branch was pushed to by a user without write access

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Mar 23, 2026

For the codesize test updates you will want to do emsdk install tot then ./tools/maint/rebaseline_tests.py

pipe2 only accepted O_CLOEXEC, rejecting O_NONBLOCK with ENOTSUP.
Accept O_NONBLOCK and set it on the created pipe streams.

This is needed by GLib's GWakeup which uses
pipe2(fds, O_CLOEXEC | O_NONBLOCK).
This is an automatic change generated by tools/maint/rebaseline_tests.py.

The following (31) test expectation files were updated by
running the tests with `--rebaseline`:

```
codesize/test_codesize_cxx_ctors1.json: 151832 => 151832 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_ctors2.json: 151235 => 151235 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_except.json: 195690 => 195690 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_except_wasm.json: 166948 => 166948 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_except_wasm_legacy.json: 164829 => 164829 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_lto.json: 120519 => 120519 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_mangle.json: 262181 => 262181 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_noexcept.json: 153855 => 153855 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_wasmfs.json: 179737 => 179737 [+0 bytes / +0.00%]
codesize/test_codesize_file_preload.json: 23789 => 23789 [+0 bytes / +0.00%]
codesize/test_codesize_files_js_fs.json: 18215 => 18215 [+0 bytes / +0.00%]
codesize/test_codesize_files_wasmfs.json: 63883 => 63883 [+0 bytes / +0.00%]
codesize/test_codesize_hello_O0.json: 39111 => 39111 [+0 bytes / +0.00%]
codesize/test_codesize_hello_O1.json: 8875 => 8875 [+0 bytes / +0.00%]
codesize/test_codesize_hello_dylink.json: 43853 => 43853 [+0 bytes / +0.00%]
codesize/test_codesize_hello_dylink_all.json: 821751 => 821794 [+43 bytes / +0.01%]
codesize/test_codesize_mem_O3.json: 9614 => 9614 [+0 bytes / +0.00%]
codesize/test_codesize_mem_O3_grow.json: 9900 => 9900 [+0 bytes / +0.00%]
codesize/test_codesize_minimal_O0.json: 20467 => 20467 [+0 bytes / +0.00%]
codesize/test_codesize_minimal_pthreads.json: 26409 => 26409 [+0 bytes / +0.00%]
codesize/test_codesize_minimal_pthreads_memgrowth.json: 26812 => 26812 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_embind.json: 14909 => 14909 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_embind_val.json: 11642 => 11642 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl2_wasm.json: 13200 => 13200 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl2_wasm2js.json: 18534 => 18534 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl2_wasm_singlefile.json: 15046 => 15046 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl_wasm.json: 12738 => 12738 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl_wasm2js.json: 18060 => 18060 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_random_printf_wasm.json: 10815 => 10815 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json: 17114 => 17114 [+0 bytes / +0.00%]
codesize/test_unoptimized_code_size.json: 180230 => 180230 [+0 bytes / +0.00%]

Average change: +0.00% (+0.00% - +0.01%)
```
@sbc100 sbc100 changed the title syscall: Accept O_NONBLOCK flag in pipe2 [syscall] Accept O_NONBLOCK flag in pipe2 Mar 30, 2026
@sbc100 sbc100 enabled auto-merge (squash) March 30, 2026 20:24
@thiblahute
Copy link
Copy Markdown
Contributor Author

thiblahute commented Mar 30, 2026

From https://github.com/emscripten-core/emscripten/actions/runs/23765785637/job/69244759709?pr=26501:

The following (30) test expectation files were updated by
running the tests with `--rebaseline`:


codesize/test_codesize_cxx_ctors1.json: 151832 => 151832 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_ctors2.json: 151235 => 151235 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_except.json: 195690 => 195690 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_except_wasm.json: 166948 => 166948 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_except_wasm_legacy.json: 164829 => 164829 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_lto.json: 120519 => 120519 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_mangle.json: 262181 => 262181 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_noexcept.json: 153855 => 153855 [+0 bytes / +0.00%]
codesize/test_codesize_cxx_wasmfs.json: 179737 => 179737 [+0 bytes / +0.00%]
codesize/test_codesize_file_preload.json: 23789 => 23789 [+0 bytes / +0.00%]
codesize/test_codesize_files_js_fs.json: 18215 => 18215 [+0 bytes / +0.00%]
codesize/test_codesize_files_wasmfs.json: 63883 => 63883 [+0 bytes / +0.00%]
codesize/test_codesize_hello_O0.json: 39111 => 39111 [+0 bytes / +0.00%]
codesize/test_codesize_hello_O1.json: 8875 => 8875 [+0 bytes / +0.00%]
codesize/test_codesize_hello_dylink.json: 43853 => 43853 [+0 bytes / +0.00%]
codesize/test_codesize_mem_O3.json: 9614 => 9614 [+0 bytes / +0.00%]
codesize/test_codesize_mem_O3_grow.json: 9900 => 9900 [+0 bytes / +0.00%]
codesize/test_codesize_minimal_O0.json: 20467 => 20467 [+0 bytes / +0.00%]
codesize/test_codesize_minimal_pthreads.json: 26409 => 26409 [+0 bytes / +0.00%]
codesize/test_codesize_minimal_pthreads_memgrowth.json: 26812 => 26812 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_embind.json: 14909 => 14909 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_embind_val.json: 11642 => 11642 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl2_wasm.json: 13200 => 13200 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl2_wasm2js.json: 18534 => 18534 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl2_wasm_singlefile.json: 15046 => 15046 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl_wasm.json: 12738 => 12738 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_hello_webgl_wasm2js.json: 18060 => 18060 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_random_printf_wasm.json: 10815 => 10815 [+0 bytes / +0.00%]
codesize/test_minimal_runtime_code_size_random_printf_wasm2js.json: 17114 => 17114 [+0 bytes / +0.00%]
codesize/test_unoptimized_code_size.json: 180230 => 180230 [+0 bytes / +0.00%]

Average change: +0.00% (+0.00% - +0.00%)

This looks weird to me

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented Mar 30, 2026

This looks weird to me

Hmm.. yes that does looks strange. That can happen sometimes when the script doesn't know how to parse the json file in question correctly.

Are you able to run ./test/runner codesize --rebase on the main branch without generating any diffs? Unless you can do that there is no hope of generated the correct results on your PR branch.

If you are not able to do that, and you have tried ./emsdk install tot again, and it still doesn't work I can also upload the new expections to this PR if you like.

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