Skip to content

Conversation

@xingxue-ibm
Copy link
Contributor

Description

The previous commit #4750 changed the tv_nsec field of the timespec structure to i32 to match the output types of system calls fstat and fstat64. However, it turns out that other system calls, such as nanosleep, expect the tv_nsec field to be of type c_long. This patch restores the type of timespec.tv_nsec to c_long and uses struct st_timespec in struct stat and struct stat64 for the fstat and fstat64 system calls, aligning these definitions with those in the AIX <sys/stat.h> header.

In <sys/stat.h>:

/* internal timespec to preserve binary compatibility */
typedef struct st_timespec {
        time_t  tv_sec;         /* seconds */
        int     tv_nsec;        /* and nanoseconds */
} st_timespec_t;

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

…st_timespec' in 'struct stat' and 'struct stat64' to be consistent with AIX headers.
@xingxue-ibm
Copy link
Contributor Author

@rustbot label +stable-nominated

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Jan 20, 2026
@xingxue-ibm xingxue-ibm changed the title AIX: Revert timespec.tv_nsec to c_long and introduce st_timespec for stat AIX: Revert timespec.tv_nsec to c_long and use st_timespec for stat Jan 20, 2026
Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

Thanks!

@JohnTitor JohnTitor added this pull request to the merge queue Jan 20, 2026
Merged via the queue into rust-lang:main with commit a44a76e Jan 20, 2026
50 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-powerpc O-unix stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants