Merge changes Iff15ac5e,I52fce957,I6c2a1d56,I929ea38b,Ia0476219,Ia9a357de,Ifb82ae2c
* changes: Rename LOG_ASSERT to ALOG_ASSERT Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) Rename (IF_)LOG() to (IF_)ALOG()
This commit is contained in:
commit
fa7860a27f
55 changed files with 563 additions and 507 deletions
|
|
@ -47,7 +47,7 @@ extern "C" {
|
|||
// ---------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* Normally we strip LOGV (VERBOSE messages) from release builds.
|
||||
* Normally we strip ALOGV (VERBOSE messages) from release builds.
|
||||
* You can modify this (for example with "#define LOG_NDEBUG 0"
|
||||
* at the top of your source file) to change that behavior.
|
||||
*/
|
||||
|
|
@ -73,91 +73,121 @@ extern "C" {
|
|||
/*
|
||||
* Simplified macro to send a verbose log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef LOGV
|
||||
#ifndef ALOGV
|
||||
#if LOG_NDEBUG
|
||||
#define LOGV(...) ((void)0)
|
||||
#define ALOGV(...) ((void)0)
|
||||
#else
|
||||
#define LOGV(...) ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
|
||||
#endif
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGV
|
||||
#define LOGV ALOGV
|
||||
#endif
|
||||
#define ALOGV LOGV
|
||||
#endif
|
||||
|
||||
#define CONDITION(cond) (__builtin_expect((cond)!=0, 0))
|
||||
|
||||
#ifndef LOGV_IF
|
||||
#ifndef ALOGV_IF
|
||||
#if LOG_NDEBUG
|
||||
#define LOGV_IF(cond, ...) ((void)0)
|
||||
#define ALOGV_IF(cond, ...) ((void)0)
|
||||
#else
|
||||
#define LOGV_IF(cond, ...) \
|
||||
#define ALOGV_IF(cond, ...) \
|
||||
( (CONDITION(cond)) \
|
||||
? ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#endif
|
||||
#define ALOGV_IF LOGV_IF
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGV_IF
|
||||
#define LOGV_IF ALOGV_IF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a debug log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGD
|
||||
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGD
|
||||
#define LOGD(...) ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||
#define ALOGD LOGD
|
||||
#define LOGD ALOGD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LOGD_IF
|
||||
#define LOGD_IF(cond, ...) \
|
||||
#ifndef ALOGD_IF
|
||||
#define ALOGD_IF(cond, ...) \
|
||||
( (CONDITION(cond)) \
|
||||
? ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#define ALOGD_IF LOGD_IF
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGD_IF
|
||||
#define LOGD_IF ALOGD_IF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an info log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGI
|
||||
#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGI
|
||||
#define LOGI(...) ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
|
||||
#define ALOGI LOGI
|
||||
#define LOGI ALOGI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LOGI_IF
|
||||
#define LOGI_IF(cond, ...) \
|
||||
#ifndef ALOGI_IF
|
||||
#define ALOGI_IF(cond, ...) \
|
||||
( (CONDITION(cond)) \
|
||||
? ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#define ALOGI_IF LOGI_IF
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGI_IF
|
||||
#define LOGI_IF ALOGI_IF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send a warning log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGW
|
||||
#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGW
|
||||
#define LOGW(...) ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
|
||||
#define ALOGW LOGW
|
||||
#define LOGW ALOGW
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LOGW_IF
|
||||
#define LOGW_IF(cond, ...) \
|
||||
#ifndef ALOGW_IF
|
||||
#define ALOGW_IF(cond, ...) \
|
||||
( (CONDITION(cond)) \
|
||||
? ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#define ALOGW_IF LOGW_IF
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGW_IF
|
||||
#define LOGW_IF ALOGW_IF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simplified macro to send an error log message using the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOGE
|
||||
#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGE
|
||||
#define LOGE(...) ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||
#define ALOGE LOGE
|
||||
#define LOGE ALOGE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LOGE_IF
|
||||
#define LOGE_IF(cond, ...) \
|
||||
#ifndef ALOGE_IF
|
||||
#define ALOGE_IF(cond, ...) \
|
||||
( (CONDITION(cond)) \
|
||||
? ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
|
||||
: (void)0 )
|
||||
#define ALOGE_IF LOGE_IF
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOGE_IF
|
||||
#define LOGE_IF ALOGE_IF
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
|
@ -166,49 +196,64 @@ extern "C" {
|
|||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* verbose priority.
|
||||
*/
|
||||
#ifndef IF_LOGV
|
||||
#ifndef IF_ALOGV
|
||||
#if LOG_NDEBUG
|
||||
#define IF_LOGV() if (false)
|
||||
#define IF_ALOGV() if (false)
|
||||
#else
|
||||
#define IF_LOGV() IF_LOG(LOG_VERBOSE, LOG_TAG)
|
||||
#define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
|
||||
#endif
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOGV
|
||||
#define IF_LOGV IF_ALOGV
|
||||
#endif
|
||||
#define IF_ALOGV IF_LOGV
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* debug priority.
|
||||
*/
|
||||
#ifndef IF_ALOGD
|
||||
#define IF_ALOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOGD
|
||||
#define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG)
|
||||
#define IF_ALOGD IF_LOGD
|
||||
#define IF_LOGD IF_ALOGD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* info priority.
|
||||
*/
|
||||
#ifndef IF_ALOGI
|
||||
#define IF_ALOGI() IF_ALOG(LOG_INFO, LOG_TAG)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOGI
|
||||
#define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG)
|
||||
#define IF_ALOGI IF_LOGI
|
||||
#define IF_LOGI IF_ALOGI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* warn priority.
|
||||
*/
|
||||
#ifndef IF_ALOGW
|
||||
#define IF_ALOGW() IF_ALOG(LOG_WARN, LOG_TAG)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOGW
|
||||
#define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG)
|
||||
#define IF_ALOGW IF_LOGW
|
||||
#define IF_LOGW IF_ALOGW
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conditional based on whether the current LOG_TAG is enabled at
|
||||
* error priority.
|
||||
*/
|
||||
#ifndef IF_ALOGE
|
||||
#define IF_ALOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOGE
|
||||
#define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG)
|
||||
#define IF_ALOGE IF_LOGE
|
||||
#define IF_LOGE IF_ALOGE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -344,10 +389,13 @@ extern "C" {
|
|||
* Assertion that generates a log message when the assertion fails.
|
||||
* Stripped out of release builds. Uses the current LOG_TAG.
|
||||
*/
|
||||
#ifndef ALOG_ASSERT
|
||||
#define ALOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__)
|
||||
//#define ALOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOG_ASSERT
|
||||
#define LOG_ASSERT(cond, ...) LOG_FATAL_IF(!(cond), ## __VA_ARGS__)
|
||||
//#define LOG_ASSERT(cond) LOG_FATAL_IF(!(cond), "Assertion failed: " #cond)
|
||||
#define ALOG_ASSERT LOG_ASSERT
|
||||
#define LOG_ASSERT ALOG_ASSERT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
|
@ -356,13 +404,17 @@ extern "C" {
|
|||
* Basic log message macro.
|
||||
*
|
||||
* Example:
|
||||
* LOG(LOG_WARN, NULL, "Failed with error %d", errno);
|
||||
* ALOG(LOG_WARN, NULL, "Failed with error %d", errno);
|
||||
*
|
||||
* The second argument may be NULL or "" to indicate the "global" tag.
|
||||
*/
|
||||
#ifndef LOG
|
||||
#define LOG(priority, tag, ...) \
|
||||
#ifndef ALOG
|
||||
#define ALOG(priority, tag, ...) \
|
||||
LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef LOG
|
||||
#define LOG ALOG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -384,9 +436,13 @@ extern "C" {
|
|||
/*
|
||||
* Conditional given a desired logging priority and tag.
|
||||
*/
|
||||
#ifndef IF_LOG
|
||||
#define IF_LOG(priority, tag) \
|
||||
#ifndef IF_ALOG
|
||||
#define IF_ALOG(priority, tag) \
|
||||
if (android_testLog(ANDROID_##priority, tag))
|
||||
// Temporary measure for code still using old LOG macros.
|
||||
#ifndef IF_LOG
|
||||
#define IF_LOG IF_ALOG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
|
|
@ -440,7 +496,7 @@ typedef enum {
|
|||
__android_log_vprint(prio, tag, fmt)
|
||||
|
||||
/* XXX Macros to work around syntax errors in places where format string
|
||||
* arg is not passed to LOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
|
||||
* arg is not passed to ALOG_ASSERT, LOG_ALWAYS_FATAL or LOG_ALWAYS_FATAL_IF
|
||||
* (happens only in debug builds).
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ ssize_t bufferWrite(Buffer* buffer, int fd) {
|
|||
if (bytesWritten >= 0) {
|
||||
buffer->remaining -= bytesWritten;
|
||||
|
||||
LOGD("Buffer bytes written: %d", (int) bytesWritten);
|
||||
LOGD("Buffer size: %d", (int) buffer->size);
|
||||
LOGD("Buffer remaining: %d", (int) buffer->remaining);
|
||||
ALOGD("Buffer bytes written: %d", (int) bytesWritten);
|
||||
ALOGD("Buffer size: %d", (int) buffer->size);
|
||||
ALOGD("Buffer remaining: %d", (int) buffer->remaining);
|
||||
|
||||
return buffer->remaining;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,14 +25,14 @@
|
|||
#include <cutils/log.h>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#define LOG(level, ...) \
|
||||
#define ALOG(level, ...) \
|
||||
((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__))
|
||||
#define LOGV(...) LOG("V", __VA_ARGS__)
|
||||
#define LOGD(...) LOG("D", __VA_ARGS__)
|
||||
#define LOGI(...) LOG("I", __VA_ARGS__)
|
||||
#define LOGW(...) LOG("W", __VA_ARGS__)
|
||||
#define LOGE(...) LOG("E", __VA_ARGS__)
|
||||
#define LOG_ALWAYS_FATAL(...) do { LOGE(__VA_ARGS__); exit(1); } while (0)
|
||||
#define ALOGV(...) ALOG("V", __VA_ARGS__)
|
||||
#define ALOGD(...) ALOG("D", __VA_ARGS__)
|
||||
#define ALOGI(...) ALOG("I", __VA_ARGS__)
|
||||
#define ALOGW(...) ALOG("W", __VA_ARGS__)
|
||||
#define ALOGE(...) ALOG("E", __VA_ARGS__)
|
||||
#define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0)
|
||||
#endif
|
||||
|
||||
#endif // _CUTILS_LOGHACK_H
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ static void setNonBlocking(int fd) {
|
|||
static void closeWithWarning(int fd) {
|
||||
int result = close(fd);
|
||||
if (result == -1) {
|
||||
LOGW("close() error: %s", strerror(errno));
|
||||
ALOGW("close() error: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +263,7 @@ static void peerUnlock(Peer* peer) {
|
|||
|
||||
/** Frees a simple, i.e. header-only, outgoing packet. */
|
||||
static void outgoingPacketFree(OutgoingPacket* packet) {
|
||||
LOGD("Freeing outgoing packet.");
|
||||
ALOGD("Freeing outgoing packet.");
|
||||
free(packet);
|
||||
}
|
||||
|
||||
|
|
@ -374,10 +374,10 @@ static bool peerProxyRemoveConnection(void* key, void* value, void* context) {
|
|||
*/
|
||||
static void peerProxyKill(PeerProxy* peerProxy, bool errnoIsSet) {
|
||||
if (errnoIsSet) {
|
||||
LOGI("Peer %d died. errno: %s", peerProxy->credentials.pid,
|
||||
ALOGI("Peer %d died. errno: %s", peerProxy->credentials.pid,
|
||||
strerror(errno));
|
||||
} else {
|
||||
LOGI("Peer %d died.", peerProxy->credentials.pid);
|
||||
ALOGI("Peer %d died.", peerProxy->credentials.pid);
|
||||
}
|
||||
|
||||
// If we lost the master, we're up a creek. We can't let this happen.
|
||||
|
|
@ -433,12 +433,12 @@ static void peerProxyKill(PeerProxy* peerProxy, bool errnoIsSet) {
|
|||
static void peerProxyHandleError(PeerProxy* peerProxy, char* functionName) {
|
||||
if (errno == EINTR) {
|
||||
// Log interruptions but otherwise ignore them.
|
||||
LOGW("%s() interrupted.", functionName);
|
||||
ALOGW("%s() interrupted.", functionName);
|
||||
} else if (errno == EAGAIN) {
|
||||
LOGD("EWOULDBLOCK");
|
||||
ALOGD("EWOULDBLOCK");
|
||||
// Ignore.
|
||||
} else {
|
||||
LOGW("Error returned by %s().", functionName);
|
||||
ALOGW("Error returned by %s().", functionName);
|
||||
peerProxyKill(peerProxy, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -461,7 +461,7 @@ static bool peerProxyWriteFromBuffer(PeerProxy* peerProxy, Buffer* outgoing) {
|
|||
static void peerProxyWriteBytes(PeerProxy* peerProxy) {
|
||||
Buffer* buffer = peerProxy->currentPacket->bytes;
|
||||
if (peerProxyWriteFromBuffer(peerProxy, buffer)) {
|
||||
LOGD("Bytes written.");
|
||||
ALOGD("Bytes written.");
|
||||
peerProxyNextPacket(peerProxy);
|
||||
}
|
||||
}
|
||||
|
|
@ -527,10 +527,10 @@ static void peerProxyWrite(SelectableFd* fd) {
|
|||
Buffer* outgoingHeader = &peerProxy->outgoingHeader;
|
||||
bool headerWritten = bufferWriteComplete(outgoingHeader);
|
||||
if (!headerWritten) {
|
||||
LOGD("Writing header...");
|
||||
ALOGD("Writing header...");
|
||||
headerWritten = peerProxyWriteFromBuffer(peerProxy, outgoingHeader);
|
||||
if (headerWritten) {
|
||||
LOGD("Header written.");
|
||||
ALOGD("Header written.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -559,7 +559,7 @@ static void peerProxyWrite(SelectableFd* fd) {
|
|||
* Sets up a peer proxy's fd before we try to select() it.
|
||||
*/
|
||||
static void peerProxyBeforeSelect(SelectableFd* fd) {
|
||||
LOGD("Before select...");
|
||||
ALOGD("Before select...");
|
||||
|
||||
PeerProxy* peerProxy = (PeerProxy*) fd->data;
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ static void peerProxyBeforeSelect(SelectableFd* fd) {
|
|||
peerUnlock(peerProxy->peer);
|
||||
|
||||
if (hasPackets) {
|
||||
LOGD("Packets found. Setting onWritable().");
|
||||
ALOGD("Packets found. Setting onWritable().");
|
||||
|
||||
fd->onWritable = &peerProxyWrite;
|
||||
} else {
|
||||
|
|
@ -579,11 +579,11 @@ static void peerProxyBeforeSelect(SelectableFd* fd) {
|
|||
|
||||
/** Prepare to read bytes from the peer. */
|
||||
static void peerProxyExpectBytes(PeerProxy* peerProxy, Header* header) {
|
||||
LOGD("Expecting %d bytes.", header->size);
|
||||
|
||||
peerProxy->inputState = READING_BYTES;
|
||||
ALOGD("Expecting %d bytes.", header->size);
|
||||
|
||||
peerProxy->inputState = READING_BYTES;
|
||||
if (bufferPrepareForRead(peerProxy->inputBuffer, header->size) == -1) {
|
||||
LOGW("Couldn't allocate memory for incoming data. Size: %u",
|
||||
ALOGW("Couldn't allocate memory for incoming data. Size: %u",
|
||||
(unsigned int) header->size);
|
||||
|
||||
// TODO: Ignore the packet and log a warning?
|
||||
|
|
@ -670,7 +670,7 @@ static void masterProxyExpectConnection(PeerProxy* masterProxy,
|
|||
// TODO: Restructure things so we don't need this check.
|
||||
// Verify that this really is the master.
|
||||
if (!masterProxy->master) {
|
||||
LOGW("Non-master process %d tried to send us a connection.",
|
||||
ALOGW("Non-master process %d tried to send us a connection.",
|
||||
masterProxy->credentials.pid);
|
||||
// Kill off the evil peer.
|
||||
peerProxyKill(masterProxy, false);
|
||||
|
|
@ -686,7 +686,7 @@ static void masterProxyExpectConnection(PeerProxy* masterProxy,
|
|||
peerLock(localPeer);
|
||||
PeerProxy* peerProxy = peerProxyGetOrCreate(localPeer, pid, false);
|
||||
if (peerProxy == NULL) {
|
||||
LOGW("Peer proxy creation failed: %s", strerror(errno));
|
||||
ALOGW("Peer proxy creation failed: %s", strerror(errno));
|
||||
} else {
|
||||
// Fill in full credentials.
|
||||
peerProxy->credentials = header->credentials;
|
||||
|
|
@ -746,7 +746,7 @@ static void masterProxyAcceptConnection(PeerProxy* masterProxy) {
|
|||
if (size < 0) {
|
||||
if (errno == EINTR) {
|
||||
// Log interruptions but otherwise ignore them.
|
||||
LOGW("recvmsg() interrupted.");
|
||||
ALOGW("recvmsg() interrupted.");
|
||||
return;
|
||||
} else if (errno == EAGAIN) {
|
||||
// Keep waiting for the connection.
|
||||
|
|
@ -777,14 +777,14 @@ static void masterProxyAcceptConnection(PeerProxy* masterProxy) {
|
|||
// The peer proxy this connection is for.
|
||||
PeerProxy* peerProxy = masterProxy->connecting;
|
||||
if (peerProxy == NULL) {
|
||||
LOGW("Received connection for unknown peer.");
|
||||
ALOGW("Received connection for unknown peer.");
|
||||
closeWithWarning(incomingFd);
|
||||
} else {
|
||||
Peer* peer = masterProxy->peer;
|
||||
|
||||
SelectableFd* selectableFd = selectorAdd(peer->selector, incomingFd);
|
||||
if (selectableFd == NULL) {
|
||||
LOGW("Error adding fd to selector for %d.",
|
||||
ALOGW("Error adding fd to selector for %d.",
|
||||
peerProxy->credentials.pid);
|
||||
closeWithWarning(incomingFd);
|
||||
peerProxyKill(peerProxy, false);
|
||||
|
|
@ -811,7 +811,7 @@ static void masterConnectPeers(PeerProxy* peerA, PeerProxy* peerB) {
|
|||
int sockets[2];
|
||||
int result = socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets);
|
||||
if (result == -1) {
|
||||
LOGW("socketpair() error: %s", strerror(errno));
|
||||
ALOGW("socketpair() error: %s", strerror(errno));
|
||||
// TODO: Send CONNECTION_FAILED packets to peers.
|
||||
return;
|
||||
}
|
||||
|
|
@ -821,7 +821,7 @@ static void masterConnectPeers(PeerProxy* peerA, PeerProxy* peerB) {
|
|||
if (packetA == NULL || packetB == NULL) {
|
||||
free(packetA);
|
||||
free(packetB);
|
||||
LOGW("malloc() error. Failed to tell process %d that process %d is"
|
||||
ALOGW("malloc() error. Failed to tell process %d that process %d is"
|
||||
" dead.", peerA->credentials.pid, peerB->credentials.pid);
|
||||
return;
|
||||
}
|
||||
|
|
@ -852,7 +852,7 @@ static void masterReportConnectionError(PeerProxy* peerProxy,
|
|||
Credentials credentials) {
|
||||
OutgoingPacket* packet = calloc(1, sizeof(OutgoingPacket));
|
||||
if (packet == NULL) {
|
||||
LOGW("malloc() error. Failed to tell process %d that process %d is"
|
||||
ALOGW("malloc() error. Failed to tell process %d that process %d is"
|
||||
" dead.", peerProxy->credentials.pid, credentials.pid);
|
||||
return;
|
||||
}
|
||||
|
|
@ -902,10 +902,10 @@ static void masterProxyHandleConnectionError(PeerProxy* masterProxy,
|
|||
peerUnlock(peer);
|
||||
|
||||
if (peerProxy != NULL) {
|
||||
LOGI("Couldn't connect to %d.", pid);
|
||||
ALOGI("Couldn't connect to %d.", pid);
|
||||
peerProxyKill(peerProxy, false);
|
||||
} else {
|
||||
LOGW("Peer proxy for %d not found. This shouldn't happen.", pid);
|
||||
ALOGW("Peer proxy for %d not found. This shouldn't happen.", pid);
|
||||
}
|
||||
|
||||
peerProxyExpectHeader(masterProxy);
|
||||
|
|
@ -929,7 +929,7 @@ static void peerProxyHandleHeader(PeerProxy* peerProxy, Header* header) {
|
|||
peerProxyExpectBytes(peerProxy, header);
|
||||
break;
|
||||
default:
|
||||
LOGW("Invalid packet type from %d: %d", peerProxy->credentials.pid,
|
||||
ALOGW("Invalid packet type from %d: %d", peerProxy->credentials.pid,
|
||||
header->type);
|
||||
peerProxyKill(peerProxy, false);
|
||||
}
|
||||
|
|
@ -947,7 +947,7 @@ static bool peerProxyBufferInput(PeerProxy* peerProxy) {
|
|||
return false;
|
||||
} else if (size == 0) {
|
||||
// EOF.
|
||||
LOGI("EOF");
|
||||
ALOGI("EOF");
|
||||
peerProxyKill(peerProxy, false);
|
||||
return false;
|
||||
} else if (bufferReadComplete(in)) {
|
||||
|
|
@ -963,23 +963,23 @@ static bool peerProxyBufferInput(PeerProxy* peerProxy) {
|
|||
* Reads input from a peer process.
|
||||
*/
|
||||
static void peerProxyRead(SelectableFd* fd) {
|
||||
LOGD("Reading...");
|
||||
ALOGD("Reading...");
|
||||
PeerProxy* peerProxy = (PeerProxy*) fd->data;
|
||||
int state = peerProxy->inputState;
|
||||
Buffer* in = peerProxy->inputBuffer;
|
||||
switch (state) {
|
||||
case READING_HEADER:
|
||||
if (peerProxyBufferInput(peerProxy)) {
|
||||
LOGD("Header read.");
|
||||
ALOGD("Header read.");
|
||||
// We've read the complete header.
|
||||
Header* header = (Header*) in->data;
|
||||
peerProxyHandleHeader(peerProxy, header);
|
||||
}
|
||||
break;
|
||||
case READING_BYTES:
|
||||
LOGD("Reading bytes...");
|
||||
ALOGD("Reading bytes...");
|
||||
if (peerProxyBufferInput(peerProxy)) {
|
||||
LOGD("Bytes read.");
|
||||
ALOGD("Bytes read.");
|
||||
// We have the complete packet. Notify bytes listener.
|
||||
peerProxy->peer->onBytes(peerProxy->credentials,
|
||||
in->data, in->size);
|
||||
|
|
@ -1026,11 +1026,11 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
|
|||
// Accept connection.
|
||||
int socket = accept(listenerFd->fd, NULL, NULL);
|
||||
if (socket == -1) {
|
||||
LOGW("accept() error: %s", strerror(errno));
|
||||
ALOGW("accept() error: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
LOGD("Accepted connection as fd %d.", socket);
|
||||
ALOGD("Accepted connection as fd %d.", socket);
|
||||
|
||||
// Get credentials.
|
||||
Credentials credentials;
|
||||
|
|
@ -1040,7 +1040,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
|
|||
&ucredentials, &credentialsSize);
|
||||
// We might want to verify credentialsSize.
|
||||
if (result == -1) {
|
||||
LOGW("getsockopt() error: %s", strerror(errno));
|
||||
ALOGW("getsockopt() error: %s", strerror(errno));
|
||||
closeWithWarning(socket);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1050,7 +1050,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
|
|||
credentials.uid = ucredentials.uid;
|
||||
credentials.gid = ucredentials.gid;
|
||||
|
||||
LOGI("Accepted connection from process %d.", credentials.pid);
|
||||
ALOGI("Accepted connection from process %d.", credentials.pid);
|
||||
|
||||
Peer* masterPeer = (Peer*) listenerFd->data;
|
||||
|
||||
|
|
@ -1061,7 +1061,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
|
|||
= hashmapGet(masterPeer->peerProxies, &credentials.pid);
|
||||
if (peerProxy != NULL) {
|
||||
peerUnlock(masterPeer);
|
||||
LOGW("Alread connected to process %d.", credentials.pid);
|
||||
ALOGW("Alread connected to process %d.", credentials.pid);
|
||||
closeWithWarning(socket);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1070,7 +1070,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
|
|||
SelectableFd* socketFd = selectorAdd(masterPeer->selector, socket);
|
||||
if (socketFd == NULL) {
|
||||
peerUnlock(masterPeer);
|
||||
LOGW("malloc() failed.");
|
||||
ALOGW("malloc() failed.");
|
||||
closeWithWarning(socket);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1079,7 +1079,7 @@ static void masterAcceptConnection(SelectableFd* listenerFd) {
|
|||
peerProxy = peerProxyCreate(masterPeer, credentials);
|
||||
peerUnlock(masterPeer);
|
||||
if (peerProxy == NULL) {
|
||||
LOGW("malloc() failed.");
|
||||
ALOGW("malloc() failed.");
|
||||
socketFd->remove = true;
|
||||
closeWithWarning(socket);
|
||||
}
|
||||
|
|
@ -1118,7 +1118,7 @@ static Peer* localPeer;
|
|||
|
||||
/** Frees a packet of bytes. */
|
||||
static void outgoingPacketFreeBytes(OutgoingPacket* packet) {
|
||||
LOGD("Freeing outgoing packet.");
|
||||
ALOGD("Freeing outgoing packet.");
|
||||
bufferFree(packet->bytes);
|
||||
free(packet);
|
||||
}
|
||||
|
|
@ -1270,7 +1270,7 @@ void masterPeerInitialize(BytesListener* bytesListener,
|
|||
LOG_ALWAYS_FATAL("bind() error: %s", strerror(errno));
|
||||
}
|
||||
|
||||
LOGD("Listener socket: %d", listenerSocket);
|
||||
ALOGD("Listener socket: %d", listenerSocket);
|
||||
|
||||
// Queue up to 16 connections.
|
||||
result = listen(listenerSocket, 16);
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ static int connectToServer(const char* fileName)
|
|||
|
||||
sock = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
LOGW("UNIX domain socket create failed (errno=%d)\n", errno);
|
||||
ALOGW("UNIX domain socket create failed (errno=%d)\n", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ static int connectToServer(const char* fileName)
|
|||
if (cc < 0) {
|
||||
// ENOENT means socket file doesn't exist
|
||||
// ECONNREFUSED means socket exists but nobody is listening
|
||||
//LOGW("AF_UNIX connect failed for '%s': %s\n",
|
||||
//ALOGW("AF_UNIX connect failed for '%s': %s\n",
|
||||
// fileName, strerror(errno));
|
||||
close(sock);
|
||||
return -1;
|
||||
|
|
@ -128,9 +128,9 @@ static void init(void)
|
|||
|
||||
gPropFd = connectToServer(SYSTEM_PROPERTY_PIPE_NAME);
|
||||
if (gPropFd < 0) {
|
||||
//LOGW("not connected to system property server\n");
|
||||
//ALOGW("not connected to system property server\n");
|
||||
} else {
|
||||
//LOGV("Connected to system property server\n");
|
||||
//ALOGV("Connected to system property server\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ int property_get(const char *key, char *value, const char *default_value)
|
|||
char recvBuf[1+PROPERTY_VALUE_MAX];
|
||||
int len = -1;
|
||||
|
||||
//LOGV("PROPERTY GET [%s]\n", key);
|
||||
//ALOGV("PROPERTY GET [%s]\n", key);
|
||||
|
||||
pthread_once(&gInitOnce, init);
|
||||
if (gPropFd < 0) {
|
||||
|
|
@ -189,12 +189,12 @@ int property_get(const char *key, char *value, const char *default_value)
|
|||
strcpy(value, recvBuf+1);
|
||||
len = strlen(value);
|
||||
} else {
|
||||
LOGE("Got strange response to property_get request (%d)\n",
|
||||
ALOGE("Got strange response to property_get request (%d)\n",
|
||||
recvBuf[0]);
|
||||
assert(0);
|
||||
return -1;
|
||||
}
|
||||
//LOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n",
|
||||
//ALOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n",
|
||||
// recvBuf[0], default_value, len, key, value);
|
||||
|
||||
return len;
|
||||
|
|
@ -207,7 +207,7 @@ int property_set(const char *key, const char *value)
|
|||
char recvBuf[1];
|
||||
int result = -1;
|
||||
|
||||
//LOGV("PROPERTY SET [%s]: [%s]\n", key, value);
|
||||
//ALOGV("PROPERTY SET [%s]: [%s]\n", key, value);
|
||||
|
||||
pthread_once(&gInitOnce, init);
|
||||
if (gPropFd < 0)
|
||||
|
|
@ -241,7 +241,7 @@ int property_set(const char *key, const char *value)
|
|||
int property_list(void (*propfn)(const char *key, const char *value, void *cookie),
|
||||
void *cookie)
|
||||
{
|
||||
//LOGV("PROPERTY LIST\n");
|
||||
//ALOGV("PROPERTY LIST\n");
|
||||
pthread_once(&gInitOnce, init);
|
||||
if (gPropFd < 0)
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ void qtaguid_resTrack(void) {
|
|||
static int write_ctrl(const char *cmd) {
|
||||
int fd, res, savedErrno;
|
||||
|
||||
LOGV("write_ctrl(%s)", cmd);
|
||||
ALOGV("write_ctrl(%s)", cmd);
|
||||
|
||||
fd = TEMP_FAILURE_RETRY(open(CTRL_PROCPATH, O_WRONLY));
|
||||
if (fd < 0) {
|
||||
|
|
@ -74,7 +74,7 @@ static int write_ctrl(const char *cmd) {
|
|||
savedErrno = 0;
|
||||
}
|
||||
if (res < 0) {
|
||||
LOGI("Failed write_ctrl(%s) res=%d errno=%d", cmd, res, savedErrno);
|
||||
ALOGI("Failed write_ctrl(%s) res=%d errno=%d", cmd, res, savedErrno);
|
||||
}
|
||||
close(fd);
|
||||
return -savedErrno;
|
||||
|
|
@ -107,11 +107,11 @@ int qtaguid_tagSocket(int sockfd, int tag, uid_t uid) {
|
|||
|
||||
snprintf(lineBuf, sizeof(lineBuf), "t %d %llu %d", sockfd, kTag, uid);
|
||||
|
||||
LOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid);
|
||||
ALOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid);
|
||||
|
||||
res = write_ctrl(lineBuf);
|
||||
if (res < 0) {
|
||||
LOGI("Tagging socket %d with tag %llx(%d) for uid %d failed errno=%d",
|
||||
ALOGI("Tagging socket %d with tag %llx(%d) for uid %d failed errno=%d",
|
||||
sockfd, kTag, tag, uid, res);
|
||||
}
|
||||
|
||||
|
|
@ -122,12 +122,12 @@ int qtaguid_untagSocket(int sockfd) {
|
|||
char lineBuf[CTRL_MAX_INPUT_LEN];
|
||||
int res;
|
||||
|
||||
LOGV("Untagging socket %d", sockfd);
|
||||
ALOGV("Untagging socket %d", sockfd);
|
||||
|
||||
snprintf(lineBuf, sizeof(lineBuf), "u %d", sockfd);
|
||||
res = write_ctrl(lineBuf);
|
||||
if (res < 0) {
|
||||
LOGI("Untagging socket %d failed errno=%d", sockfd, res);
|
||||
ALOGI("Untagging socket %d failed errno=%d", sockfd, res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -137,7 +137,7 @@ int qtaguid_setCounterSet(int counterSetNum, uid_t uid) {
|
|||
char lineBuf[CTRL_MAX_INPUT_LEN];
|
||||
int res;
|
||||
|
||||
LOGV("Setting counters to set %d for uid %d", counterSetNum, uid);
|
||||
ALOGV("Setting counters to set %d for uid %d", counterSetNum, uid);
|
||||
|
||||
snprintf(lineBuf, sizeof(lineBuf), "s %d %d", counterSetNum, uid);
|
||||
res = write_ctrl(lineBuf);
|
||||
|
|
@ -149,14 +149,14 @@ int qtaguid_deleteTagData(int tag, uid_t uid) {
|
|||
int fd, cnt = 0, res = 0;
|
||||
uint64_t kTag = (uint64_t)tag << 32;
|
||||
|
||||
LOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid);
|
||||
ALOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid);
|
||||
|
||||
pthread_once(&resTrackInitDone, qtaguid_resTrack);
|
||||
|
||||
snprintf(lineBuf, sizeof(lineBuf), "d %llu %d", kTag, uid);
|
||||
res = write_ctrl(lineBuf);
|
||||
if (res < 0) {
|
||||
LOGI("Deleteing tag data with tag %llx/%d for uid %d failed with cnt=%d errno=%d",
|
||||
ALOGI("Deleteing tag data with tag %llx/%d for uid %d failed with cnt=%d errno=%d",
|
||||
kTag, tag, uid, cnt, errno);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord,
|
|||
&& p_rs->read_end == p_rs->buffer_end
|
||||
) {
|
||||
// this should never happen
|
||||
//LOGE("max record length exceeded\n");
|
||||
//ALOGE("max record length exceeded\n");
|
||||
assert (0);
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static void eatWakeupData(SelectableFd* wakeupFd) {
|
|||
static char garbage[64];
|
||||
if (read(wakeupFd->fd, garbage, sizeof(garbage)) < 0) {
|
||||
if (errno == EINTR) {
|
||||
LOGI("read() interrupted.");
|
||||
ALOGI("read() interrupted.");
|
||||
} else {
|
||||
LOG_ALWAYS_FATAL("This should never happen: %s", strerror(errno));
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ void selectorWakeUp(Selector* selector) {
|
|||
static char garbage[1];
|
||||
if (write(selector->wakeupPipe[1], garbage, sizeof(garbage)) < 0) {
|
||||
if (errno == EINTR) {
|
||||
LOGI("read() interrupted.");
|
||||
ALOGI("read() interrupted.");
|
||||
} else {
|
||||
LOG_ALWAYS_FATAL("This should never happen: %s", strerror(errno));
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ Selector* selectorCreate(void) {
|
|||
LOG_ALWAYS_FATAL("pipe() error: %s", strerror(errno));
|
||||
}
|
||||
|
||||
LOGD("Wakeup fd: %d", selector->wakeupPipe[0]);
|
||||
ALOGD("Wakeup fd: %d", selector->wakeupPipe[0]);
|
||||
|
||||
SelectableFd* wakeupFd = selectorAdd(selector, selector->wakeupPipe[0]);
|
||||
if (wakeupFd == NULL) {
|
||||
|
|
@ -169,11 +169,11 @@ static void prepareForSelect(Selector* selector) {
|
|||
|
||||
bool inSet = false;
|
||||
if (maybeAdd(selectableFd, selectableFd->onExcept, exceptFds)) {
|
||||
LOGD("Selecting fd %d for writing...", selectableFd->fd);
|
||||
ALOGD("Selecting fd %d for writing...", selectableFd->fd);
|
||||
inSet = true;
|
||||
}
|
||||
if (maybeAdd(selectableFd, selectableFd->onReadable, readFds)) {
|
||||
LOGD("Selecting fd %d for reading...", selectableFd->fd);
|
||||
ALOGD("Selecting fd %d for reading...", selectableFd->fd);
|
||||
inSet = true;
|
||||
}
|
||||
if (maybeAdd(selectableFd, selectableFd->onWritable, writeFds)) {
|
||||
|
|
@ -200,9 +200,9 @@ static void prepareForSelect(Selector* selector) {
|
|||
*/
|
||||
static inline void maybeInvoke(SelectableFd* selectableFd,
|
||||
void (*callback)(SelectableFd*), fd_set* fdSet) {
|
||||
if (callback != NULL && !selectableFd->remove &&
|
||||
if (callback != NULL && !selectableFd->remove &&
|
||||
FD_ISSET(selectableFd->fd, fdSet)) {
|
||||
LOGD("Selected fd %d.", selectableFd->fd);
|
||||
ALOGD("Selected fd %d.", selectableFd->fd);
|
||||
callback(selectableFd);
|
||||
}
|
||||
}
|
||||
|
|
@ -238,20 +238,20 @@ void selectorLoop(Selector* selector) {
|
|||
|
||||
prepareForSelect(selector);
|
||||
|
||||
LOGD("Entering select().");
|
||||
ALOGD("Entering select().");
|
||||
|
||||
// Select file descriptors.
|
||||
int result = select(selector->maxFd + 1, &selector->readFds,
|
||||
&selector->writeFds, &selector->exceptFds, NULL);
|
||||
|
||||
LOGD("Exiting select().");
|
||||
ALOGD("Exiting select().");
|
||||
|
||||
setInSelect(selector, false);
|
||||
|
||||
if (result == -1) {
|
||||
// Abort on everything except EINTR.
|
||||
if (errno == EINTR) {
|
||||
LOGI("select() interrupted.");
|
||||
ALOGI("select() interrupted.");
|
||||
} else {
|
||||
LOG_ALWAYS_FATAL("select() error: %s",
|
||||
strerror(errno));
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@ bool socket_peer_is_trusted(int fd)
|
|||
int n = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len);
|
||||
|
||||
if (n != 0) {
|
||||
LOGE("could not get socket credentials: %s\n", strerror(errno));
|
||||
ALOGE("could not get socket credentials: %s\n", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((cr.uid != AID_ROOT) && (cr.uid != AID_SHELL)) {
|
||||
LOGE("untrusted userid on other end of socket: userid %d\n", cr.uid);
|
||||
ALOGE("untrusted userid on other end of socket: userid %d\n", cr.uid);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ struct str_parms *str_parms_create_str(const char *_string)
|
|||
if (!str)
|
||||
goto err_strdup;
|
||||
|
||||
LOGV("%s: source string == '%s'\n", __func__, _string);
|
||||
ALOGV("%s: source string == '%s'\n", __func__, _string);
|
||||
|
||||
kvpair = strtok_r(str, ";", &tmpstr);
|
||||
while (kvpair && *kvpair) {
|
||||
|
|
@ -137,7 +137,7 @@ next_pair:
|
|||
}
|
||||
|
||||
if (!items)
|
||||
LOGV("%s: no items found in string\n", __func__);
|
||||
ALOGV("%s: no items found in string\n", __func__);
|
||||
|
||||
free(str);
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ char *str_parms_to_str(struct str_parms *str_parms)
|
|||
|
||||
static bool dump_entry(void *key, void *value, void *context)
|
||||
{
|
||||
LOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value);
|
||||
ALOGI("key: '%s' value: '%s'\n", (char *)key, (char *)value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -301,7 +301,7 @@ static void test_str_parms_str(const char *str)
|
|||
str_parms_dump(str_parms);
|
||||
out_str = str_parms_to_str(str_parms);
|
||||
str_parms_destroy(str_parms);
|
||||
LOGI("%s: '%s' stringified is '%s'", __func__, str, out_str);
|
||||
ALOGI("%s: '%s' stringified is '%s'", __func__, str, out_str);
|
||||
free(out_str);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static int send_request(int fd, int sendStdio, int argc, const char **argv)
|
|||
{
|
||||
#ifndef HAVE_ANDROID_OS
|
||||
// not supported on simulator targets
|
||||
//LOGE("zygote_* not supported on simulator targets");
|
||||
//ALOGE("zygote_* not supported on simulator targets");
|
||||
return -1;
|
||||
#else /* HAVE_ANDROID_OS */
|
||||
uint32_t pid;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ cfg_pentry(struct pc_partition *pentry, uint8_t status, uint8_t type,
|
|||
pentry->start_lba = start;
|
||||
pentry->len_lba = len;
|
||||
|
||||
LOGI("Configuring pentry. status=0x%x type=0x%x start_lba=%u len_lba=%u",
|
||||
ALOGI("Configuring pentry. status=0x%x type=0x%x start_lba=%u len_lba=%u",
|
||||
pentry->status, pentry->type, pentry->start_lba, pentry->len_lba);
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ kb_to_lba(uint32_t len_kb, uint32_t sect_size)
|
|||
lba = (lba + (uint64_t)sect_size - 1) & ~((uint64_t)sect_size - 1);
|
||||
lba /= (uint64_t)sect_size;
|
||||
if (lba >= 0xffffffffULL)
|
||||
LOGE("Error converting kb -> lba. 32bit overflow, expect weirdness");
|
||||
ALOGE("Error converting kb -> lba. 32bit overflow, expect weirdness");
|
||||
return (uint32_t)(lba & 0xffffffffULL);
|
||||
}
|
||||
|
||||
|
|
@ -75,12 +75,12 @@ mk_pri_pentry(struct disk_info *dinfo, struct part_info *pinfo, int pnum,
|
|||
struct pc_partition *pentry;
|
||||
|
||||
if (pnum >= PC_NUM_BOOT_RECORD_PARTS) {
|
||||
LOGE("Maximum number of primary partition exceeded.");
|
||||
ALOGE("Maximum number of primary partition exceeded.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(item = alloc_wl(sizeof(struct pc_partition)))) {
|
||||
LOGE("Unable to allocate memory for partition entry.");
|
||||
ALOGE("Unable to allocate memory for partition entry.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
|
|||
uint32_t len; /* in lba units */
|
||||
|
||||
if (!(item = alloc_wl(sizeof(struct pc_boot_record)))) {
|
||||
LOGE("Unable to allocate memory for EBR.");
|
||||
ALOGE("Unable to allocate memory for EBR.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ mk_ext_pentry(struct disk_info *dinfo, struct part_info *pinfo, uint32_t *lba,
|
|||
len = kb_to_lba(pinfo->len_kb, dinfo->sect_size);
|
||||
else {
|
||||
if (pnext) {
|
||||
LOGE("Only the last partition can be specified to fill the disk "
|
||||
ALOGE("Only the last partition can be specified to fill the disk "
|
||||
"(name = '%s')", pinfo->name);
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
if ((temp_wr = mk_pri_pentry(dinfo, NULL, cnt, &cur_lba)))
|
||||
wlist_add(&wr_list, temp_wr);
|
||||
else {
|
||||
LOGE("Cannot create primary extended partition.");
|
||||
ALOGE("Cannot create primary extended partition.");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
if (temp_wr)
|
||||
wlist_add(&wr_list, temp_wr);
|
||||
else {
|
||||
LOGE("Cannot create partition %d (%s).", cnt, pinfo->name);
|
||||
ALOGE("Cannot create partition %d (%s).", cnt, pinfo->name);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
cur_lba = 0;
|
||||
memset(&blank, 0, sizeof(struct part_info));
|
||||
if (!(temp_wr = mk_pri_pentry(dinfo, &blank, cnt, &cur_lba))) {
|
||||
LOGE("Cannot create blank partition %d.", cnt);
|
||||
ALOGE("Cannot create blank partition %d.", cnt);
|
||||
goto fail;
|
||||
}
|
||||
wlist_add(&wr_list, temp_wr);
|
||||
|
|
@ -279,7 +279,7 @@ config_mbr(struct disk_info *dinfo)
|
|||
return wr_list;
|
||||
|
||||
nospace:
|
||||
LOGE("Not enough space to add parttion '%s'.", pinfo->name);
|
||||
ALOGE("Not enough space to add parttion '%s'.", pinfo->name);
|
||||
|
||||
fail:
|
||||
wlist_free(wr_list);
|
||||
|
|
@ -310,13 +310,13 @@ find_mbr_part(struct disk_info *dinfo, const char *name)
|
|||
num++;
|
||||
|
||||
if (!(dev_name = malloc(MAX_NAME_LEN))) {
|
||||
LOGE("Cannot allocate memory.");
|
||||
ALOGE("Cannot allocate memory.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
num = snprintf(dev_name, MAX_NAME_LEN, "%s%d", dinfo->device, num);
|
||||
if (num >= MAX_NAME_LEN) {
|
||||
LOGE("Device name is too long?!");
|
||||
ALOGE("Device name is too long?!");
|
||||
free(dev_name);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ parse_len(const char *str, uint64_t *plen)
|
|||
tmp[sizeof(tmp)-1] = '\0';
|
||||
len_str = strlen(tmp);
|
||||
if (!len_str) {
|
||||
LOGE("Invalid disk length specified.");
|
||||
ALOGE("Invalid disk length specified.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -64,13 +64,13 @@ parse_len(const char *str, uint64_t *plen)
|
|||
|
||||
*plen = strtoull(tmp, NULL, 0);
|
||||
if (!*plen) {
|
||||
LOGE("Invalid length specified: %s", str);
|
||||
ALOGE("Invalid length specified: %s", str);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*plen == (uint64_t)-1) {
|
||||
if (multiple > 1) {
|
||||
LOGE("Size modifier illegal when len is -1");
|
||||
ALOGE("Size modifier illegal when len is -1");
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -80,7 +80,7 @@ parse_len(const char *str, uint64_t *plen)
|
|||
*plen *= multiple;
|
||||
|
||||
if (*plen > 0xffffffffULL) {
|
||||
LOGE("Length specified is too large!: %llu KB", *plen);
|
||||
ALOGE("Length specified is too large!: %llu KB", *plen);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ load_partitions(cnode *root, struct disk_info *dinfo)
|
|||
pinfo->flags |= PART_ACTIVE_FLAG;
|
||||
|
||||
if (!(tmp = config_str(partnode, "type", NULL))) {
|
||||
LOGE("Partition type required: %s", pinfo->name);
|
||||
ALOGE("Partition type required: %s", pinfo->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ load_partitions(cnode *root, struct disk_info *dinfo)
|
|||
} else if (!strcmp(tmp, "fat32")) {
|
||||
pinfo->type = PC_PART_TYPE_FAT32;
|
||||
} else {
|
||||
LOGE("Unsupported partition type found: %s", tmp);
|
||||
ALOGE("Unsupported partition type found: %s", tmp);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -146,13 +146,13 @@ load_diskconfig(const char *fn, char *path_override)
|
|||
const char *tmp;
|
||||
|
||||
if (!(dinfo = malloc(sizeof(struct disk_info)))) {
|
||||
LOGE("Could not malloc disk_info");
|
||||
ALOGE("Could not malloc disk_info");
|
||||
return NULL;
|
||||
}
|
||||
memset(dinfo, 0, sizeof(struct disk_info));
|
||||
|
||||
if (!(dinfo->part_lst = malloc(MAX_NUM_PARTS * sizeof(struct part_info)))) {
|
||||
LOGE("Could not malloc part_lst");
|
||||
ALOGE("Could not malloc part_lst");
|
||||
goto fail;
|
||||
}
|
||||
memset(dinfo->part_lst, 0,
|
||||
|
|
@ -160,33 +160,33 @@ load_diskconfig(const char *fn, char *path_override)
|
|||
|
||||
config_load_file(root, fn);
|
||||
if (root->first_child == NULL) {
|
||||
LOGE("Could not read config file %s", fn);
|
||||
ALOGE("Could not read config file %s", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(devroot = config_find(root, "device"))) {
|
||||
LOGE("Could not find device section in config file '%s'", fn);
|
||||
ALOGE("Could not find device section in config file '%s'", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
if (!(tmp = config_str(devroot, "path", path_override))) {
|
||||
LOGE("device path is requried");
|
||||
ALOGE("device path is requried");
|
||||
goto fail;
|
||||
}
|
||||
dinfo->device = strdup(tmp);
|
||||
|
||||
/* find the partition scheme */
|
||||
if (!(tmp = config_str(devroot, "scheme", NULL))) {
|
||||
LOGE("partition scheme is required");
|
||||
ALOGE("partition scheme is required");
|
||||
goto fail;
|
||||
} else if (!strcmp(tmp, "mbr")) {
|
||||
dinfo->scheme = PART_SCHEME_MBR;
|
||||
} else if (!strcmp(tmp, "gpt")) {
|
||||
LOGE("'gpt' partition scheme not supported yet.");
|
||||
ALOGE("'gpt' partition scheme not supported yet.");
|
||||
goto fail;
|
||||
} else {
|
||||
LOGE("Unknown partition scheme specified: %s", tmp);
|
||||
ALOGE("Unknown partition scheme specified: %s", tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -194,30 +194,30 @@ load_diskconfig(const char *fn, char *path_override)
|
|||
tmp = config_str(devroot, "sector_size", "512");
|
||||
dinfo->sect_size = strtol(tmp, NULL, 0);
|
||||
if (!dinfo->sect_size) {
|
||||
LOGE("Invalid sector size: %s", tmp);
|
||||
ALOGE("Invalid sector size: %s", tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* first lba where the partitions will start on disk */
|
||||
if (!(tmp = config_str(devroot, "start_lba", NULL))) {
|
||||
LOGE("start_lba must be provided");
|
||||
ALOGE("start_lba must be provided");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(dinfo->skip_lba = strtol(tmp, NULL, 0))) {
|
||||
LOGE("Invalid starting LBA (or zero): %s", tmp);
|
||||
ALOGE("Invalid starting LBA (or zero): %s", tmp);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Number of LBAs on disk */
|
||||
if (!(tmp = config_str(devroot, "num_lba", NULL))) {
|
||||
LOGE("num_lba is required");
|
||||
ALOGE("num_lba is required");
|
||||
goto fail;
|
||||
}
|
||||
dinfo->num_lba = strtoul(tmp, NULL, 0);
|
||||
|
||||
if (!(partnode = config_find(devroot, "partitions"))) {
|
||||
LOGE("Device must specify partition list");
|
||||
ALOGE("Device must specify partition list");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -244,12 +244,12 @@ sync_ptable(int fd)
|
|||
sync();
|
||||
|
||||
if (fstat(fd, &stat)) {
|
||||
LOGE("Cannot stat, errno=%d.", errno);
|
||||
ALOGE("Cannot stat, errno=%d.", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (S_ISBLK(stat.st_mode) && ((rv = ioctl(fd, BLKRRPART, NULL)) < 0)) {
|
||||
LOGE("Could not re-read partition table. REBOOT!. (errno=%d)", errno);
|
||||
ALOGE("Could not re-read partition table. REBOOT!. (errno=%d)", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -281,12 +281,12 @@ validate(struct disk_info *dinfo)
|
|||
return -1;
|
||||
|
||||
if ((fd = open(dinfo->device, O_RDWR)) < 0) {
|
||||
LOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno);
|
||||
ALOGE("Cannot open device '%s' (errno=%d)", dinfo->device, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fstat(fd, &stat)) {
|
||||
LOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno);
|
||||
ALOGE("Cannot stat file '%s', errno=%d.", dinfo->device, errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -299,19 +299,19 @@ validate(struct disk_info *dinfo)
|
|||
if (S_ISBLK(stat.st_mode)) {
|
||||
/* get the sector size and make sure we agree */
|
||||
if (ioctl(fd, BLKSSZGET, §_sz) < 0) {
|
||||
LOGE("Cannot get sector size (errno=%d)", errno);
|
||||
ALOGE("Cannot get sector size (errno=%d)", errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!sect_sz || sect_sz != dinfo->sect_size) {
|
||||
LOGE("Device sector size is zero or sector sizes do not match!");
|
||||
ALOGE("Device sector size is zero or sector sizes do not match!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* allow the user override the "disk size" if they provided num_lba */
|
||||
if (!dinfo->num_lba) {
|
||||
if (ioctl(fd, BLKGETSIZE64, &disk_size) < 0) {
|
||||
LOGE("Could not get block device size (errno=%d)", errno);
|
||||
ALOGE("Could not get block device size (errno=%d)", errno);
|
||||
goto fail;
|
||||
}
|
||||
/* XXX: we assume that the disk has < 2^32 sectors :-) */
|
||||
|
|
@ -319,9 +319,9 @@ validate(struct disk_info *dinfo)
|
|||
} else
|
||||
disk_size = (uint64_t)dinfo->num_lba * (uint64_t)dinfo->sect_size;
|
||||
} else if (S_ISREG(stat.st_mode)) {
|
||||
LOGI("Requesting operation on a regular file, not block device.");
|
||||
ALOGI("Requesting operation on a regular file, not block device.");
|
||||
if (!dinfo->sect_size) {
|
||||
LOGE("Sector size for regular file images cannot be zero");
|
||||
ALOGE("Sector size for regular file images cannot be zero");
|
||||
goto fail;
|
||||
}
|
||||
if (dinfo->num_lba)
|
||||
|
|
@ -331,12 +331,12 @@ validate(struct disk_info *dinfo)
|
|||
disk_size = (uint64_t)stat.st_size;
|
||||
}
|
||||
} else {
|
||||
LOGE("Device does not refer to a regular file or a block device!");
|
||||
ALOGE("Device does not refer to a regular file or a block device!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if 1
|
||||
LOGV("Device/file %s: size=%llu bytes, num_lba=%u, sect_size=%d",
|
||||
ALOGV("Device/file %s: size=%llu bytes, num_lba=%u, sect_size=%d",
|
||||
dinfo->device, disk_size, dinfo->num_lba, dinfo->sect_size);
|
||||
#endif
|
||||
|
||||
|
|
@ -350,12 +350,12 @@ validate(struct disk_info *dinfo)
|
|||
if (part->len_kb != (uint32_t)-1) {
|
||||
total_size += part->len_kb * 1024;
|
||||
} else if (part->len_kb == 0) {
|
||||
LOGE("Zero-size partition '%s' is invalid.", part->name);
|
||||
ALOGE("Zero-size partition '%s' is invalid.", part->name);
|
||||
goto fail;
|
||||
} else {
|
||||
/* the partition requests the rest of the disk. */
|
||||
if (cnt + 1 != dinfo->num_parts) {
|
||||
LOGE("Only the last partition in the list can request to fill "
|
||||
ALOGE("Only the last partition in the list can request to fill "
|
||||
"the rest of disk.");
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -363,7 +363,7 @@ validate(struct disk_info *dinfo)
|
|||
|
||||
if ((part->type != PC_PART_TYPE_LINUX) &&
|
||||
(part->type != PC_PART_TYPE_FAT32)) {
|
||||
LOGE("Unknown partition type (0x%x) encountered for partition "
|
||||
ALOGE("Unknown partition type (0x%x) encountered for partition "
|
||||
"'%s'\n", part->type, part->name);
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -371,7 +371,7 @@ validate(struct disk_info *dinfo)
|
|||
|
||||
/* only matters for disks, not files */
|
||||
if (S_ISBLK(stat.st_mode) && total_size > disk_size) {
|
||||
LOGE("Total requested size of partitions (%llu) is greater than disk "
|
||||
ALOGE("Total requested size of partitions (%llu) is greater than disk "
|
||||
"size (%llu).", total_size, disk_size);
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -399,7 +399,7 @@ validate_and_config(struct disk_info *dinfo, int *fd, struct write_list **lst)
|
|||
case PART_SCHEME_GPT:
|
||||
/* not supported yet */
|
||||
default:
|
||||
LOGE("Uknown partition scheme.");
|
||||
ALOGE("Uknown partition scheme.");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ apply_disk_config(struct disk_info *dinfo, int test)
|
|||
int rv;
|
||||
|
||||
if (validate_and_config(dinfo, &fd, &wr_lst) != 0) {
|
||||
LOGE("Configuration is invalid.");
|
||||
ALOGE("Configuration is invalid.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -523,10 +523,10 @@ find_part_device(struct disk_info *dinfo, const char *name)
|
|||
case PART_SCHEME_MBR:
|
||||
return find_mbr_part(dinfo, name);
|
||||
case PART_SCHEME_GPT:
|
||||
LOGE("GPT is presently not supported");
|
||||
ALOGE("GPT is presently not supported");
|
||||
break;
|
||||
default:
|
||||
LOGE("Unknown partition table scheme");
|
||||
ALOGE("Unknown partition table scheme");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,20 +40,20 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
int done = 0;
|
||||
uint64_t total = 0;
|
||||
|
||||
LOGI("Writing RAW image '%s' to '%s' (offset=%llu)", src, dst, offset);
|
||||
ALOGI("Writing RAW image '%s' to '%s' (offset=%llu)", src, dst, offset);
|
||||
if ((src_fd = open(src, O_RDONLY)) < 0) {
|
||||
LOGE("Could not open %s for reading (errno=%d).", src, errno);
|
||||
ALOGE("Could not open %s for reading (errno=%d).", src, errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!test) {
|
||||
if ((dst_fd = open(dst, O_RDWR)) < 0) {
|
||||
LOGE("Could not open '%s' for read/write (errno=%d).", dst, errno);
|
||||
ALOGE("Could not open '%s' for read/write (errno=%d).", dst, errno);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (lseek64(dst_fd, offset, SEEK_SET) != offset) {
|
||||
LOGE("Could not seek to offset %lld in %s.", offset, dst);
|
||||
ALOGE("Could not seek to offset %lld in %s.", offset, dst);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
/* XXX: Should we not even bother with EINTR? */
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
LOGE("Error (%d) while reading from '%s'", errno, src);
|
||||
ALOGE("Error (%d) while reading from '%s'", errno, src);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
/* XXX: Should we not even bother with EINTR? */
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
LOGE("Error (%d) while writing to '%s'", errno, dst);
|
||||
ALOGE("Error (%d) while writing to '%s'", errno, dst);
|
||||
goto fail;
|
||||
}
|
||||
if (!tmp)
|
||||
|
|
@ -94,14 +94,14 @@ write_raw_image(const char *dst, const char *src, loff_t offset, int test)
|
|||
}
|
||||
|
||||
if (!done) {
|
||||
LOGE("Exited read/write loop without setting flag! WTF?!");
|
||||
ALOGE("Exited read/write loop without setting flag! WTF?!");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (dst_fd >= 0)
|
||||
fsync(dst_fd);
|
||||
|
||||
LOGI("Wrote %llu bytes to %s @ %lld", total, dst, offset);
|
||||
ALOGI("Wrote %llu bytes to %s @ %lld", total, dst, offset);
|
||||
|
||||
close(src_fd);
|
||||
if (dst_fd >= 0)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ main(int argc, char *argv[])
|
|||
struct disk_info *dinfo;
|
||||
|
||||
if (argc < 2) {
|
||||
LOGE("usage: %s <conf file>", argv[0]);
|
||||
ALOGE("usage: %s <conf file>", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ alloc_wl(uint32_t data_len)
|
|||
struct write_list *item;
|
||||
|
||||
if (!(item = malloc(sizeof(struct write_list) + data_len))) {
|
||||
LOGE("Unable to allocate memory.");
|
||||
ALOGE("Unable to allocate memory.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -71,18 +71,18 @@ wlist_commit(int fd, struct write_list *lst, int test)
|
|||
{
|
||||
for(; lst; lst = lst->next) {
|
||||
if (lseek64(fd, lst->offset, SEEK_SET) != (loff_t)lst->offset) {
|
||||
LOGE("Cannot seek to the specified position (%lld).", lst->offset);
|
||||
ALOGE("Cannot seek to the specified position (%lld).", lst->offset);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!test) {
|
||||
if (write(fd, lst->data, lst->len) != (int)lst->len) {
|
||||
LOGE("Failed writing %u bytes at position %lld.", lst->len,
|
||||
ALOGE("Failed writing %u bytes at position %lld.", lst->len,
|
||||
lst->offset);
|
||||
goto fail;
|
||||
}
|
||||
} else
|
||||
LOGI("Would write %d bytes @ offset %lld.", lst->len, lst->offset);
|
||||
ALOGI("Would write %d bytes @ offset %lld.", lst->len, lst->offset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void printerr(char *fmt, ...)
|
|||
vsnprintf(errmsg, sizeof(errmsg), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
LOGD("%s", errmsg);
|
||||
ALOGD("%s", errmsg);
|
||||
}
|
||||
|
||||
const char *dhcp_lasterror()
|
||||
|
|
@ -151,14 +151,14 @@ static const char *dhcp_type_to_name(uint32_t type)
|
|||
void dump_dhcp_info(dhcp_info *info)
|
||||
{
|
||||
char addr[20], gway[20], mask[20];
|
||||
LOGD("--- dhcp %s (%d) ---",
|
||||
ALOGD("--- dhcp %s (%d) ---",
|
||||
dhcp_type_to_name(info->type), info->type);
|
||||
strcpy(addr, ipaddr(info->ipaddr));
|
||||
strcpy(gway, ipaddr(info->gateway));
|
||||
LOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength);
|
||||
if (info->dns1) LOGD("dns1: %s", ipaddr(info->dns1));
|
||||
if (info->dns2) LOGD("dns2: %s", ipaddr(info->dns2));
|
||||
LOGD("server %s, lease %d seconds",
|
||||
ALOGD("ip %s gw %s prefixLength %d", addr, gway, info->prefixLength);
|
||||
if (info->dns1) ALOGD("dns1: %s", ipaddr(info->dns1));
|
||||
if (info->dns2) ALOGD("dns2: %s", ipaddr(info->dns2));
|
||||
ALOGD("server %s, lease %d seconds",
|
||||
ipaddr(info->serveraddr), info->lease);
|
||||
}
|
||||
|
||||
|
|
@ -250,9 +250,9 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
|
|||
const char *name;
|
||||
char buf[2048];
|
||||
|
||||
LOGD("===== DHCP message:");
|
||||
ALOGD("===== DHCP message:");
|
||||
if (len < DHCP_MSG_FIXED_SIZE) {
|
||||
LOGD("Invalid length %d, should be %d", len, DHCP_MSG_FIXED_SIZE);
|
||||
ALOGD("Invalid length %d, should be %d", len, DHCP_MSG_FIXED_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -264,18 +264,18 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
|
|||
name = "BOOTREPLY";
|
||||
else
|
||||
name = "????";
|
||||
LOGD("op = %s (%d), htype = %d, hlen = %d, hops = %d",
|
||||
ALOGD("op = %s (%d), htype = %d, hlen = %d, hops = %d",
|
||||
name, msg->op, msg->htype, msg->hlen, msg->hops);
|
||||
LOGD("xid = 0x%08x secs = %d, flags = 0x%04x optlen = %d",
|
||||
ALOGD("xid = 0x%08x secs = %d, flags = 0x%04x optlen = %d",
|
||||
ntohl(msg->xid), ntohs(msg->secs), ntohs(msg->flags), len);
|
||||
LOGD("ciaddr = %s", ipaddr(msg->ciaddr));
|
||||
LOGD("yiaddr = %s", ipaddr(msg->yiaddr));
|
||||
LOGD("siaddr = %s", ipaddr(msg->siaddr));
|
||||
LOGD("giaddr = %s", ipaddr(msg->giaddr));
|
||||
ALOGD("ciaddr = %s", ipaddr(msg->ciaddr));
|
||||
ALOGD("yiaddr = %s", ipaddr(msg->yiaddr));
|
||||
ALOGD("siaddr = %s", ipaddr(msg->siaddr));
|
||||
ALOGD("giaddr = %s", ipaddr(msg->giaddr));
|
||||
|
||||
c = msg->hlen > 16 ? 16 : msg->hlen;
|
||||
hex2str(buf, msg->chaddr, c);
|
||||
LOGD("chaddr = {%s}", buf);
|
||||
ALOGD("chaddr = {%s}", buf);
|
||||
|
||||
for (n = 0; n < 64; n++) {
|
||||
if ((msg->sname[n] < ' ') || (msg->sname[n] > 127)) {
|
||||
|
|
@ -293,8 +293,8 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
|
|||
}
|
||||
msg->file[127] = 0;
|
||||
|
||||
LOGD("sname = '%s'", msg->sname);
|
||||
LOGD("file = '%s'", msg->file);
|
||||
ALOGD("sname = '%s'", msg->sname);
|
||||
ALOGD("file = '%s'", msg->file);
|
||||
|
||||
if (len < 4) return;
|
||||
len -= 4;
|
||||
|
|
@ -327,7 +327,7 @@ void dump_dhcp_msg(dhcp_msg *msg, int len)
|
|||
name = dhcp_type_to_name(x[2]);
|
||||
else
|
||||
name = NULL;
|
||||
LOGD("op %d len %d {%s} %s", x[0], optsz, buf, name == NULL ? "" : name);
|
||||
ALOGD("op %d len %d {%s} %s", x[0], optsz, buf, name == NULL ? "" : name);
|
||||
len -= optsz;
|
||||
x = x + optsz + 2;
|
||||
}
|
||||
|
|
@ -347,28 +347,28 @@ static int send_message(int sock, int if_index, dhcp_msg *msg, int size)
|
|||
static int is_valid_reply(dhcp_msg *msg, dhcp_msg *reply, int sz)
|
||||
{
|
||||
if (sz < DHCP_MSG_FIXED_SIZE) {
|
||||
if (verbose) LOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE);
|
||||
if (verbose) ALOGD("netcfg: Wrong size %d != %d\n", sz, DHCP_MSG_FIXED_SIZE);
|
||||
return 0;
|
||||
}
|
||||
if (reply->op != OP_BOOTREPLY) {
|
||||
if (verbose) LOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY);
|
||||
if (verbose) ALOGD("netcfg: Wrong Op %d != %d\n", reply->op, OP_BOOTREPLY);
|
||||
return 0;
|
||||
}
|
||||
if (reply->xid != msg->xid) {
|
||||
if (verbose) LOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid),
|
||||
if (verbose) ALOGD("netcfg: Wrong Xid 0x%x != 0x%x\n", ntohl(reply->xid),
|
||||
ntohl(msg->xid));
|
||||
return 0;
|
||||
}
|
||||
if (reply->htype != msg->htype) {
|
||||
if (verbose) LOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype);
|
||||
if (verbose) ALOGD("netcfg: Wrong Htype %d != %d\n", reply->htype, msg->htype);
|
||||
return 0;
|
||||
}
|
||||
if (reply->hlen != msg->hlen) {
|
||||
if (verbose) LOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen);
|
||||
if (verbose) ALOGD("netcfg: Wrong Hlen %d != %d\n", reply->hlen, msg->hlen);
|
||||
return 0;
|
||||
}
|
||||
if (memcmp(msg->chaddr, reply->chaddr, msg->hlen)) {
|
||||
if (verbose) LOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr));
|
||||
if (verbose) ALOGD("netcfg: Wrong chaddr %x != %x\n", *(reply->chaddr),*(msg->chaddr));
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -469,7 +469,7 @@ int dhcp_init_ifc(const char *ifname)
|
|||
r = receive_packet(s, &reply);
|
||||
if (r < 0) {
|
||||
if (errno != 0) {
|
||||
LOGD("receive_packet failed (%d): %s", r, strerror(errno));
|
||||
ALOGD("receive_packet failed (%d): %s", r, strerror(errno));
|
||||
if (errno == ENETDOWN || errno == ENXIO) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@
|
|||
#else
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define LOGD printf
|
||||
#define LOGW printf
|
||||
#define ALOGD printf
|
||||
#define ALOGW printf
|
||||
#endif
|
||||
|
||||
static int ifc_ctl_sock = -1;
|
||||
|
|
@ -382,7 +382,7 @@ int ifc_clear_ipv6_addresses(const char *name) {
|
|||
|
||||
ret = ifc_del_address(ifname, addrstr, prefixlen);
|
||||
if (ret) {
|
||||
LOGE("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname,
|
||||
ALOGE("Deleting address %s/%d on %s: %s", addrstr, prefixlen, ifname,
|
||||
strerror(-ret));
|
||||
lasterror = ret;
|
||||
}
|
||||
|
|
@ -686,7 +686,7 @@ int ifc_remove_host_routes(const char *name)
|
|||
init_sockaddr_in(&rt.rt_genmask, mask);
|
||||
addr.s_addr = dest;
|
||||
if (ioctl(ifc_ctl_sock, SIOCDELRT, &rt) < 0) {
|
||||
LOGD("failed to remove route for %s to %s: %s",
|
||||
ALOGD("failed to remove route for %s to %s: %s",
|
||||
ifname, inet_ntoa(addr), strerror(errno));
|
||||
}
|
||||
}
|
||||
|
|
@ -752,7 +752,7 @@ int ifc_set_default_route(const char *ifname, in_addr_t gateway)
|
|||
ifc_init();
|
||||
addr.s_addr = gateway;
|
||||
if ((result = ifc_create_default_route(ifname, gateway)) < 0) {
|
||||
LOGD("failed to add %s as default route for %s: %s",
|
||||
ALOGD("failed to add %s as default route for %s: %s",
|
||||
inet_ntoa(addr), ifname, strerror(errno));
|
||||
}
|
||||
ifc_close();
|
||||
|
|
@ -773,7 +773,7 @@ int ifc_remove_default_route(const char *ifname)
|
|||
rt.rt_flags = RTF_UP|RTF_GATEWAY;
|
||||
init_sockaddr_in(&rt.rt_dst, 0);
|
||||
if ((result = ioctl(ifc_ctl_sock, SIOCDELRT, &rt)) < 0) {
|
||||
LOGD("failed to remove default route for %s: %s", ifname, strerror(errno));
|
||||
ALOGD("failed to remove default route for %s: %s", ifname, strerror(errno));
|
||||
}
|
||||
ifc_close();
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
#else
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#define LOGD printf
|
||||
#define LOGW printf
|
||||
#define ALOGD printf
|
||||
#define ALOGW printf
|
||||
#endif
|
||||
|
||||
#include "dhcpmsg.h"
|
||||
|
|
@ -179,23 +179,23 @@ int receive_packet(int s, struct dhcp_msg *msg)
|
|||
is_valid = 0;
|
||||
if (nread < (int)(sizeof(struct iphdr) + sizeof(struct udphdr))) {
|
||||
#if VERBOSE
|
||||
LOGD("Packet is too small (%d) to be a UDP datagram", nread);
|
||||
ALOGD("Packet is too small (%d) to be a UDP datagram", nread);
|
||||
#endif
|
||||
} else if (packet.ip.version != IPVERSION || packet.ip.ihl != (sizeof(packet.ip) >> 2)) {
|
||||
#if VERBOSE
|
||||
LOGD("Not a valid IP packet");
|
||||
ALOGD("Not a valid IP packet");
|
||||
#endif
|
||||
} else if (nread < ntohs(packet.ip.tot_len)) {
|
||||
#if VERBOSE
|
||||
LOGD("Packet was truncated (read %d, needed %d)", nread, ntohs(packet.ip.tot_len));
|
||||
ALOGD("Packet was truncated (read %d, needed %d)", nread, ntohs(packet.ip.tot_len));
|
||||
#endif
|
||||
} else if (packet.ip.protocol != IPPROTO_UDP) {
|
||||
#if VERBOSE
|
||||
LOGD("IP protocol (%d) is not UDP", packet.ip.protocol);
|
||||
ALOGD("IP protocol (%d) is not UDP", packet.ip.protocol);
|
||||
#endif
|
||||
} else if (packet.udp.dest != htons(PORT_BOOTP_CLIENT)) {
|
||||
#if VERBOSE
|
||||
LOGD("UDP dest port (%d) is not DHCP client", ntohs(packet.udp.dest));
|
||||
ALOGD("UDP dest port (%d) is not DHCP client", ntohs(packet.udp.dest));
|
||||
#endif
|
||||
} else {
|
||||
is_valid = 1;
|
||||
|
|
@ -209,7 +209,7 @@ int receive_packet(int s, struct dhcp_msg *msg)
|
|||
/* validate IP header checksum */
|
||||
sum = finish_sum(checksum(&packet.ip, sizeof(packet.ip), 0));
|
||||
if (sum != 0) {
|
||||
LOGW("IP header checksum failure (0x%x)", packet.ip.check);
|
||||
ALOGW("IP header checksum failure (0x%x)", packet.ip.check);
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
|
|
@ -231,7 +231,7 @@ int receive_packet(int s, struct dhcp_msg *msg)
|
|||
sum = finish_sum(checksum(&packet, nread, 0));
|
||||
packet.udp.check = temp;
|
||||
if (temp != sum) {
|
||||
LOGW("UDP header checksum failure (0x%x should be 0x%x)", sum, temp);
|
||||
ALOGW("UDP header checksum failure (0x%x should be 0x%x)", sum, temp);
|
||||
return -1;
|
||||
}
|
||||
memcpy(msg, &packet.dhcp, dhcp_size);
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ int ARMAssembler::generate(const char* name)
|
|||
// the instruction cache is flushed by CodeCache
|
||||
const int64_t duration = ggl_system_time() - mDuration;
|
||||
const char * const format = "generated %s (%d ins) at [%p:%p] in %lld ns\n";
|
||||
LOGI(format, name, int(pc()-base()), base(), pc(), duration);
|
||||
ALOGI(format, name, int(pc()-base()), base(), pc(), duration);
|
||||
|
||||
#if defined(WITH_LIB_HARDWARE)
|
||||
if (__builtin_expect(mQemuTracing, 0)) {
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ int CodeCache::cache( const AssemblyKeyBase& keyBase,
|
|||
const long base = long(assembly->base());
|
||||
const long curr = base + long(assembly->size());
|
||||
err = cacheflush(base, curr, 0);
|
||||
LOGE_IF(err, "__ARM_NR_cacheflush error %s\n",
|
||||
ALOGE_IF(err, "__ARM_NR_cacheflush error %s\n",
|
||||
strerror(errno));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ int GGLAssembler::scanline(const needs_t& needs, context_t const* c)
|
|||
needs.p, needs.n, needs.t[0], needs.t[1], per_fragment_ops);
|
||||
|
||||
if (err) {
|
||||
LOGE("Error while generating ""%s""\n", name);
|
||||
ALOGE("Error while generating ""%s""\n", name);
|
||||
disassemble(name);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -1095,7 +1095,7 @@ int RegisterAllocator::RegisterFile::obtain()
|
|||
}
|
||||
// this is not an error anymore because, we'll try again with
|
||||
// a lower optimization level.
|
||||
//LOGE_IF(i >= nbreg, "pixelflinger ran out of registers\n");
|
||||
//ALOGE_IF(i >= nbreg, "pixelflinger ran out of registers\n");
|
||||
if (i >= nbreg) {
|
||||
mStatus |= OUT_OF_REGISTERS;
|
||||
// we return SP so we can more easily debug things
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ void GGLAssembler::mul_factor( component_t& d,
|
|||
}
|
||||
}
|
||||
|
||||
LOGE_IF(ms>=32, "mul_factor overflow vs=%d, fs=%d", vs, fs);
|
||||
ALOGE_IF(ms>=32, "mul_factor overflow vs=%d, fs=%d", vs, fs);
|
||||
|
||||
int vreg = v.reg;
|
||||
int freg = f.reg;
|
||||
|
|
@ -574,7 +574,7 @@ void GGLAssembler::mul_factor_add( component_t& d,
|
|||
int as = a.h;
|
||||
int ms = vs+fs;
|
||||
|
||||
LOGE_IF(ms>=32, "mul_factor_add overflow vs=%d, fs=%d, as=%d", vs, fs, as);
|
||||
ALOGE_IF(ms>=32, "mul_factor_add overflow vs=%d, fs=%d, as=%d", vs, fs, as);
|
||||
|
||||
integer_t add(a.reg, a.h, a.flags);
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ void GGLAssembler::downshift(
|
|||
int dbits = dh - dl;
|
||||
int dithering = 0;
|
||||
|
||||
LOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits);
|
||||
ALOGE_IF(sbits<dbits, "sbits (%d) < dbits (%d) in downshift", sbits, dbits);
|
||||
|
||||
if (sbits>dbits) {
|
||||
// see if we need to dither
|
||||
|
|
|
|||
|
|
@ -778,7 +778,7 @@ void GGLAssembler::filter16(
|
|||
break;
|
||||
default:
|
||||
// unsupported format, do something sensical...
|
||||
LOGE("Unsupported 16-bits texture format (%d)", tmu.format_idx);
|
||||
ALOGE("Unsupported 16-bits texture format (%d)", tmu.format_idx);
|
||||
LDRH(AL, texel.reg, txPtr.reg);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ static void pick_scanline(context_t* c)
|
|||
}
|
||||
|
||||
#if DEBUG_NEEDS
|
||||
LOGI("Needs: n=0x%08x p=0x%08x t0=0x%08x t1=0x%08x",
|
||||
ALOGI("Needs: n=0x%08x p=0x%08x t0=0x%08x t1=0x%08x",
|
||||
c->state.needs.n, c->state.needs.p,
|
||||
c->state.needs.t[0], c->state.needs.t[1]);
|
||||
#endif
|
||||
|
|
@ -381,7 +381,7 @@ static void pick_scanline(context_t* c)
|
|||
err = gCodeCache.cache(a->key(), a);
|
||||
}
|
||||
if (ggl_unlikely(err)) {
|
||||
LOGE("error generating or caching assembly. Reverting to NOP.");
|
||||
ALOGE("error generating or caching assembly. Reverting to NOP.");
|
||||
c->scanline = scanline_noop;
|
||||
c->init_y = init_y_noop;
|
||||
c->step_y = step_y__nop;
|
||||
|
|
@ -395,12 +395,12 @@ static void pick_scanline(context_t* c)
|
|||
c->scanline_as->decStrong(c);
|
||||
}
|
||||
|
||||
//LOGI("using generated pixel-pipeline");
|
||||
//ALOGI("using generated pixel-pipeline");
|
||||
c->scanline_as = assembly.get();
|
||||
c->scanline_as->incStrong(c); // hold on to assembly
|
||||
c->scanline = (void(*)(context_t* c))assembly->base();
|
||||
#else
|
||||
// LOGW("using generic (slow) pixel-pipeline");
|
||||
// ALOGW("using generic (slow) pixel-pipeline");
|
||||
c->scanline = scanline;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1761,7 +1761,7 @@ void init_y_error(context_t* c, int32_t y0)
|
|||
// woooops, shoud never happen,
|
||||
// fail gracefully (don't display anything)
|
||||
init_y_noop(c, y0);
|
||||
LOGE("color-buffer has an invalid format!");
|
||||
ALOGE("color-buffer has an invalid format!");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ VectorImpl::VectorImpl(const VectorImpl& rhs)
|
|||
|
||||
VectorImpl::~VectorImpl()
|
||||
{
|
||||
LOG_ASSERT(!mCount,
|
||||
ALOG_ASSERT(!mCount,
|
||||
"[%p] "
|
||||
"subclasses of VectorImpl must call finish_vector()"
|
||||
" in their destructor. Leaking %d bytes.",
|
||||
|
|
@ -67,7 +67,7 @@ VectorImpl::~VectorImpl()
|
|||
|
||||
VectorImpl& VectorImpl::operator = (const VectorImpl& rhs)
|
||||
{
|
||||
LOG_ASSERT(mItemSize == rhs.mItemSize,
|
||||
ALOG_ASSERT(mItemSize == rhs.mItemSize,
|
||||
"Vector<> have different types (this=%p, rhs=%p)", this, &rhs);
|
||||
if (this != &rhs) {
|
||||
release_storage();
|
||||
|
|
@ -176,7 +176,7 @@ ssize_t VectorImpl::replaceAt(size_t index)
|
|||
|
||||
ssize_t VectorImpl::replaceAt(const void* prototype, size_t index)
|
||||
{
|
||||
LOG_ASSERT(index<size(),
|
||||
ALOG_ASSERT(index<size(),
|
||||
"[%p] replace: index=%d, size=%d", this, (int)index, (int)size());
|
||||
|
||||
void* item = editItemLocation(index);
|
||||
|
|
@ -193,7 +193,7 @@ ssize_t VectorImpl::replaceAt(const void* prototype, size_t index)
|
|||
|
||||
ssize_t VectorImpl::removeItemsAt(size_t index, size_t count)
|
||||
{
|
||||
LOG_ASSERT((index+count)<=size(),
|
||||
ALOG_ASSERT((index+count)<=size(),
|
||||
"[%p] remove: index=%d, count=%d, size=%d",
|
||||
this, (int)index, (int)count, (int)size());
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ void VectorImpl::clear()
|
|||
|
||||
void* VectorImpl::editItemLocation(size_t index)
|
||||
{
|
||||
LOG_ASSERT(index<capacity(),
|
||||
ALOG_ASSERT(index<capacity(),
|
||||
"[%p] itemLocation: index=%d, capacity=%d, count=%d",
|
||||
this, (int)index, (int)capacity(), (int)mCount);
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ void* VectorImpl::editItemLocation(size_t index)
|
|||
|
||||
const void* VectorImpl::itemLocation(size_t index) const
|
||||
{
|
||||
LOG_ASSERT(index<capacity(),
|
||||
ALOG_ASSERT(index<capacity(),
|
||||
"[%p] editItemLocation: index=%d, capacity=%d, count=%d",
|
||||
this, (int)index, (int)capacity(), (int)mCount);
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ void VectorImpl::release_storage()
|
|||
|
||||
void* VectorImpl::_grow(size_t where, size_t amount)
|
||||
{
|
||||
// LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
||||
// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
||||
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
|
||||
|
||||
if (where > mCount)
|
||||
|
|
@ -281,7 +281,7 @@ void* VectorImpl::_grow(size_t where, size_t amount)
|
|||
const size_t new_size = mCount + amount;
|
||||
if (capacity() < new_size) {
|
||||
const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2);
|
||||
// LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
|
||||
// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
|
||||
if ((mStorage) &&
|
||||
(mCount==where) &&
|
||||
(mFlags & HAS_TRIVIAL_COPY) &&
|
||||
|
|
@ -325,7 +325,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
|
|||
if (!mStorage)
|
||||
return;
|
||||
|
||||
// LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
||||
// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
|
||||
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
|
||||
|
||||
if (where >= mCount)
|
||||
|
|
@ -334,7 +334,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
|
|||
const size_t new_size = mCount - amount;
|
||||
if (new_size*3 < capacity()) {
|
||||
const size_t new_capacity = max(kMinVectorCapacity, new_size*2);
|
||||
// LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
|
||||
// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
|
||||
if ((where == mCount-amount) &&
|
||||
(mFlags & HAS_TRIVIAL_COPY) &&
|
||||
(mFlags & HAS_TRIVIAL_DTOR))
|
||||
|
|
|
|||
|
|
@ -94,15 +94,15 @@ static inline void swap(T& a, T& b) {
|
|||
static void
|
||||
triangle_dump_points( const GGLcoord* v0,
|
||||
const GGLcoord* v1,
|
||||
const GGLcoord* v2 )
|
||||
const GGLcoord* v2 )
|
||||
{
|
||||
float tri = 1.0f / TRI_ONE;
|
||||
LOGD( " P0=(%.3f, %.3f) [%08x, %08x]\n"
|
||||
" P1=(%.3f, %.3f) [%08x, %08x]\n"
|
||||
" P2=(%.3f, %.3f) [%08x, %08x]\n",
|
||||
v0[0]*tri, v0[1]*tri, v0[0], v0[1],
|
||||
v1[0]*tri, v1[1]*tri, v1[0], v1[1],
|
||||
v2[0]*tri, v2[1]*tri, v2[0], v2[1] );
|
||||
ALOGD(" P0=(%.3f, %.3f) [%08x, %08x]\n"
|
||||
" P1=(%.3f, %.3f) [%08x, %08x]\n"
|
||||
" P2=(%.3f, %.3f) [%08x, %08x]\n",
|
||||
v0[0]*tri, v0[1]*tri, v0[0], v0[1],
|
||||
v1[0]*tri, v1[1]*tri, v1[0], v1[1],
|
||||
v2[0]*tri, v2[1]*tri, v2[0], v2[1] );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -639,7 +639,7 @@ struct Edge
|
|||
static void
|
||||
edge_dump( Edge* edge )
|
||||
{
|
||||
LOGI( " top=%d (%.3f) bot=%d (%.3f) x=%d (%.3f) ix=%d (%.3f)",
|
||||
ALOGI( " top=%d (%.3f) bot=%d (%.3f) x=%d (%.3f) ix=%d (%.3f)",
|
||||
edge->y_top, edge->y_top/float(TRI_ONE),
|
||||
edge->y_bot, edge->y_bot/float(TRI_ONE),
|
||||
edge->x, edge->x/float(FIXED_ONE),
|
||||
|
|
@ -650,7 +650,7 @@ static void
|
|||
triangle_dump_edges( Edge* edges,
|
||||
int count )
|
||||
{
|
||||
LOGI( "%d edge%s:\n", count, count == 1 ? "" : "s" );
|
||||
ALOGI( "%d edge%s:\n", count, count == 1 ? "" : "s" );
|
||||
for ( ; count > 0; count--, edges++ )
|
||||
edge_dump( edges );
|
||||
}
|
||||
|
|
@ -835,7 +835,7 @@ void AAEdge::dump()
|
|||
float tri = 1.0f / TRI_ONE;
|
||||
float iter = 1.0f / (1<<TRI_ITERATORS_BITS);
|
||||
float fix = 1.0f / FIXED_ONE;
|
||||
LOGD( "x=%08x (%.3f), "
|
||||
ALOGD( "x=%08x (%.3f), "
|
||||
"x_incr=%08x (%.3f), y_incr=%08x (%.3f), "
|
||||
"y_top=%08x (%.3f), y_bot=%08x (%.3f) ",
|
||||
x, x*fix,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#ifdef USE_LIBLOG
|
||||
#define LOG_TAG "usbhost"
|
||||
#include "utils/Log.h"
|
||||
#define D LOGD
|
||||
#define D ALOGD
|
||||
#else
|
||||
#define D printf
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
void fatal(const char *msg) {
|
||||
fprintf(stderr, "%s", msg);
|
||||
LOG(LOG_ERROR, "logwrapper", "%s", msg);
|
||||
ALOG(LOG_ERROR, "logwrapper", "%s", msg);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) {
|
|||
buffer[b] = '\0';
|
||||
} else if (buffer[b] == '\n') {
|
||||
buffer[b] = '\0';
|
||||
LOG(LOG_INFO, tag, "%s", &buffer[a]);
|
||||
ALOG(LOG_INFO, tag, "%s", &buffer[a]);
|
||||
a = b + 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) {
|
|||
if (a == 0 && b == sizeof(buffer) - 1) {
|
||||
// buffer is full, flush
|
||||
buffer[b] = '\0';
|
||||
LOG(LOG_INFO, tag, "%s", &buffer[a]);
|
||||
ALOG(LOG_INFO, tag, "%s", &buffer[a]);
|
||||
b = 0;
|
||||
} else if (a != b) {
|
||||
// Keep left-overs
|
||||
|
|
@ -84,21 +84,21 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) {
|
|||
// Flush remaining data
|
||||
if (a != b) {
|
||||
buffer[b] = '\0';
|
||||
LOG(LOG_INFO, tag, "%s", &buffer[a]);
|
||||
ALOG(LOG_INFO, tag, "%s", &buffer[a]);
|
||||
}
|
||||
status = 0xAAAA;
|
||||
if (wait(&status) != -1) { // Wait for child
|
||||
if (WIFEXITED(status))
|
||||
LOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", tag,
|
||||
ALOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", tag,
|
||||
WEXITSTATUS(status));
|
||||
else if (WIFSIGNALED(status))
|
||||
LOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", tag,
|
||||
ALOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", tag,
|
||||
WTERMSIG(status));
|
||||
else if (WIFSTOPPED(status))
|
||||
LOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", tag,
|
||||
ALOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", tag,
|
||||
WSTOPSIG(status));
|
||||
} else
|
||||
LOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag,
|
||||
ALOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag,
|
||||
strerror(errno), errno);
|
||||
if (seg_fault_on_exit)
|
||||
*(int *)status = 0; // causes SIGSEGV with fault_address = status
|
||||
|
|
@ -111,7 +111,7 @@ void child(int argc, char* argv[]) {
|
|||
argv_child[argc] = NULL;
|
||||
|
||||
if (execvp(argv_child[0], argv_child)) {
|
||||
LOG(LOG_ERROR, "logwrapper",
|
||||
ALOG(LOG_ERROR, "logwrapper",
|
||||
"executing %s failed: %s\n", argv_child[0], strerror(errno));
|
||||
exit(-1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,12 +213,12 @@ int CommandListener::ListCmd::runCommand(SocketClient *cli, int argc, char **arg
|
|||
if (!NetworkManager::Instance()->getPropMngr()->get((*it),
|
||||
p_v,
|
||||
sizeof(p_v))) {
|
||||
LOGW("Failed to get %s (%s)", (*it), strerror(errno));
|
||||
ALOGW("Failed to get %s (%s)", (*it), strerror(errno));
|
||||
}
|
||||
|
||||
char *buf;
|
||||
if (asprintf(&buf, "%s %s", (*it), p_v) < 0) {
|
||||
LOGE("Failed to allocate memory");
|
||||
ALOGE("Failed to allocate memory");
|
||||
free((*it));
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ int Controller::unloadKernelModule(const char *modtag) {
|
|||
}
|
||||
|
||||
if (rc != 0) {
|
||||
LOGW("Unable to unload kernel driver '%s' (%s)", modtag,
|
||||
ALOGW("Unable to unload kernel driver '%s' (%s)", modtag,
|
||||
strerror(errno));
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -96,7 +96,7 @@ bool Controller::isKernelModuleLoaded(const char *modtag) {
|
|||
FILE *fp = fopen("/proc/modules", "r");
|
||||
|
||||
if (!fp) {
|
||||
LOGE("Unable to open /proc/modules (%s)", strerror(errno));
|
||||
ALOGE("Unable to open /proc/modules (%s)", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ bool Controller::isKernelModuleLoaded(const char *modtag) {
|
|||
char *endTag = strchr(line, ' ');
|
||||
|
||||
if (!endTag) {
|
||||
LOGW("Unable to find tag for line '%s'", line);
|
||||
ALOGW("Unable to find tag for line '%s'", line);
|
||||
continue;
|
||||
}
|
||||
if (!strncmp(line, modtag, (endTag - line))) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ DhcpClient::~DhcpClient() {
|
|||
}
|
||||
|
||||
int DhcpClient::start(Controller *c) {
|
||||
LOGD("Starting DHCP service (arp probe = %d)", mDoArpProbe);
|
||||
ALOGD("Starting DHCP service (arp probe = %d)", mDoArpProbe);
|
||||
char svc[PROPERTY_VALUE_MAX];
|
||||
snprintf(svc,
|
||||
sizeof(svc),
|
||||
|
|
@ -72,7 +72,7 @@ int DhcpClient::start(Controller *c) {
|
|||
|
||||
sockaddr_in addr;
|
||||
if ((mListenerSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
||||
LOGE("Failed to create DHCP listener socket");
|
||||
ALOGE("Failed to create DHCP listener socket");
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ int DhcpClient::start(Controller *c) {
|
|||
addr.sin_port = htons(DhcpClient::STATUS_MONITOR_PORT);
|
||||
|
||||
if (bind(mListenerSocket, (struct sockaddr *) &addr, sizeof(addr))) {
|
||||
LOGE("Failed to bind DHCP listener socket");
|
||||
ALOGE("Failed to bind DHCP listener socket");
|
||||
close(mListenerSocket);
|
||||
mListenerSocket = -1;
|
||||
pthread_mutex_unlock(&mLock);
|
||||
|
|
@ -90,14 +90,14 @@ int DhcpClient::start(Controller *c) {
|
|||
}
|
||||
|
||||
if (mServiceManager->start(svc)) {
|
||||
LOGE("Failed to start dhcp service");
|
||||
ALOGE("Failed to start dhcp service");
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
mListener = new DhcpListener(mController, mListenerSocket, mHandlers);
|
||||
if (mListener->startListener()) {
|
||||
LOGE("Failed to start listener");
|
||||
ALOGE("Failed to start listener");
|
||||
#if 0
|
||||
mServiceManager->stop("dhcpcd");
|
||||
return -1;
|
||||
|
|
@ -126,7 +126,7 @@ int DhcpClient::stop() {
|
|||
close(mListenerSocket);
|
||||
|
||||
if (mServiceManager->stop("dhcpcd")) {
|
||||
LOGW("Failed to stop DHCP service (%s)", strerror(errno));
|
||||
ALOGW("Failed to stop DHCP service (%s)", strerror(errno));
|
||||
// XXX: Kill it the hard way.. but its gotta go!
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ int DhcpEvent::parseString(const char *buffer) {
|
|||
else if (!strcasecmp(buffer, "TIMEOUT"))
|
||||
return DhcpEvent::TIMEOUT;
|
||||
else {
|
||||
LOGW("Bad event '%s'", buffer);
|
||||
ALOGW("Bad event '%s'", buffer);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) {
|
|||
int rc;
|
||||
|
||||
if ((rc = read(cli->getSocket(), buffer, sizeof(buffer))) < 0) {
|
||||
LOGW("Error reading dhcp status msg (%s)", strerror(errno));
|
||||
ALOGW("Error reading dhcp status msg (%s)", strerror(errno));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) {
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (!(tmp = strsep(&next, ":"))) {
|
||||
LOGW("Error parsing state '%s'", buffer);
|
||||
ALOGW("Error parsing state '%s'", buffer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -65,22 +65,22 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) {
|
|||
struct in_addr ipaddr, netmask, gateway, broadcast, dns1, dns2;
|
||||
|
||||
if (!inet_aton(strsep(&next, ":"), &ipaddr)) {
|
||||
LOGW("Malformatted IP specified");
|
||||
ALOGW("Malformatted IP specified");
|
||||
}
|
||||
if (!inet_aton(strsep(&next, ":"), &netmask)) {
|
||||
LOGW("Malformatted netmask specified");
|
||||
ALOGW("Malformatted netmask specified");
|
||||
}
|
||||
if (!inet_aton(strsep(&next, ":"), &broadcast)) {
|
||||
LOGW("Malformatted broadcast specified");
|
||||
ALOGW("Malformatted broadcast specified");
|
||||
}
|
||||
if (!inet_aton(strsep(&next, ":"), &gateway)) {
|
||||
LOGW("Malformatted gateway specified");
|
||||
ALOGW("Malformatted gateway specified");
|
||||
}
|
||||
if (!inet_aton(strsep(&next, ":"), &dns1)) {
|
||||
LOGW("Malformatted dns1 specified");
|
||||
ALOGW("Malformatted dns1 specified");
|
||||
}
|
||||
if (!inet_aton(strsep(&next, ":"), &dns2)) {
|
||||
LOGW("Malformatted dns2 specified");
|
||||
ALOGW("Malformatted dns2 specified");
|
||||
}
|
||||
mHandlers->onDhcpLeaseUpdated(mController, &ipaddr, &netmask,
|
||||
&broadcast, &gateway, &dns1, &dns2);
|
||||
|
|
@ -92,7 +92,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) {
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (!(tmp = strsep(&next, ":"))) {
|
||||
LOGW("Error parsing event '%s'", buffer);
|
||||
ALOGW("Error parsing event '%s'", buffer);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ bool DhcpListener::onDataAvailable(SocketClient *cli) {
|
|||
mHandlers->onDhcpEvent(mController, ev);
|
||||
|
||||
} else {
|
||||
LOGW("Unknown DHCP monitor msg '%s'", buffer);
|
||||
ALOGW("Unknown DHCP monitor msg '%s'", buffer);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ int DhcpState::parseString(const char *buffer) {
|
|||
else if (!strcasecmp(buffer, "ANNOUNCING"))
|
||||
return DhcpState::ANNOUNCING;
|
||||
else {
|
||||
LOGW("Bad state '%s'", buffer);
|
||||
ALOGW("Bad state '%s'", buffer);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ NetworkManager::~NetworkManager() {
|
|||
|
||||
int NetworkManager::run() {
|
||||
if (startControllers()) {
|
||||
LOGW("Unable to start all controllers (%s)", strerror(errno));
|
||||
ALOGW("Unable to start all controllers (%s)", strerror(errno));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -107,29 +107,29 @@ Controller *NetworkManager::findController(const char *name) {
|
|||
}
|
||||
|
||||
void NetworkManager::onInterfaceConnected(Controller *c) {
|
||||
LOGD("Controller %s interface %s connected", c->getName(), c->getBoundInterface());
|
||||
ALOGD("Controller %s interface %s connected", c->getName(), c->getBoundInterface());
|
||||
|
||||
if (mDhcp->start(c)) {
|
||||
LOGE("Failed to start DHCP (%s)", strerror(errno));
|
||||
ALOGE("Failed to start DHCP (%s)", strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkManager::onInterfaceDisconnected(Controller *c) {
|
||||
LOGD("Controller %s interface %s disconnected", c->getName(),
|
||||
ALOGD("Controller %s interface %s disconnected", c->getName(),
|
||||
c->getBoundInterface());
|
||||
|
||||
mDhcp->stop();
|
||||
}
|
||||
|
||||
void NetworkManager::onControllerSuspending(Controller *c) {
|
||||
LOGD("Controller %s interface %s suspending", c->getName(),
|
||||
ALOGD("Controller %s interface %s suspending", c->getName(),
|
||||
c->getBoundInterface());
|
||||
mDhcp->stop();
|
||||
}
|
||||
|
||||
void NetworkManager::onControllerResumed(Controller *c) {
|
||||
LOGD("Controller %s interface %s resumed", c->getName(),
|
||||
ALOGD("Controller %s interface %s resumed", c->getName(),
|
||||
c->getBoundInterface());
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ void NetworkManager::onDhcpStateChanged(Controller *c, int state) {
|
|||
char tmp[255];
|
||||
char tmp2[255];
|
||||
|
||||
LOGD("onDhcpStateChanged(%s -> %s)",
|
||||
ALOGD("onDhcpStateChanged(%s -> %s)",
|
||||
DhcpState::toString(mLastDhcpState, tmp, sizeof(tmp)),
|
||||
DhcpState::toString(state, tmp2, sizeof(tmp2)));
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ void NetworkManager::onDhcpStateChanged(Controller *c, int state) {
|
|||
|
||||
void NetworkManager::onDhcpEvent(Controller *c, int evt) {
|
||||
char tmp[64];
|
||||
LOGD("onDhcpEvent(%s)", DhcpEvent::toString(evt, tmp, sizeof(tmp)));
|
||||
ALOGD("onDhcpEvent(%s)", DhcpEvent::toString(evt, tmp, sizeof(tmp)));
|
||||
}
|
||||
|
||||
void NetworkManager::onDhcpLeaseUpdated(Controller *c, struct in_addr *addr,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int OpenVpnController::enable() {
|
|||
char tmp[64];
|
||||
|
||||
if (!mPropMngr->get("vpn.gateway", tmp, sizeof(tmp))) {
|
||||
LOGE("Error reading property 'vpn.gateway' (%s)", strerror(errno));
|
||||
ALOGE("Error reading property 'vpn.gateway' (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
snprintf(svc, sizeof(svc), "openvpn:--remote %s 1194", tmp);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Property::Property(const char *name, bool readOnly,
|
|||
mName(name), mReadOnly(readOnly), mType(type),
|
||||
mNumElements(numElements) {
|
||||
if (index(name, '.')) {
|
||||
LOGW("Property name %s violates namespace rules", name);
|
||||
ALOGW("Property name %s violates namespace rules", name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,22 +38,22 @@ StringProperty::StringProperty(const char *name, bool ro, int elements) :
|
|||
Property(name, ro, Property::Type_STRING, elements) {
|
||||
}
|
||||
int StringProperty::set(int idx, int value) {
|
||||
LOGE("Integer 'set' called on string property!");
|
||||
ALOGE("Integer 'set' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int StringProperty::set(int idx, struct in_addr *value) {
|
||||
LOGE("IpAddr 'set' called on string property!");
|
||||
ALOGE("IpAddr 'set' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int StringProperty::get(int idx, int *buffer) {
|
||||
LOGE("Integer 'get' called on string property!");
|
||||
ALOGE("Integer 'get' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int StringProperty::get(int idx, struct in_addr *buffer) {
|
||||
LOGE("IpAddr 'get' called on string property!");
|
||||
ALOGE("IpAddr 'get' called on string property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ StringPropertyHelper::StringPropertyHelper(const char *name, bool ro,
|
|||
|
||||
int StringPropertyHelper::set(int idx, const char *value) {
|
||||
if (idx != 0) {
|
||||
LOGW("Attempt to use array index on StringPropertyHelper::set");
|
||||
ALOGW("Attempt to use array index on StringPropertyHelper::set");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ int StringPropertyHelper::set(int idx, const char *value) {
|
|||
|
||||
int StringPropertyHelper::get(int idx, char *buffer, size_t max) {
|
||||
if (idx != 0) {
|
||||
LOGW("Attempt to use array index on StringPropertyHelper::get");
|
||||
ALOGW("Attempt to use array index on StringPropertyHelper::get");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -90,22 +90,22 @@ IntegerProperty::IntegerProperty(const char *name, bool ro, int elements) :
|
|||
}
|
||||
|
||||
int IntegerProperty::set(int idx, const char *value) {
|
||||
LOGE("String 'set' called on integer property!");
|
||||
ALOGE("String 'set' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IntegerProperty::set(int idx, struct in_addr *value) {
|
||||
LOGE("IpAddr 'set' called on integer property!");
|
||||
ALOGE("IpAddr 'set' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IntegerProperty::get(int idx, char *buffer, size_t max) {
|
||||
LOGE("String 'get' called on integer property!");
|
||||
ALOGE("String 'get' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IntegerProperty::get(int idx, struct in_addr *buffer) {
|
||||
LOGE("IpAddr 'get' called on integer property!");
|
||||
ALOGE("IpAddr 'get' called on integer property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ IntegerPropertyHelper::IntegerPropertyHelper(const char *name, bool ro,
|
|||
|
||||
int IntegerPropertyHelper::set(int idx, int value) {
|
||||
if (idx != 0) {
|
||||
LOGW("Attempt to use array index on IntegerPropertyHelper::set");
|
||||
ALOGW("Attempt to use array index on IntegerPropertyHelper::set");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ int IntegerPropertyHelper::set(int idx, int value) {
|
|||
|
||||
int IntegerPropertyHelper::get(int idx, int *buffer) {
|
||||
if (idx != 0) {
|
||||
LOGW("Attempt to use array index on IntegerPropertyHelper::get");
|
||||
ALOGW("Attempt to use array index on IntegerPropertyHelper::get");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -141,22 +141,22 @@ IPV4AddressProperty::IPV4AddressProperty(const char *name, bool ro, int elements
|
|||
}
|
||||
|
||||
int IPV4AddressProperty::set(int idx, const char *value) {
|
||||
LOGE("String 'set' called on ipv4 property!");
|
||||
ALOGE("String 'set' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IPV4AddressProperty::set(int idx, int value) {
|
||||
LOGE("Integer 'set' called on ipv4 property!");
|
||||
ALOGE("Integer 'set' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IPV4AddressProperty::get(int idx, char *buffer, size_t max) {
|
||||
LOGE("String 'get' called on ipv4 property!");
|
||||
ALOGE("String 'get' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
int IPV4AddressProperty::get(int idx, int *buffer) {
|
||||
LOGE("Integer 'get' called on ipv4 property!");
|
||||
ALOGE("Integer 'get' called on ipv4 property!");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ IPV4AddressPropertyHelper::IPV4AddressPropertyHelper(const char *name, bool ro,
|
|||
|
||||
int IPV4AddressPropertyHelper::set(int idx, struct in_addr *value) {
|
||||
if (idx != 0) {
|
||||
LOGW("Attempt to use array index on IPV4AddressPropertyHelper::set");
|
||||
ALOGW("Attempt to use array index on IPV4AddressPropertyHelper::set");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ int IPV4AddressPropertyHelper::set(int idx, struct in_addr *value) {
|
|||
|
||||
int IPV4AddressPropertyHelper::get(int idx, struct in_addr *buffer) {
|
||||
if (idx != 0) {
|
||||
LOGW("Attempt to use array index on IPV4AddressPropertyHelper::get");
|
||||
ALOGW("Attempt to use array index on IPV4AddressPropertyHelper::get");
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ Property *PropertyManager::lookupProperty_UNLOCKED(PropertyNamespace *ns, const
|
|||
int PropertyManager::attachProperty(const char *ns_name, Property *p) {
|
||||
PropertyNamespace *ns;
|
||||
|
||||
LOGD("Attaching property %s to namespace %s", p->getName(), ns_name);
|
||||
ALOGD("Attaching property %s to namespace %s", p->getName(), ns_name);
|
||||
pthread_mutex_lock(&mLock);
|
||||
if (!(ns = lookupNamespace_UNLOCKED(ns_name))) {
|
||||
LOGD("Creating namespace %s", ns_name);
|
||||
ALOGD("Creating namespace %s", ns_name);
|
||||
ns = new PropertyNamespace(ns_name);
|
||||
mNamespaces->push_back(ns);
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ int PropertyManager::attachProperty(const char *ns_name, Property *p) {
|
|||
if (lookupProperty_UNLOCKED(ns, p->getName())) {
|
||||
errno = EADDRINUSE;
|
||||
pthread_mutex_unlock(&mLock);
|
||||
LOGE("Failed to register property %s.%s (%s)",
|
||||
ALOGE("Failed to register property %s.%s (%s)",
|
||||
ns_name, p->getName(), strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -90,11 +90,11 @@ int PropertyManager::attachProperty(const char *ns_name, Property *p) {
|
|||
int PropertyManager::detachProperty(const char *ns_name, Property *p) {
|
||||
PropertyNamespace *ns;
|
||||
|
||||
LOGD("Detaching property %s from namespace %s", p->getName(), ns_name);
|
||||
ALOGD("Detaching property %s from namespace %s", p->getName(), ns_name);
|
||||
pthread_mutex_lock(&mLock);
|
||||
if (!(ns = lookupNamespace_UNLOCKED(ns_name))) {
|
||||
pthread_mutex_unlock(&mLock);
|
||||
LOGE("Namespace '%s' not found", ns_name);
|
||||
ALOGE("Namespace '%s' not found", ns_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ int PropertyManager::detachProperty(const char *ns_name, Property *p) {
|
|||
}
|
||||
}
|
||||
|
||||
LOGE("Property %s.%s not found", ns_name, p->getName());
|
||||
ALOGE("Property %s.%s not found", ns_name, p->getName());
|
||||
pthread_mutex_unlock(&mLock);
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
|
|
@ -130,7 +130,7 @@ int PropertyManager::doSet(Property *p, int idx, const char *value) {
|
|||
errno = 0;
|
||||
tmp = strtol(value, (char **) NULL, 10);
|
||||
if (errno) {
|
||||
LOGE("Failed to convert '%s' to int", value);
|
||||
ALOGE("Failed to convert '%s' to int", value);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -138,13 +138,13 @@ int PropertyManager::doSet(Property *p, int idx, const char *value) {
|
|||
} else if (p->getType() == Property::Type_IPV4) {
|
||||
struct in_addr tmp;
|
||||
if (!inet_aton(value, &tmp)) {
|
||||
LOGE("Failed to convert '%s' to ipv4", value);
|
||||
ALOGE("Failed to convert '%s' to ipv4", value);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
return p->set(idx, &tmp);
|
||||
} else {
|
||||
LOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
ALOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
p->getType());
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
|
|
@ -157,7 +157,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) {
|
|||
|
||||
if (p->getType() == Property::Type_STRING) {
|
||||
if (p->get(idx, buffer, max)) {
|
||||
LOGW("String property %s get failed (%s)", p->getName(),
|
||||
ALOGW("String property %s get failed (%s)", p->getName(),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -165,7 +165,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) {
|
|||
else if (p->getType() == Property::Type_INTEGER) {
|
||||
int tmp;
|
||||
if (p->get(idx, &tmp)) {
|
||||
LOGW("Integer property %s get failed (%s)", p->getName(),
|
||||
ALOGW("Integer property %s get failed (%s)", p->getName(),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -173,13 +173,13 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) {
|
|||
} else if (p->getType() == Property::Type_IPV4) {
|
||||
struct in_addr tmp;
|
||||
if (p->get(idx, &tmp)) {
|
||||
LOGW("IPV4 property %s get failed (%s)", p->getName(),
|
||||
ALOGW("IPV4 property %s get failed (%s)", p->getName(),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
strncpy(buffer, inet_ntoa(tmp), max);
|
||||
} else {
|
||||
LOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
ALOGE("Property '%s' has an unknown type (%d)", p->getName(),
|
||||
p->getType());
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
|
|
@ -193,7 +193,7 @@ int PropertyManager::doGet(Property *p, int idx, char *buffer, size_t max) {
|
|||
|
||||
int PropertyManager::set(const char *name, const char *value) {
|
||||
|
||||
LOGD("set %s = '%s'", name, value);
|
||||
ALOGD("set %s = '%s'", name, value);
|
||||
pthread_mutex_lock(&mLock);
|
||||
PropertyNamespaceCollection::iterator ns_it;
|
||||
for (ns_it = mNamespaces->begin(); ns_it != mNamespaces->end(); ++ns_it) {
|
||||
|
|
@ -215,7 +215,7 @@ int PropertyManager::set(const char *name, const char *value) {
|
|||
}
|
||||
}
|
||||
|
||||
LOGE("Property %s not found", name);
|
||||
ALOGE("Property %s not found", name);
|
||||
pthread_mutex_unlock(&mLock);
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
|
|
@ -246,7 +246,7 @@ const char *PropertyManager::get(const char *name, char *buffer, size_t max) {
|
|||
}
|
||||
}
|
||||
|
||||
LOGE("Property %s not found", name);
|
||||
ALOGE("Property %s not found", name);
|
||||
pthread_mutex_unlock(&mLock);
|
||||
errno = ENOENT;
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ ScanResult::ScanResult(char *rawResult) {
|
|||
|
||||
return;
|
||||
out_bad:
|
||||
LOGW("Malformatted scan result (%s)", rawResult);
|
||||
ALOGW("Malformatted scan result (%s)", rawResult);
|
||||
}
|
||||
|
||||
ScanResult::~ScanResult() {
|
||||
|
|
|
|||
|
|
@ -64,22 +64,22 @@ Supplicant::~Supplicant() {
|
|||
int Supplicant::start() {
|
||||
|
||||
if (setupConfig()) {
|
||||
LOGW("Unable to setup supplicant.conf");
|
||||
ALOGW("Unable to setup supplicant.conf");
|
||||
}
|
||||
|
||||
if (mServiceManager->start(SUPPLICANT_SERVICE_NAME)) {
|
||||
LOGE("Error starting supplicant (%s)", strerror(errno));
|
||||
ALOGE("Error starting supplicant (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
wpa_ctrl_cleanup();
|
||||
if (connectToSupplicant()) {
|
||||
LOGE("Error connecting to supplicant (%s)\n", strerror(errno));
|
||||
ALOGE("Error connecting to supplicant (%s)\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (retrieveInterfaceName()) {
|
||||
LOGE("Error retrieving interface name (%s)\n", strerror(errno));
|
||||
ALOGE("Error retrieving interface name (%s)\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -89,12 +89,12 @@ int Supplicant::start() {
|
|||
int Supplicant::stop() {
|
||||
|
||||
if (mListener->stopListener()) {
|
||||
LOGW("Unable to stop supplicant listener (%s)", strerror(errno));
|
||||
ALOGW("Unable to stop supplicant listener (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mServiceManager->stop(SUPPLICANT_SERVICE_NAME)) {
|
||||
LOGW("Error stopping supplicant (%s)", strerror(errno));
|
||||
ALOGW("Error stopping supplicant (%s)", strerror(errno));
|
||||
}
|
||||
|
||||
if (mCtrl) {
|
||||
|
|
@ -120,7 +120,7 @@ int Supplicant::sendCommand(const char *cmd, char *reply, size_t *reply_len) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// LOGD("sendCommand(): -> '%s'", cmd);
|
||||
// ALOGD("sendCommand(): -> '%s'", cmd);
|
||||
|
||||
int rc;
|
||||
memset(reply, 0, *reply_len);
|
||||
|
|
@ -133,7 +133,7 @@ int Supplicant::sendCommand(const char *cmd, char *reply, size_t *reply_len) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
// LOGD("sendCommand(): <- '%s'", reply);
|
||||
// ALOGD("sendCommand(): <- '%s'", reply);
|
||||
return 0;
|
||||
}
|
||||
SupplicantStatus *Supplicant::getStatus() {
|
||||
|
|
@ -178,7 +178,7 @@ int Supplicant::refreshNetworkList() {
|
|||
char *linep_next = NULL;
|
||||
|
||||
if (!strtok_r(reply, "\n", &linep_next)) {
|
||||
LOGW("Malformatted network list\n");
|
||||
ALOGW("Malformatted network list\n");
|
||||
free(reply);
|
||||
errno = EIO;
|
||||
return -1;
|
||||
|
|
@ -199,7 +199,7 @@ int Supplicant::refreshNetworkList() {
|
|||
if ((merge_wn = this->lookupNetwork_UNLOCKED(new_wn->getNetworkId()))) {
|
||||
num_refreshed++;
|
||||
if (merge_wn->refresh()) {
|
||||
LOGW("Error refreshing network %d (%s)",
|
||||
ALOGW("Error refreshing network %d (%s)",
|
||||
merge_wn->getNetworkId(), strerror(errno));
|
||||
}
|
||||
delete new_wn;
|
||||
|
|
@ -210,7 +210,7 @@ int Supplicant::refreshNetworkList() {
|
|||
new_wn->attachProperties(pm, new_ns);
|
||||
mNetworks->push_back(new_wn);
|
||||
if (new_wn->refresh()) {
|
||||
LOGW("Unable to refresh network id %d (%s)",
|
||||
ALOGW("Unable to refresh network id %d (%s)",
|
||||
new_wn->getNetworkId(), strerror(errno));
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ int Supplicant::refreshNetworkList() {
|
|||
}
|
||||
|
||||
|
||||
LOGD("Networks added %d, refreshed %d, removed %d\n",
|
||||
ALOGD("Networks added %d, refreshed %d, removed %d\n",
|
||||
num_added, num_refreshed, num_removed);
|
||||
pthread_mutex_unlock(&mNetworksLock);
|
||||
|
||||
|
|
@ -243,11 +243,11 @@ int Supplicant::refreshNetworkList() {
|
|||
|
||||
int Supplicant::connectToSupplicant() {
|
||||
if (!isStarted())
|
||||
LOGW("Supplicant service not running");
|
||||
ALOGW("Supplicant service not running");
|
||||
|
||||
mCtrl = wpa_ctrl_open("tiwlan0"); // XXX:
|
||||
if (mCtrl == NULL) {
|
||||
LOGE("Unable to open connection to supplicant on \"%s\": %s",
|
||||
ALOGE("Unable to open connection to supplicant on \"%s\": %s",
|
||||
"tiwlan0", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -267,7 +267,7 @@ int Supplicant::connectToSupplicant() {
|
|||
mListener = new SupplicantListener(mHandlers, mMonitor);
|
||||
|
||||
if (mListener->startListener()) {
|
||||
LOGE("Error - unable to start supplicant listener");
|
||||
ALOGE("Error - unable to start supplicant listener");
|
||||
stop();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ int Supplicant::setScanMode(bool active) {
|
|||
|
||||
if (sendCommand((active ? "DRIVER SCAN-ACTIVE" : "DRIVER SCAN-PASSIVE"),
|
||||
reply, &len)) {
|
||||
LOGW("triggerScan(%d): Error setting scan mode (%s)", active,
|
||||
ALOGW("triggerScan(%d): Error setting scan mode (%s)", active,
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -292,7 +292,7 @@ int Supplicant::triggerScan() {
|
|||
size_t len = sizeof(reply);
|
||||
|
||||
if (sendCommand("SCAN", reply, &len)) {
|
||||
LOGW("triggerScan(): Error initiating scan");
|
||||
ALOGW("triggerScan(): Error initiating scan");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -303,7 +303,7 @@ int Supplicant::getRssi(int *buffer) {
|
|||
size_t len = sizeof(reply);
|
||||
|
||||
if (sendCommand("DRIVER RSSI", reply, &len)) {
|
||||
LOGW("Failed to get RSSI (%s)", strerror(errno));
|
||||
ALOGW("Failed to get RSSI (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +311,7 @@ int Supplicant::getRssi(int *buffer) {
|
|||
char *s;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!(s = strsep(&next, " "))) {
|
||||
LOGE("Error parsing RSSI");
|
||||
ALOGE("Error parsing RSSI");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -325,7 +325,7 @@ int Supplicant::getLinkSpeed() {
|
|||
size_t len = sizeof(reply);
|
||||
|
||||
if (sendCommand("DRIVER LINKSPEED", reply, &len)) {
|
||||
LOGW("Failed to get LINKSPEED (%s)", strerror(errno));
|
||||
ALOGW("Failed to get LINKSPEED (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -333,13 +333,13 @@ int Supplicant::getLinkSpeed() {
|
|||
char *s;
|
||||
|
||||
if (!(s = strsep(&next, " "))) {
|
||||
LOGE("Error parsing LINKSPEED");
|
||||
ALOGE("Error parsing LINKSPEED");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(s = strsep(&next, " "))) {
|
||||
LOGE("Error parsing LINKSPEED");
|
||||
ALOGE("Error parsing LINKSPEED");
|
||||
errno = EIO;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -350,10 +350,10 @@ int Supplicant::stopDriver() {
|
|||
char reply[64];
|
||||
size_t len = sizeof(reply);
|
||||
|
||||
LOGD("stopDriver()");
|
||||
ALOGD("stopDriver()");
|
||||
|
||||
if (sendCommand("DRIVER STOP", reply, &len)) {
|
||||
LOGW("Failed to stop driver (%s)", strerror(errno));
|
||||
ALOGW("Failed to stop driver (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -363,9 +363,9 @@ int Supplicant::startDriver() {
|
|||
char reply[64];
|
||||
size_t len = sizeof(reply);
|
||||
|
||||
LOGD("startDriver()");
|
||||
ALOGD("startDriver()");
|
||||
if (sendCommand("DRIVER START", reply, &len)) {
|
||||
LOGW("Failed to start driver (%s)", strerror(errno));
|
||||
ALOGW("Failed to start driver (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -452,26 +452,26 @@ int Supplicant::setupConfig() {
|
|||
if (access(SUPP_CONFIG_FILE, R_OK|W_OK) == 0) {
|
||||
return 0;
|
||||
} else if (errno != ENOENT) {
|
||||
LOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
ALOGE("Cannot access \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
srcfd = open(SUPP_CONFIG_TEMPLATE, O_RDONLY);
|
||||
if (srcfd < 0) {
|
||||
LOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
ALOGE("Cannot open \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
destfd = open(SUPP_CONFIG_FILE, O_CREAT|O_WRONLY, 0660);
|
||||
if (destfd < 0) {
|
||||
close(srcfd);
|
||||
LOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
ALOGE("Cannot create \"%s\": %s", SUPP_CONFIG_FILE, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((nread = read(srcfd, buf, sizeof(buf))) != 0) {
|
||||
if (nread < 0) {
|
||||
LOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
ALOGE("Error reading \"%s\": %s", SUPP_CONFIG_TEMPLATE, strerror(errno));
|
||||
close(srcfd);
|
||||
close(destfd);
|
||||
unlink(SUPP_CONFIG_FILE);
|
||||
|
|
@ -484,7 +484,7 @@ int Supplicant::setupConfig() {
|
|||
close(srcfd);
|
||||
|
||||
if (chown(SUPP_CONFIG_FILE, AID_SYSTEM, AID_WIFI) < 0) {
|
||||
LOGE("Error changing group ownership of %s to %d: %s",
|
||||
ALOGE("Error changing group ownership of %s to %d: %s",
|
||||
SUPP_CONFIG_FILE, AID_WIFI, strerror(errno));
|
||||
unlink(SUPP_CONFIG_FILE);
|
||||
return -1;
|
||||
|
|
@ -496,7 +496,7 @@ int Supplicant::setNetworkVar(int networkId, const char *var, const char *val) {
|
|||
char reply[255];
|
||||
size_t len = sizeof(reply) -1;
|
||||
|
||||
LOGD("netid %d, var '%s' = '%s'", networkId, var, val);
|
||||
ALOGD("netid %d, var '%s' = '%s'", networkId, var, val);
|
||||
char *tmp;
|
||||
asprintf(&tmp, "SET_NETWORK %d %s %s", networkId, var, val);
|
||||
if (sendCommand(tmp, reply, &len)) {
|
||||
|
|
@ -507,7 +507,7 @@ int Supplicant::setNetworkVar(int networkId, const char *var, const char *val) {
|
|||
|
||||
len = sizeof(reply) -1;
|
||||
if (sendCommand("SAVE_CONFIG", reply, &len)) {
|
||||
LOGE("Error saving config after %s = %s", var, val);
|
||||
ALOGE("Error saving config after %s = %s", var, val);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -621,7 +621,7 @@ int Supplicant::setBluetoothCoexistenceMode(int mode) {
|
|||
int Supplicant::setApScanMode(int mode) {
|
||||
char req[64];
|
||||
|
||||
// LOGD("setApScanMode(%d)", mode);
|
||||
// ALOGD("setApScanMode(%d)", mode);
|
||||
sprintf(req, "AP_SCAN %d", mode);
|
||||
|
||||
char reply[16];
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event,
|
|||
// p
|
||||
char *q = index(p, '\'');
|
||||
if (!q) {
|
||||
LOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
ALOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
return;
|
||||
}
|
||||
mSsid = (char *) malloc((q - p) +1);
|
||||
|
|
@ -59,7 +59,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event,
|
|||
// ^
|
||||
// p
|
||||
if (!(q = index(p, ' '))) {
|
||||
LOGE("Unable to decode frequency\n");
|
||||
ALOGE("Unable to decode frequency\n");
|
||||
return;
|
||||
}
|
||||
*q = '\0';
|
||||
|
|
@ -73,7 +73,7 @@ SupplicantAssociatingEvent::SupplicantAssociatingEvent(int level, char *event,
|
|||
|
||||
char *q = index(p, '\'');
|
||||
if (!q) {
|
||||
LOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
ALOGE("Unable to decode SSID (p = {%s})\n", p);
|
||||
return;
|
||||
}
|
||||
mSsid = (char *) malloc((q - p) +1);
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ SupplicantConnectedEvent::SupplicantConnectedEvent(int level, char *event,
|
|||
else
|
||||
mReassociated = true;
|
||||
} else
|
||||
LOGE("Unable to decode re-assocation");
|
||||
ALOGE("Unable to decode re-assocation");
|
||||
} else
|
||||
LOGE("Unable to decode event");
|
||||
ALOGE("Unable to decode event");
|
||||
}
|
||||
|
||||
SupplicantConnectedEvent::SupplicantConnectedEvent(const char *bssid,
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ SupplicantEvent *SupplicantEventFactory::createEvent(char *event, size_t len) {
|
|||
level = atoi(tmp);
|
||||
event += (match - event) + 1;
|
||||
} else
|
||||
LOGW("Unclosed level brace in event");
|
||||
ALOGW("Unclosed level brace in event");
|
||||
} else
|
||||
LOGW("No level specified in event");
|
||||
ALOGW("No level specified in event");
|
||||
|
||||
/*
|
||||
* <N>CTRL-EVENT-XXX
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) {
|
|||
size_t nread = buflen - 1;
|
||||
|
||||
if ((rc = wpa_ctrl_recv(mMonitor, buf, &nread))) {
|
||||
LOGE("wpa_ctrl_recv failed (%s)", strerror(errno));
|
||||
ALOGE("wpa_ctrl_recv failed (%s)", strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
buf[nread] = '\0';
|
||||
if (!rc && !nread) {
|
||||
LOGD("Received EOF on supplicant socket\n");
|
||||
ALOGD("Received EOF on supplicant socket\n");
|
||||
strncpy(buf, WPA_EVENT_TERMINATING " - signal 0 received", buflen-1);
|
||||
buf[buflen-1] = '\0';
|
||||
return false;
|
||||
|
|
@ -63,7 +63,7 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) {
|
|||
SupplicantEvent *evt = mFactory->createEvent(buf, nread);
|
||||
|
||||
if (!evt) {
|
||||
LOGW("Dropping unknown supplicant event '%s'", buf);
|
||||
ALOGW("Dropping unknown supplicant event '%s'", buf);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ bool SupplicantListener::onDataAvailable(SocketClient *cli) {
|
|||
else if (evt->getType() == SupplicantEvent::EVENT_DISCONNECTED)
|
||||
mHandlers->onDisconnectedEvent((SupplicantDisconnectedEvent *) evt);
|
||||
else
|
||||
LOGW("Whoops - no handler available for event '%s'\n", buf);
|
||||
ALOGW("Whoops - no handler available for event '%s'\n", buf);
|
||||
#if 0
|
||||
else if (evt->getType() == SupplicantEvent::EVENT_TERMINATING)
|
||||
mHandlers->onTerminatingEvent(evt);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ SupplicantStateChangeEvent::SupplicantStateChangeEvent(int level, char *event,
|
|||
// XXX: move this stuff into a static creation method
|
||||
char *p = index(event, ' ');
|
||||
if (!p) {
|
||||
LOGW("Bad event '%s'\n", event);
|
||||
ALOGW("Bad event '%s'\n", event);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,9 +81,9 @@ SupplicantStatus *SupplicantStatus::createStatus(char *data, int len) {
|
|||
else if (!strcmp(value, "IDLE"))
|
||||
state = SupplicantState::IDLE;
|
||||
else
|
||||
LOGE("Unknown supplicant state '%s'", value);
|
||||
ALOGE("Unknown supplicant state '%s'", value);
|
||||
} else
|
||||
LOGD("Ignoring unsupported status token '%s'", token);
|
||||
ALOGD("Ignoring unsupported status token '%s'", token);
|
||||
}
|
||||
|
||||
return new SupplicantStatus(state, id, bssid, ssid);
|
||||
|
|
|
|||
|
|
@ -33,25 +33,25 @@ bool TiwlanEventListener::onDataAvailable(SocketClient *cli) {
|
|||
struct ipc_ev_data *data;
|
||||
|
||||
if (!(data = (struct ipc_ev_data *) malloc(sizeof(struct ipc_ev_data)))) {
|
||||
LOGE("Failed to allocate packet (out of memory)");
|
||||
ALOGE("Failed to allocate packet (out of memory)");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (recv(cli->getSocket(), data, sizeof(struct ipc_ev_data), 0) < 0) {
|
||||
LOGE("recv failed (%s)", strerror(errno));
|
||||
ALOGE("recv failed (%s)", strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (data->event_type == IPC_EVENT_LINK_SPEED) {
|
||||
uint32_t *spd = (uint32_t *) data->buffer;
|
||||
*spd /= 2;
|
||||
// LOGD("Link speed = %u MB/s", *spd);
|
||||
// ALOGD("Link speed = %u MB/s", *spd);
|
||||
} else if (data->event_type == IPC_EVENT_LOW_SNR) {
|
||||
LOGW("Low signal/noise ratio");
|
||||
ALOGW("Low signal/noise ratio");
|
||||
} else if (data->event_type == IPC_EVENT_LOW_RSSI) {
|
||||
LOGW("Low RSSI");
|
||||
ALOGW("Low RSSI");
|
||||
} else {
|
||||
// LOGD("Dropping unhandled driver event %d", data->event_type);
|
||||
// ALOGD("Dropping unhandled driver event %d", data->event_type);
|
||||
}
|
||||
|
||||
// TODO: Tell WifiController about the event
|
||||
|
|
|
|||
|
|
@ -75,23 +75,23 @@ int TiwlanWifiController::loadFirmware() {
|
|||
while (count-- > 0) {
|
||||
if (property_get(DRIVER_PROP_NAME, driver_status, NULL)) {
|
||||
if (!strcmp(driver_status, "ok")) {
|
||||
LOGD("Firmware loaded OK");
|
||||
ALOGD("Firmware loaded OK");
|
||||
|
||||
if (startDriverEventListener()) {
|
||||
LOGW("Failed to start driver event listener (%s)",
|
||||
ALOGW("Failed to start driver event listener (%s)",
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else if (!strcmp(DRIVER_PROP_NAME, "failed")) {
|
||||
LOGE("Firmware load failed");
|
||||
ALOGE("Firmware load failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
usleep(200000);
|
||||
}
|
||||
property_set(DRIVER_PROP_NAME, "timeout");
|
||||
LOGE("Firmware load timed out");
|
||||
ALOGE("Firmware load timed out");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -99,13 +99,13 @@ int TiwlanWifiController::startDriverEventListener() {
|
|||
struct sockaddr_in addr;
|
||||
|
||||
if (mListenerSock != -1) {
|
||||
LOGE("Listener already started!");
|
||||
ALOGE("Listener already started!");
|
||||
errno = EBUSY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((mListenerSock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
||||
LOGE("socket failed (%s)", strerror(errno));
|
||||
ALOGE("socket failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -117,14 +117,14 @@ int TiwlanWifiController::startDriverEventListener() {
|
|||
if (bind(mListenerSock,
|
||||
(struct sockaddr *) &addr,
|
||||
sizeof(addr)) < 0) {
|
||||
LOGE("bind failed (%s)", strerror(errno));
|
||||
ALOGE("bind failed (%s)", strerror(errno));
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
mEventListener = new TiwlanEventListener(mListenerSock);
|
||||
|
||||
if (mEventListener->startListener()) {
|
||||
LOGE("Error starting driver listener (%s)", strerror(errno));
|
||||
ALOGE("Error starting driver listener (%s)", strerror(errno));
|
||||
goto out_err;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -108,50 +108,50 @@ int WifiController::stop() {
|
|||
int WifiController::enable() {
|
||||
|
||||
if (!isPoweredUp()) {
|
||||
LOGI("Powering up");
|
||||
ALOGI("Powering up");
|
||||
sendStatusBroadcast("Powering up WiFi hardware");
|
||||
if (powerUp()) {
|
||||
LOGE("Powerup failed (%s)", strerror(errno));
|
||||
ALOGE("Powerup failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mModuleName[0] != '\0' && !isKernelModuleLoaded(mModuleName)) {
|
||||
LOGI("Loading driver");
|
||||
ALOGI("Loading driver");
|
||||
sendStatusBroadcast("Loading WiFi driver");
|
||||
if (loadKernelModule(mModulePath, mModuleArgs)) {
|
||||
LOGE("Kernel module load failed (%s)", strerror(errno));
|
||||
ALOGE("Kernel module load failed (%s)", strerror(errno));
|
||||
goto out_powerdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFirmwareLoaded()) {
|
||||
LOGI("Loading firmware");
|
||||
ALOGI("Loading firmware");
|
||||
sendStatusBroadcast("Loading WiFI firmware");
|
||||
if (loadFirmware()) {
|
||||
LOGE("Firmware load failed (%s)", strerror(errno));
|
||||
ALOGE("Firmware load failed (%s)", strerror(errno));
|
||||
goto out_powerdown;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mSupplicant->isStarted()) {
|
||||
LOGI("Starting WPA Supplicant");
|
||||
ALOGI("Starting WPA Supplicant");
|
||||
sendStatusBroadcast("Starting WPA Supplicant");
|
||||
if (mSupplicant->start()) {
|
||||
LOGE("Supplicant start failed (%s)", strerror(errno));
|
||||
ALOGE("Supplicant start failed (%s)", strerror(errno));
|
||||
goto out_unloadmodule;
|
||||
}
|
||||
}
|
||||
|
||||
if (Controller::bindInterface(mSupplicant->getInterfaceName())) {
|
||||
LOGE("Error binding interface (%s)", strerror(errno));
|
||||
ALOGE("Error binding interface (%s)", strerror(errno));
|
||||
goto out_unloadmodule;
|
||||
}
|
||||
|
||||
if (mSupplicant->refreshNetworkList())
|
||||
LOGW("Error getting list of networks (%s)", strerror(errno));
|
||||
ALOGW("Error getting list of networks (%s)", strerror(errno));
|
||||
|
||||
LOGW("TODO: Set # of allowed regulatory channels!");
|
||||
ALOGW("TODO: Set # of allowed regulatory channels!");
|
||||
|
||||
mPropMngr->attachProperty("wifi", mDynamicProperties.propSupplicantState);
|
||||
mPropMngr->attachProperty("wifi", mDynamicProperties.propActiveScan);
|
||||
|
|
@ -167,19 +167,19 @@ int WifiController::enable() {
|
|||
mPropMngr->attachProperty("wifi", mDynamicProperties.propNetCount);
|
||||
mPropMngr->attachProperty("wifi", mDynamicProperties.propTriggerScan);
|
||||
|
||||
LOGI("Enabled successfully");
|
||||
ALOGI("Enabled successfully");
|
||||
return 0;
|
||||
|
||||
out_unloadmodule:
|
||||
if (mModuleName[0] != '\0' && !isKernelModuleLoaded(mModuleName)) {
|
||||
if (unloadKernelModule(mModuleName)) {
|
||||
LOGE("Unable to unload module after failure!");
|
||||
ALOGE("Unable to unload module after failure!");
|
||||
}
|
||||
}
|
||||
|
||||
out_powerdown:
|
||||
if (powerDown()) {
|
||||
LOGE("Unable to powerdown after failure!");
|
||||
ALOGE("Unable to powerdown after failure!");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ int WifiController::setSuspend(bool suspend) {
|
|||
|
||||
pthread_mutex_lock(&mLock);
|
||||
if (suspend == mSuspended) {
|
||||
LOGW("Suspended state already = %d", suspend);
|
||||
ALOGW("Suspended state already = %d", suspend);
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -204,29 +204,29 @@ int WifiController::setSuspend(bool suspend) {
|
|||
mHandlers->onControllerSuspending(this);
|
||||
|
||||
char tmp[80];
|
||||
LOGD("Suspending from supplicant state %s",
|
||||
ALOGD("Suspending from supplicant state %s",
|
||||
SupplicantState::toString(mSupplicantState,
|
||||
tmp,
|
||||
sizeof(tmp)));
|
||||
|
||||
if (mSupplicantState != SupplicantState::IDLE) {
|
||||
LOGD("Forcing Supplicant disconnect");
|
||||
ALOGD("Forcing Supplicant disconnect");
|
||||
if (mSupplicant->disconnect()) {
|
||||
LOGW("Error disconnecting (%s)", strerror(errno));
|
||||
ALOGW("Error disconnecting (%s)", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
LOGD("Stopping Supplicant driver");
|
||||
ALOGD("Stopping Supplicant driver");
|
||||
if (mSupplicant->stopDriver()) {
|
||||
LOGE("Error stopping driver (%s)", strerror(errno));
|
||||
ALOGE("Error stopping driver (%s)", strerror(errno));
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
LOGD("Resuming");
|
||||
ALOGD("Resuming");
|
||||
|
||||
if (mSupplicant->startDriver()) {
|
||||
LOGE("Error resuming driver (%s)", strerror(errno));
|
||||
ALOGE("Error resuming driver (%s)", strerror(errno));
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -241,7 +241,7 @@ int WifiController::setSuspend(bool suspend) {
|
|||
|
||||
mSuspended = suspend;
|
||||
pthread_mutex_unlock(&mLock);
|
||||
LOGD("Suspend / Resume completed");
|
||||
ALOGD("Suspend / Resume completed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -269,16 +269,16 @@ int WifiController::disable() {
|
|||
if (mSupplicant->isStarted()) {
|
||||
sendStatusBroadcast("Stopping WPA Supplicant");
|
||||
if (mSupplicant->stop()) {
|
||||
LOGE("Supplicant stop failed (%s)", strerror(errno));
|
||||
ALOGE("Supplicant stop failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
LOGW("disable(): Supplicant not running?");
|
||||
ALOGW("disable(): Supplicant not running?");
|
||||
|
||||
if (mModuleName[0] != '\0' && isKernelModuleLoaded(mModuleName)) {
|
||||
sendStatusBroadcast("Unloading WiFi driver");
|
||||
if (unloadKernelModule(mModuleName)) {
|
||||
LOGE("Unable to unload module (%s)", strerror(errno));
|
||||
ALOGE("Unable to unload module (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@ int WifiController::disable() {
|
|||
if (isPoweredUp()) {
|
||||
sendStatusBroadcast("Powering down WiFi hardware");
|
||||
if (powerDown()) {
|
||||
LOGE("Powerdown failed (%s)", strerror(errno));
|
||||
ALOGE("Powerdown failed (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -426,38 +426,38 @@ int WifiController::setBluetoothCoexistenceMode(int mode) {
|
|||
}
|
||||
|
||||
void WifiController::onAssociatingEvent(SupplicantAssociatingEvent *evt) {
|
||||
LOGD("onAssociatingEvent(%s, %s, %d)",
|
||||
ALOGD("onAssociatingEvent(%s, %s, %d)",
|
||||
(evt->getBssid() ? evt->getBssid() : "n/a"),
|
||||
(evt->getSsid() ? evt->getSsid() : "n/a"),
|
||||
evt->getFreq());
|
||||
}
|
||||
|
||||
void WifiController::onAssociatedEvent(SupplicantAssociatedEvent *evt) {
|
||||
LOGD("onAssociatedEvent(%s)", evt->getBssid());
|
||||
ALOGD("onAssociatedEvent(%s)", evt->getBssid());
|
||||
}
|
||||
|
||||
void WifiController::onConnectedEvent(SupplicantConnectedEvent *evt) {
|
||||
LOGD("onConnectedEvent(%s, %d)", evt->getBssid(), evt->getReassociated());
|
||||
ALOGD("onConnectedEvent(%s, %d)", evt->getBssid(), evt->getReassociated());
|
||||
SupplicantStatus *ss = mSupplicant->getStatus();
|
||||
WifiNetwork *wn;
|
||||
|
||||
if (ss->getWpaState() != SupplicantState::COMPLETED) {
|
||||
char tmp[32];
|
||||
|
||||
LOGW("onConnected() with SupplicantState = %s!",
|
||||
ALOGW("onConnected() with SupplicantState = %s!",
|
||||
SupplicantState::toString(ss->getWpaState(), tmp,
|
||||
sizeof(tmp)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ss->getId() == -1) {
|
||||
LOGW("onConnected() with id = -1!");
|
||||
ALOGW("onConnected() with id = -1!");
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentlyConnectedNetworkId = ss->getId();
|
||||
if (!(wn = mSupplicant->lookupNetwork(ss->getId()))) {
|
||||
LOGW("Error looking up connected network id %d (%s)",
|
||||
ALOGW("Error looking up connected network id %d (%s)",
|
||||
ss->getId(), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
|
@ -470,7 +470,7 @@ void WifiController::onScanResultsEvent(SupplicantScanResultsEvent *evt) {
|
|||
char *reply;
|
||||
|
||||
if (!(reply = (char *) malloc(4096))) {
|
||||
LOGE("Out of memory");
|
||||
ALOGE("Out of memory");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ void WifiController::onScanResultsEvent(SupplicantScanResultsEvent *evt) {
|
|||
size_t len = 4096;
|
||||
|
||||
if (mSupplicant->sendCommand("SCAN_RESULTS", reply, &len)) {
|
||||
LOGW("onScanResultsEvent: Error getting scan results (%s)",
|
||||
ALOGW("onScanResultsEvent: Error getting scan results (%s)",
|
||||
strerror(errno));
|
||||
free(reply);
|
||||
return;
|
||||
|
|
@ -530,7 +530,7 @@ void WifiController::onStateChangeEvent(SupplicantStateChangeEvent *evt) {
|
|||
if (evt->getState() == mSupplicantState)
|
||||
return;
|
||||
|
||||
LOGD("onStateChangeEvent(%s -> %s)",
|
||||
ALOGD("onStateChangeEvent(%s -> %s)",
|
||||
SupplicantState::toString(mSupplicantState, tmp, sizeof(tmp)),
|
||||
SupplicantState::toString(evt->getState(), tmp2, sizeof(tmp2)));
|
||||
|
||||
|
|
@ -559,7 +559,7 @@ void WifiController::onStateChangeEvent(SupplicantStateChangeEvent *evt) {
|
|||
}
|
||||
|
||||
void WifiController::onConnectionTimeoutEvent(SupplicantConnectionTimeoutEvent *evt) {
|
||||
LOGD("onConnectionTimeoutEvent(%s)", evt->getBssid());
|
||||
ALOGD("onConnectionTimeoutEvent(%s)", evt->getBssid());
|
||||
}
|
||||
|
||||
void WifiController::onDisconnectedEvent(SupplicantDisconnectedEvent *evt) {
|
||||
|
|
@ -569,39 +569,39 @@ void WifiController::onDisconnectedEvent(SupplicantDisconnectedEvent *evt) {
|
|||
|
||||
#if 0
|
||||
void WifiController::onTerminatingEvent(SupplicantEvent *evt) {
|
||||
LOGD("onTerminatingEvent(%s)", evt->getEvent());
|
||||
ALOGD("onTerminatingEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onPasswordChangedEvent(SupplicantEvent *evt) {
|
||||
LOGD("onPasswordChangedEvent(%s)", evt->getEvent());
|
||||
ALOGD("onPasswordChangedEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onEapNotificationEvent(SupplicantEvent *evt) {
|
||||
LOGD("onEapNotificationEvent(%s)", evt->getEvent());
|
||||
ALOGD("onEapNotificationEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onEapStartedEvent(SupplicantEvent *evt) {
|
||||
LOGD("onEapStartedEvent(%s)", evt->getEvent());
|
||||
ALOGD("onEapStartedEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onEapMethodEvent(SupplicantEvent *evt) {
|
||||
LOGD("onEapMethodEvent(%s)", evt->getEvent());
|
||||
ALOGD("onEapMethodEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onEapSuccessEvent(SupplicantEvent *evt) {
|
||||
LOGD("onEapSuccessEvent(%s)", evt->getEvent());
|
||||
ALOGD("onEapSuccessEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onEapFailureEvent(SupplicantEvent *evt) {
|
||||
LOGD("onEapFailureEvent(%s)", evt->getEvent());
|
||||
ALOGD("onEapFailureEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onLinkSpeedEvent(SupplicantEvent *evt) {
|
||||
LOGD("onLinkSpeedEvent(%s)", evt->getEvent());
|
||||
ALOGD("onLinkSpeedEvent(%s)", evt->getEvent());
|
||||
}
|
||||
|
||||
void WifiController::onDriverStateEvent(SupplicantEvent *evt) {
|
||||
LOGD("onDriverStateEvent(%s)", evt->getEvent());
|
||||
ALOGD("onDriverStateEvent(%s)", evt->getEvent());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -609,7 +609,7 @@ void WifiController::onStatusPollInterval() {
|
|||
pthread_mutex_lock(&mLock);
|
||||
int rssi;
|
||||
if (mSupplicant->getRssi(&rssi)) {
|
||||
LOGE("Failed to get rssi (%s)", strerror(errno));
|
||||
ALOGE("Failed to get rssi (%s)", strerror(errno));
|
||||
pthread_mutex_unlock(&mLock);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,15 +43,15 @@ WifiNetwork::WifiNetwork(WifiController *c, Supplicant *suppl, const char *data)
|
|||
char *flags;
|
||||
|
||||
if (!(id = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract network id");
|
||||
ALOGE("Failed to extract network id");
|
||||
if (!(ssid = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract ssid");
|
||||
ALOGE("Failed to extract ssid");
|
||||
if (!(bssid = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract bssid");
|
||||
ALOGE("Failed to extract bssid");
|
||||
if (!(flags = strsep(&next, "\t")))
|
||||
LOGE("Failed to extract flags");
|
||||
ALOGE("Failed to extract flags");
|
||||
|
||||
// LOGD("id '%s', ssid '%s', bssid '%s', flags '%s'", id, ssid, bssid,
|
||||
// ALOGD("id '%s', ssid '%s', bssid '%s', flags '%s'", id, ssid, bssid,
|
||||
// flags ? flags :"null");
|
||||
|
||||
if (id)
|
||||
|
|
@ -77,7 +77,7 @@ WifiNetwork::WifiNetwork(WifiController *c, Supplicant *suppl, const char *data)
|
|||
if (!strcmp(flags, "[DISABLED]"))
|
||||
mEnabled = false;
|
||||
else
|
||||
LOGW("Unsupported flags '%s'", flags);
|
||||
ALOGW("Unsupported flags '%s'", flags);
|
||||
}
|
||||
|
||||
free(tmp);
|
||||
|
|
@ -215,7 +215,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "key_mgmt", buffer, len)) {
|
||||
if (WifiNetwork::parseKeyManagementMask(buffer, &mask)) {
|
||||
LOGE("Error parsing key_mgmt (%s)", strerror(errno));
|
||||
ALOGE("Error parsing key_mgmt (%s)", strerror(errno));
|
||||
} else {
|
||||
mKeyManagement = mask;
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "proto", buffer, len)) {
|
||||
if (WifiNetwork::parseProtocolsMask(buffer, &mask)) {
|
||||
LOGE("Error parsing proto (%s)", strerror(errno));
|
||||
ALOGE("Error parsing proto (%s)", strerror(errno));
|
||||
} else {
|
||||
mProtocols = mask;
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "auth_alg", buffer, len)) {
|
||||
if (WifiNetwork::parseAuthAlgorithmsMask(buffer, &mask)) {
|
||||
LOGE("Error parsing auth_alg (%s)", strerror(errno));
|
||||
ALOGE("Error parsing auth_alg (%s)", strerror(errno));
|
||||
} else {
|
||||
mAuthAlgorithms = mask;
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "pairwise", buffer, len)) {
|
||||
if (WifiNetwork::parsePairwiseCiphersMask(buffer, &mask)) {
|
||||
LOGE("Error parsing pairwise (%s)", strerror(errno));
|
||||
ALOGE("Error parsing pairwise (%s)", strerror(errno));
|
||||
} else {
|
||||
mPairwiseCiphers = mask;
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ int WifiNetwork::refresh() {
|
|||
len = sizeof(buffer);
|
||||
if (mSuppl->getNetworkVar(mNetid, "group", buffer, len)) {
|
||||
if (WifiNetwork::parseGroupCiphersMask(buffer, &mask)) {
|
||||
LOGE("Error parsing group (%s)", strerror(errno));
|
||||
ALOGE("Error parsing group (%s)", strerror(errno));
|
||||
} else {
|
||||
mGroupCiphers = mask;
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ int WifiNetwork::refresh() {
|
|||
|
||||
return 0;
|
||||
out_err:
|
||||
LOGE("Refresh failed (%s)",strerror(errno));
|
||||
ALOGE("Refresh failed (%s)",strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -453,12 +453,12 @@ int WifiNetwork::setEnabled(bool enabled) {
|
|||
|
||||
if (enabled) {
|
||||
if (getPriority() == -1) {
|
||||
LOGE("Cannot enable network when priority is not set");
|
||||
ALOGE("Cannot enable network when priority is not set");
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
if (getKeyManagement() == KeyManagementMask::UNKNOWN) {
|
||||
LOGE("Cannot enable network when KeyManagement is not set");
|
||||
ALOGE("Cannot enable network when KeyManagement is not set");
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ int WifiNetwork::parseKeyManagementMask(const char *buffer, uint32_t *mask) {
|
|||
char *v_next = v_tmp;
|
||||
char *v_token;
|
||||
|
||||
// LOGD("parseKeyManagementMask(%s)", buffer);
|
||||
// ALOGD("parseKeyManagementMask(%s)", buffer);
|
||||
*mask = 0;
|
||||
|
||||
while((v_token = strsep(&v_next, " "))) {
|
||||
|
|
@ -526,13 +526,13 @@ int WifiNetwork::parseKeyManagementMask(const char *buffer, uint32_t *mask) {
|
|||
else if (!strcasecmp(v_token, "IEEE8021X"))
|
||||
*mask |= KeyManagementMask::IEEE8021X;
|
||||
else {
|
||||
LOGW("Invalid KeyManagementMask value '%s'", v_token);
|
||||
ALOGW("Invalid KeyManagementMask value '%s'", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
LOGW("KeyManagementMask value '%s' when NONE", v_token);
|
||||
ALOGW("KeyManagementMask value '%s' when NONE", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
|
|
@ -548,7 +548,7 @@ int WifiNetwork::parseProtocolsMask(const char *buffer, uint32_t *mask) {
|
|||
char *v_next = v_tmp;
|
||||
char *v_token;
|
||||
|
||||
// LOGD("parseProtocolsMask(%s)", buffer);
|
||||
// ALOGD("parseProtocolsMask(%s)", buffer);
|
||||
*mask = 0;
|
||||
while((v_token = strsep(&v_next, " "))) {
|
||||
if (!strcasecmp(v_token, "WPA"))
|
||||
|
|
@ -556,7 +556,7 @@ int WifiNetwork::parseProtocolsMask(const char *buffer, uint32_t *mask) {
|
|||
else if (!strcasecmp(v_token, "RSN"))
|
||||
*mask |= SecurityProtocolMask::RSN;
|
||||
else {
|
||||
LOGW("Invalid ProtocolsMask value '%s'", v_token);
|
||||
ALOGW("Invalid ProtocolsMask value '%s'", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
|
|
@ -573,7 +573,7 @@ int WifiNetwork::parseAuthAlgorithmsMask(const char *buffer, uint32_t *mask) {
|
|||
char *v_next = v_tmp;
|
||||
char *v_token;
|
||||
|
||||
// LOGD("parseAuthAlgorithmsMask(%s)", buffer);
|
||||
// ALOGD("parseAuthAlgorithmsMask(%s)", buffer);
|
||||
|
||||
*mask = 0;
|
||||
if (buffer[0] == '\0')
|
||||
|
|
@ -587,7 +587,7 @@ int WifiNetwork::parseAuthAlgorithmsMask(const char *buffer, uint32_t *mask) {
|
|||
else if (!strcasecmp(v_token, "LEAP"))
|
||||
*mask |= AuthenticationAlgorithmMask::LEAP;
|
||||
else {
|
||||
LOGW("Invalid AuthAlgorithmsMask value '%s'", v_token);
|
||||
ALOGW("Invalid AuthAlgorithmsMask value '%s'", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
|
|
@ -603,7 +603,7 @@ int WifiNetwork::parsePairwiseCiphersMask(const char *buffer, uint32_t *mask) {
|
|||
char *v_next = v_tmp;
|
||||
char *v_token;
|
||||
|
||||
// LOGD("parsePairwiseCiphersMask(%s)", buffer);
|
||||
// ALOGD("parsePairwiseCiphersMask(%s)", buffer);
|
||||
|
||||
*mask = 0;
|
||||
while((v_token = strsep(&v_next, " "))) {
|
||||
|
|
@ -616,13 +616,13 @@ int WifiNetwork::parsePairwiseCiphersMask(const char *buffer, uint32_t *mask) {
|
|||
else if (!strcasecmp(v_token, "CCMP"))
|
||||
*mask |= PairwiseCiphersMask::CCMP;
|
||||
else {
|
||||
LOGW("PairwiseCiphersMask value '%s' when NONE", v_token);
|
||||
ALOGW("PairwiseCiphersMask value '%s' when NONE", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
LOGW("Invalid PairwiseCiphersMask value '%s'", v_token);
|
||||
ALOGW("Invalid PairwiseCiphersMask value '%s'", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
|
|
@ -638,7 +638,7 @@ int WifiNetwork::parseGroupCiphersMask(const char *buffer, uint32_t *mask) {
|
|||
char *v_next = v_tmp;
|
||||
char *v_token;
|
||||
|
||||
// LOGD("parseGroupCiphersMask(%s)", buffer);
|
||||
// ALOGD("parseGroupCiphersMask(%s)", buffer);
|
||||
|
||||
*mask = 0;
|
||||
while((v_token = strsep(&v_next, " "))) {
|
||||
|
|
@ -651,7 +651,7 @@ int WifiNetwork::parseGroupCiphersMask(const char *buffer, uint32_t *mask) {
|
|||
else if (!strcasecmp(v_token, "CCMP"))
|
||||
*mask |= GroupCiphersMask::CCMP;
|
||||
else {
|
||||
LOGW("Invalid GroupCiphersMask value '%s'", v_token);
|
||||
ALOGW("Invalid GroupCiphersMask value '%s'", v_token);
|
||||
errno = EINVAL;
|
||||
free(v_tmp);
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -58,13 +58,13 @@ int WifiScanner::stop() {
|
|||
char c = 0;
|
||||
|
||||
if (write(mCtrlPipe[1], &c, 1) != 1) {
|
||||
LOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
ALOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *ret;
|
||||
if (pthread_join(mThread, &ret)) {
|
||||
LOGE("Error joining to scanner thread (%s)", strerror(errno));
|
||||
ALOGE("Error joining to scanner thread (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ int WifiScanner::stop() {
|
|||
}
|
||||
|
||||
void WifiScanner::run() {
|
||||
LOGD("Starting wifi scanner (active = %d)", mActive);
|
||||
ALOGD("Starting wifi scanner (active = %d)", mActive);
|
||||
|
||||
while(1) {
|
||||
fd_set read_fds;
|
||||
|
|
@ -88,16 +88,16 @@ void WifiScanner::run() {
|
|||
FD_SET(mCtrlPipe[0], &read_fds);
|
||||
|
||||
if (mSuppl->triggerScan(mActive)) {
|
||||
LOGW("Error triggering scan (%s)", strerror(errno));
|
||||
ALOGW("Error triggering scan (%s)", strerror(errno));
|
||||
}
|
||||
|
||||
if ((rc = select(mCtrlPipe[0] + 1, &read_fds, NULL, NULL, &to)) < 0) {
|
||||
LOGE("select failed (%s) - sleeping for one scanner period", strerror(errno));
|
||||
ALOGE("select failed (%s) - sleeping for one scanner period", strerror(errno));
|
||||
sleep(mPeriod);
|
||||
continue;
|
||||
} else if (!rc) {
|
||||
} else if (FD_ISSET(mCtrlPipe[0], &read_fds))
|
||||
break;
|
||||
} // while
|
||||
LOGD("Stopping wifi scanner");
|
||||
ALOGD("Stopping wifi scanner");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ int WifiStatusPoller::stop() {
|
|||
char c = 0;
|
||||
|
||||
if (write(mCtrlPipe[1], &c, 1) != 1) {
|
||||
LOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
ALOGE("Error writing to control pipe (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void *ret;
|
||||
if (pthread_join(mThread, &ret)) {
|
||||
LOGE("Error joining to listener thread (%s)", strerror(errno));
|
||||
ALOGE("Error joining to listener thread (%s)", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
close(mCtrlPipe[0]);
|
||||
|
|
@ -68,10 +68,10 @@ void *WifiStatusPoller::threadStart(void *obj) {
|
|||
WifiStatusPoller *me = reinterpret_cast<WifiStatusPoller *>(obj);
|
||||
|
||||
me->mStarted = true;
|
||||
LOGD("Starting");
|
||||
ALOGD("Starting");
|
||||
me->run();
|
||||
me->mStarted = false;
|
||||
LOGD("Stopping");
|
||||
ALOGD("Stopping");
|
||||
pthread_exit(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ void WifiStatusPoller::run() {
|
|||
max = mCtrlPipe[0];
|
||||
|
||||
if ((rc = select(max + 1, &read_fds, NULL, NULL, &to)) < 0) {
|
||||
LOGE("select failed (%s)", strerror(errno));
|
||||
ALOGE("select failed (%s)", strerror(errno));
|
||||
sleep(1);
|
||||
continue;
|
||||
} else if (!rc) {
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@
|
|||
#include "TiwlanWifiController.h"
|
||||
|
||||
int main() {
|
||||
LOGI("Nexus version 0.1 firing up");
|
||||
ALOGI("Nexus version 0.1 firing up");
|
||||
|
||||
CommandListener *cl = new CommandListener();
|
||||
|
||||
NetworkManager *nm;
|
||||
if (!(nm = NetworkManager::Instance())) {
|
||||
LOGE("Unable to create NetworkManager");
|
||||
ALOGE("Unable to create NetworkManager");
|
||||
exit (-1);
|
||||
};
|
||||
|
||||
|
|
@ -47,12 +47,12 @@ int main() {
|
|||
|
||||
|
||||
if (NetworkManager::Instance()->run()) {
|
||||
LOGE("Unable to Run NetworkManager (%s)", strerror(errno));
|
||||
ALOGE("Unable to Run NetworkManager (%s)", strerror(errno));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (cl->startListener()) {
|
||||
LOGE("Unable to start CommandListener (%s)", strerror(errno));
|
||||
ALOGE("Unable to start CommandListener (%s)", strerror(errno));
|
||||
exit (1);
|
||||
}
|
||||
|
||||
|
|
@ -62,6 +62,6 @@ int main() {
|
|||
sleep(1000);
|
||||
}
|
||||
|
||||
LOGI("Nexus exiting");
|
||||
ALOGI("Nexus exiting");
|
||||
exit(0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue