Skip to content

feat: add macOS (aarch64) cross-platform support - #9

Closed
Bulletdev wants to merge 1 commit into
mainfrom
feat/macos-cross-platform
Closed

Bulletdev wants to merge 1 commit into
mainfrom
feat/macos-cross-platform

Conversation

@Bulletdev

Copy link
Copy Markdown
Member

Summary

  • New src/platform.zig module — centralizes all OS-specific socket constants (IPPROTO_RAW, IP_HDRINCL, MSG_DONTWAIT) with comptime conditionals for darwin vs linux, replacing direct use of std.posix namespaces that don't exist on macOS
  • macOS geteuid() via inline ARM64 assembly — std.os.linux.geteuid() is Linux-only; on macOS aarch64, uses svc #0x80 syscall 25 (offset 0x2000000 + 25) to check root privileges
  • Guard Linux-only ioctl in progress bar — TIOCGWINSZ via std.os.linux.ioctl caused "invalid system call" on macOS; now behind comptime builtin.os.tag == .linux with fallback to 80 columns

Files changed

File Change
src/platform.zig New — OS-specific constants
src/main.zig comptime geteuid for linux/macos
src/progress.zig comptime guard on ioctl
src/tx.zig Use platform module
src/rx.zig Use platform module
src/os.zig Use platform module
src/traceroute.zig Use platform module

Test plan

  • Cross-compile from Docker (Alpine/aarch64-linux) with -Dtarget=aarch64-macos — builds clean
  • TCP Connect scan (-sT) runs on macOS ARM64 without root
  • Progress bar renders correctly (80-col fallback on macOS)
  • Verify Linux build still works (no regressions)
  • Verify raw socket scans (-sS) work on Linux with root

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

Semgrep Static Analysis

Severity Count
Errors 0
Critical (HIGH confidence) 0
Warnings 0

No issues found.

@github-actions

Copy link
Copy Markdown

Security Scan Summary

Check Status
Semgrep success
Secret Detection success

All security checks passed!

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Introduce comptime OS conditionals so OhmZ compiles and runs natively
on macOS ARM64 without hardcoding Linux-only constants.

- Create src/platform.zig centralizing IPPROTO_RAW, IP_HDRINCL, and
  MSG_DONTWAIT with correct values per OS (darwin vs linux)
- Replace std.os.linux.geteuid() with inline ARM64 assembly (svc #0x80)
  on macOS, guarded by comptime builtin.os.tag check
- Guard Linux-only ioctl TIOCGWINSZ in progress.zig behind comptime,
  defaulting to 80 columns on non-Linux platforms
- Update tx.zig, rx.zig, os.zig, traceroute.zig to use platform module
@Bulletdev
Bulletdev force-pushed the feat/macos-cross-platform branch from e969d4a to 4beb077 Compare November 21, 2026 23:08
@github-actions

Copy link
Copy Markdown

Semgrep Static Analysis

Severity Count
Errors 0
Critical (HIGH confidence) 0
Warnings 0

No issues found.

@github-actions

Copy link
Copy Markdown

Security Scan Summary

Check Status
Semgrep success
Secret Detection success

All security checks passed!

@Bulletdev Bulletdev self-assigned this Nov 21, 2026
@Bulletdev Bulletdev closed this Nov 22, 2026
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