[erlang-questions] Linked-in drivers: output and outputv callbacks

Joel Reymont joelr1@REDACTED
Thu Dec 13 22:30:34 CET 2007


Tony,

You misunderstood my question. It's not _what_ outputv does but how is  
it possible that efile_drv.c sets up both outputv and output callbacks  
and both seem to be called somehow.

At least I assume that they are both being called since the set of  
functions that the driver performs is split over the two callbacks.  
The read/write functions are in outputv and a whole bunch of others  
like mkdir are in output.

	Thanks, Joel

On Dec 13, 2007, at 8:28 PM, Tony Rogvall wrote:

> There is actually quite some descent docs to read here:
>
> http://www.erlang.org/doc/apps/erts/index.html
>
> void outputv(ErlDrvData drv_data, ErlIOVec *ev)
>
> This function is called whenever the port is written to. If it is  
> NULL, the output function is called instead. This function is faster  
> than output, because it takes an ErlIOVec directly, which requires  
> no copying of the data. The port should be in binary mode, see  
> open_port/2.
>
> The ErlIOVec contains both a SysIOVec, suitable for writev, and one  
> or more binaries. If these binaries should be retained, when the  
> driver returns from outputv, they can be queued (using  
> driver_enq_bin for instance), or if they are kept in a static or  
> global variable, the reference counter can be incremented.

--
http://wagerlabs.com








More information about the erlang-questions mailing list