Lines Matching refs:tr
307 struct process *tr; /* target process */
313 tr = p->p_p;
314 mtx_enter(&tr->ps_mtx);
315 if (ISSET(tr->ps_flags, PS_TRACED)) {
316 mtx_leave(&tr->ps_mtx);
319 atomic_setbits_int(&tr->ps_flags, PS_TRACED);
320 tr->ps_opptr = tr->ps_pptr;
321 mtx_leave(&tr->ps_mtx);
322 if (tr->ps_ptstat == NULL)
323 tr->ps_ptstat = malloc(sizeof(*tr->ps_ptstat),
325 memset(tr->ps_ptstat, 0, sizeof(*tr->ps_ptstat));
333 if ((tr = prfind(pid)) == NULL) {
337 t = TAILQ_FIRST(&tr->ps_threads);
345 if ((tr = process_tprfind(pid, &t)) == NULL) {
361 if ((error = process_checktracestate(p->p_p, tr, t)))
371 if (tr == p->p_p) {
379 if (ISSET(tr->ps_flags, PS_SYSTEM)) {
387 if (ISSET(tr->ps_flags, PS_TRACED)) {
395 if (ISSET(tr->ps_flags, PS_INEXEC)) {
411 if ((tr->ps_ucred->cr_ruid != p->p_ucred->cr_ruid ||
412 ISSET(tr->ps_flags, PS_SUGIDEXEC | PS_SUGID)) &&
420 !inferior(tr, p->p_p) && (error = suser(p)) != 0)
429 if ((tr->ps_pid == 1) && (securelevel > -1)) {
439 if (tr->ps_pid != 1 && inferior(p->p_p, tr)) {
469 if (pid < THREAD_PID_OFFSET && tr->ps_single)
470 t = tr->ps_single;
471 else if (t == tr->ps_single)
507 if (pid < THREAD_PID_OFFSET && tr->ps_single)
508 t = tr->ps_single;
519 mtx_enter(&tr->ps_mtx);
520 process_untrace(tr);
521 atomic_clearbits_int(&tr->ps_flags, PS_WAITED);
522 mtx_leave(&tr->ps_mtx);
525 memset(tr->ps_ptstat, 0, sizeof(*tr->ps_ptstat));
529 tr->ps_xsig = data;
541 if (pid < THREAD_PID_OFFSET && tr->ps_single)
542 t = tr->ps_single;
558 mtx_enter(&tr->ps_mtx);
559 atomic_setbits_int(&tr->ps_flags, PS_TRACED);
560 tr->ps_opptr = tr->ps_pptr;
561 process_reparent(tr, p->p_p);
562 mtx_leave(&tr->ps_mtx);
563 if (tr->ps_ptstat == NULL)
564 tr->ps_ptstat = malloc(sizeof(*tr->ps_ptstat),
583 struct process *tr; /* target process */
590 if ((tr = prfind(pid)) == NULL)
593 if ((error = process_checktracestate(p->p_p, tr, NULL)))
604 t = tfind_user(pts->pts_tid, tr);
609 t = TAILQ_FIRST(&tr->ps_threads);
622 pe->pe_set_event = tr->ps_ptmask;
625 tr->ps_ptmask = pe->pe_set_event;
628 if (tr->ps_single)
629 tr->ps_ptstat->pe_tid =
630 tr->ps_single->p_tid + THREAD_PID_OFFSET;
631 memcpy(addr, tr->ps_ptstat, sizeof *tr->ps_ptstat);
649 struct process *tr; /* target process */
658 if ((tr = process_tprfind(pid, &t)) == NULL)
661 if ((error = process_checktracestate(p->p_p, tr, t)))
669 if ((error = process_checkioperm(p, tr)) != 0)
689 error = process_domem(p, tr, &uio, write ? PT_WRITE_I :
733 uio.uio_offset += tr->ps_auxinfo;
735 if (uio.uio_offset < (off_t)tr->ps_strings)
738 if (uio.uio_offset > (off_t)tr->ps_strings)
741 (off_t)tr->ps_strings)
742 uio.uio_resid = (off_t)tr->ps_strings -
749 error = process_domem(p, tr, &uio, req);
823 struct process *tr = prfind(tpid);
825 if (tr == NULL)
827 *tp = TAILQ_FIRST(&tr->ps_threads);
828 return tr;
834 * Check whether 'tr' is currently traced by 'curpr' and in a state
839 process_checktracestate(struct process *curpr, struct process *tr,
846 if (!ISSET(tr->ps_flags, PS_TRACED))
852 if (tr->ps_pptr != curpr)
858 if (ISSET(tr->ps_flags, PS_INEXEC))
865 (t->p_stat != SSTOP || !ISSET(tr->ps_flags, PS_WAITED)))
877 * tr = tracee
891 process_checkioperm(struct proc *p, struct process *tr)
895 if ((tr->ps_ucred->cr_ruid != p->p_ucred->cr_ruid ||
896 ISSET(tr->ps_flags, PS_SUGIDEXEC | PS_SUGID)) &&
900 if ((tr->ps_pid == 1) && (securelevel > -1))
903 if (ISSET(tr->ps_flags, PS_INEXEC))
910 process_domem(struct proc *curp, struct process *tr, struct uio *uio, int req)
921 if ((error = process_checkioperm(curp, tr)) != 0)
924 vm = tr->ps_vmspace;
925 if ((tr->ps_flags & PS_EXITING) || (vm->vm_refcnt < 1))
936 pmap_proc_iflush(tr, addr, len);