Issue 326: Fix AIX dialect to work with context refactor #338
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The AIX driver no longer compiled after the major refactor that moved global variables into a context structure passed to functions. This commit updates the AIX dialect to work with the new architecture. Only tested compilation with "aixgcc" configure target. I don't have access to the legacy AIX compilers.
In addition to the context library changes the include ordering needed to be adjusted to ensure the very first time sys/inttypes.h was included it was with _KERNEL and __KERNEL_64 defined. Without this fix ulong32int64_t was 8 bytes when it actually needs to be 4 bytes because the kernel structs still use 32 bit fields even on 64 bit kernels.
This has been tested in AIX 7.2, AIX 7.3, macOS Tahoe 26.0.1, and Ubuntu 24.04.
Changes:
Add dialect-specific fields to struct lsof_context_dialect in dlsof.h:
Add convenience macros (Kd, Km, Lvfs, Mtab, Clone, CloneMaj, ClonePtc, AFSVfsp) to access dialect context fields, allowing existing code to work with minimal changes
Remove global variable declarations from dlsof.h and definitions from dstore.c for variables now in context
Update initialize() in dproc.c to initialize all dialect context fields
Update kreadx() function signature to take context parameter and update all call sites in dproc.c
The isglocked() function returns enum lsof_lock_mode, not char. Update the prototype in dproto.h to match the implementation.
Fix signal handler lowpgsp() to not take context parameter Signal handlers can only take signal number, so use static context pointer
Fix machine.h include order issue causing incorrect kernel struct sizes
Add dnode2.c symlink to .gitignore
All other AIX source files (ddev.c, dfile.c, dnode.c, dnode1.c, dnode2.c, dsock.c) should work without changes due to the convenience macros that transparently access ctx->dialect fields.
This allows the AIX driver to compile with the refactored codebase while maintaining compatibility with the existing code structure.