Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ReadMemInfo on FreeBSD #1239

Merged
merged 1 commit into from
May 13, 2022
Merged

Conversation

dfr
Copy link
Contributor

@dfr dfr commented May 12, 2022

Signed-off-by: Doug Rabson [email protected]

total int64 = 0
used int64 = 0
)
for i := 0; ; i++ {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question: Can you get number of swap devices using nswapdev instead infinite loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea - I was kind of following the algorithm used in the base system's swapinfo command but this is better.

Copy link
Collaborator

@flouthoc flouthoc May 12, 2022

Choose a reason for hiding this comment

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

@dfr I am not aware about BSD a lot so i am not even sure about it. It was just a question or rather a discussion, you can feel free to discuss more about that as there is no requirement to change code right away :). Could you help checking if it does not breaks anything else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I re-tested using 'podman info' and verified that it still reads the swap details. I also noticed that it mixed up used and free totals for swap so I fixed that.

@flouthoc
Copy link
Collaborator

Two questions above.

Comment on lines +68 to +74
if MemTotal < 0 || MemFree < 0 || SwapTotal < 0 || SwapFree < 0 {
return nil, fmt.Errorf("error getting system memory info %v\n", err)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think any of these can be negative if the two calls above succeed. Perhaps this can change to an assert?

@dfr dfr force-pushed the freebsd-meminfo branch 3 times, most recently from 1c49f8d to c2c7936 Compare May 13, 2022 07:10
Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM @containers/storage-maintainers PTAL

@rhatdan
Copy link
Member

rhatdan commented May 13, 2022

LGTM

@rhatdan rhatdan merged commit eb4f1bd into containers:main May 13, 2022
@dfr dfr deleted the freebsd-meminfo branch June 13, 2023 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants