procps/proc
Jim Warner 5d5a52a380 library: normalize/standardize the i/f, <SLABINFO> api
Before this major redesign, the slabs interface likely
was our messiest 2nd generation attempt at opaqueness.
Beyond the standard 'new', 'ref' & 'unref', there were
a total of 12 exported functions. Now, there are four.

The 1st step was to remove several of those functions.
These were quick to go since they were not used (yet):
. procps_slabnode_count
. procps_slabnode_getname
. procps_slabnode_getstack

Then, the following were internalized so users needn't
be burdened with implementation details in the future:
. procps_slabinfo_read (renamed: read_slabinfo_failed)
. procps_slabnode_stacks_alloc (renamed: stacks_alloc)

Still others evolved into the minimal interface we had
strived for in the other upgraded 3rd generation APIs:
. procps_slabnode_get -----------> procps_slabinfo_get
. separate stack_alloc/fill --> procps_slabinfo_select
. separate stacks_alloc/fill ---> procps_slabinfo_reap
. procps_slabnode_stacks_sort --> procps_slabinfo_sort

------------------------------------------------------
Beyond those reductions, the major modifications were:

. This API tries to be as forgiving as possible and as
such won't throw errors when a caller request makes no
sense. For example, if a 'get' or 'select' requested a
SLABNODE item (with no current means to id that node),
results will be zero. By the same token, should 'reap'
include a global SLABS item (meaning those values will
be duplicated in *every* node stack) it'll be allowed.

. If the above behavior is undesired, a new #define of
ENFORCE_LOGICAL can be used to restrict certain items.

. Permission problems will now be caught at 'new' time
thanks to a priming 'read' call. That read also serves
to make DELTA values potentially useful at 1st access.

. Separate slab/slabnode enumerators were consolidated
into one, simplifying validation & the results struct.

. Several internal parameter checks were relaxed since
they were already checked by the caller. Besides if we
cannot trust our own code we might as well hang it up.

. That sort provision was made more efficient and will
offer the ascending choice, in addition to descending.

------------------------------------------------------
Lastly, some additional thoughts regarding the future:

. It would not be difficult to expand 'select' to also
accept a nodeid, or to clone it as 'select_node'. And,
should the same be extended to 'get', a results struct
could be returned instead of signed long accommodating
the extra data type(s) like a node name (string data).

. The 'get' function is not currently affected by that
 define ENFORCE_LOGICAL. However, at some future point
perhaps -EINVAL would be more appropriate than a zero.

Signed-off-by: Jim Warner <james.warner@comcast.net>
2016-06-09 20:51:06 +10:00
..
.gitignore tests: update template and add pids 2016-04-19 21:33:02 +10:00
alloc.c
alloc.h
COPYING
devname.c
devname.h
diskstat.c misc: Few more resource leak fixes 2016-05-03 21:58:13 +10:00
diskstat.h
escape.c
escape.h
libprocps.pc.in
libprocps.sym library: normalize/standardize the i/f, <SLABINFO> api 2016-06-09 20:51:06 +10:00
meminfo.c library: add parameter checks for 'get', <MEMINFO> api 2016-06-07 21:04:43 +10:00
meminfo.h library: remove the ull_int result type, <MEMINFO> api 2016-05-12 21:15:01 +10:00
namespace.c
namespace.h
openproc.3
pids.c library: eliminated a final potential NULL, <PIDS> api 2016-05-22 21:59:18 +10:00
pids.h library: try different alignment for types, <PIDS> api 2016-05-16 19:58:20 +10:00
procps-private.h
procps.h library: rename the 'slab' sources as 'slabinfo' files 2016-06-09 20:51:06 +10:00
pwcache.c
pwcache.h
readproc.3
readproc.c library: eliminated a final potential NULL, <PIDS> api 2016-05-22 21:59:18 +10:00
readproc.h library: eliminated a final potential NULL, <PIDS> api 2016-05-22 21:59:18 +10:00
readproctab.3
slabinfo.c library: normalize/standardize the i/f, <SLABINFO> api 2016-06-09 20:51:06 +10:00
slabinfo.h library: normalize/standardize the i/f, <SLABINFO> api 2016-06-09 20:51:06 +10:00
stat.c library: improve internal 'get' processing, <STAT> api 2016-06-07 21:04:43 +10:00
stat.h library: improve internal 'get' processing, <STAT> api 2016-06-07 21:04:43 +10:00
sysinfo.c
sysinfo.h library: remove an obsolete 'jiffs' typedef in sysinfo 2016-05-08 21:12:22 +10:00
test_namespace.c tests: update template and add pids 2016-04-19 21:33:02 +10:00
test_pids.c library: fix new and unref pids test 2016-06-07 21:13:57 +10:00
test_sysinfo.c tests: update template and add pids 2016-04-19 21:33:02 +10:00
test_uptime.c library: procps_uptime() return value is a status 2016-05-01 16:50:25 +10:00
test_version.c library: Fix LINUX_VERSION macro 2016-05-01 17:46:25 +10:00
uptime.c library: procps_uptime() return value is a status 2016-05-01 16:50:25 +10:00
uptime.h
version.c
version.h library: Fix LINUX_VERSION macro 2016-05-01 17:46:25 +10:00
vmstat.c library: normalize/standardize interface, <VMSTAT> api 2016-06-07 21:04:43 +10:00
vmstat.h library: normalize/standardize interface, <VMSTAT> api 2016-06-07 21:04:43 +10:00
wchan.c
wchan.h