Browse Source

LibC: Declare sockaddr_storage

This type is guaranteed to fit the largest sockaddr_foo supported by
the system. In our case, that's sockaddr_un.
Andreas Kling 5 years ago
parent
commit
eeb9042b8e
1 changed files with 7 additions and 0 deletions
  1. 7 0
      Libraries/LibC/sys/socket.h

+ 7 - 0
Libraries/LibC/sys/socket.h

@@ -86,6 +86,13 @@ struct ucred {
 #define SO_BINDTODEVICE 7
 #define SO_KEEPALIVE 9
 
+struct sockaddr_storage {
+    union {
+        char data[sizeof(sockaddr_un)];
+        void* alignment;
+    };
+};
+
 int socket(int domain, int type, int protocol);
 int bind(int sockfd, const struct sockaddr* addr, socklen_t);
 int listen(int sockfd, int backlog);