Lines Matching refs:tcp

329 update_personality(struct tcb *tcp, unsigned int personality)  in update_personality()  argument
335 if (personality == tcp->currpers) in update_personality()
337 tcp->currpers = personality; in update_personality()
355 tcp->pid, names[personality]); in update_personality()
567 decode_socket_subcall(struct tcb *tcp) in decode_socket_subcall() argument
572 if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= SYS_socket_nsubcalls) in decode_socket_subcall()
575 tcp->scno = SYS_socket_subcall + tcp->u_arg[0]; in decode_socket_subcall()
576 tcp->qual_flg = qual_flags[tcp->scno]; in decode_socket_subcall()
577 tcp->s_ent = &sysent[tcp->scno]; in decode_socket_subcall()
578 addr = tcp->u_arg[1]; in decode_socket_subcall()
579 n = tcp->s_ent->nargs; in decode_socket_subcall()
580 if (sizeof(tcp->u_arg[0]) == current_wordsize) { in decode_socket_subcall()
581 memset(tcp->u_arg, 0, n * sizeof(tcp->u_arg[0])); in decode_socket_subcall()
582 (void) umoven(tcp, addr, n * sizeof(tcp->u_arg[0]), tcp->u_arg); in decode_socket_subcall()
588 (void) umove(tcp, addr, &args); in decode_socket_subcall()
590 tcp->u_arg[i] = args[i]; in decode_socket_subcall()
597 decode_ipc_subcall(struct tcb *tcp) in decode_ipc_subcall() argument
601 if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= SYS_ipc_nsubcalls) in decode_ipc_subcall()
604 tcp->scno = SYS_ipc_subcall + tcp->u_arg[0]; in decode_ipc_subcall()
605 tcp->qual_flg = qual_flags[tcp->scno]; in decode_ipc_subcall()
606 tcp->s_ent = &sysent[tcp->scno]; in decode_ipc_subcall()
607 n = tcp->s_ent->nargs; in decode_ipc_subcall()
609 tcp->u_arg[i] = tcp->u_arg[i + 1]; in decode_ipc_subcall()
615 decode_mips_subcall(struct tcb *tcp) in decode_mips_subcall() argument
617 if (!SCNO_IS_VALID(tcp->u_arg[0])) in decode_mips_subcall()
619 tcp->scno = tcp->u_arg[0]; in decode_mips_subcall()
620 tcp->qual_flg = qual_flags[tcp->scno]; in decode_mips_subcall()
621 tcp->s_ent = &sysent[tcp->scno]; in decode_mips_subcall()
622 memmove(&tcp->u_arg[0], &tcp->u_arg[1], in decode_mips_subcall()
623 sizeof(tcp->u_arg) - sizeof(tcp->u_arg[0])); in decode_mips_subcall()
633 return printargs(tcp); in SYS_FUNC()
638 printargs(struct tcb *tcp) in printargs() argument
640 if (entering(tcp)) { in printargs()
642 int n = tcp->s_ent->nargs; in printargs()
644 tprintf("%s%#lx", i ? ", " : "", tcp->u_arg[i]); in printargs()
650 printargs_lu(struct tcb *tcp) in printargs_lu() argument
652 if (entering(tcp)) { in printargs_lu()
654 int n = tcp->s_ent->nargs; in printargs_lu()
656 tprintf("%s%lu", i ? ", " : "", tcp->u_arg[i]); in printargs_lu()
662 printargs_ld(struct tcb *tcp) in printargs_ld() argument
664 if (entering(tcp)) { in printargs_ld()
666 int n = tcp->s_ent->nargs; in printargs_ld()
668 tprintf("%s%ld", i ? ", " : "", tcp->u_arg[i]); in printargs_ld()
674 dumpio(struct tcb *tcp) in dumpio() argument
678 if (syserror(tcp)) in dumpio()
680 if ((unsigned long) tcp->u_arg[0] >= num_quals) in dumpio()
682 sen = tcp->s_ent->sen; in dumpio()
685 if (qual_flags[tcp->u_arg[0]] & QUAL_READ) { in dumpio()
691 dumpstr(tcp, tcp->u_arg[1], tcp->u_rval); in dumpio()
694 dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); in dumpio()
697 dumpiov_in_msghdr(tcp, tcp->u_arg[1]); in dumpio()
700 dumpiov_in_mmsghdr(tcp, tcp->u_arg[1]); in dumpio()
704 if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE) { in dumpio()
710 dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); in dumpio()
713 dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]); in dumpio()
716 dumpiov_in_msghdr(tcp, tcp->u_arg[1]); in dumpio()
719 dumpiov_in_mmsghdr(tcp, tcp->u_arg[1]); in dumpio()
785 static int arch_get_scno(struct tcb *tcp);
792 trace_syscall_entering(struct tcb *tcp) in trace_syscall_entering() argument
796 scno_good = res = get_scno(tcp); in trace_syscall_entering()
800 res = get_syscall_args(tcp); in trace_syscall_entering()
803 printleader(tcp); in trace_syscall_entering()
806 else if (tcp->qual_flg & UNDEFINED_SCNO) in trace_syscall_entering()
807 tprintf("%s(", syscall_name(tcp->scno)); in trace_syscall_entering()
809 tprintf("%s(", tcp->s_ent->sys_name); in trace_syscall_entering()
818 if (SEN_syscall == tcp->s_ent->sen) in trace_syscall_entering()
819 decode_mips_subcall(tcp); in trace_syscall_entering()
822 if ( SEN_execve == tcp->s_ent->sen in trace_syscall_entering()
824 || SEN_execv == tcp->s_ent->sen in trace_syscall_entering()
831 switch (tcp->s_ent->sen) { in trace_syscall_entering()
834 decode_socket_subcall(tcp); in trace_syscall_entering()
839 decode_ipc_subcall(tcp); in trace_syscall_entering()
845 if (!(tcp->qual_flg & QUAL_TRACE) in trace_syscall_entering()
846 || (tracing_paths && !pathtrace_match(tcp)) in trace_syscall_entering()
848 tcp->flags |= TCB_INSYSCALL | TCB_FILTERED; in trace_syscall_entering()
849 tcp->sys_func_rval = 0; in trace_syscall_entering()
853 tcp->flags &= ~TCB_FILTERED; in trace_syscall_entering()
862 if (tcp->s_ent->sys_flags & STACKTRACE_CAPTURE_ON_ENTER) in trace_syscall_entering()
863 unwind_capture_stacktrace(tcp); in trace_syscall_entering()
867 printleader(tcp); in trace_syscall_entering()
868 if (tcp->qual_flg & UNDEFINED_SCNO) in trace_syscall_entering()
869 tprintf("%s(", syscall_name(tcp->scno)); in trace_syscall_entering()
871 tprintf("%s(", tcp->s_ent->sys_name); in trace_syscall_entering()
872 if ((tcp->qual_flg & QUAL_RAW) && SEN_exit != tcp->s_ent->sen) in trace_syscall_entering()
873 res = printargs(tcp); in trace_syscall_entering()
875 res = tcp->s_ent->sys_func(tcp); in trace_syscall_entering()
877 fflush(tcp->outf); in trace_syscall_entering()
879 tcp->flags |= TCB_INSYSCALL; in trace_syscall_entering()
880 tcp->sys_func_rval = res; in trace_syscall_entering()
883 gettimeofday(&tcp->etime, NULL); in trace_syscall_entering()
888 trace_syscall_exiting(struct tcb *tcp) in trace_syscall_exiting() argument
901 if (tcp->s_ent->sys_flags & STACKTRACE_INVALIDATE_CACHE) in trace_syscall_exiting()
902 unwind_cache_invalidate(tcp); in trace_syscall_exiting()
907 update_personality(tcp, tcp->currpers); in trace_syscall_exiting()
909 res = (get_regs_error ? -1 : get_syscall_result(tcp)); in trace_syscall_exiting()
910 if (filtered(tcp) || hide_log_until_execve) in trace_syscall_exiting()
914 count_syscall(tcp, &tv); in trace_syscall_exiting()
929 if ((followfork < 2 && printing_tcp != tcp) || (tcp->flags & TCB_REPRINT)) { in trace_syscall_exiting()
930 tcp->flags &= ~TCB_REPRINT; in trace_syscall_exiting()
931 printleader(tcp); in trace_syscall_exiting()
932 if (tcp->qual_flg & UNDEFINED_SCNO) in trace_syscall_exiting()
933 tprintf("<... %s resumed> ", syscall_name(tcp->scno)); in trace_syscall_exiting()
935 tprintf("<... %s resumed> ", tcp->s_ent->sys_name); in trace_syscall_exiting()
937 printing_tcp = tcp; in trace_syscall_exiting()
939 tcp->s_prev_ent = NULL; in trace_syscall_exiting()
946 tcp->flags &= ~TCB_INSYSCALL; in trace_syscall_exiting()
947 tcp->sys_func_rval = 0; in trace_syscall_exiting()
950 tcp->s_prev_ent = tcp->s_ent; in trace_syscall_exiting()
953 if (tcp->qual_flg & QUAL_RAW) { in trace_syscall_exiting()
964 if (not_failing_only && tcp->u_error) in trace_syscall_exiting()
966 if (tcp->sys_func_rval & RVAL_DECODED) in trace_syscall_exiting()
967 sys_res = tcp->sys_func_rval; in trace_syscall_exiting()
969 sys_res = tcp->s_ent->sys_func(tcp); in trace_syscall_exiting()
974 u_error = tcp->u_error; in trace_syscall_exiting()
975 if (tcp->qual_flg & QUAL_RAW) { in trace_syscall_exiting()
979 tprintf("= %#lx", tcp->u_rval); in trace_syscall_exiting()
1046 if ((sys_res & RVAL_STR) && tcp->auxstr) in trace_syscall_exiting()
1047 tprintf(" (%s)", tcp->auxstr); in trace_syscall_exiting()
1058 (unsigned int) tcp->u_rval); in trace_syscall_exiting()
1061 tprintf("= %#lx", tcp->u_rval); in trace_syscall_exiting()
1064 tprintf("= %#lo", tcp->u_rval); in trace_syscall_exiting()
1067 tprintf("= %lu", tcp->u_rval); in trace_syscall_exiting()
1070 tprintf("= %ld", tcp->u_rval); in trace_syscall_exiting()
1075 printfd(tcp, tcp->u_rval); in trace_syscall_exiting()
1078 tprintf("= %ld", tcp->u_rval); in trace_syscall_exiting()
1090 tprintf("= %llu", tcp->u_lrval); in trace_syscall_exiting()
1103 if ((sys_res & RVAL_STR) && tcp->auxstr) in trace_syscall_exiting()
1104 tprintf(" (%s)", tcp->auxstr); in trace_syscall_exiting()
1107 tv_sub(&tv, &tv, &tcp->etime); in trace_syscall_exiting()
1112 dumpio(tcp); in trace_syscall_exiting()
1117 unwind_print_stacktrace(tcp); in trace_syscall_exiting()
1121 tcp->flags &= ~TCB_INSYSCALL; in trace_syscall_exiting()
1122 tcp->sys_func_rval = 0; in trace_syscall_exiting()
1127 trace_syscall(struct tcb *tcp) in trace_syscall() argument
1129 return exiting(tcp) ? in trace_syscall()
1130 trace_syscall_exiting(tcp) : trace_syscall_entering(tcp); in trace_syscall()
1134 is_erestart(struct tcb *tcp) in is_erestart() argument
1136 switch (tcp->u_error) { in is_erestart()
1150 temporarily_clear_syserror(struct tcb *tcp) in temporarily_clear_syserror() argument
1152 saved_u_error = tcp->u_error; in temporarily_clear_syserror()
1153 tcp->u_error = 0; in temporarily_clear_syserror()
1157 restore_cleared_syserror(struct tcb *tcp) in restore_cleared_syserror() argument
1159 tcp->u_error = saved_u_error; in restore_cleared_syserror()
1201 print_pc(struct tcb *tcp) in print_pc() argument
1208 # define ARCH_GET_PC upeek(tcp->pid, ARCH_PC_PEEK_ADDR, &pc) in print_pc()
1301 get_scno(struct tcb *tcp) in get_scno() argument
1306 int rc = arch_get_scno(tcp); in get_scno()
1310 if (SCNO_IS_VALID(tcp->scno)) { in get_scno()
1311 tcp->s_ent = &sysent[tcp->scno]; in get_scno()
1312 tcp->qual_flg = qual_flags[tcp->scno]; in get_scno()
1320 tcp->s_ent = &unknown; in get_scno()
1321 tcp->qual_flg = UNDEFINED_SCNO | QUAL_RAW | DEFAULT_QUAL_FLAGS; in get_scno()
1323 error_msg("pid %d invalid syscall %ld", tcp->pid, tcp->scno); in get_scno()
1338 get_syscall_result(struct tcb *tcp) in get_syscall_result() argument
1341 if (get_syscall_result_regs(tcp)) in get_syscall_result()
1344 tcp->u_error = 0; in get_syscall_result()
1345 get_error(tcp, !(tcp->s_ent->sys_flags & SYSCALL_NEVER_FAILS)); in get_syscall_result()