adbd: receive jdwp pids from art as raw integers.
Don't go through a pointless conversion to hex that reduces our maximum pid to 64k. Bug: http://b/17661822 Test: `adb jdwp` Change-Id: Idd572eac827f3ed3825ac2cf55fc4db109e70854
This commit is contained in:
parent
bac72c884f
commit
86f39b4078
|
@ -124,9 +124,6 @@
|
|||
** for each JDWP process, we record its pid and its connected socket
|
||||
**/
|
||||
|
||||
// PIDs are transmitted as 4 hex digits in ascii.
|
||||
static constexpr size_t PID_LEN = 4;
|
||||
|
||||
static void jdwp_process_event(int socket, unsigned events, void* _proc);
|
||||
static void jdwp_process_list_updated(void);
|
||||
|
||||
|
@ -174,7 +171,7 @@ struct JdwpProcess {
|
|||
_jdwp_list.remove_if(pred);
|
||||
}
|
||||
|
||||
int pid = -1;
|
||||
int32_t pid = -1;
|
||||
int socket = -1;
|
||||
fdevent* fde = nullptr;
|
||||
|
||||
|
@ -221,17 +218,9 @@ static void jdwp_process_event(int socket, unsigned events, void* _proc) {
|
|||
|
||||
if (events & FDE_READ) {
|
||||
if (proc->pid < 0) {
|
||||
/* read the PID as a 4-hexchar string */
|
||||
char buf[PID_LEN + 1];
|
||||
ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, buf, PID_LEN, 0));
|
||||
if (rc != PID_LEN) {
|
||||
D("failed to read jdwp pid: %s", strerror(errno));
|
||||
goto CloseProcess;
|
||||
}
|
||||
buf[PID_LEN] = '\0';
|
||||
|
||||
if (sscanf(buf, "%04x", &proc->pid) != 1) {
|
||||
D("could not decode JDWP %p PID number: '%s'", proc, buf);
|
||||
ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, &proc->pid, sizeof(proc->pid), 0));
|
||||
if (rc != sizeof(proc->pid)) {
|
||||
D("failed to read jdwp pid: rc = %zd, errno = %s", rc, strerror(errno));
|
||||
goto CloseProcess;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue