-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Tracking issue for libc 1.0 #3248
Comments
On the LFS64 symbol removal point (#2935) the current PR is attempting to achieve rust crate API compatibility (by aliasing LFS64 things to their non-LFS64 equivalents), hiding the effective ABI break in musl libc (it's not a real break since those symbols never "really" existed, but they existed enough for the libc crate to wind up depending on them 😞). If 0.3 is going to be a breaking change we could do a simpler change where we simply stop all the LFS64 functions and types from the libc crate (which is arguably closer to the musl libc API). My expectation was that we'd merge the API-compatible change in a 0.2.x (and maybe then deprecate the aliases?) and remove them "later" in a 0.3 release, but if 0.3 is imminent, maybe we just drop the items completely? Note that the rust libc crate has to do "something" here to work with musl 1.2.4+ (@wesleywiser moved rustc's self-contained version to 1.2.3 since that's ABI-compatible with 1.1.24 but 1.2.4 breaks the crate's use of the ABI). |
@bossmc Figuring out how to deal with time64 has been one of the two biggest blocking issues for this. (The other is having unnamed fields of struct and union types, for which there's an accepted RFC that still needs compiler support.) We could just try to match the API of musl as closely as possible when building for musl, but that just pushes the problem onto whoever uses libc. Personally, I would like to minimize the degree to which people have to write a pile of Is there some reasonable way we could generally make the same function names and types available on every platform that has 64-bit support, so that people only need |
So, the changes for 64 bits version of time and file offset function is just for |
Created the |
Great to see 0.3 starting to take shape! |
I expect it will take at least a few months until 0.3 is ready. As you can see from the list at the top of this issue, there is still quite a lot of work to do. |
Will PR submitted to |
You should make 2 separate PRs. |
According to both RFC 1242 and RFC 3119 and also https://blog.rust-lang.org/2017/02/06/roadmap.html , mature crates, which are part of "official Rust", should not have 0.x version numbers. So, please, release 1.0, not 0.3. Previous discussion: #547 . We should take this chance and release 1.0, not 0.3. libc is mature enough. Later we can release 2.0, etc, if needed. If there exist previous discussion, where you decided to release 0.3, not 1.0, then I'm sorry. The discussion is not linked from first comment |
Obviously, next libc release should use semver trick ( https://github.com/dtolnay/semver-trick ), because libc types widely used in public interfaces |
Also, we possibly should wait for extern types ( rust-lang/rust#43467 ). Many libc types are good candidates, for example, FILE ( https://docs.rs/libc/0.2.153/libc/enum.FILE.html ) |
I've updated the tracking issue to talk about libc 1.0 instead of 0.3. |
This comment was marked as off-topic.
This comment was marked as off-topic.
It seems the reviewer for this repository is overwhelmed: there are 53 pull requests awaiting review, and almost all of them are for @JohnTitor. So do you need help? I'm willing to help push forward. |
Our branches unfortunately seem to have been diverging - some PRs target I assume the original intent was to merge So, please always target I have updated documentation to reflect this. (If the difference between the branches get more minimal, we can probably switch back to merge-up flow. It is just different enough now that taking individual commits is easier to do correctly than a full merge, and I don't really see it getting easier with the 1.0 refactoring.) |
One other notable thing I think we should definitely do is make all padding or reserved fields |
This issue tracks changes we want to make in libc 1.0.
(Note that this tracking issue previously referred to libc 0.3, this should now be assumed to refer to 1.0 instead)
64-bit
time_t
andoff_t
On some 32-bit targets, it is unclear whether
time_t
should be 32-bit or 64-bit since in C this depends on what pre-processor macros are defined when the C standard library headers are included (e.g._FILE_OFFSET_BITS
,_TIME_BITS
on glibc) or what version of the libc headers are used (e.g. musl 1.2 changedtime_t
to always be 64-bit). This was achieved without breaking ABI compatibility by giving the new 64-bit API separate symbol names (clock_gettime64
) and having the header files transparently redirect the old function names to the new symbols. The old symbols remain available for programs built against old versions of the libc headers.This makes it difficult for the
libc
crate since we can only have one definition ofoff_t
andtime_t
, and yet we need our definitions of those types to match the ones used in any C code we link against.time64_t
andoff64_t
.Breaking changes
Most of these are mistakes that were made early on which cannot be fixed without making a breaking change. libc 1.0 is a good opportunity to make these changes.
iconv
on all platformspthread_t
definition on Darwin (should be a raw pointer, not anuintptr_t
) #2903vfork
: Deprecate vfork #1574Policy
These don't involve any code changes, but instead require a decision for how to handle breaking changes moving forward.
Anonymous structs and unions
Some C types are defined using anonymous structs and unions, such as
sigaction
orsiginfo
. To properly expose these, we need support for anonymous structs and unions in Rust. This feature is part of RFC 2102, but the implementation is still a work in progress.Trait implementations
RFC 2235 added implementations of
Eq
,Hash
andDebug
for all libc types. However it turns out that this is not appropriate for many libc types, especially in the presence of padding, unions and extensible structs.We would like to un-accept this RFC for libc 1.0 and completely remove
Eq
andHash
trait implementations for all types. It is still an open question whether we want to keepDebug
trait implementations, but we are tending towards removing them as well.Eq
,Hash
, etc. RFC: Implement Debug, Eq, PartialEq, and Hash for libc structs rfcs#2235Debug
or make it best-effort.Testing
We use ctest2 to check that the struct and function definitions in libc match those in C header files. However ctest2 is based on an old fork of the Rust parser, which doesn't handle new syntax well. It might be worth rewriting it or replacing it with a more modern tool (possibly based on bindgen/cbindgen).
Implementation plan
main
.@rustbot label +stable-nominated
. After merge tomain
, this PR will be considered for cherry pick tolibc-0.2
.The text was updated successfully, but these errors were encountered: