Clean up internal libc logging.

We only need one logging API, and I prefer the one that does no
allocation and is thus safe to use in any context.

Also use O_CLOEXEC when opening the /dev/log files.

Move everything logging-related into one header file.

Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
This commit is contained in:
Elliott Hughes
2013-03-15 15:30:25 -07:00
parent e23ed8c644
commit 8f2a5a0b40
48 changed files with 186 additions and 456 deletions

View File

@@ -37,9 +37,6 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <private/debug_format.h>
#include <private/logd.h>
extern "C" int tgkill(int tgid, int tid, int sig);
#define DEBUGGER_SOCKET_NAME "android:debuggerd"
@@ -157,15 +154,15 @@ static bool haveSiginfo(int signum) {
sigemptyset(&newact.sa_mask);
if (sigaction(signum, &newact, &oldact) < 0) {
__libc_android_log_write(ANDROID_LOG_FATAL, "libc",
"Failed testing for SA_SIGINFO");
return 0;
__libc_format_log(ANDROID_LOG_FATAL, "libc", "Failed testing for SA_SIGINFO: %s",
strerror(errno));
return 0;
}
bool ret = (oldact.sa_flags & SA_SIGINFO) != 0;
if (sigaction(signum, &oldact, NULL) < 0) {
__libc_android_log_write(ANDROID_LOG_FATAL, "libc",
"Restore failed in test for SA_SIGINFO");
if (sigaction(signum, &oldact, NULL) == -1) {
__libc_format_log(ANDROID_LOG_FATAL, "libc", "Restore failed in test for SA_SIGINFO: %s",
strerror(errno));
}
return ret;
}