Skip to content

feat: Add AIX platform support to common package with uptime and boot time functions#1979

Merged
shirou merged 2 commits intoshirou:masterfrom
Dylan-M:dylanmyers/aix_foundation
Jan 24, 2026
Merged

feat: Add AIX platform support to common package with uptime and boot time functions#1979
shirou merged 2 commits intoshirou:masterfrom
Dylan-M:dylanmyers/aix_foundation

Conversation

@Dylan-M
Copy link
Copy Markdown
Contributor

@Dylan-M Dylan-M commented Dec 23, 2025

Description

This PR adds comprehensive AIX (ppc64) platform support to the gopsutil common package.

Part 1 of splitting #1969: Prerequisites

Changes

  • Labeler Configuration: Added AIX to the GitHub labeler for better issue/PR organization
  • Common Package: Implemented new common_aix.go module providing:
    • BootTimeWithContext(): Calculates system boot time
    • UptimeWithContext(): Retrieves system uptime using ps command
    • ParseUptime(): Parses ps etimes output into total minutes, handling multiple time formats
  • Host Package: Refactored host_aix.go to delegate uptime/boot time functions to common package
  • Tests: Added comprehensive unit tests in common_aix_test.go covering valid and invalid uptime parsing scenarios

Implementation Details

The AIX implementation uses ps -o etimes -p 1 to retrieve the elapsed time for PID 1, which supports the following formats:

  • DAYS-HOURS:MINUTES:SECONDS (e.g., "124-01:40:39")
  • HOURS:MINUTES:SECONDS (e.g., "15:03:02")
  • MINUTES:SECONDS (e.g., "01:02" on just-rebooted systems)

This approach is more robust than parsing the uptime command output and provides better accuracy for the AIX platform.

@Dylan-M Dylan-M force-pushed the dylanmyers/aix_foundation branch from 9649184 to 49f0e76 Compare December 23, 2025 17:16
@Dylan-M Dylan-M marked this pull request as ready for review December 23, 2025 17:24
Copy link
Copy Markdown
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Overall LGTM, but could you check my comment? Thanks!

Comment thread .github/labeler.yml Outdated
@Dylan-M Dylan-M requested a review from shirou January 12, 2026 13:19
@Dylan-M
Copy link
Copy Markdown
Contributor Author

Dylan-M commented Jan 21, 2026

Overall LGTM, but could you check my comment? Thanks!

Done, addressed, and ready for your re-review.

Is there anything I can do for you or help with to accelerate your review/testing of this PR set?

I can help with temporary access to an AIX system if that would help. I would just need a more private contact for you. If you're on the CNCF Slack, we could chat there.

Copy link
Copy Markdown
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

LGTM! common.timeSince is the same as the one in host/host.go. I'll open another PR to have host.go use this common function. Thanks!

@shirou shirou merged commit 7f96671 into shirou:master Jan 24, 2026
52 checks passed
@Dylan-M
Copy link
Copy Markdown
Contributor Author

Dylan-M commented Jan 24, 2026

LGTM! common.timeSince is the same as the one in host/host.go. I'll open another PR to have host.go use this common function. Thanks!

That is handled by one of my follow on PRs

EDIT: Nevermind, I seem to have missed that one. :)

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