Mercurial > hg > nginx
comparison src/core/ngx_inet.c @ 3230:a7491af45540
http listen unix domain sockets
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 26 Oct 2009 11:43:32 +0000 |
parents | f9b5dfcc96d8 |
children | 0c5c5e876391 |
comparison
equal
deleted
inserted
replaced
3229:a632dc9f3e73 | 3230:a7491af45540 |
---|---|
65 u_char *p; | 65 u_char *p; |
66 struct sockaddr_in *sin; | 66 struct sockaddr_in *sin; |
67 #if (NGX_HAVE_INET6) | 67 #if (NGX_HAVE_INET6) |
68 size_t n; | 68 size_t n; |
69 struct sockaddr_in6 *sin6; | 69 struct sockaddr_in6 *sin6; |
70 #endif | |
71 #if (NGX_HAVE_UNIX_DOMAIN) | |
72 struct sockaddr_un *saun; | |
70 #endif | 73 #endif |
71 | 74 |
72 switch (sa->sa_family) { | 75 switch (sa->sa_family) { |
73 | 76 |
74 case AF_INET: | 77 case AF_INET: |
104 n = ngx_sprintf(&text[1 + n], "]:%d", | 107 n = ngx_sprintf(&text[1 + n], "]:%d", |
105 ntohs(sin6->sin6_port)) - text; | 108 ntohs(sin6->sin6_port)) - text; |
106 } | 109 } |
107 | 110 |
108 return n; | 111 return n; |
112 #endif | |
113 | |
114 #if (NGX_HAVE_UNIX_DOMAIN) | |
115 | |
116 case AF_UNIX: | |
117 saun = (struct sockaddr_un *) sa; | |
118 | |
119 /* we do not include trailing zero in address length */ | |
120 | |
121 return ngx_snprintf(text, len, "unix:%s%Z", saun->sun_path) - text - 1; | |
122 | |
109 #endif | 123 #endif |
110 | 124 |
111 default: | 125 default: |
112 return 0; | 126 return 0; |
113 } | 127 } |