Skip to content

Conversation

@charlesrocket
Copy link
Contributor

@charlesrocket charlesrocket commented Jun 13, 2025

Fixes #67

  • CI is a bit sloppy due to zig 0.14 not being available via pkg
  • TCP and UDP tests are skipped for now

Copy link
Owner

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but we're going to have to do some work so that this works on macOS as well.

@charlesrocket
Copy link
Contributor Author

@mitchellh fixed mach port, all tests are green now

- name: Install zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably use Zig 0.14.1 since that's what we use elsewhere.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... or maybe not. I thought I was reviewing a Ghostty PR...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could bump all jobs, but this might potentially break things for non-FBSD cases.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do the bump as well.

Copy link
Owner

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes, most importantly around the mach port state.

Loop wakeups from thread pools on FreeBSD will crash, but Ghostty doesn't use this so I don't think we should block merging on that. But let's fix this, I noted a TODO.

I moved our Zig version to 0.14.1 and CI to Namespace.

- name: Install zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.14.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do the bump as well.

};

/// The struct used for loop wakeup. This is only internal state.
const Wakeup = if (builtin.os.tag.isDarwin()) struct {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted our wakeup state to this @charlesrocket. We'll have to implement this using eventfd for FreeBSD for thread pool loop wakeups to work. Until then, we crash.

This isn't used on Ghostty so you didn't run into it.

Take a look at Epoll for examples.

I won't block the merge on this.

// TODO: error handling
.freebsd => eventfd(
0,
0x100000, // EFD_CLOEXEC
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@charlesrocket CLOEXEC is very important for this, so I kept to std.posix for Linux and hardcoded the value for FreeBSD.

@mitchellh mitchellh merged commit 9bc5232 into mitchellh:main Jun 17, 2025
11 checks passed
@charlesrocket charlesrocket deleted the fbsd branch June 17, 2025 20:52
mitchellh added a commit to ghostty-org/ghostty that referenced this pull request Jun 21, 2025
- [x] Waiting for mitchellh/libxev#167
- [x] Translations
- [x] x11
- [x] Wayland
- [ ] CI
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.

Add FreeBSD support

4 participants