Repository navigation
feat(libkernel_sys): implement settimeofday - #9682
Gruzzberry wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
The implementation and current-main conventions check look consistent with the documented host-clock limitation; I did not independently reproduce the author-reported Windows test run, and this checkout has no build configured for this head. I found one repository-readiness issue before this can proceed: 1. The current open #9389 changes the adjacent sigqueue stub in Export.Discovery.cpp; a pairwise merge check reports a conflict in that file. The PR body notes that one side will need rebasing, but the contribution rule asks authors to agree on the order and put the dependency on the checklist when one must wait. Please coordinate with #9389 and update the checklist accordingly. This head is also two commits behind current main; refresh it and rerun the relevant checks after the #9389 overlap order is resolved. The existing Windows test report and the passing conventions/eligibility checks are noted; product test jobs are skipped automatically on this PR.
I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
|
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.
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.
|
|
Holding this as a draft, following the direction on #5239: the open queue is above 700 and no named title needs this change on current |
FreeBSD 11.4's kern_settimeofday rejects a timeval with a microsecond field outside 0 to 999999 or a negative second field with EINVAL before changing anything, sets the clock from a valid timeval, and then stores the timezone, which gettimeofday reports. settimeofday now checks the timeval the same way and throws for a valid one, as clock_settime does, because the host clock is not changed. A timezone given without a timeval is stored and gettimeofday reports it instead of 0 and 0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f953d56 to
363acba
Compare
|
I’ve noticed that asking you to hold this PR was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. |
What
settimeofdaywas a throwing stub in libkernel_sys. FreeBSD 11.4'skern_settimeofday(called bysys_settimeofday, which treats a null pointer as not given) rejects a time with a negative second count or a microsecond count outside 0 to 999999 withEINVALbefore changing anything, sets the clock from a valid time, and only then stores the time zone, whichsys_gettimeofdayreports.SetTimeOfDay_nid_no_patchinTime.cpp, next toclock_settime, does the same checks. A valid time throws, naming it, asclock_settimedoes forCLOCK_REALTIME, because the host clock is never set; the time zone is then not stored. A time zone given without a time is kept for the process, andgettimeofdaynow reports it instead of 0 and 0 (which it still reports until one is set).settimeofdayin libkernel_sys forwards to the helper.sceKernelGettimezoneis unchanged and still reports 0 and 0: whether the console's reads the same value is not known. The debt entry next toclock_settimerecords the throw, the zone and the unverified privilege check.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmaind6eafa5.guest_kernel_sys: newCheckSettimeofdaycases: null time and zone return 0;{0, 1000000},{0, -1}and{-1, 0}fail withEINVALand store nothing; a valid time throws withsettimeofday: setting the time to 1000000000.000000and stores no zone; a zone alone is stored and read back bygettimeofday, which still returns the time; the zone is reset to 0 and 0 at the end. Onmainthe test aborts withsettimeofday_nid_postfix not implemented; with this PR it passes.guest_freebsd_clocks,guest_time_conversion,guest_time_extras,guest_mktime,guest_strftime,guest_utime,guest_utime_forwarding,guest_system_service_time_zone,guest_cpu_time_clocks,guest_nanosleep: pass.maind6eafa5 and onmainwith this PR merged together with feat(libkernel_sys): implement lchflags #9442, fix(libkernel): fail chflags through a dangling Windows symbolic link with ENOENT #9469, fix(libc): follow a Windows symbolic link in access #9474, fix(libkernel): follow a Windows symbolic link in chmod #9487, fix(libkernel): fail open with O_CREAT and O_EXCL on a Windows symbolic link #9496 and fix(libc): rename onto or from a Windows directory symbolic link like a link #9661, same machine: 1890 tests each, identical results (1869 passed, 18 skipped; on both, the 3agc_driver_sample_order*tests fail andagc_driver_image_array_window_past_layer_limitis not built, as its 64 KiBalignasis rejected by this MinGW toolchain).python tools/check_conventions.py --base upstream/main: passes.Overlaps
tools/pr_overlap.py --branchlists feat(libkernel_sys): implement sigqueue #9389 (sigqueue), which removes the stub next tosettimeofdayinExport.Discovery.cpp: text only, whichever lands second rebases.libkernel.mdandGuestKernelSys.cpp, are clean. feat(libkernel_sys): implement chown, lchown, fchownat and linkat #9103 does not merge withmainitself (libkernel_sys.md, a file this PR does not touch) and merges cleanly here otherwise.gettimeofday,clock_settimeor the time zone.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryExport.Discovery.cpp); this PR then rebases.AI-assisted (Claude Code).
🤖 Generated with Claude Code