From: Thomas Jarosch Date: Tue, 18 Nov 2008 09:21:27 +0000 (+0000) Subject: libasyncio: (tomj) document the magic behind MegaAddr X-Git-Tag: v0.3~82 X-Git-Url: http://developer.intra2net.com/git/?p=libasyncio;a=commitdiff_plain;h=e4e9cd8cb934121d17d3d472b1846ffad6619dad libasyncio: (tomj) document the magic behind MegaAddr --- diff --git a/asyncio/async_socket.cpp b/asyncio/async_socket.cpp index 468ceb3..34e04ef 100644 --- a/asyncio/async_socket.cpp +++ b/asyncio/async_socket.cpp @@ -27,6 +27,16 @@ namespace struct sockaddr_un dummy_un; +/** + Struct for holding sockaddr. + + It's called "MegaAddr" because we use a trick to extend the historical UNIX domain socket + path length of 108 bytes to PATH_MAX by declaring a large enough buffer + at the end of the union. + + This works as long as the POSIX functions don't verify the buffer length. + For glibc on linux this is true. +*/ union MegaAddr { struct sockaddr m_addr; struct sockaddr_in m_addr_in;