Implement ReadMemInfo on FreeBSD#1239
Conversation
pkg/system/meminfo_freebsd.go
Outdated
| total int64 = 0 | ||
| used int64 = 0 | ||
| ) | ||
| for i := 0; ; i++ { |
There was a problem hiding this comment.
Just a question: Can you get number of swap devices using nswapdev instead infinite loop.
There was a problem hiding this comment.
Good idea - I was kind of following the algorithm used in the base system's swapinfo command but this is better.
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
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.
|
Two questions above. |
| if MemTotal < 0 || MemFree < 0 || SwapTotal < 0 || SwapFree < 0 { | ||
| return nil, fmt.Errorf("error getting system memory info %v\n", err) | ||
| } |
There was a problem hiding this comment.
I don't think any of these can be negative if the two calls above succeed. Perhaps this can change to an assert?
1c49f8d to
c2c7936
Compare
Signed-off-by: Doug Rabson <dfr@rabson.org>
flouthoc
left a comment
There was a problem hiding this comment.
LGTM @containers/storage-maintainers PTAL
|
LGTM |
Signed-off-by: Doug Rabson dfr@rabson.org