Justus Winter, le Wed 11 Dec 2013 13:04:00 +0100, a écrit :
> Currently, rpctrace dies if a tracee uses select(2) because it asserts
> that reply_type is a MACH_MSG_TYPE_PORT_SEND_ONCE right.  Generalize
> the code surrounding the failing assertion.

Ack.

> * utils/rpctrace.c (trace_and_forward): Generalize code by switching
> over reply_type.
> ---
>  utils/rpctrace.c |   40 +++++++++++++++++++++++-----------------
>  1 file changed, 23 insertions(+), 17 deletions(-)
> 
> diff --git a/utils/rpctrace.c b/utils/rpctrace.c
> index 9433ef3..5d3b2ca 100644
> --- a/utils/rpctrace.c
> +++ b/utils/rpctrace.c
> @@ -1284,24 +1284,30 @@ trace_and_forward (mach_msg_header_t *inp, 
> mach_msg_header_t *outp)
>       /* The reply port might be dead, e.g., the traced task has died. */
>       && MACH_PORT_VALID (inp->msgh_local_port))
>        {
> -     struct send_once_info *info;
> -     // TODO is the reply port always a send once right?
> -     assert (reply_type == MACH_MSG_TYPE_PORT_SEND_ONCE);
> -     info = new_send_once_wrapper (inp->msgh_local_port,
> -                                   &inp->msgh_local_port);
> -     reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
> -     assert (inp->msgh_local_port);
> -
> -     if (TRACED_INFO (info)->name == 0)
> +     switch (reply_type)
>         {
> -         if (msgid == 0)
> -           asprintf (&TRACED_INFO (info)->name, "reply(%u:%u)",
> -                     (unsigned int) TRACED_INFO (info)->pi.port_right,
> -                     (unsigned int) inp->msgh_id);
> -         else
> -           asprintf (&TRACED_INFO (info)->name, "reply(%u:%s)",
> -                     (unsigned int) TRACED_INFO (info)->pi.port_right,
> -                     msgid->name);
> +       case MACH_MSG_TYPE_PORT_SEND_ONCE:;
> +         struct send_once_info *info;
> +         info = new_send_once_wrapper (inp->msgh_local_port,
> +                                       &inp->msgh_local_port);
> +         reply_type = MACH_MSG_TYPE_MAKE_SEND_ONCE;
> +         assert (inp->msgh_local_port);
> +
> +         if (TRACED_INFO (info)->name == 0)
> +           {
> +             if (msgid == 0)
> +               asprintf (&TRACED_INFO (info)->name, "reply(%u:%u)",
> +                         (unsigned int) TRACED_INFO (info)->pi.port_right,
> +                         (unsigned int) inp->msgh_id);
> +             else
> +               asprintf (&TRACED_INFO (info)->name, "reply(%u:%s)",
> +                         (unsigned int) TRACED_INFO (info)->pi.port_right,
> +                         msgid->name);
> +           }
> +         break;
> +
> +       default:
> +         error (1, 0, "Reply type %i not handled", reply_type);
>         }
>        }
>  
> -- 
> 1.7.10.4
> 

-- 
Samuel
Linux, c'est simple : ça s'adresse à une machine qui est parfois un peu
maraboutée mais qui d'habitude n'a pas d'états d'âme. Sur Usenet y'a
plein d'humains et de primates, et ça devient vraiment gore par moment.
-+- TP in : Guide du linuxien pervers - "Le linuxien a-t-il une âme ?" -+-

Reply via email to