A priming read at 'new' time in that <slabinfo> module
was important so that permission problems are detected
early. Plus, it also had the potential of making delta
values valid when 'get' or 'select' were first called.
It is for that latter reason that such a read was also
incorporated in the <diskstats> module 'new' function.
No other module, however, employed such priming reads.
This patch just brings those potential benefits to all
of our other newlib modules with the exception of that
<pids> guy. That module is, of necessity, sufficiently
different from those others to justify such exclusion.
Not only are there precious few DELTA enums in <pids>,
but the costs of a priming read would be much greater.
[ otherwise, these newly added priming reads have no ]
[ measurable negative impact on performance/timings. ]
Signed-off-by: Jim Warner <james.warner@comcast.net>
return rc;
}
+ /* do a priming read here for the following potential benefits: |
+ 1) ensure there will be no problems with subsequent access |
+ 2) make delta results potentially useful, even if 1st time | */
+ if ((rc = meminfo_read_failed(p))) {
+ procps_meminfo_unref(&p);
+ return rc;
+ }
+
*info = p;
return 0;
} // end: procps_meminfo_new
struct stat_info **info)
{
struct stat_info *p;
+ int rc;
if (info == NULL || *info != NULL)
return -EINVAL;
#endif
#endif
+ /* do a priming read here for the following potential benefits: |
+ 1) ensure there will be no problems with subsequent access |
+ 2) make delta results potentially useful, even if 1st time | */
+ if ((rc = stat_read_failed(p))) {
+ procps_stat_unref(&p);
+ return rc;
+ }
+
*info = p;
return 0;
} // end :procps_stat_new
return rc;
}
+ /* do a priming read here for the following potential benefits: |
+ 1) ensure there will be no problems with subsequent access |
+ 2) make delta results potentially useful, even if 1st time | */
+ if ((rc = vmstat_read_failed(p))) {
+ procps_vmstat_unref(&p);
+ return rc;
+ }
+
*info = p;
return 0;
} // end: procps_vmstat_new