Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f07a1f8 authored by Steve Block's avatar Steve Block
Browse files

Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF)

Change-Id: I6c2a1d56dadb7e5c69e478f4d8c7d9f2127db2af
parent 4163b459
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -149,17 +149,23 @@ extern "C" {
/*
 * 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)ALOG(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)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

/*
@@ -224,9 +230,12 @@ extern "C" {
 * 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_ALOG(LOG_WARN, LOG_TAG)
#define IF_ALOGW IF_LOGW
#define IF_LOGW IF_ALOGW
#endif
#endif

/*
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
#define ALOGV(...)   ALOG("V", __VA_ARGS__)
#define ALOGD(...)   ALOG("D", __VA_ARGS__)
#define ALOGI(...)   ALOG("I", __VA_ARGS__)
#define LOGW(...)   ALOG("W", __VA_ARGS__)
#define ALOGW(...)   ALOG("W", __VA_ARGS__)
#define LOGE(...)   ALOG("E", __VA_ARGS__)
#define LOG_ALWAYS_FATAL(...)   do { LOGE(__VA_ARGS__); exit(1); } while (0)
#endif
+19 −19
Original line number Diff line number Diff line
@@ -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));
    }
}

@@ -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) {
        ALOGD("EWOULDBLOCK");
        // Ignore.
    } else {
        LOGW("Error returned by %s().", functionName);
        ALOGW("Error returned by %s().", functionName);
        peerProxyKill(peerProxy, true);
    }
}
@@ -583,7 +583,7 @@ static void peerProxyExpectBytes(PeerProxy* peerProxy, Header* header) {

    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;
    }
@@ -905,7 +905,7 @@ static void masterProxyHandleConnectionError(PeerProxy* masterProxy,
        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);
    }
@@ -1026,7 +1026,7 @@ 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;
    }
    
@@ -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;
    }
@@ -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);
    }
+3 −3
Original line number Diff line number Diff line
@@ -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,7 +128,7 @@ 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 {
        //ALOGV("Connected to system property server\n");
    }
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@
#include <stdio.h>
#include <string.h>
#define ALOGD printf
#define LOGW printf
#define ALOGW printf
#endif

static int ifc_ctl_sock = -1;
Loading