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

Commit c05bd7b4 authored by Tom Cherry's avatar Tom Cherry Committed by android-build-merger
Browse files

Merge changes from topic "logcatd-shell"

am: 0ae12722

Change-Id: Ia437299ab7d069eafb2e35063e2b0c3b43c6543a
parents 4b2d9723 0ae12722
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -36,19 +36,13 @@ cc_binary {

    defaults: ["logcat_defaults"],
    srcs: [
        "logcat_main.cpp",
        "logcat.cpp",
    ],
}

cc_binary {
sh_binary {
    name: "logcatd",

    defaults: ["logcat_defaults"],
    srcs: [
        "logcatd_main.cpp",
        "logcat.cpp",
    ],
    src: "logcatd",
}

sh_binary {
+1 −3
Original line number Diff line number Diff line
@@ -14,8 +14,6 @@
 * limitations under the License.
 */

#include "logcat.h"

#include <ctype.h>
#include <dirent.h>
#include <errno.h>
@@ -1177,7 +1175,7 @@ int Logcat::Run(int argc, char** argv) {
    return EXIT_SUCCESS;
}

int RunLogcat(int argc, char** argv) {
int main(int argc, char** argv) {
    Logcat logcat;
    return logcat.Run(argc, argv);
}

logcat/logcat.h

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
/*
 * Copyright (C) 2005-2017 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.
 */

#pragma once

int RunLogcat(int argc, char** argv);
 No newline at end of file

logcat/logcat_main.cpp

deleted100644 → 0
+0 −25
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.
 */

#include <signal.h>
#include <stdlib.h>

#include "logcat.h"

int main(int argc, char** argv) {
    signal(SIGPIPE, exit);
    return RunLogcat(argc, argv);
}

logcat/logcatd

0 → 100755
+25 −0
Original line number Diff line number Diff line
#! /system/bin/sh

# This is primarily meant to be used by logpersist.  This script is run as an init service, which
# first reads the 'last' logcat to persistent storage with `-L` then run logcat again without
# `-L` to read the current logcat buffers to persistent storage.

has_last="false"
for arg in "$@"; do
  if [ "$arg" == "-L" -o "$arg" == "--last" ]; then
    has_last="true"
  fi
done

if [ "$has_last" == "true" ]; then
  logcat "$@"
fi

args_without_last=()
for arg in "$@"; do
  if [ "$arg" != "-L" -a "$arg" != "--last" ]; then
    ARGS+=("$arg")
  fi
done

exec logcat "${ARGS[@]}"
Loading