[erlang-questions] erts_port_control() and binp

Salikhov Dinislam Dinislam.Salikhov@REDACTED
Fri Dec 9 16:00:15 CET 2016


Finally, I've figured it out:
bufp either contains a copy of data passed to port as binary or points 
to the data inside the passed binary.
In the latter case refcount of the binary is incremented and the pointer 
to binary is kept in binp field, so the buffer in use wouldn't be 
garbage collected.

Salikhov Dinislam

On 12/09/2016 04:19 PM, Salikhov Dinislam wrote:
> Hello!
>
> I'm looking through VM sources now.
> In erts/emulator/beam/erl_port.h there is a 'struct 
> ErtsProc2PortSigData_' with a union as the last field.
> One of the values of this union is 'struct control'.
> I'm interesting in the field binp of the struct control.
>
> I grepped through the sources and found that the struct is used only 
> in a few places in erts/emulator/beam/io.c
> Except the places where the field is set, it's used only as an 
> argument of cleanup_scheduled_control() in the same file.
> So what's the meaning of the field binp? What is it needed for?
>
> Salikhov Dinislam




More information about the erlang-questions mailing list