2 Commits
Author SHA1 Message Date
Jeong, YunWon 7da001a7c9 address review: kqueue lock and host_env select (#8724)
* address review: kqueue lock and timeout overflow

Hold the kqueue fd lock through kevent and drop it before
changelist parsing and signal handlers. Reject timeouts that
overflow Instant or Duration. Round poll millisecond timeouts
upward. Cast kevent defaults for NetBSD field widths. Provide
login_tty on Solaris/illumos via setsid, TIOCSCTTY, and dup2.

Assisted-by: Grok:grok-4.6

* Move select timeout conversion into host_env

poll millisecond ceiling, kevent timespec rounding, and
default filter/flag widths now live in host_env. stdlib
select.rs keeps Python conversion and signal retry only.

Assisted-by: Grok:grok-4.6

* Move socket wait and rusage timeval into host_env

socket.sock_wait_deadline now calls host_env wait_fd.
resource and process-time conversion no longer read
timeval fields in stdlib or vm.

Assisted-by: Grok:grok-4.6

* Deny libc select syscalls in vm and stdlib clippy

Block libc poll/select/kqueue/epoll entry points and
non-reexported ABI types. host_env keeps empty lists.

Assisted-by: Grok:grok-4.6

* address review: portable timeval and wait_fd

Widen rusage timeval math to i64 so 32-bit time_t compiles.
Saturate duration_to_timeval when tv_sec is narrower than u64.
Round wait_fd poll timeouts up and accept Windows RawSocket.
Ignore EPERM from setsid in the Solaris login_tty fallback.
Deny libc::epoll_pwait2 in vm and stdlib clippy.

Assisted-by: Grok:grok-4.6
2026-09-17 21:06:49 +09:00
f51f27c949 Create rustpython-host-env (#7582)
* Create rustpython-host-env crate; move host abstractions out of common

Move os, crt_fd, fileutils, windows, macros modules from
rustpython-common into the new rustpython-host-env crate.
This isolates host OS API wrappers behind a crate boundary
with zero Python runtime dependency.

- Add crates/host_env to workspace
- Drop nix, windows-sys, widestring deps from common
- Wire vm and stdlib to depend on rustpython-host-env
- Migrate all imports from common::{os,crt_fd,fileutils,windows}
  to rustpython_host_env::

* refactor: extract host helpers

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/48d1e64d-37ce-409f-b511-8e61a349665c

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* lint: enforce direct host API boundaries

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/97225fb7-7b3d-4197-a77c-eb44aead5b13

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* refactor: extract remaining host env helpers

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/d96f57e1-b196-4460-9983-97d5ff118835

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* fix: clean extracted host env follow-up

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/d96f57e1-b196-4460-9983-97d5ff118835

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* fix: document env mutation safety

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/d96f57e1-b196-4460-9983-97d5ff118835

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* refactor: split host fs helpers from fileutils

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/c57424c5-0e1d-490a-82b3-2d2f6c8cf2cd

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* fix: resolve latest host env ci regressions

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/899eb717-ebc6-4a4a-870c-2a15c5f33e02

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* fix: resolve remaining windows clippy host fs calls

Agent-Logs-Url: https://github.com/RustPython/RustPython/sessions/12f32740-8173-4b10-a1d6-00b29e90a8ec

Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>

* host_env

---------

Co-authored-by: Jeong, YunWon <jeong@youknowone.org>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: youknowone <69878+youknowone@users.noreply.github.com>
2026-04-21 00:13:25 +09:00