source: remove unused code 89/143389/1
authorJinhyung Jo <jinhyung.jo@samsung.com>
Wed, 9 Aug 2017 09:31:01 +0000 (18:31 +0900)
committerJinhyung Jo <jinhyung.jo@samsung.com>
Wed, 9 Aug 2017 09:31:01 +0000 (18:31 +0900)
Change-Id: Ib52f23e49f6b876304d19567f7bf1b9b372b5742
Signed-off-by: Jinhyung Jo <jinhyung.jo@samsung.com>
src/sdb.c
src/sdb.h
src/sockets.h

index 21653e3..353995f 100644 (file)
--- a/src/sdb.c
+++ b/src/sdb.c
@@ -1110,14 +1110,6 @@ nomem:
     return 0;
 }
 
-#ifdef HAVE_WIN32_PROC
-static BOOL WINAPI ctrlc_handler(DWORD type)
-{
-    exit(STATUS_CONTROL_C_EXIT);
-    return TRUE;
-}
-#endif
-
 static void sdb_cleanup(void)
 {
     clear_sdbd_commandline_args(&sdbd_commandline_args);
@@ -1132,56 +1124,6 @@ static void sdb_cleanup(void)
     unload_sdbd_plugin();
 }
 
-void start_logging(void)
-{
-#ifdef HAVE_WIN32_PROC
-    char    temp[ MAX_PATH ];
-    FILE*   fnul;
-    FILE*   flog;
-
-    GetTempPath( sizeof(temp) - 8, temp );
-    strcat( temp, "sdb.log" );
-
-    /* Win32 specific redirections */
-    fnul = fopen( "NUL", "rt" );
-    if (fnul != NULL)
-        stdin[0] = fnul[0];
-
-    flog = fopen( temp, "at" );
-    if (flog == NULL)
-        flog = fnul;
-
-    setvbuf( flog, NULL, _IONBF, 0 );
-
-    stdout[0] = flog[0];
-    stderr[0] = flog[0];
-    fprintf(stderr,"--- sdb starting (pid %d) ---\n", getpid());
-#else
-    int fd;
-
-    fd = unix_open("/dev/null", O_RDONLY);
-    if (fd < 0) {
-        // hopefully not gonna happen
-        return;
-    }
-    dup2(fd, 0);
-    sdb_close(fd);
-
-    fd = unix_open("/tmp/sdb.log", O_WRONLY | O_CREAT | O_APPEND, 0640);
-    if(fd < 0) {
-        fd = unix_open("/dev/null", O_WRONLY);
-        if (fd < 0) {
-            // hopefully not gonna happen
-            return;
-        }
-    }
-    dup2(fd, 1);
-    dup2(fd, 2);
-    sdb_close(fd);
-    fprintf(stderr,"--- sdb starting (pid %d) ---\n", getpid());
-#endif
-}
-
 void start_device_log(void)
 {
     int fd;
@@ -1998,7 +1940,7 @@ static void fork_child_handler(void)
     sdb_mutex_unlock(&D_lock);
 }
 
-int sdb_main(int is_daemon, int server_port)
+int sdb_main(int server_port)
 {
     check_emulator_or_device();
 
@@ -2021,9 +1963,7 @@ int sdb_main(int is_daemon, int server_port)
     pthread_atfork(fork_prepare_handler, fork_parent_handler, fork_child_handler);
 
     atexit(sdb_cleanup);
-#ifdef HAVE_WIN32_PROC
-    SetConsoleCtrlHandler( ctrlc_handler, TRUE );
-#elif defined(HAVE_FORKEXEC)
+#if defined(HAVE_FORKEXEC)
     // No SIGCHLD. Let the service subproc handle its children.
     signal(SIGPIPE, SIG_IGN);
 #endif
@@ -2113,18 +2053,6 @@ int sdb_main(int is_daemon, int server_port)
     D("sdb_main(): post init_jdwp()\n");
 #endif
 
-    if (is_daemon)
-    {
-        // inform our parent that we are up and running.
-#ifdef HAVE_WIN32_PROC
-        DWORD  count;
-        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK\n", 3, &count, NULL );
-#elif defined(HAVE_FORKEXEC)
-        fprintf(stderr, "OK\n");
-#endif
-        start_logging();
-    }
-
     D("Event loop starting\n");
 
     fdevent_loop();
@@ -2270,6 +2198,6 @@ int main(int argc, char **argv)
 
     //sdbd will never die on emulator!
     signal(SIGTERM, handle_sig_term); /* tizen specific */
-    return sdb_main(0, DEFAULT_SDB_PORT);
+    return sdb_main(DEFAULT_SDB_PORT);
 }
 
index 1516455..43a3bfe 100644 (file)
--- a/src/sdb.h
+++ b/src/sdb.h
@@ -323,7 +323,7 @@ void send_packet(apacket *p, atransport *t);
 
 void get_my_path(char *s, size_t maxLen);
 int launch_server(int server_port);
-int sdb_main(int is_daemon, int server_port);
+int sdb_main(int server_port);
 
 
 /* transports are ref-counted
index e358a19..56f4e60 100644 (file)
@@ -28,52 +28,11 @@ typedef int  socklen_t;
 #include <sys/socket.h>
 #endif
 
-#define ANDROID_SOCKET_ENV_PREFIX   "ANDROID_SOCKET_"
-#define ANDROID_SOCKET_DIR      "/dev/socket"
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
- * android_get_control_socket - simple helper function to get the file
- * descriptor of our init-managed Unix domain socket. `name' is the name of the
- * socket, as given in init.rc. Returns -1 on error.
- *
- * This is inline and not in libcutils proper because we want to use this in
- * third-party daemons with minimal modification.
- */
-static inline int android_get_control_socket(const char *name)
-{
-    char key[64] = ANDROID_SOCKET_ENV_PREFIX;
-    const char *val;
-    int fd;
-
-    /* build our environment variable, counting cycles like a wolf ... */
-#if HAVE_STRLCPY
-    strlcpy(key + sizeof(ANDROID_SOCKET_ENV_PREFIX) - 1,
-        name,
-        sizeof(key) - sizeof(ANDROID_SOCKET_ENV_PREFIX));
-#else   /* for the host, which may lack the almightly strncpy ... */
-    strncpy(key + sizeof(ANDROID_SOCKET_ENV_PREFIX) - 1,
-        name,
-        sizeof(key) - sizeof(ANDROID_SOCKET_ENV_PREFIX));
-    key[sizeof(key)-1] = '\0';
-#endif
-
-    val = getenv(key);
-    if (!val)
-        return -1;
-
-    errno = 0;
-    fd = strtol(val, NULL, 10);
-    if (errno)
-        return -1;
-
-    return fd;
-}
-
-/*
  * See also android.os.LocalSocketAddress.Namespace
  */
 // Linux "abstract" (non-filesystem) namespace