| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The Chromium Authors. All rights reserved. | 2 * Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "tools/android/memtrack_helper/memtrack_helper.h" | 7 #include "tools/android/memtrack_helper/memtrack_helper.h" |
| 8 | 8 |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <errno.h> | 10 #include <errno.h> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 break; | 205 break; |
| 206 } | 206 } |
| 207 | 207 |
| 208 if (res) | 208 if (res) |
| 209 exit_with_failure("bind"); | 209 exit_with_failure("bind"); |
| 210 | 210 |
| 211 if (argc > 1 && strcmp(argv[1], "-d") == 0) | 211 if (argc > 1 && strcmp(argv[1], "-d") == 0) |
| 212 daemonize(); | 212 daemonize(); |
| 213 | 213 |
| 214 if(memtrack_init()) | 214 res = memtrack_init(); |
| 215 exit_with_failure("memtrack_init() returned non-zero"); | 215 if (res == -ENOENT) { |
| 216 exit_with_failure("Unable to load memtrack module in libhardware. " |
| 217 "Probably implementation is missing in this ROM."); |
| 218 } else if (res != 0) { |
| 219 exit_with_failure("memtrack_init() returned non-zero status."); |
| 220 } |
| 216 | 221 |
| 217 if (listen(server_fd, 128 /* max number of queued requests */)) | 222 if (listen(server_fd, 128 /* max number of queued requests */)) |
| 218 exit_with_failure("listen"); | 223 exit_with_failure("listen"); |
| 219 | 224 |
| 220 for (;;) { | 225 for (;;) { |
| 221 struct sockaddr_un client_addr; | 226 struct sockaddr_un client_addr; |
| 222 socklen_t len = sizeof(client_addr); | 227 socklen_t len = sizeof(client_addr); |
| 223 int client_sock = accept(server_fd, (struct sockaddr*)&client_addr, &len); | 228 int client_sock = accept(server_fd, (struct sockaddr*)&client_addr, &len); |
| 224 handle_one_request(client_sock); | 229 handle_one_request(client_sock); |
| 225 close(client_sock); | 230 close(client_sock); |
| 226 } | 231 } |
| 227 | 232 |
| 228 return EXIT_SUCCESS; | 233 return EXIT_SUCCESS; |
| 229 } | 234 } |
| OLD | NEW |