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

Commit b47aa2a5 authored by Tom Cherry's avatar Tom Cherry
Browse files

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
parent 21bb36c6
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@

#include <string>

#include <cutils/sockets.h>
#include <private/android_filesystem_config.h>
#include <private/android_logger.h>

#include "logger.h"
+1 −2
Original line number Diff line number Diff line
@@ -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
+0 −15
Original line number Diff line number Diff line
@@ -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
+0 −2
Original line number Diff line number Diff line
@@ -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"
+1 −2
Original line number Diff line number Diff line
@@ -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)) {
Loading