[saga-rg] Re: Meeting Notes: Messaging API

John Shalf jshalf at lbl.gov
Tue Nov 22 18:41:58 CST 2005


On Nov 22, 2005, at 3:21 PM, Andre Merzky wrote:
> Quoting [Andrei Hutanu] (Nov 22 2005):
>> Andre,
>>
>> Thanks for the notes!
>>
>>>
>>> - read: two step mechanism:
>>>   (int   handle, int size) = query_size ();
>>>   (char* buffer)           = read (handle, size);
>>>
>>>   - handle can be zero, if size is known (one step read)
>>>   - buffer needs to be allocated by application.
>>>   - if size is zero, the buffer is allocated by the
>>>     implementation and returned to be freed by the
>>>     application (one step read)
>>>
>>>
>> This part is a bit confusing .. with the one step read you lose the
>> length of the message?
>> it should probably be  (char* buffer, int size) = read () for the one
>> step read ..Or am I reading it wrong..
>
> No, you are probably right.  IIRC, we pinned down two
> different semantics for one step read:
>
>  a) size is known, malloc by application
>     (buffer) = read (handle = NULL, size);

The read should be like POSIX and return the buffer size rather than  
the buffer itself.

>  b) size unknown, malloc by implementation
>     (buffer, size) = read ();

Wait, I think Andre had it correct.  There is also a
     c) size unknown, but buffer is presized to what the application  
programmer expects to the the max message size.  Under this  
circumstance, you can do a single step read which returns the  
*actual* size of the read.  If the message was larger than the buffer  
size declared in the read(), then the read will be truncated and the  
truncated message data will be dropped.
	int read(handle, buffer, size)
	buffer is presumed to be "size" bytes in length.  Read returns the  
actual message size.  If message is larger than buffer size, then  
truncated data is dropped.

> Thanks, Andre.
>
>
>> Andrei
>
>
>
> -- 
> +-----------------------------------------------------------------+
> | Andre Merzky                      | phon: +31 - 20 - 598 - 7759 |
> | Vrije Universiteit Amsterdam (VU) | fax : +31 - 20 - 598 - 7653 |
> | Dept. of Computer Science         | mail: merzky at cs.vu.nl       |
> | De Boelelaan 1083a                | www:  http://www.merzky.net |
> | 1081 HV Amsterdam, Netherlands    |                             |
> +-----------------------------------------------------------------+





More information about the saga-rg mailing list