liblog: remove more unused code

Cleanup the headers; we really don't want to encourage any more
cutils/list.h usage...

Remove __android_log_uid() since the only remaining users are built
for device, so they can just use getuid() directly.

Test: build
Change-Id: I62be2c1e43d83807deaa9342afcc72459947cf15
This commit is contained in:
Tom Cherry 2020-01-08 15:34:14 -08:00
parent 21bb36c66a
commit b47aa2a592
7 changed files with 4 additions and 26 deletions

View file

@ -35,8 +35,6 @@
#include <string>
#include <cutils/sockets.h>
#include <private/android_filesystem_config.h>
#include <private/android_logger.h>
#include "logger.h"

View file

@ -34,7 +34,6 @@
#include <shared_mutex>
#include <cutils/sockets.h>
#include <private/android_filesystem_config.h>
#include <private/android_logger.h>
@ -113,7 +112,7 @@ int LogdWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr)
}
/* logd, after initialization and priv drop */
if (__android_log_uid() == AID_LOGD) {
if (getuid() == AID_LOGD) {
/*
* ignore log messages we send to ourself (logd).
* Such log messages are often generated by libraries we depend on

View file

@ -18,7 +18,6 @@
#include <stdatomic.h>
#include <cutils/list.h>
#include <log/log.h>
#include "log_portability.h"
@ -49,18 +48,4 @@ inline bool android_logger_is_logd(struct logger* logger) {
return reinterpret_cast<uintptr_t>(logger) & LOGGER_LOGD;
}
/* OS specific dribs and drabs */
#if defined(_WIN32)
#include <private/android_filesystem_config.h>
typedef uint32_t uid_t;
static inline uid_t __android_log_uid() {
return AID_SYSTEM;
}
#else
static inline uid_t __android_log_uid() {
return getuid();
}
#endif
__END_DECLS

View file

@ -27,8 +27,6 @@
#include <unistd.h>
#include <android/log.h>
#include <cutils/list.h>
#include <private/android_filesystem_config.h>
#include "log_portability.h"
#include "logd_reader.h"

View file

@ -15,7 +15,6 @@
*/
#include <errno.h>
#include <stdatomic.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
@ -42,7 +41,7 @@
#if defined(__ANDROID__)
static int check_log_uid_permissions() {
uid_t uid = __android_log_uid();
uid_t uid = getuid();
/* Matches clientHasLogCredentials() in logd */
if ((uid != AID_SYSTEM) && (uid != AID_ROOT) && (uid != AID_LOG)) {

View file

@ -23,7 +23,7 @@
#include <string.h>
#include <sys/types.h>
#include <private/android_filesystem_config.h>
#include <cutils/list.h>
#include <private/android_logger.h>
#include "logger.h"

View file

@ -26,7 +26,6 @@
#include <shared_mutex>
#include <log/log_properties.h>
#include <private/android_filesystem_config.h>
#include <private/android_logger.h>
#include "log_portability.h"
@ -113,7 +112,7 @@ int PmsgWrite(log_id_t logId, struct timespec* ts, struct iovec* vec, size_t nr)
pmsgHeader.magic = LOGGER_MAGIC;
pmsgHeader.len = sizeof(pmsgHeader) + sizeof(header);
pmsgHeader.uid = __android_log_uid();
pmsgHeader.uid = getuid();
pmsgHeader.pid = getpid();
header.id = logId;