Lines Matching refs:proc
147 JdwpProcess* proc = _jdwp_list.next; in jdwp_process_list() local
149 for ( ; proc != &_jdwp_list; proc = proc->next ) { in jdwp_process_list()
153 if (proc->pid < 0) in jdwp_process_list()
156 len = snprintf(p, end-p, "%d\n", proc->pid); in jdwp_process_list()
180 jdwp_process_free( JdwpProcess* proc ) in jdwp_process_free() argument
182 if (proc) { in jdwp_process_free()
185 proc->prev->next = proc->next; in jdwp_process_free()
186 proc->next->prev = proc->prev; in jdwp_process_free()
188 if (proc->socket >= 0) { in jdwp_process_free()
189 adb_shutdown(proc->socket); in jdwp_process_free()
190 adb_close(proc->socket); in jdwp_process_free()
191 proc->socket = -1; in jdwp_process_free()
194 if (proc->fde != NULL) { in jdwp_process_free()
195 fdevent_destroy(proc->fde); in jdwp_process_free()
196 proc->fde = NULL; in jdwp_process_free()
198 proc->pid = -1; in jdwp_process_free()
200 for (n = 0; n < proc->out_count; n++) { in jdwp_process_free()
201 adb_close(proc->out_fds[n]); in jdwp_process_free()
203 proc->out_count = 0; in jdwp_process_free()
205 free(proc); in jdwp_process_free()
218 JdwpProcess* proc = reinterpret_cast<JdwpProcess*>( in jdwp_process_alloc() local
219 calloc(1, sizeof(*proc))); in jdwp_process_alloc()
221 if (proc == NULL) { in jdwp_process_alloc()
226 proc->socket = socket; in jdwp_process_alloc()
227 proc->pid = -1; in jdwp_process_alloc()
228 proc->next = proc; in jdwp_process_alloc()
229 proc->prev = proc; in jdwp_process_alloc()
231 proc->fde = fdevent_create( socket, jdwp_process_event, proc ); in jdwp_process_alloc()
232 if (proc->fde == NULL) { in jdwp_process_alloc()
234 free(proc); in jdwp_process_alloc()
238 proc->fde->state |= FDE_DONT_CLOSE; in jdwp_process_alloc()
239 proc->in_len = 0; in jdwp_process_alloc()
240 proc->out_count = 0; in jdwp_process_alloc()
243 proc->next = &_jdwp_list; in jdwp_process_alloc()
244 proc->prev = proc->next->prev; in jdwp_process_alloc()
246 proc->prev->next = proc; in jdwp_process_alloc()
247 proc->next->prev = proc; in jdwp_process_alloc()
250 fdevent_add(proc->fde, FDE_READ); in jdwp_process_alloc()
252 return proc; in jdwp_process_alloc()
259 JdwpProcess* proc = reinterpret_cast<JdwpProcess*>(_proc); in jdwp_process_event() local
262 if (proc->pid < 0) { in jdwp_process_event()
264 char* p = proc->in_buff + proc->in_len; in jdwp_process_event()
265 int size = 4 - proc->in_len; in jdwp_process_event()
285 proc->in_len += len; in jdwp_process_event()
289 memcpy(temp, proc->in_buff, 4); in jdwp_process_event()
292 if (sscanf( temp, "%04x", &proc->pid ) != 1) { in jdwp_process_event()
293 D("could not decode JDWP %p PID number: '%s'", proc, temp); in jdwp_process_event()
298 D("Adding pid %d to jdwp process list", proc->pid); in jdwp_process_event()
316 D("terminating JDWP %d connection: %s", proc->pid, in jdwp_process_event()
323 proc->pid, len ); in jdwp_process_event()
328 if (proc->pid >= 0) { in jdwp_process_event()
329 D( "remove pid %d to jdwp process list", proc->pid ); in jdwp_process_event()
331 jdwp_process_free(proc); in jdwp_process_event()
338 proc->pid, proc->out_count, proc->out_fds[0]); in jdwp_process_event()
339 if (proc->out_count > 0) { in jdwp_process_event()
340 int fd = proc->out_fds[0]; in jdwp_process_event()
364 if (!set_file_block_mode(proc->socket, true)) { in jdwp_process_event()
365 VLOG(JDWP) << "failed to set blocking mode for fd " << proc->socket; in jdwp_process_event()
370 ret = sendmsg(proc->socket, &msg, 0); in jdwp_process_event()
378 proc->pid, strerror(errno)); in jdwp_process_event()
383 fd, proc->pid); in jdwp_process_event()
385 for (n = 1; n < proc->out_count; n++) in jdwp_process_event()
386 proc->out_fds[n-1] = proc->out_fds[n]; in jdwp_process_event()
388 if (!set_file_block_mode(proc->socket, false)) { in jdwp_process_event()
389 VLOG(JDWP) << "failed to set non-blocking mode for fd " << proc->socket; in jdwp_process_event()
393 if (--proc->out_count == 0) in jdwp_process_event()
394 fdevent_del( proc->fde, FDE_WRITE ); in jdwp_process_event()
403 JdwpProcess* proc = _jdwp_list.next; in create_jdwp_connection_fd() local
406 for ( ; proc != &_jdwp_list; proc = proc->next ) { in create_jdwp_connection_fd()
407 if (proc->pid == pid) { in create_jdwp_connection_fd()
418 if (proc->out_count >= MAX_OUT_FDS) { in create_jdwp_connection_fd()
431 proc->out_fds[ proc->out_count ] = fds[1]; in create_jdwp_connection_fd()
432 if (++proc->out_count == 1) in create_jdwp_connection_fd()
433 fdevent_add( proc->fde, FDE_WRITE ); in create_jdwp_connection_fd()
530 JdwpProcess* proc; in jdwp_control_event() local
550 proc = jdwp_process_alloc( s ); in jdwp_control_event()
551 if (proc == NULL) in jdwp_control_event()