-
Notifications
You must be signed in to change notification settings - Fork 1.6k
rfc 1291: Add libutil to scope of libc crate on Linux #1529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It would be helpful to also provide some rationale as to why this new library should be picked up by default. For example it would be nice to see how compatible this is across platforms (not just Linux), across various C libraries on Linux (like MUSL), etc. It would also be useful to know whether this is available throughout various distributions of Linux. |
66df245
to
b547ddb
Compare
Ah yes I meant to do that. I've updated the commit message with a bunch of detail regarding |
The initial motivation for adding this library is to get access to `openpty(3)` and `forkpty(3)`. These simplify opening a pseudoterminal master / slave pair. The functions are defined on Linux, OSX, FreeBSD, NetBSD, and OpenBSD. On OS X, they are available without linking to any additionaly libraries; on the other platforms they require linking with `-lutil`. On Linux, libutil is part of glibc, and defines 6 symbols: - forkpty - logwtmp - login_tty - openpty - login - logout libutil is available in the base installs of Debian-, Fedora-, and Arch-derived distributions, as well as openSUSE and Android, though on Android the `pty.h` header that declares the functions seems not to be available. Together, these cover the DistroWatch [0] top 10 distributions. In musl libc, `openpty(3)` and `forkpty(3)` are included in `libc.a`. On NetBSD and OpenBSD, these functions are included in libutil, which defines about 100 functions. On FreeBSD, these functions are included in libutil, which defines about 200 functions. [0]: http://distrowatch.com/
b547ddb
to
504fc53
Compare
Thanks @kamalmarhubi! These seem like they're widely available enough and somewhat standard enough that it appears reasonable to me to include them. |
@alexcrichton what's the process on an RFC change like this? |
This falls under the purview of the libs team, so we'll move this into FCP when we get a chance to get around to this (our triage meeting is on Wednesdays) |
👍 thanks for the details! |
I have some reservations about this. Right now the things libc links to can reasonably be described as part of the C runtime - they are all things that a C compiler will link you to by default in some scenario - crt, compiler-rt, m, dl, pthreads. I don't know that libutil is in this same category. |
@brson what do you mean "will link you to by default"? IIRC, |
This is only true for glibc-based platforms. System.dylib, libmusl and many other saner runtimes link to everything by default. |
🔔 This RFC is now entering its week-long final comment period 🔔 |
The symbols in |
The libs team discussed this RFC during triage today and the decision was to merge. The libutil.a library seems ubiquitous enough to add and the functions are common enough too. Thanks again for the RFC @kamalmarhubi! |
yay! |
The functions were added for Apple in rust-lang#202. Adding them to other platforms was pending an amendment to RFC 1291 to expand the scope of libc to include libutil. The amendment was merged as rust-lang/rfcs#1529
The functions were added for Apple in rust-lang#202. Adding them to other platforms was pending an amendment to RFC 1291 to expand the scope of libc to include libutil. The amendment was merged as rust-lang/rfcs#1529
unix: Add openpty(3) and forkpty(3) for non-Apple platforms The functions were added for Apple in #202. Adding them to other platforms was pending an amendment to RFC 1291 to expand the scope of libc to include libutil. The amendment was merged as rust-lang/rfcs#1529
The functions were added for Apple in rust-lang#202. Adding them to other platforms was pending an amendment to RFC 1291 to expand the scope of libc to include libutil. The amendment was merged as rust-lang/rfcs#1529
unix: Add openpty(3) and forkpty(3) for non-Apple platforms The functions were added for Apple in #202. Adding them to other platforms was pending an amendment to RFC 1291 to expand the scope of libc to include libutil. The amendment was merged as rust-lang/rfcs#1529
The initial motivation for adding this library is to get access to
openpty(3)
andforkpty(3)
. These simplify opening a pseudoterminalmaster / slave pair. The functions are defined on Linux, OSX, FreeBSD,
NetBSD, and OpenBSD. On OS X, they are available without linking to any
additionaly libraries; on the other platforms they require linking with
-lutil
.On Linux, libutil is part of glibc, and defines 6 symbols:
libutil is available in the base installs of Debian-, Fedora-, and
Arch-derived distributions, as well as openSUSE and Android, though on
Android the
pty.h
header that declares the functions seems not to beavailable. Together, these cover the DistroWatch 0 top 10
distributions.
In musl libc,
openpty(3)
andforkpty(3)
are included inlibc.a
.On NetBSD and OpenBSD, these functions are included in libutil, which
defines about 100 functions.
On FreeBSD, these functions are included in libutil, which defines about
200 functions.