Skip to content

Make the package importable outside FreeBSD - #11

Merged
gronke merged 2 commits into
gronke:mainfrom
no-pictures:fix/import-off-freebsd
Jul 8, 2026
Merged

Make the package importable outside FreeBSD#11
gronke merged 2 commits into
gronke:mainfrom
no-pictures:fix/import-off-freebsd

Conversation

@gronke

@gronke gronke commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Importing jail executed a sysctl, so the package only loaded on FreeBSD and no unit test could run anywhere else.

  • Importing no longer touches the kernel: JAIL_MAX_AF_IPS is read on first access and cached, keeping its public name.
  • The jail(2) functions get ctypes prototypes with errno support, resolved on first use like in freebsd_sysctl — groundwork for raising OSError on failures in a follow-up.
  • CI gains a Linux job running the marshalling unit tests, all of which now pass off FreeBSD; freebsd-sysctl installs from git until 0.1.0 reaches PyPI.
  • Behavior on FreeBSD is unchanged: JAIL_MAX_AF_IPS and raw jail.dll access work as before.

gronke added 2 commits July 8, 2026 06:49
Importing the package executed a sysctl, which failed anywhere outside FreeBSD and blocked the unit tests off the platform.
The jail(2) family now carries ctypes prototypes, resolved lazily like in freebsd_sysctl, and use_errno on the libc handle prepares errno reporting.
JAIL_MAX_AF_IPS keeps its name through a module __getattr__ and caches the first read.
The marshalling tests need no FreeBSD kernel now that the package imports everywhere.
freebsd-sysctl installs from the upstream git main until 0.1.0 is published on PyPI.
@gronke
gronke merged commit eb2177b into gronke:main Jul 8, 2026
4 checks passed
@no-pictures
no-pictures Bot deleted the fix/import-off-freebsd branch July 8, 2026 07:37
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.

1 participant