library: some minor miscellaeous improvements, 3rd gen
A collection of miscellaneous code and comment tweaks. [ such changes will stop when desk checking ends too ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
c767adf974
commit
220236a9af
@ -574,6 +574,7 @@ static int read_meminfo_failed (
|
|||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
|
|
||||||
head = buf;
|
head = buf;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
static ENTRY e; // just to keep coverity off our backs (e.data)
|
static ENTRY e; // just to keep coverity off our backs (e.data)
|
||||||
ENTRY *ep;
|
ENTRY *ep;
|
||||||
@ -595,7 +596,6 @@ static int read_meminfo_failed (
|
|||||||
tail = strchr(head, '\n');
|
tail = strchr(head, '\n');
|
||||||
if (!tail)
|
if (!tail)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
head = tail + 1;
|
head = tail + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -628,10 +628,10 @@ static int read_meminfo_failed (
|
|||||||
mHr(derived_swap_used) = mHr(SwapTotal) - mHr(SwapFree);
|
mHr(derived_swap_used) = mHr(SwapTotal) - mHr(SwapFree);
|
||||||
|
|
||||||
// let's not distort the deltas the first time thru ...
|
// let's not distort the deltas the first time thru ...
|
||||||
if (!info->meminfo_was_read)
|
if (!info->meminfo_was_read) {
|
||||||
memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data));
|
memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data));
|
||||||
info->meminfo_was_read = 1;
|
info->meminfo_was_read = 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#undef mHr
|
#undef mHr
|
||||||
} // end: read_meminfo_failed
|
} // end: read_meminfo_failed
|
||||||
@ -710,7 +710,8 @@ static struct stacks_extent *stacks_alloc (
|
|||||||
* The initial refcount is 1, and needs to be decremented
|
* The initial refcount is 1, and needs to be decremented
|
||||||
* to release the resources of the structure.
|
* to release the resources of the structure.
|
||||||
*
|
*
|
||||||
* Returns: a pointer to a new meminfo struct
|
* Returns: < 0 on failure, 0 on success along with
|
||||||
|
* a pointer to a new context struct
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_meminfo_new (
|
PROCPS_EXPORT int procps_meminfo_new (
|
||||||
struct procps_meminfo **info)
|
struct procps_meminfo **info)
|
||||||
|
@ -1117,7 +1117,8 @@ static int stacks_fetch (
|
|||||||
*
|
*
|
||||||
* @info: location of returned new structure
|
* @info: location of returned new structure
|
||||||
*
|
*
|
||||||
* Returns: 0 on success <0 on failure
|
* Returns: < 0 on failure, 0 on success along with
|
||||||
|
* a pointer to a new context struct
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_pids_new (
|
PROCPS_EXPORT int procps_pids_new (
|
||||||
struct procps_pidsinfo **info,
|
struct procps_pidsinfo **info,
|
||||||
|
@ -491,10 +491,10 @@ static int read_slabinfo_failed (
|
|||||||
else
|
else
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
if (!info->slabinfo_was_read)
|
if (!info->slabinfo_was_read) {
|
||||||
memcpy(&info->hist.old, &info->hist.new, sizeof(struct slabs_summ));
|
memcpy(&info->hist.old, &info->hist.new, sizeof(struct slabs_summ));
|
||||||
info->slabinfo_was_read = 1;
|
info->slabinfo_was_read = 1;
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
} // end: read_slabinfo_failed
|
} // end: read_slabinfo_failed
|
||||||
|
|
||||||
@ -773,7 +773,8 @@ static int stacks_reconfig_maybe (
|
|||||||
*
|
*
|
||||||
* @info: location of returned new structure
|
* @info: location of returned new structure
|
||||||
*
|
*
|
||||||
* Returns: 0 on success <0 on failure
|
* Returns: < 0 on failure, 0 on success along with
|
||||||
|
* a pointer to a new context struct
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_slabinfo_new (
|
PROCPS_EXPORT int procps_slabinfo_new (
|
||||||
struct procps_slabinfo **info)
|
struct procps_slabinfo **info)
|
||||||
|
@ -577,10 +577,10 @@ reap_em_again:
|
|||||||
info->sys_hist.new.procs_running = llnum;
|
info->sys_hist.new.procs_running = llnum;
|
||||||
|
|
||||||
// let's not distort the deltas the first time thru ...
|
// let's not distort the deltas the first time thru ...
|
||||||
if (!info->stat_was_read)
|
if (!info->stat_was_read) {
|
||||||
memcpy(&info->sys_hist.old, &info->sys_hist.new, sizeof(struct stat_data));
|
memcpy(&info->sys_hist.old, &info->sys_hist.new, sizeof(struct stat_data));
|
||||||
|
info->stat_was_read = 1;
|
||||||
info->stat_was_read = 1;
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} // end: read_stat_failed
|
} // end: read_stat_failed
|
||||||
|
|
||||||
@ -769,7 +769,8 @@ static struct stat_stack *update_single_stack (
|
|||||||
* The initial refcount is 1, and needs to be decremented
|
* The initial refcount is 1, and needs to be decremented
|
||||||
* to release the resources of the structure.
|
* to release the resources of the structure.
|
||||||
*
|
*
|
||||||
* Returns: a new stat info container
|
* Returns: < 0 on failure, 0 on success along with
|
||||||
|
* a pointer to a new context struct
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_stat_new (
|
PROCPS_EXPORT int procps_stat_new (
|
||||||
struct procps_statinfo **info)
|
struct procps_statinfo **info)
|
||||||
|
@ -999,6 +999,7 @@ static int read_vmstat_failed (
|
|||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
|
|
||||||
head = buf;
|
head = buf;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
static ENTRY e; // just to keep coverity off our backs (e.data)
|
static ENTRY e; // just to keep coverity off our backs (e.data)
|
||||||
ENTRY *ep;
|
ENTRY *ep;
|
||||||
@ -1020,15 +1021,14 @@ static int read_vmstat_failed (
|
|||||||
tail = strchr(head, '\n');
|
tail = strchr(head, '\n');
|
||||||
if (!tail)
|
if (!tail)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
head = tail + 1;
|
head = tail + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let's not distort the deltas the first time thru ...
|
// let's not distort the deltas the first time thru ...
|
||||||
if (!info->vmstat_was_read)
|
if (!info->vmstat_was_read) {
|
||||||
memcpy(&info->hist.old, &info->hist.new, sizeof(struct vmstat_data));
|
memcpy(&info->hist.old, &info->hist.new, sizeof(struct vmstat_data));
|
||||||
info->vmstat_was_read = 1;
|
info->vmstat_was_read = 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} // end: read_vmstat_failed
|
} // end: read_vmstat_failed
|
||||||
|
|
||||||
@ -1106,7 +1106,8 @@ static struct stacks_extent *stacks_alloc (
|
|||||||
* The initial refcount is 1, and needs to be decremented
|
* The initial refcount is 1, and needs to be decremented
|
||||||
* to release the resources of the structure.
|
* to release the resources of the structure.
|
||||||
*
|
*
|
||||||
* Returns: a pointer to a new vmstatinfo struct
|
* Returns: < 0 on failure, 0 on success along with
|
||||||
|
* a pointer to a new context struct
|
||||||
*/
|
*/
|
||||||
PROCPS_EXPORT int procps_vmstat_new (
|
PROCPS_EXPORT int procps_vmstat_new (
|
||||||
struct procps_vmstat **info)
|
struct procps_vmstat **info)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user