Skip to content

Conversation

@domisafonov
Copy link

Currently, the library doesn't build on OpenBSD which does not have either of ptsname_r or TIOCPTYGNAME. There is a documented mechanism to get all the requisites with PTMGET ioctl on /dev/ptm which this PR uses.

After that fix, the crate did build, but didn't work due to OpenBSD's more strict handling of ptys: it requires the controlling terminal to be set to the slave device which is also done in this PR.

Bindgen is used when building on OpenBSD due to the lack of PTMGET/PTM_PATH/struct ptmget in the libc or nix crate.

I made sure not to change the resulting behavior on other platforms, but I'm a bit new to the tty/pty topic and I'd appreciate feedback for things that may need improvement.

@epage
Copy link
Contributor

epage commented Jan 5, 2026

I do not want to take on maintenance of OpenBSD bindings as part of this project.

We also have no way to verify that this continues to build which makes me hesitant to declare support for OpenBSD.

it requires the controlling terminal to be set to the slave device which is also done in this PR.

"also done" implies it should be at least a separate commit

@domisafonov
Copy link
Author

I can get rid of the bindings using openpty which is discouraged by the existing comments. My reasoning for its safety specifically on openbsd is that pty(4) says:

The standard way to allocate pty devices is through openpty(3), a
function which internally uses a PTMGET ioctl(2) call on the /dev/ptm
device.
...
struct ptmget {
   int     cfd;
   int     sfd;
   char    cn[16];
   char    sn[16];
};

So, I read that as a guarantee for the path to be under 16 characters.

We also have no way to verify that this continues to build which makes me hesitant to declare support for OpenBSD.

I'm not doing on a company's behalf and can't really provide a CI runner, so I'll understand if you just close the PR.

Thanks for your time!

@epage epage closed this Jan 5, 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.

2 participants