libasyncio: (tomj) document the magic behind MegaAddr
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 18 Nov 2008 09:21:27 +0000 (09:21 +0000)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Tue, 18 Nov 2008 09:21:27 +0000 (09:21 +0000)
asyncio/async_socket.cpp

index 468ceb3..34e04ef 100644 (file)
@@ -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;