got rid of all uses of strerror
This required some minor refactoring of other things and there were some
other small cleanups I noticed along the way.
diff --git a/aos/linux_code/init.cc b/aos/linux_code/init.cc
index e8bcba1..05004a2 100644
--- a/aos/linux_code/init.cc
+++ b/aos/linux_code/init.cc
@@ -24,15 +24,14 @@
if (set_for_root || !am_root) {
struct rlimit64 rlim;
if (getrlimit64(resource, &rlim) == -1) {
- Die("%s-init: getrlimit64(%d) failed with %d (%s)\n",
- program_invocation_short_name, resource, errno, strerror(errno));
+ PDie("%s-init: getrlimit64(%d) failed",
+ program_invocation_short_name, resource);
}
rlim.rlim_cur = soft;
if (setrlimit64(resource, &rlim) == -1) {
- Die("%s-init: setrlimit64(%d, {cur=%ju,max=%ju})"
- " failed with %d (%s)\n", program_invocation_short_name,
- resource, (uintmax_t)rlim.rlim_cur, (uintmax_t)rlim.rlim_max,
- errno, strerror(errno));
+ PDie("%s-init: setrlimit64(%d, {cur=%ju,max=%ju}) failed",
+ program_invocation_short_name, resource, (uintmax_t)rlim.rlim_cur,
+ (uintmax_t)rlim.rlim_max);
}
}
}
@@ -48,8 +47,7 @@
int LockAllMemory() {
InitStart();
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
- Die("%s-init: mlockall failed with %d (%s)\n",
- program_invocation_short_name, errno, strerror(errno));
+ PDie("%s-init: mlockall failed", program_invocation_short_name);
}
// Forces the memory pages for all the stack space that we're ever going to
@@ -65,10 +63,7 @@
// non-realtime processes.
void DoInitNRT(aos_core_create create) {
InitStart();
- if (aos_core_create_shared_mem(create)) {
- Die("%s-init: creating shared memory reference failed\n",
- program_invocation_short_name);
- }
+ aos_core_create_shared_mem(create);
logging::linux_code::Register();
}
@@ -89,8 +84,7 @@
struct sched_param param;
param.sched_priority = 30 + relative_priority;
if (sched_setscheduler(0, SCHED_FIFO, ¶m) != 0) {
- Die("%s-init: setting SCHED_FIFO failed with %d (%s)\n",
- program_invocation_short_name, errno, strerror(errno));
+ PDie("%s-init: setting SCHED_FIFO failed", program_invocation_short_name);
}
} else {
fprintf(stderr, "%s not doing realtime initialization because environment"
@@ -103,10 +97,7 @@
}
void Cleanup() {
- if (aos_core_free_shared_mem()) {
- Die("%s-init: freeing shared mem failed\n",
- program_invocation_short_name);
- }
+ aos_core_free_shared_mem();
}
void WriteCoreDumps() {