library: <STAT> api, change for that 'get' return type
The following commit message is shared with 4 patches. ------------------------------------------------------ Under the newlib interface most of our 'get' functions represent a bit of a compromise in that the actual raw values are coerced into one (probably ok) return type. That approach creates the possibility of truncation at best, and wouldn't serve future needs should something other than numeric data be added to the 'get' results. This commit trades the current compromise for a return value guaranteed to satisfy all future needs, namely a pointer to a particular api's specific results struct. The impact on existing programs is minimal, especially when using a new supplied macro. Otherwise, native 'C' syntax could be used, but may feel somewhat unnatural. [ as an aside, this new approach allows us to delete ] [ all 'getsfunc' table entries & the supporting code ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -97,8 +97,11 @@ struct stat_reaped {
|
||||
#define PROCPS_STAT_SUMMARY_ID -11111
|
||||
#define PROCPS_STAT_NODE_INVALID -22222
|
||||
|
||||
#define PROCPS_STAT_VAL(rel_enum,type,stack) \
|
||||
stack -> head [ rel_enum ] . result . type
|
||||
#define PROCPS_STAT_GET( statinfo, actual_enum, type ) \
|
||||
procps_stat_get( statinfo, actual_enum ) -> result . type
|
||||
|
||||
#define PROCPS_STAT_VAL( relative_enum, type, stack ) \
|
||||
stack -> head [ relative_enum ] . result . type
|
||||
|
||||
|
||||
struct procps_statinfo;
|
||||
@ -107,7 +110,7 @@ int procps_stat_new (struct procps_statinfo **info);
|
||||
int procps_stat_ref (struct procps_statinfo *info);
|
||||
int procps_stat_unref (struct procps_statinfo **info);
|
||||
|
||||
signed long long procps_stat_get (
|
||||
struct stat_result *procps_stat_get (
|
||||
struct procps_statinfo *info,
|
||||
enum stat_item item);
|
||||
|
||||
|
Reference in New Issue
Block a user