Skip to content
  • Lennart Poettering's avatar
    unix-fd: add message encoding/decoding for unix fds · a0cc21f8
    Lennart Poettering authored
    When appending unix fds to the message a new entry in the fd array will
    be allocated and the index to it will be written to the message payload.
    
    When parsing unix fds from the message the index will be read from the
    payload and then looked up in the fd array.
    
    When we read fds we put them in a queue first. Since each message knows
    how many fds are attached to it we will then pop enough fds from this
    queue each time we decode a message from the stream.
    
    This should make sending and receiving more portable since we don't make
    any strong requirements on the exact semantics of the SCM_RIGHTS
    implementation: as long as fds are recieved in order, none or lost and
    the arrive at the same time as at least one byte from the actual message
    dat we should be able to handle them correctly.
    a0cc21f8