Skip to content

aix: clean up module#5259

Open
dybucc wants to merge 10 commits into
rust-lang:mainfrom
dybucc:aix-cleanup
Open

aix: clean up module#5259
dybucc wants to merge 10 commits into
rust-lang:mainfrom
dybucc:aix-cleanup

Conversation

@dybucc

@dybucc dybucc commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

this pr is concerned with the aix module. each patch addresses either one of (1) adding new bindings, (2) moving the powerpc64 module bindings into the top-level aix module, or (3) more gracefully handling lfs-compliant types and routines. other minor clean ups are also included.

  • i will not comment on new bindings. these were only added as a consequence of my checking through the header files with which the below items are concerned with.

  • the merging of the aix/powerpc64 module into the aix module has been made due to this being the only supported rust target using aix. there were already aix module definitions for sum types whose fields were conditionally compiled and assumed to be of one type or another depending on machine word size. in those cases, existing definitions preferred 64-bit-relative code paths. this transition has also required reworking some type definitions. they either (1) used currently non-standard naming for fields declared through anonymous records/unions, (2) were exposing kernel types when these should be provided as opaque types, or (3) were exposing incomplete types that actually had full definitions in upstream header files. lastly, there were some types that simply did not exist at all. i assume that ows to aix version differences between the time when the bindings were initially provided/modified and the current declarations.

  • lfs handling required some careful consideration. in 64-bit aix targets, most "64"-suffixed types have equivalent definitions with the unsuffixed types. the only exception to this was found in two record types; statvfs and statfs. each of these contains one field of type fsid_t. this type is unconditionally declared as having an effective size of 8 bytes and a 4-byte alignment requirement. the fsid64_t type has an effective size of 16 bytes and an 8-byte alignment requirement. the latter is used in the statvfs64 and statfs64 types. the routines making use of these can neither be assumed to have equivalent signatures, so the suffixed variants have been gated under the aix_large_file_api cfg. the gnu_file_offset_bits64 cfg could have probably been reused, but i have decided against that to favor tidiness.

Sources

files sys/types.h, sys/inttypes.h, sys/lock_def.h, sys/ptrace.h, sys/stat.h, sys/statfs.h, sys/statvfs.h under /usr/include on any aix 7.3 machine.

links cannot be provided. sources are not public.

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

dybucc added 9 commits July 7, 2026 12:36
add new type aliases under sys/types.h and sys/intttypes.h. these header
files can be found under /usr/include on any aix 7.3 machine.
simplify crate-relative item paths to use self-module-relative paths.

replace uses of deprecated fixed-width c integer types with rust integer
types.
add new routines under sys/ptrace.h. this header file can be found under
/usr/include on any aix 7.3 machine.
add new cfg to expose lfs-compliant definitions in aix. aix has
virtually equivalent definitions for "64"-suffixed and unsuffixed types
under 64-bit machine word targets. we are currently targetting only
powerpc64. the exception to this include the records and routines that
do need a cfg because their effective size and alignment (in the case of
records) are different among suffixed and unsuffixed variants. c.f.
sys/stat.h, sys/statfs.h and sys/statvfs.h under /usr/include on any aix
7.3 machine.
add deprecation notices to most routines specified in lfs. this follows
from prior commits on lfs. see those for an explanation on why an
exception had to be made for two records.
add new synchronization types from sys/lock_def.h. this header file can
be found under /usr/include in any aix 7.3 machine. these types are
added in preparation of the module merging between the aix/powerpc64
module and the aix module. the former uses some of these types (or
rather, it should use some of these types.) the definitions from that
module will be made to match upstream in due time.
add missing types from sys/types.h. this header file can be found under
/usr/include in any aix 7.3 machine.
add new macro symbols as constants from the sys/types.h header file.
this can be found in any aix 7.3 machine under /usr/include.
move all type definitions and routine bindings into the aix top-level
module. the only supported target using aix is powerpc64. this has been
the case for some time. multiple existing definitions whose upstream
header conditionally uses different types for 32-bit and 64-bit machine
word sizes were already preferring the latter.

remove the aix/powerpc64 module. all bindings now live in the top-level
aix module.

fix some definitions. there were quite a few types that were either
declared with the wrong identifiers, were exposed as opaque types when
they're not upstream, or were otherwise only exposed in kernel mode.
existing sum types with conditionally compiled fields that rely on this
latter fact assume we are not compiling for that type of processes. this
assumption has transitively applied to the types brought over from the
powerpc64 submodule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants