rust-lang / rust-lang/libc

What time fields should `struct stat` have?

Open
#4,965 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.6k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
69

Description

Prior discussion at https://github.com/rust-lang/libc/pull/4942

@xbjfk said:

I would personally push for using timespec to:

* Closer match the libc source
* Be POSIX correct and match the correct C usage / docs / man pages.
* Have more compatibility with other architectures (hermit, AIX and hurd are already)
* Make struct definitions easier to read (especially with bi-endian architectures)
* We can remove a lot of test skips.

I personally think the best path forward would be to revert 55fa65b so that people can try the new experimental musl with less breaking changes (and fixing loongarch) and reintroduce the name change without a feature gate for all platforms in the 1.0 branch only for the reasons listed above (virtually every UNIX platform supported by libc uses timespec).

IIRC this was changed with time64 changes the because having conditional definitions for the padding was a bit unwieldy.

Will look into making a PR for this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the prior discussion in PR 4942 and commit 55fa65b, then review how struct stat time fields are represented across the supported platforms. The quoted proposal identifies timespec, time64 padding, musl, loongarch, hermit, AIX, and hurd as relevant areas. Done means the maintainers agree on the representation and the required platform and test changes are identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.