[Tarantool-patches] [PATCH 14/16] sio: increase SERVICE_NAME_MAXLEN size

Cyrill Gorcunov gorcunov at gmail.com
Tue Mar 23 09:56:48 MSK 2021


On Mon, Mar 22, 2021 at 11:32:14PM +0100, Vladislav Shpilevoy wrote:
> > 
> > Actually IPv6 may include a scope as well. Currently at least
> > libc indeed does limit it to 45 symbols plus eos mark so we're
> > safe. Still 200 seems to be much over the top, maybe 128 instead?
> 
> I decided to be paranoid and made it 200 deliberately. Anyway it is
> not used in any swarm allocations. 128 seems right on the edge. You
> can have 108 bytes of Unix socket path, + strlen("unix/:"). It is
> already 114.
> 
> Also it is used for sio_socketname(), where you have addr str (114)
> + strlen(", aka ")(6) + strlen(", peer of ")(10), which is already
> 130 total.

Aha! Thanks for explanation.

> > Also pow2 gonna be easier to manage by any memory manager.
> 
> It would matter if the buffer would be ever allocated on its own.
> But it is always either on the stack, or inside of another structure,
> where total size is not a power of 2 anyway, most likely.

FWIW the data on stack always allocated by size of stack line, ie pow2.
But dosn't matter, 200 should be fine, thanks!


More information about the Tarantool-patches mailing list