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

Commit 7581e86a authored by Tom Cherry's avatar Tom Cherry Committed by Gerrit Code Review
Browse files

Merge "Remove ANDROID_LOG_RDONLY, etc"

parents 89650f96 907b2d03
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -457,8 +457,8 @@ static void dump_log_file(log_t* log, pid_t pid, const char* filename, unsigned
    return;
  }

  logger_list = android_logger_list_open(
      android_name_to_log_id(filename), ANDROID_LOG_RDONLY | ANDROID_LOG_NONBLOCK, tail, pid);
  logger_list =
      android_logger_list_open(android_name_to_log_id(filename), ANDROID_LOG_NONBLOCK, tail, pid);

  if (!logger_list) {
    ALOGE("Unable to open %s: %s\n", filename, strerror(errno));
+5 −8
Original line number Diff line number Diff line
@@ -118,10 +118,9 @@ at a time in time sorted order, optionally limited to a specific pid and tail of
finally a call closing the logs.  A single log can be opened with `android_logger_list_open()`; or
multiple logs can be opened with `android_logger_list_alloc()`, calling in turn the
`android_logger_open()` for each log id.  Each entry can be retrieved with
`android_logger_list_read()`.  The log(s) can be closed with `android_logger_list_free()`.  The logs
should be opened with an `ANDROID_LOG_RDONLY` mode.  `ANDROID_LOG_NONBLOCK` mode will report when
the log reading is done with an `EAGAIN` error return code, otherwise the
`android_logger_list_read()` call will block for new entries.
`android_logger_list_read()`.  The log(s) can be closed with `android_logger_list_free()`.
`ANDROID_LOG_NONBLOCK` mode will report when the log reading is done with an `EAGAIN` error return 
code, otherwise the `android_logger_list_read()` call will block for new entries.

The `ANDROID_LOG_WRAP` mode flag to the `android_logger_list_alloc_time()` signals logd to quiesce
the reader until the buffer is about to prune at the start time then proceed to dumping content.
@@ -130,14 +129,12 @@ The `ANDROID_LOG_PSTORE` mode flag to the `android_logger_open()` is used to swi
logs to the persistent logs from before the last reboot.

The value returned by `android_logger_open()` can be used as a parameter to the
`android_logger_clear()` function to empty the sub-log.  It is recommended to only open log
`ANDROID_LOG_WRONLY` in that case.
`android_logger_clear()` function to empty the sub-log.

The value returned by `android_logger_open()` can be used as a parameter to the
`android_logger_get_log_(size|readable_size|version)` to retrieve the sub-log maximum size, readable
size and log buffer format protocol version respectively.  `android_logger_get_id()` returns the id
that was used when opening the sub-log.  It is recommended to open the log `ANDROID_LOG_RDONLY` in
these cases.
that was used when opening the sub-log.

Errors
------
+0 −4
Original line number Diff line number Diff line
@@ -141,10 +141,6 @@ ssize_t android_logger_get_prune_list(struct logger_list* logger_list,
                                      char* buf, size_t len);
int android_logger_set_prune_list(struct logger_list* logger_list, const char* buf, size_t len);

#define ANDROID_LOG_RDONLY O_RDONLY
#define ANDROID_LOG_WRONLY O_WRONLY
#define ANDROID_LOG_RDWR O_RDWR
#define ANDROID_LOG_ACCMODE O_ACCMODE
#ifndef O_NONBLOCK
#define ANDROID_LOG_NONBLOCK 0x00000800
#else
+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ ssize_t __android_log_pmsg_file_read(log_id_t logId, char prio, const char* pref
  /* Add just enough clues in logger_list and transp to make API function */
  memset(&logger_list, 0, sizeof(logger_list));

  logger_list.mode = ANDROID_LOG_PSTORE | ANDROID_LOG_NONBLOCK | ANDROID_LOG_RDONLY;
  logger_list.mode = ANDROID_LOG_PSTORE | ANDROID_LOG_NONBLOCK;
  logger_list.log_mask = (unsigned)-1;
  if (logId != LOG_ID_ANY) {
    logger_list.log_mask = (1 << logId);
+2 −4
Original line number Diff line number Diff line
@@ -648,8 +648,7 @@ static const int alarm_time = 3;
static void BM_log_latency(benchmark::State& state) {
  pid_t pid = getpid();

  struct logger_list* logger_list =
      android_logger_list_open(LOG_ID_EVENTS, ANDROID_LOG_RDONLY, 0, pid);
  struct logger_list* logger_list = android_logger_list_open(LOG_ID_EVENTS, 0, 0, pid);

  if (!logger_list) {
    fprintf(stderr, "Unable to open events log: %s\n", strerror(errno));
@@ -723,8 +722,7 @@ static void caught_delay(int /*signum*/) {
static void BM_log_delay(benchmark::State& state) {
  pid_t pid = getpid();

  struct logger_list* logger_list =
      android_logger_list_open(LOG_ID_EVENTS, ANDROID_LOG_RDONLY, 0, pid);
  struct logger_list* logger_list = android_logger_list_open(LOG_ID_EVENTS, 0, 0, pid);

  if (!logger_list) {
    fprintf(stderr, "Unable to open events log: %s\n", strerror(errno));
Loading