Re: IDL issue - struct return vs. cap return

"Jonathan S. Shapiro" <[email protected]>
Newsgroups gmane.os.hurd.l4
Organization The EROS Group, LLC
Message-ID <[email protected]>
On Mon, 2007-07-09 at 23:24 +0200, Neal H. Walfield wrote:
> > Because cap_t is a reference, you basically have two options if you want
> > to return a cap_t from an IDL procedure:
> > 
> >   1. Use a well-known return location, e.g. capability register 2.
> >   2. Call the capability location allocator from inside the stub, as
> >      in:
> > 
> >      f() {
> >       cap_t _retVal = alloc_cap_location();
> >       DO_SYSCALL_HERE(_retVal);
> >       return _retVal;
> >     }
> 
> 3. The caller provides the address of the slot in which the function
>    should store the capability.  (You want this for the same reasons
>    you may not necessarily want a function to call malloc.)

This is exactly what happens when the return value is rotated to be an
OUT parameter.

What you seem to be advocating is that the location be passed in and
then be passed back out. What advantage is there to this?

shap
-- 
Jonathan S. Shapiro, Ph.D.
Managing Director
The EROS Group, LLC
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.