-
Notifications
You must be signed in to change notification settings - Fork 77
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
Improve OpenBSD memory handling #77
base: master
Are you sure you want to change the base?
Conversation
This ensures the types are packed correctly and we don't end up with a silent 0 for npages for example. closes #12
@@ -282,7 +292,7 @@ func (self *Swap) Get() error { | |||
|
|||
rnswap := C.swapctl(C.SWAP_STATS, unsafe.Pointer(&swdev[0]), nswap) | |||
if rnswap == 0 { | |||
return nil | |||
return fmt.Errorf("Failed to call swapctl(2)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this return an error when a machine has 0 swap devices? The OpenBSD man page for swapctl(2) is somewhat ambiguous here, but my interpretation is that a return value of 0 is OK and -1 indicates failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't return an error in such case; I've ran swapctl -d /dev/sd0b
to remove my /dev/sd0b
as a swap device and this conditional didn't get triggered.
❕ Build Aborted
Expand to view the summary
Build stats
Trends 🧪Steps errorsExpand to view the steps failures
|
❕ Build Aborted
Expand to view the summary
Build stats
Trends 🧪Steps errorsExpand to view the steps failures
|
❕ Build Aborted
Expand to view the summary
Build stats
Trends 🧪Steps errorsExpand to view the steps failures
|
As prompted by #72, the actual fix and some improvements in error reporting.
NB: This was tested with
examples/free/free.go
, not cockroachdb itself.