Redundant code in trace_syscall_exiting()

haris iqbal haris.phnx at gmail.com
Tue Mar 8 05:25:47 UTC 2016


  if (tcp->qual_flg & QUAL_RAW) {
        /* sys_res = printargs(tcp); - but it's nop on sysexit */
    } else {
    /* FIXME: not_failing_only (IOW, option -z) is broken:
     * failure of syscall is known only after syscall return.
     * Thus we end up with something like this on, say, ENOENT:
     *     open("doesnt_exist", O_RDONLY <unfinished ...>
     *     {next syscall decode}
     * whereas the intended result is that open(...) line
     * is not shown at all.
     */
        if (not_failing_only && tcp->u_error)
            goto ret;   /* ignore failed syscalls */
        if (tcp->sys_func_rval & RVAL_DECODED)
            sys_res = tcp->sys_func_rval;
        else
            sys_res = tcp->s_ent->sys_func(tcp);
    }

This condition check in if seems redundant. Should I remove it with

if (!(tcp->qual_flg & QUAL_RAW))
{
  /* FIXME: not_failing_only (IOW, option -z) is broken:
     * failure of syscall is known only after syscall return.
     * Thus we end up with something like this on, say, ENOENT:
     *     open("doesnt_exist", O_RDONLY <unfinished ...>
     *     {next syscall decode}
     * whereas the intended result is that open(...) line
     * is not shown at all.
     */
        if (not_failing_only && tcp->u_error)
            goto ret;   /* ignore failed syscalls */
        if (tcp->sys_func_rval & RVAL_DECODED)
            sys_res = tcp->sys_func_rval;
        else
            sys_res = tcp->s_ent->sys_func(tcp);
}

-- 

With regards,

Md Haris Iqbal,
Placement Coordinator, MTech IT
NITK Surathkal,
Contact: +91 8861996962




More information about the Strace-devel mailing list