Reuse devinfo struct
The devstat API expects us to reuse one devinfo for many invocations of devstat_getstats. In particular, it allocates and resizes memory referenced by devinfo.
This commit is contained in:
parent
ea55d0f5cb
commit
38c5890428
3 changed files with 12 additions and 5 deletions
|
|
@ -10,10 +10,9 @@
|
|||
#include <devstat_freebsd.h>
|
||||
|
||||
|
||||
int _get_stats(Stats **stats) {
|
||||
int _get_stats(struct devinfo *info, Stats **stats) {
|
||||
struct statinfo current;
|
||||
struct devinfo info = {};
|
||||
current.dinfo = &info;
|
||||
current.dinfo = info;
|
||||
|
||||
if (devstat_getdevs(NULL, ¤t) == -1) {
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue