From: Jim Warner Date: Mon, 13 Jul 2015 05:00:00 +0000 (-0500) Subject: library: also include a 'read' for slabnode_chain_fill X-Git-Tag: v4.0.0~1090 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d1073a22a9e02f8e635b30f38a191cbe5c193eb;p=procps-ng library: also include a 'read' for slabnode_chain_fill 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 --- diff --git a/proc/slab.c b/proc/slab.c index 2029d172..392c0416 100644 --- a/proc/slab.c +++ b/proc/slab.c @@ -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; }