Loading liblog/fake_log_device.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ * passed on to the underlying (fake) log device. When not in the * passed on to the underlying (fake) log device. When not in the * simulator, messages are printed to stderr. * simulator, messages are printed to stderr. */ */ #include "fake_log_device.h" #include <log/logd.h> #include <log/logd.h> #include <stdlib.h> #include <stdlib.h> Loading liblog/fake_log_device.h 0 → 100644 +28 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBLOG_FAKE_LOG_DEVICE_H #define _LIBLOG_FAKE_LOG_DEVICE_H #include <sys/types.h> struct iovec; int fakeLogOpen(const char *pathName, int flags); int fakeLogClose(int fd); ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count); #endif // _LIBLOG_FAKE_LOG_DEVICE_H liblog/logd_write.c +5 −1 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ #if FAKE_LOG_DEVICE #if FAKE_LOG_DEVICE // This will be defined when building for the host. // This will be defined when building for the host. #include "fake_log_device.h" #define log_open(pathname, flags) fakeLogOpen(pathname, flags) #define log_open(pathname, flags) fakeLogOpen(pathname, flags) #define log_writev(filedes, vector, count) fakeLogWritev(filedes, vector, count) #define log_writev(filedes, vector, count) fakeLogWritev(filedes, vector, count) #define log_close(filedes) fakeLogClose(filedes) #define log_close(filedes) fakeLogClose(filedes) Loading @@ -50,6 +51,8 @@ static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_ static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; #endif #endif #define UNUSED __attribute__((__unused__)) static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; /* /* Loading @@ -72,7 +75,8 @@ int __android_log_dev_available(void) return (g_log_status == kLogAvailable); return (g_log_status == kLogAvailable); } } static int __write_to_log_null(log_id_t log_fd, struct iovec *vec, size_t nr) static int __write_to_log_null(UNUSED log_id_t log_fd, UNUSED struct iovec *vec, UNUSED size_t nr) { { return -1; return -1; } } Loading Loading
liblog/fake_log_device.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ * passed on to the underlying (fake) log device. When not in the * passed on to the underlying (fake) log device. When not in the * simulator, messages are printed to stderr. * simulator, messages are printed to stderr. */ */ #include "fake_log_device.h" #include <log/logd.h> #include <log/logd.h> #include <stdlib.h> #include <stdlib.h> Loading
liblog/fake_log_device.h 0 → 100644 +28 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2013 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _LIBLOG_FAKE_LOG_DEVICE_H #define _LIBLOG_FAKE_LOG_DEVICE_H #include <sys/types.h> struct iovec; int fakeLogOpen(const char *pathName, int flags); int fakeLogClose(int fd); ssize_t fakeLogWritev(int fd, const struct iovec* vector, int count); #endif // _LIBLOG_FAKE_LOG_DEVICE_H
liblog/logd_write.c +5 −1 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ #if FAKE_LOG_DEVICE #if FAKE_LOG_DEVICE // This will be defined when building for the host. // This will be defined when building for the host. #include "fake_log_device.h" #define log_open(pathname, flags) fakeLogOpen(pathname, flags) #define log_open(pathname, flags) fakeLogOpen(pathname, flags) #define log_writev(filedes, vector, count) fakeLogWritev(filedes, vector, count) #define log_writev(filedes, vector, count) fakeLogWritev(filedes, vector, count) #define log_close(filedes) fakeLogClose(filedes) #define log_close(filedes) fakeLogClose(filedes) Loading @@ -50,6 +51,8 @@ static int (*write_to_log)(log_id_t, struct iovec *vec, size_t nr) = __write_to_ static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t log_init_lock = PTHREAD_MUTEX_INITIALIZER; #endif #endif #define UNUSED __attribute__((__unused__)) static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 }; /* /* Loading @@ -72,7 +75,8 @@ int __android_log_dev_available(void) return (g_log_status == kLogAvailable); return (g_log_status == kLogAvailable); } } static int __write_to_log_null(log_id_t log_fd, struct iovec *vec, size_t nr) static int __write_to_log_null(UNUSED log_id_t log_fd, UNUSED struct iovec *vec, UNUSED size_t nr) { { return -1; return -1; } } Loading