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

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

Merge "logcat: remove the rest of liblogcat" am: 20d02ca4 am: f6fb4303

am: 0542463e

Change-Id: Idcb8e4945418538b25003e1088789d0f49ad448a
parents 093bc18e 0542463e
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ cc_defaults {
        "-Wall",
        "-Wall",
        "-Wextra",
        "-Wextra",
        "-Werror",
        "-Werror",
        "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
    ],
    ],
    shared_libs: [
    shared_libs: [
        "libbase",
        "libbase",
+238 −673

File changed.

Preview size limit exceeded, changes collapsed.

+1 −42
Original line number Original line Diff line number Diff line
@@ -16,45 +16,4 @@


#pragma once
#pragma once


#include <stdio.h>
int RunLogcat(int argc, char** argv);

 No newline at end of file
/*
 * The opaque context
 */
typedef struct android_logcat_context_internal* android_logcat_context;

/* Creates a context associated with this logcat instance
 *
 * Returns a pointer to the context, or a NULL on error.
 */
android_logcat_context create_android_logcat();

/* Collects and outputs the logcat data to output and error file descriptors
 *
 * Will block, performed in-thread and in-process
 *
 * The output file descriptor variable, if greater than or equal to 0, is
 * where the output (ie: stdout) will be sent. The file descriptor is closed
 * on android_logcat_destroy which terminates the instance, or when an -f flag
 * (output redirect to a file) is present in the command.  The error file
 * descriptor variable, if greater than or equal to 0, is where the error
 * stream (ie: stderr) will be sent, also closed on android_logcat_destroy.
 * The error file descriptor can be set to equal to the output file descriptor,
 * which will mix output and error stream content, and will defer closure of
 * the file descriptor on -f flag redirection.  Negative values for the file
 * descriptors will use stdout and stderr FILE references respectively
 * internally, and will not close the references as noted above.
 *
 * Return value is 0 for success, non-zero for errors.
 */
int android_logcat_run_command(android_logcat_context ctx, int output, int error, int argc,
                               char* const* argv, char* const* envp);

/* Finished with context
 *
 * Kill the command thread ASAP (if any), and free up all associated resources.
 *
 * Return value is the result of the android_logcat_run_command, or
 * non-zero for any errors.
 */
int android_logcat_destroy(android_logcat_context* ctx);
+2 −7
Original line number Original line Diff line number Diff line
@@ -19,12 +19,7 @@


#include "logcat.h"
#include "logcat.h"


int main(int argc, char** argv, char** envp) {
int main(int argc, char** argv) {
    android_logcat_context ctx = create_android_logcat();
    if (!ctx) return -1;
    signal(SIGPIPE, exit);
    signal(SIGPIPE, exit);
    int retval = android_logcat_run_command(ctx, -1, -1, argc, argv, envp);
    return RunLogcat(argc, argv);
    int ret = android_logcat_destroy(&ctx);
    if (!ret) ret = retval;
    return ret;
}
}
+3 −10
Original line number Original line Diff line number Diff line
@@ -23,10 +23,7 @@


#include "logcat.h"
#include "logcat.h"


int main(int argc, char** argv, char** envp) {
int main(int argc, char** argv) {
    android_logcat_context ctx = create_android_logcat();
    if (!ctx) return -1;

    signal(SIGPIPE, exit);
    signal(SIGPIPE, exit);


    // Save and detect presence of -L or --last flag
    // Save and detect presence of -L or --last flag
@@ -46,8 +43,7 @@ int main(int argc, char** argv, char** envp) {
    int ret = 0;
    int ret = 0;
    if (last) {
    if (last) {
        // Run logcat command with -L flag
        // Run logcat command with -L flag
        ret = android_logcat_run_command(ctx, -1, -1, argv_hold.size() - 1,
        ret = RunLogcat(argv_hold.size() - 1, (char**)&argv_hold[0]);
                                         (char* const*)&argv_hold[0], envp);
        // Remove -L and --last flags from argument list
        // Remove -L and --last flags from argument list
        for (std::vector<const char*>::iterator it = argv_hold.begin();
        for (std::vector<const char*>::iterator it = argv_hold.begin();
             it != argv_hold.end();) {
             it != argv_hold.end();) {
@@ -62,10 +58,7 @@ int main(int argc, char** argv, char** envp) {
    }
    }


    // Run logcat command without -L flag
    // Run logcat command without -L flag
    int retval = android_logcat_run_command(ctx, -1, -1, argv_hold.size() - 1,
    int retval = RunLogcat(argv_hold.size() - 1, (char**)&argv_hold[0]);
                                            (char* const*)&argv_hold[0], envp);
    if (!ret) ret = retval;
    retval = android_logcat_destroy(&ctx);
    if (!ret) ret = retval;
    if (!ret) ret = retval;
    return ret;
    return ret;
}
}