summaryrefslogtreecommitdiffstats
path: root/darwin/DarwinProcessList.c
diff options
context:
space:
mode:
authorMichael McConville <mmcconville ~a~ mykolab ~d~ com>2015-09-19 12:15:26 -0400
committerMichael McConville <mmcconville ~a~ mykolab ~d~ com>2015-09-19 12:15:26 -0400
commit571cbc0aa1138891f2233db681531d132b31b88f (patch)
treebc126132afb3500afe578aa8d6c374254d6d68a7 /darwin/DarwinProcessList.c
parente2bbd5cfa45e02c00ba932e2cd519382b203157a (diff)
Change more fprintf(stderr, ...); exit(...); to err[x](...). Tweak a few existing ones and fix some style.
Diffstat (limited to 'darwin/DarwinProcessList.c')
-rw-r--r--darwin/DarwinProcessList.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/darwin/DarwinProcessList.c b/darwin/DarwinProcessList.c
index 9dbe4c89..2260f833 100644
--- a/darwin/DarwinProcessList.c
+++ b/darwin/DarwinProcessList.c
@@ -41,16 +41,14 @@ void ProcessList_getHostInfo(host_basic_info_data_t *p) {
mach_msg_type_number_t info_size = HOST_BASIC_INFO_COUNT;
if(0 != host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)p, &info_size)) {
- fprintf(stderr, "Unable to retrieve host info\n");
- exit(2);
+ err(2, "Unable to retrieve host info\n");
}
}
void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t *p) {
if(NULL != p && NULL != *p) {
if(0 != munmap(*p, vm_page_size)) {
- fprintf(stderr, "Unable to free old CPU load information\n");
- exit(8);
+ err(8, "Unable to free old CPU load information\n");
}
}
@@ -63,8 +61,7 @@ unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) {
// TODO Improving the accuracy of the load counts woule help a lot.
if(0 != host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &cpu_count, (processor_info_array_t *)p, &info_size)) {
- fprintf(stderr, "Unable to retrieve CPU info\n");
- exit(4);
+ err(4, "Unable to retrieve CPU info\n");
}
return cpu_count;
@@ -91,7 +88,7 @@ struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) {
processes = malloc(*count);
if (processes == NULL)
- err(6, "Out of memory for kproc_infos");
+ errx(6, "Out of memory for kproc_infos");
if (sysctl(mib, 4, processes, count, NULL, 0) < 0)
err(7, "Unable to get kinfo_procs");

© 2014-2024 Faster IT GmbH | imprint | privacy policy