OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "tools/android/forwarder2/socket.h" | 5 #include "tools/android/forwarder2/socket.h" |
6 | 6 |
7 #include <arpa/inet.h> | 7 #include <arpa/inet.h> |
| 8 #include <errno.h> |
8 #include <fcntl.h> | 9 #include <fcntl.h> |
9 #include <netdb.h> | 10 #include <netdb.h> |
10 #include <netinet/in.h> | 11 #include <netinet/in.h> |
11 #include <stdio.h> | 12 #include <stdio.h> |
12 #include <string.h> | 13 #include <string.h> |
13 #include <sys/socket.h> | 14 #include <sys/socket.h> |
14 #include <sys/types.h> | 15 #include <sys/types.h> |
15 #include <unistd.h> | 16 #include <unistd.h> |
16 | 17 |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 ucred ucred; | 441 ucred ucred; |
441 socklen_t len = sizeof(ucred); | 442 socklen_t len = sizeof(ucred); |
442 if (getsockopt(socket.socket_, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1) { | 443 if (getsockopt(socket.socket_, SOL_SOCKET, SO_PEERCRED, &ucred, &len) == -1) { |
443 CHECK_NE(ENOPROTOOPT, errno); | 444 CHECK_NE(ENOPROTOOPT, errno); |
444 return -1; | 445 return -1; |
445 } | 446 } |
446 return ucred.pid; | 447 return ucred.pid; |
447 } | 448 } |
448 | 449 |
449 } // namespace forwarder2 | 450 } // namespace forwarder2 |
OLD | NEW |