Prefix LOG and CHECK with AOS_
This prepares us for introducing glog more widely and transitioning
things over where they make sense.
Change-Id: Ic6c208882407bc2153fe875ffc736d66f5c8ade5
diff --git a/aos/ipc_lib/aos_sync.cc b/aos/ipc_lib/aos_sync.cc
index 572b864..101a189 100644
--- a/aos/ipc_lib/aos_sync.cc
+++ b/aos/ipc_lib/aos_sync.cc
@@ -354,16 +354,16 @@
return r;
}
-// This gets called by functions before LOG(FATAL)ing with error messages that
-// would be incorrect if the error was caused by a process forking without
+// This gets called by functions before AOS_LOG(FATAL)ing with error messages
+// that would be incorrect if the error was caused by a process forking without
// initialize_in_new_thread getting called in the fork.
void check_cached_tid(pid_t tid) {
pid_t actual = do_get_tid();
if (tid != actual) {
- LOG(FATAL,
- "task %jd forked into %jd without letting aos_sync know"
- " so we're not really sure what's going on\n",
- static_cast<intmax_t>(tid), static_cast<intmax_t>(actual));
+ AOS_LOG(FATAL,
+ "task %jd forked into %jd without letting aos_sync know"
+ " so we're not really sure what's going on\n",
+ static_cast<intmax_t>(tid), static_cast<intmax_t>(actual));
}
}
@@ -379,7 +379,7 @@
void *InstallAtforkHook() {
if (pthread_atfork(NULL, NULL, atfork_child) != 0) {
- PLOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed", atfork_child);
+ AOS_PLOG(FATAL, "pthread_atfork(NULL, NULL, %p) failed", atfork_child);
}
return nullptr;
}
@@ -475,8 +475,8 @@
robust_head.pending_next = 0;
if (syscall(SYS_set_robust_list, robust_head_next_value(), sizeof(robust_head)) !=
0) {
- PLOG(FATAL, "set_robust_list(%p, %zd) failed",
- reinterpret_cast<void *>(robust_head.next), sizeof(robust_head));
+ AOS_PLOG(FATAL, "set_robust_list(%p, %zd) failed",
+ reinterpret_cast<void *>(robust_head.next), sizeof(robust_head));
}
if (kRobustListDebug) {
printf("%" PRId32 ": init done\n", get_tid());
@@ -677,10 +677,11 @@
}
my_robust_list::robust_head.pending_next = 0;
if (ret == -EDEADLK) {
- LOG(FATAL, "multiple lock of %p by %" PRId32 "\n", m, tid);
+ AOS_LOG(FATAL, "multiple lock of %p by %" PRId32 "\n", m, tid);
}
- PELOG(FATAL, -ret, "FUTEX_LOCK_PI(%p(=%" PRIu32 "), 1, %p) failed",
- &m->futex, __atomic_load_n(&m->futex, __ATOMIC_SEQ_CST), timeout);
+ AOS_PELOG(FATAL, -ret, "FUTEX_LOCK_PI(%p(=%" PRIu32 "), 1, %p) failed",
+ &m->futex, __atomic_load_n(&m->futex, __ATOMIC_SEQ_CST),
+ timeout);
} else {
if (kLockDebug) {
printf("%" PRId32 ": %p kernel lock done\n", tid, m);
@@ -746,8 +747,8 @@
continue;
}
my_robust_list::robust_head.pending_next = 0;
- PELOG(FATAL, -ret, "FUTEX_CMP_REQUEUE_PI(%p, 1, %d, %p, *%p) failed", c,
- number_requeue, &m->futex, c);
+ AOS_PELOG(FATAL, -ret, "FUTEX_CMP_REQUEUE_PI(%p, 1, %d, %p, *%p) failed",
+ c, number_requeue, &m->futex, c);
} else {
return;
}
@@ -778,10 +779,11 @@
my_robust_list::robust_head.pending_next = 0;
check_cached_tid(tid);
if ((value & FUTEX_TID_MASK) == 0) {
- LOG(FATAL, "multiple unlock of aos_mutex %p by %" PRId32 "\n", m, tid);
+ AOS_LOG(FATAL, "multiple unlock of aos_mutex %p by %" PRId32 "\n", m,
+ tid);
} else {
- LOG(FATAL, "aos_mutex %p is locked by %" PRId32 ", not %" PRId32 "\n",
- m, value & FUTEX_TID_MASK, tid);
+ AOS_LOG(FATAL, "aos_mutex %p is locked by %" PRId32 ", not %" PRId32 "\n",
+ m, value & FUTEX_TID_MASK, tid);
}
}
@@ -794,7 +796,7 @@
const int ret = sys_futex_unlock_pi(&m->futex);
if (ret != 0) {
my_robust_list::robust_head.pending_next = 0;
- PELOG(FATAL, -ret, "FUTEX_UNLOCK_PI(%p) failed", &m->futex);
+ AOS_PELOG(FATAL, -ret, "FUTEX_UNLOCK_PI(%p) failed", &m->futex);
}
} else {
// There aren't any waiters, so no need to call into the kernel.
@@ -831,7 +833,8 @@
return 4;
}
my_robust_list::robust_head.pending_next = 0;
- PELOG(FATAL, -ret, "FUTEX_TRYLOCK_PI(%p, 0, NULL) failed", &m->futex);
+ AOS_PELOG(FATAL, -ret, "FUTEX_TRYLOCK_PI(%p, 0, NULL) failed",
+ &m->futex);
}
}
}
@@ -896,8 +899,9 @@
continue;
}
my_robust_list::robust_head.pending_next = 0;
- PELOG(FATAL, -ret, "FUTEX_WAIT_REQUEUE_PI(%p, %" PRIu32 ", %p) failed", c,
- wait_start, &m->futex);
+ AOS_PELOG(FATAL, -ret,
+ "FUTEX_WAIT_REQUEUE_PI(%p, %" PRIu32 ", %p) failed", c,
+ wait_start, &m->futex);
} else {
// Record that the kernel relocked it for us.
lock_pthread_mutex(m);