summaryrefslogtreecommitdiffstats
path: root/adb/services.c
diff options
context:
space:
mode:
Diffstat (limited to 'adb/services.c')
-rw-r--r--adb/services.c103
1 files changed, 2 insertions, 101 deletions
diff --git a/adb/services.c b/adb/services.c
index e82a0ea..619199f 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -53,59 +53,7 @@ void *service_bootstrap_func(void *x)
return 0;
}
-#if ADB_HOST
-ADB_MUTEX_DEFINE( dns_lock );
-
-static void dns_service(int fd, void *cookie)
-{
- char *hostname = cookie;
- struct hostent *hp;
- unsigned zero = 0;
-
- adb_mutex_lock(&dns_lock);
- hp = gethostbyname(hostname);
- free(cookie);
- if(hp == 0) {
- writex(fd, &zero, 4);
- } else {
- writex(fd, hp->h_addr, 4);
- }
- adb_mutex_unlock(&dns_lock);
- adb_close(fd);
-}
-#else
-extern int recovery_mode;
-
-static void recover_service(int s, void *cookie)
-{
- unsigned char buf[4096];
- unsigned count = (unsigned) cookie;
- int fd;
-
- fd = adb_creat("/tmp/update", 0644);
- if(fd < 0) {
- adb_close(s);
- return;
- }
-
- while(count > 0) {
- unsigned xfer = (count > 4096) ? 4096 : count;
- if(readx(s, buf, xfer)) break;
- if(writex(fd, buf, xfer)) break;
- count -= xfer;
- }
-
- if(count == 0) {
- writex(s, "OKAY", 4);
- } else {
- writex(s, "FAIL", 4);
- }
- adb_close(fd);
- adb_close(s);
-
- fd = adb_creat("/tmp/update.begin", 0644);
- adb_close(fd);
-}
+#if !ADB_HOST
void restart_root_service(int fd, void *cookie)
{
@@ -202,40 +150,6 @@ cleanup:
#endif
-#if 0
-static void echo_service(int fd, void *cookie)
-{
- char buf[4096];
- int r;
- char *p;
- int c;
-
- for(;;) {
- r = adb_read(fd, buf, 4096);
- if(r == 0) goto done;
- if(r < 0) {
- if(errno == EINTR) continue;
- else goto done;
- }
-
- c = r;
- p = buf;
- while(c > 0) {
- r = write(fd, p, c);
- if(r > 0) {
- c -= r;
- p += r;
- continue;
- }
- if((r < 0) && (errno == EINTR)) continue;
- goto done;
- }
- }
-done:
- close(fd);
-}
-#endif
-
static int create_service_thread(void (*func)(int, void *), void *cookie)
{
stinfo *sti;
@@ -422,9 +336,7 @@ int service_to_fd(const char *name)
disable_tcp_nagle(ret);
} else {
#if ADB_HOST
- adb_mutex_lock(&dns_lock);
ret = socket_network_client(name + 1, port, SOCK_STREAM);
- adb_mutex_unlock(&dns_lock);
#else
return -1;
#endif
@@ -443,18 +355,11 @@ int service_to_fd(const char *name)
ret = socket_local_client(name + 16,
ANDROID_SOCKET_NAMESPACE_FILESYSTEM, SOCK_STREAM);
#endif
-#if ADB_HOST
- } else if(!strncmp("dns:", name, 4)){
- char *n = strdup(name + 4);
- if(n == 0) return -1;
- ret = create_service_thread(dns_service, n);
-#else /* !ADB_HOST */
+#if !ADB_HOST
} else if(!strncmp("dev:", name, 4)) {
ret = unix_open(name + 4, O_RDWR);
} else if(!strncmp(name, "framebuffer:", 12)) {
ret = create_service_thread(framebuffer_service, 0);
- } else if(recovery_mode && !strncmp(name, "recover:", 8)) {
- ret = create_service_thread(recover_service, (void*) atoi(name + 8));
} else if (!strncmp(name, "jdwp:", 5)) {
ret = create_jdwp_connection_fd(atoi(name+5));
} else if (!strncmp(name, "log:", 4)) {
@@ -490,10 +395,6 @@ int service_to_fd(const char *name)
} else if(!strncmp(name, "usb:", 4)) {
ret = create_service_thread(restart_usb_service, NULL);
#endif
-#if 0
- } else if(!strncmp(name, "echo:", 5)){
- ret = create_service_thread(echo_service, 0);
-#endif
}
if (ret >= 0) {
close_on_exec(ret);