diff --git a/adb/fdevent.cpp b/adb/fdevent.cpp index 1b7758c57..098a39dc1 100644 --- a/adb/fdevent.cpp +++ b/adb/fdevent.cpp @@ -21,6 +21,7 @@ #include "fdevent.h" #include +#include #include #include #include @@ -75,6 +76,8 @@ static std::atomic terminate_loop(false); static bool main_thread_valid; static uint64_t main_thread_id; +static uint64_t fdevent_id; + static bool run_needs_flush = false; static auto& run_queue_notify_fd = *new unique_fd(); static auto& run_queue_mutex = *new std::mutex(); @@ -111,7 +114,8 @@ static std::string dump_fde(const fdevent* fde) { if (fde->state & FDE_ERROR) { state += "E"; } - return android::base::StringPrintf("(fdevent %d %s)", fde->fd.get(), state.c_str()); + return android::base::StringPrintf("(fdevent %" PRIu64 ": fd %d %s)", fde->id, fde->fd.get(), + state.c_str()); } void fdevent_install(fdevent* fde, int fd, fd_func func, void* arg) { @@ -125,6 +129,7 @@ fdevent* fdevent_create(int fd, fd_func func, void* arg) { CHECK_GE(fd, 0); fdevent* fde = new fdevent(); + fde->id = fdevent_id++; fde->state = FDE_ACTIVE; fde->fd.reset(fd); fde->func = func; diff --git a/adb/fdevent.h b/adb/fdevent.h index 39fa9c262..d501b8660 100644 --- a/adb/fdevent.h +++ b/adb/fdevent.h @@ -32,6 +32,8 @@ typedef void (*fd_func)(int fd, unsigned events, void *userdata); struct fdevent { + uint64_t id; + unique_fd fd; int force_eof = 0;