Skip to content

fix(libkernel): build FillStatfs's macOS branch - #17888

Closed
AasishDairelSahayaGrinspan wants to merge 1 commit into
boykopovar:mainfrom
AasishDairelSahayaGrinspan:fix/macos-fillstatfs-descriptor
Closed

AasishDairelSahayaGrinspan wants to merge 1 commit into
boykopovar:mainfrom
AasishDairelSahayaGrinspan:fix/macos-fillstatfs-descriptor

Conversation

@AasishDairelSahayaGrinspan

Copy link
Copy Markdown
Contributor

What

The macOS branch of FillStatfs (added with the fstatfs work) read a descriptor parameter the function never receives, so the full macOS build of libkernel has not compiled; the Linux and Windows branches compile, and CI builds macOS only as the relinker, which is why the break went unnoticed.

FillStatfs now fills only the statvfs-derived fields on every host, and the macOS MNT_NOEXEC lookup moved to its two callers: NativeFstatfs asks fstatfs for the descriptor it already holds, and NativeStatfs asks statfs for the path it stats. Non-Apple hosts keep the ST_NOEXEC field read inside FillStatfs, so their behavior is unchanged.

Tested

macOS 15 (arm64 host, x86_64 target via the Rosetta toolchain), Apple Clang, Release, BUILD_TESTING=ON:

  • Before the change: core/libs/prx/libkernel/File/src/Stdio.cpp fails to compile on main (use of undeclared identifier 'descriptor').
  • After: libkernel builds and ctest --test-dir build -R guest_fstatfs -V passes.
  • python3 tools/check_conventions.py --base origin/main: passed.

Linux and Windows were not compiled here; the change is guarded by __APPLE__ around code those hosts never compile, and CI covers them.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

The macOS branch of FillStatfs read a descriptor parameter the function
never received, so the full macOS build of libkernel did not compile;
the Linux and Windows branches compiled and CI builds macOS only as the
relinker, so the break went unnoticed. FillStatfs now fills only the
statvfs-derived fields on every host, and the macOS MNT_NOEXEC lookup
moved to its two callers: NativeFstatfs asks fstatfs for the descriptor
it already holds, and NativeStatfs asks statfs for the path it stats.

Co-Authored-By: GLM <noreply@z.ai>
@JJenkx

JJenkx commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Windows check of head c346407b4a, merged onto main f439f7f3a0 (c346407b4a, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • exec_arguments, guest_addresses, guest_aio, guest_aio_bad_descriptors, guest_amm_pool, guest_app_icon, guest_app_info, guest_append_streams, guest_append_writes, guest_available_cpumask, guest_closed_standard_descriptors_windows, guest_closed_standard_streams_load_windows, guest_cond_recursive_mutex, guest_cond_timedwait, guest_cond_unowned_mutex, guest_coredump_attach, guest_coredump_user_data, guest_cpu_time_clocks, guest_credentials, guest_current_cpu, guest_deferred_module_sweep, guest_deferred_module_sweep_failed, guest_direct_memory_for_app, guest_directory_buffer, guest_directory_close, guest_directory_entries, guest_directory_removed_entries, guest_directory_rewind, guest_dup, guest_dynamic_loader, guest_dynamic_loader_variant_names, guest_elf_phdr_match, guest_equeue_events, guest_exception_fault, guest_exception_handler, guest_execvp, guest_file_timestamps, guest_file_vector, guest_file_vector_memory, guest_filesystem, guest_freebsd_clocks, guest_fstat_fault, guest_fstatfs, guest_getitimer, guest_getlogin, guest_getrlimit, guest_getrusage, guest_host_standard_buffering_windows, guest_host_standard_error_windows, guest_host_streams, guest_itimer, guest_itimer_pending_default, guest_itimer_short_expiry, guest_jit_shared_memory, guest_kernel_errors, guest_kernel_fcntl, guest_kernel_fcntl_sync, guest_kernel_is_stack, guest_kernel_rename, guest_kernel_resident_fmem_export, guest_kernel_resident_fmem_export_patched, guest_kernel_stack_protect, guest_kernel_sync, guest_kill, guest_kqueue, guest_kqueue_cleared_race, guest_low_address_memory, guest_memory, guest_mlock, guest_mmap_executable, guest_mmap_fixed_anonymous, guest_module_info, guest_mprotect_unmapped, guest_msync, guest_mutex_contention, guest_mutex_raise_exception, guest_named_shm_windows_mapping, guest_nanosleep, guest_nanosleep_long_request, guest_nanosleep_timer_self_test, guest_once, guest_operation_mode, guest_output_pointer_fault, guest_page_table_stats, guest_parent_process, guest_path_name_length, guest_pipe_fault, guest_poll, guest_positioned_close, guest_positioned_race, guest_posix_cond_broadcast, guest_posix_exit, guest_posix_mutex_trylock, guest_posix_named_sem, guest_posix_sem_init, guest_posix_sem_post, guest_posix_specific, guest_process_abi_type, guest_process_arguments, guest_process_time, guest_process_time_counter, guest_process_time_counter_scaled, guest_process_time_rdtsc, guest_process_time_rdtsc_scaled, guest_process_time_scaled, guest_process_time_tsc, guest_process_time_tsc_scaled, guest_protection_report, guest_pthread_atfork, guest_pthread_attr, guest_pthread_attr_errors, guest_pthread_attr_stack, guest_pthread_barrier, guest_pthread_cancel, guest_pthread_cancel_recovery, guest_pthread_cancel_recovery_coarse, guest_pthread_cond, guest_pthread_cond_setname, guest_pthread_condattr, guest_pthread_destroyed_objects, guest_pthread_destructor_lifetime, guest_pthread_detach_attr, guest_pthread_final_release_race, guest_pthread_frame_chain, guest_pthread_getname, guest_pthread_handle_after_exit, guest_pthread_join_detach, guest_pthread_join_self, guest_pthread_key, guest_pthread_mutex_errors, guest_pthread_mutex_prioceiling, guest_pthread_mutex_spin, guest_pthread_mutexattr, guest_pthread_posix_calls, guest_pthread_released_handle, guest_pthread_rename, guest_pthread_rwlock, guest_pthread_schedparam, guest_pthread_second_join, guest_pthread_sem, guest_pthread_setname, guest_pthread_spin, guest_pthread_stack, guest_pthread_start, guest_pthread_timed_locks, guest_pthread_yield, guest_raise_exception, guest_raise_exiting_thread, guest_raise_in_host_code, guest_raise_in_system_call, guest_raise_leaves_host_code, guest_raise_nested_sleep, guest_raise_short_sleep, guest_raise_short_sleep_without_wake, guest_recvmsg_memory, guest_rename_dot, guest_rtprio_thread, guest_rwlock_retire, guest_sandbox_certificate_failure, guest_sandbox_certificate_trust, guest_sandbox_certificates, guest_sandbox_random_word, guest_sanitizer_replace_tables, guest_sched_params, guest_sched_priority, guest_select, guest_select_wait, guest_sem_canceled_wake, guest_sem_canceled_wake_coarse, guest_sem_getvalue_uninit, guest_semaphore, guest_semaphore_handoff, guest_semaphore_trace, guest_sendfile, guest_setrlimit, guest_shm_open, guest_sigaltstack, guest_signal_handler_mask, guest_signal_interrupt, guest_signal_sets, guest_signals, guest_sigtimedwait, guest_sleep_wake, guest_sleep_wake_coarse, guest_socket_address_length, guest_socket_connect_listening, guest_socket_descriptor_flags, guest_socket_descriptors, guest_socket_error, guest_socket_events, guest_socket_on_non_socket, guest_socket_options, guest_socket_options_multicast, guest_socket_pair, guest_socket_port_zero, guest_socket_read_write, guest_socket_send_before_connect, guest_socket_stream_options, guest_socket_timeouts, guest_software_version, guest_stream_close, guest_sync_on_address, guest_sysarch, guest_system_command, guest_system_configuration, guest_system_flexible_memory, guest_tcp, guest_terminal, guest_termios_speed, guest_thermal_sensors, guest_thread_cpu_clock, guest_thread_sanitizer, guest_thread_self, guest_timed_wait_cpu, guest_tls_get_addr, guest_truncate, guest_truncate_extend, guest_truncate_race, guest_udp, guest_umtx_op, guest_underscore_entries, guest_underscore_jumps, guest_unwind_module_info, guest_user_context, guest_user_context_exit, guest_usleep, guest_wait_trace, guest_waitpid, guest_windows_directory_link_types, host_cpu, host_performance_process_invalid, host_performance_session, kernel_error, nid_patcher_symbol_versions, param_json_parser, param_sfo_parser pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 17767 core/libs/prx/libkernel/File/src/Stdio.cpp L708-718, L734

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 6936 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7121 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 7447 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 9293 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 9297 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 9302 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 12682 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 12688 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 12700 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 12965 core/libs/prx/libkernel/File/src/Stdio.cpp
PR 15037 core/libs/prx/libkernel/File/src/Stdio.cpp

@AasishDairelSahayaGrinspan

Copy link
Copy Markdown
Contributor Author

Closing in favor of #17767, which fixes the same macOS FillStatfs break and was opened first (and is tested on Apple hardware). My branch took the other shape — FillStatfs stays statvfs-only and each caller performs its own MNT_NOEXEC lookup (fstatfs for the descriptor form, statfs for the path form) — but there is no need for two of these. #17767's parameterized form is fine; if its author prefers this shape instead, the branch is fix/macos-fillstatfs-descriptor at c346407b4a.

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