]> granicus.if.org Git - procps-ng/commitdiff
library: also include a 'read' for slabnode_chain_fill
authorJim Warner <james.warner@comcast.net>
Mon, 13 Jul 2015 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@enc.com.au>
Wed, 15 Jul 2015 11:26:10 +0000 (21:26 +1000)
While meminfo does implement only the singular version
of 'xxxx_chain_fill', it was wrong to limit the 'read'
to the plural version (only) within our new slabs API.

This kind of inconsistency will only spell trouble for
future users of the new libprocps API. So, this commit
will mean that any form of xxxx_chain(s)_fill function
also includes a 'read', whereas xxx_getchain does not.

Reference(s):
commit aab537bc1333b9ca57eaeec073b51af12f9280f8
http://www.freelists.org/post/procps/newlib-interfaces

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/slab.c

index 2029d172dc25d20cfe5e6f3b73a478fd182fca70..392c04165510b772d8650832c8ef127e874e4dcc 100644 (file)
@@ -565,9 +565,14 @@ PROCPS_EXPORT int procps_slabnode_chain_fill (
     struct slabnode_chain *chain,
     int nodeid)
 {
+    int rc;
+
     if (info == NULL || chain == NULL || chain->head == NULL)
         return -EINVAL;
 
+    if ((rc = procps_slabinfo_read(info)) < 0)
+        return rc;
+
     return procps_slabnode_getchain(info, chain->head, nodeid);
 }
 
@@ -609,7 +614,7 @@ PROCPS_EXPORT int procps_slabnode_chains_fill (
     for (i = 0; i < maxchains; i++) {
         if (chains[i] == NULL)
             break;
-        if ((rc = procps_slabnode_chain_fill(info, chains[i], i) < 0))
+        if ((rc = procps_slabnode_getchain(info, chains[i]->head, i) < 0))
             return rc;
     }