Loading Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -813,6 +813,7 @@ gensrcs { ], ], srcs: [ srcs: [ "core/proto/android/os/backtrace.proto", "core/proto/android/os/batterytype.proto", "core/proto/android/os/batterytype.proto", "core/proto/android/os/cpufreq.proto", "core/proto/android/os/cpufreq.proto", "core/proto/android/os/cpuinfo.proto", "core/proto/android/os/cpuinfo.proto", Loading cmds/incidentd/Android.mk +8 −2 Original line number Original line Diff line number Diff line Loading @@ -15,8 +15,10 @@ LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir) # proto files used in incidentd to generate cppstream proto headers. # proto files used in incidentd to generate cppstream proto headers. PROTO_FILES:= frameworks/base/core/proto/android/util/log.proto \ PROTO_FILES:= \ frameworks/base/core/proto/android/os/data.proto frameworks/base/core/proto/android/os/backtrace.proto \ frameworks/base/core/proto/android/os/data.proto \ frameworks/base/core/proto/android/util/log.proto # ========= # # ========= # # incidentd # # incidentd # Loading Loading @@ -46,6 +48,8 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libbase \ libbinder \ libbinder \ libcutils \ libcutils \ libdebuggerd_client \ libdumputils \ libincident \ libincident \ liblog \ liblog \ libprotobuf-cpp-lite \ libprotobuf-cpp-lite \ Loading Loading @@ -119,6 +123,8 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libbase \ libbinder \ libbinder \ libcutils \ libcutils \ libdebuggerd_client \ libdumputils \ libincident \ libincident \ liblog \ liblog \ libprotobuf-cpp-lite \ libprotobuf-cpp-lite \ Loading cmds/incidentd/incidentd.rc +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ service incidentd /system/bin/incidentd class main class main user incidentd user incidentd group incidentd log readproc group incidentd log readproc capabilities KILL SYS_PTRACE on post-fs-data on post-fs-data # Create directory for incidentd # Create directory for incidentd Loading cmds/incidentd/src/FdBuffer.cpp +29 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,35 @@ status_t FdBuffer::read(int fd, int64_t timeout) { return NO_ERROR; return NO_ERROR; } } status_t FdBuffer::readFully(int fd) { mStartTime = uptimeMillis(); while (true) { if (mBuffer.size() >= MAX_BUFFER_COUNT * BUFFER_SIZE) { // Don't let it get too big. mTruncated = true; VLOG("Truncating data"); break; } if (mBuffer.writeBuffer() == NULL) return NO_MEMORY; ssize_t amt = TEMP_FAILURE_RETRY(::read(fd, mBuffer.writeBuffer(), mBuffer.currentToWrite())); if (amt < 0) { VLOG("Fail to read %d: %s", fd, strerror(errno)); return -errno; } else if (amt == 0) { VLOG("Done reading %zu bytes", mBuffer.size()); // We're done. break; } mBuffer.wp()->move(amt); } mFinishTime = uptimeMillis(); return NO_ERROR; } status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs, status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs, const bool isSysfs) { const bool isSysfs) { struct pollfd pfds[] = { struct pollfd pfds[] = { Loading cmds/incidentd/src/FdBuffer.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,12 @@ public: */ */ status_t read(int fd, int64_t timeoutMs); status_t read(int fd, int64_t timeoutMs); /** * Read the data until we hit eof. * Returns NO_ERROR if there were no errors. */ status_t readFully(int fd); /** /** * Read processed results by streaming data to a parsing process, e.g. incident helper. * Read processed results by streaming data to a parsing process, e.g. incident helper. * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function Loading Loading
Android.bp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -813,6 +813,7 @@ gensrcs { ], ], srcs: [ srcs: [ "core/proto/android/os/backtrace.proto", "core/proto/android/os/batterytype.proto", "core/proto/android/os/batterytype.proto", "core/proto/android/os/cpufreq.proto", "core/proto/android/os/cpufreq.proto", "core/proto/android/os/cpuinfo.proto", "core/proto/android/os/cpuinfo.proto", Loading
cmds/incidentd/Android.mk +8 −2 Original line number Original line Diff line number Diff line Loading @@ -15,8 +15,10 @@ LOCAL_PATH:= $(call my-dir) LOCAL_PATH:= $(call my-dir) # proto files used in incidentd to generate cppstream proto headers. # proto files used in incidentd to generate cppstream proto headers. PROTO_FILES:= frameworks/base/core/proto/android/util/log.proto \ PROTO_FILES:= \ frameworks/base/core/proto/android/os/data.proto frameworks/base/core/proto/android/os/backtrace.proto \ frameworks/base/core/proto/android/os/data.proto \ frameworks/base/core/proto/android/util/log.proto # ========= # # ========= # # incidentd # # incidentd # Loading Loading @@ -46,6 +48,8 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libbase \ libbinder \ libbinder \ libcutils \ libcutils \ libdebuggerd_client \ libdumputils \ libincident \ libincident \ liblog \ liblog \ libprotobuf-cpp-lite \ libprotobuf-cpp-lite \ Loading Loading @@ -119,6 +123,8 @@ LOCAL_SHARED_LIBRARIES := \ libbase \ libbase \ libbinder \ libbinder \ libcutils \ libcutils \ libdebuggerd_client \ libdumputils \ libincident \ libincident \ liblog \ liblog \ libprotobuf-cpp-lite \ libprotobuf-cpp-lite \ Loading
cmds/incidentd/incidentd.rc +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ service incidentd /system/bin/incidentd class main class main user incidentd user incidentd group incidentd log readproc group incidentd log readproc capabilities KILL SYS_PTRACE on post-fs-data on post-fs-data # Create directory for incidentd # Create directory for incidentd Loading
cmds/incidentd/src/FdBuffer.cpp +29 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,35 @@ status_t FdBuffer::read(int fd, int64_t timeout) { return NO_ERROR; return NO_ERROR; } } status_t FdBuffer::readFully(int fd) { mStartTime = uptimeMillis(); while (true) { if (mBuffer.size() >= MAX_BUFFER_COUNT * BUFFER_SIZE) { // Don't let it get too big. mTruncated = true; VLOG("Truncating data"); break; } if (mBuffer.writeBuffer() == NULL) return NO_MEMORY; ssize_t amt = TEMP_FAILURE_RETRY(::read(fd, mBuffer.writeBuffer(), mBuffer.currentToWrite())); if (amt < 0) { VLOG("Fail to read %d: %s", fd, strerror(errno)); return -errno; } else if (amt == 0) { VLOG("Done reading %zu bytes", mBuffer.size()); // We're done. break; } mBuffer.wp()->move(amt); } mFinishTime = uptimeMillis(); return NO_ERROR; } status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs, status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs, const bool isSysfs) { const bool isSysfs) { struct pollfd pfds[] = { struct pollfd pfds[] = { Loading
cmds/incidentd/src/FdBuffer.h +6 −0 Original line number Original line Diff line number Diff line Loading @@ -40,6 +40,12 @@ public: */ */ status_t read(int fd, int64_t timeoutMs); status_t read(int fd, int64_t timeoutMs); /** * Read the data until we hit eof. * Returns NO_ERROR if there were no errors. */ status_t readFully(int fd); /** /** * Read processed results by streaming data to a parsing process, e.g. incident helper. * Read processed results by streaming data to a parsing process, e.g. incident helper. * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function Loading