am 5f829205: am c1416647: Merge "Clean up internal libc logging."

* commit '5f8292050fc07f4bf9e70f37a807ad028e3cfc87':
  Clean up internal libc logging.
This commit is contained in:
Elliott Hughes
2013-03-15 16:36:37 -07:00
committed by Android Git Automerger
48 changed files with 185 additions and 455 deletions

View File

@@ -171,9 +171,8 @@
#undef XLOG
#if DEBUG
# include <logd.h>
# define XLOG(...) \
__libc_android_log_print(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
# include "libc_logging.h"
# define XLOG(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc",__VA_ARGS__)
#include <stdio.h>
#include <stdarg.h>
@@ -707,9 +706,9 @@ static char*
_dnsPacket_bprintQR(DnsPacket* packet, char* p, char* end)
{
#define QQ(x) { DNS_TYPE_##x, #x }
static const struct {
static const struct {
const char* typeBytes;
const char* typeString;
const char* typeString;
} qTypes[] =
{
QQ(A), QQ(PTR), QQ(MX), QQ(AAAA), QQ(ALL),

View File

@@ -119,7 +119,7 @@ __RCSID("$NetBSD: res_send.c,v 1.9 2006/01/24 17:41:25 christos Exp $");
# include <resolv_cache.h>
#endif
#include "logd.h"
#include "libc_logging.h"
#ifndef DE_CONST
#define DE_CONST(c,v) v = ((c) ? \
@@ -555,7 +555,7 @@ res_nsend(res_state statp,
ns);
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
__libc_format_log(ANDROID_LOG_DEBUG, "libc",
"used send_vc %d\n", n);
}
@@ -567,15 +567,13 @@ res_nsend(res_state statp,
} else {
/* Use datagrams. */
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
"using send_dg\n");
__libc_format_log(ANDROID_LOG_DEBUG, "libc", "using send_dg\n");
}
n = send_dg(statp, buf, buflen, ans, anssiz, &terrno,
ns, &v_circuit, &gotsomewhere);
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
"used send_dg %d\n",n);
__libc_format_log(ANDROID_LOG_DEBUG, "libc", "used send_dg %d\n",n);
}
if (n < 0)
@@ -583,7 +581,7 @@ res_nsend(res_state statp,
if (n == 0)
goto next_ns;
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
__libc_format_log(ANDROID_LOG_DEBUG, "libc",
"time=%d, %d\n",time(NULL), time(NULL)%2);
}
if (v_circuit)
@@ -728,8 +726,7 @@ static int get_timeout(const res_state statp, const int ns)
timeout = 1;
}
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
"using timeout of %d sec\n", timeout);
__libc_format_log(ANDROID_LOG_DEBUG, "libc", "using timeout of %d sec\n", timeout);
}
return timeout;
@@ -751,7 +748,7 @@ send_vc(res_state statp,
void *tmp;
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", "using send_vc\n");
__libc_format_log(ANDROID_LOG_DEBUG, "libc", "using send_vc\n");
}
nsap = get_nsaddr(statp, (size_t)ns);
@@ -952,8 +949,7 @@ connect_with_timeout(int sock, const struct sockaddr *nsap, socklen_t salen, int
timeout = evConsTime((long)sec, 0L);
finish = evAddTime(now, timeout);
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
" %d send_vc\n", sock);
__libc_format_log(ANDROID_LOG_DEBUG, "libc", " %d send_vc\n", sock);
}
res = retrying_select(sock, &rset, &wset, &finish);
@@ -964,7 +960,7 @@ connect_with_timeout(int sock, const struct sockaddr *nsap, socklen_t salen, int
done:
fcntl(sock, F_SETFL, origflags);
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
__libc_format_log(ANDROID_LOG_DEBUG, "libc",
" %d connect_with_timeout returning %s\n", sock, res);
}
return res;
@@ -980,7 +976,7 @@ retrying_select(const int sock, fd_set *readset, fd_set *writeset, const struct
retry:
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc", " %d retying_select\n", sock);
__libc_format_log(ANDROID_LOG_DEBUG, "libc", " %d retying_select\n", sock);
}
now = evNowTime();
@@ -1000,7 +996,7 @@ retry:
n = pselect(sock + 1, readset, writeset, NULL, &timeout, NULL);
if (n == 0) {
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, " libc",
__libc_format_log(ANDROID_LOG_DEBUG, " libc",
" %d retrying_select timeout\n", sock);
}
errno = ETIMEDOUT;
@@ -1010,7 +1006,7 @@ retry:
if (errno == EINTR)
goto retry;
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
__libc_format_log(ANDROID_LOG_DEBUG, "libc",
" %d retrying_select got error %d\n",sock, n);
}
return n;
@@ -1020,7 +1016,7 @@ retry:
if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &len) < 0 || error) {
errno = error;
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
__libc_format_log(ANDROID_LOG_DEBUG, "libc",
" %d retrying_select dot error2 %d\n", sock, errno);
}
@@ -1028,7 +1024,7 @@ retry:
}
}
if (DBG) {
__libc_android_log_print(ANDROID_LOG_DEBUG, "libc",
__libc_format_log(ANDROID_LOG_DEBUG, "libc",
" %d retrying_select returning %d for %d\n",sock, n);
}

View File

@@ -42,9 +42,9 @@
#define DEBUG 0
#if DEBUG
# include <logd.h>
# include "libc_logging.h"
# include <unistd.h> /* for gettid() */
# define D(...) __libc_android_log_print(ANDROID_LOG_DEBUG,"libc", __VA_ARGS__)
# define D(...) __libc_format_log(ANDROID_LOG_DEBUG,"libc", __VA_ARGS__)
#else
# define D(...) do{}while(0)
#endif