[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sending ports in reply msg

From: Marcus Brinkmann
Subject: Re: sending ports in reply msg
Date: Fri, 13 Jul 2001 23:27:42 +0200
User-agent: Mutt/1.3.18i

On Thu, Jul 12, 2001 at 08:01:13PM -0400, Roland McGrath wrote:
> proc_setexecdata never deallocates the old port rights.

Isn't the following code doing the job?

  if (std_port_array)
      for (i = 0; i < n_std_ports; i++)
        mach_port_deallocate (mach_task_self (), std_port_array[i]);
      free (std_port_array);

> proc_getexecdata never sets its *portspoly out parameter, so garbage goes
> into the reply message.
> I think the only correct thing for proc_getexecdata to do is add a user ref
> to each port and then set *portspoly to MACH_MSG_TYPE_MOVE_SEND.

Together with a cleanup omission, I checked a fix in.
I don't check the return value of mach_port_mod_refs, as I don't think there
are reasonable error conditions.  Well, it wouldn't be too hard to roll back
at failure, if you want.  Just say so.

2001-07-13  Marcus Brinkmann  <marcus@gnu.org>

        * host.c (S_proc_getexecdata): New variable PORTS_ALLOCATED.
        Set it if we allocated a new buffer for PORTS.  If it is set,
        and allocation of a new buffer for INTS fails, unmap the buffer
        for PORTS.

        * host.c (S_proc_getexecdata): New variable I.  Go over all
        standard ports and increase the send right user reference by one.

`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]