Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9582d02 authored by Yabin Cui's avatar Yabin Cui Committed by Gerrit Code Review
Browse files

Merge "kill HAVE_FORKEXEC"

parents a3f16f22 e77b6a08
Loading
Loading
Loading
Loading
+10 −12
Original line number Original line Diff line number Diff line
@@ -947,7 +947,7 @@ nomem:
    return INSTALL_STATUS_INTERNAL_ERROR;
    return INSTALL_STATUS_INTERNAL_ERROR;
}
}


#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
static BOOL WINAPI ctrlc_handler(DWORD type)
static BOOL WINAPI ctrlc_handler(DWORD type)
{
{
    exit(STATUS_CONTROL_C_EXIT);
    exit(STATUS_CONTROL_C_EXIT);
@@ -962,7 +962,7 @@ static void adb_cleanup(void)


void start_logging(void)
void start_logging(void)
{
{
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
    char    temp[ MAX_PATH ];
    char    temp[ MAX_PATH ];
    FILE*   fnul;
    FILE*   fnul;
    FILE*   flog;
    FILE*   flog;
@@ -1070,7 +1070,7 @@ void adb_set_affinity(void)


int launch_server(int server_port)
int launch_server(int server_port)
{
{
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
    /* we need to start the server in the background                    */
    /* we need to start the server in the background                    */
    /* we create a PIPE that will be used to wait for the server's "OK" */
    /* we create a PIPE that will be used to wait for the server's "OK" */
    /* message since the pipe handles must be inheritable, we use a     */
    /* message since the pipe handles must be inheritable, we use a     */
@@ -1169,7 +1169,7 @@ int launch_server(int server_port)
            return -1;
            return -1;
        }
        }
    }
    }
#elif defined(HAVE_FORKEXEC)
#else /* !defined(_WIN32) */
    char    path[PATH_MAX];
    char    path[PATH_MAX];
    int     fd[2];
    int     fd[2];


@@ -1220,12 +1220,10 @@ int launch_server(int server_port)


        setsid();
        setsid();
    }
    }
#else
#endif /* !defined(_WIN32) */
#error "cannot implement background server start on this platform"
#endif
    return 0;
    return 0;
}
}
#endif
#endif /* ADB_HOST */


/* Constructs a local name of form tcp:port.
/* Constructs a local name of form tcp:port.
 * target_str points to the target string, it's content will be overwritten.
 * target_str points to the target string, it's content will be overwritten.
@@ -1307,9 +1305,9 @@ int adb_main(int is_daemon, int server_port)
#endif
#endif


    atexit(adb_cleanup);
    atexit(adb_cleanup);
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
    SetConsoleCtrlHandler( ctrlc_handler, TRUE );
    SetConsoleCtrlHandler( ctrlc_handler, TRUE );
#elif defined(HAVE_FORKEXEC)
#else
    // No SIGCHLD. Let the service subproc handle its children.
    // No SIGCHLD. Let the service subproc handle its children.
    signal(SIGPIPE, SIG_IGN);
    signal(SIGPIPE, SIG_IGN);
#endif
#endif
@@ -1425,10 +1423,10 @@ int adb_main(int is_daemon, int server_port)
    if (is_daemon)
    if (is_daemon)
    {
    {
        // inform our parent that we are up and running.
        // inform our parent that we are up and running.
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
        DWORD  count;
        DWORD  count;
        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK\n", 3, &count, NULL );
        WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK\n", 3, &count, NULL );
#elif defined(HAVE_FORKEXEC)
#else
        fprintf(stderr, "OK\n");
        fprintf(stderr, "OK\n");
#endif
#endif
        start_logging();
        start_logging();
+2 −2
Original line number Original line Diff line number Diff line
@@ -729,7 +729,7 @@ static char *escape_arg(const char *s)
 */
 */
int ppp(int argc, char **argv)
int ppp(int argc, char **argv)
{
{
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
    fprintf(stderr, "error: adb %s not implemented on Win32\n", argv[0]);
    fprintf(stderr, "error: adb %s not implemented on Win32\n", argv[0]);
    return -1;
    return -1;
#else
#else
@@ -792,7 +792,7 @@ int ppp(int argc, char **argv)
        adb_close(fd);
        adb_close(fd);
        return 0;
        return 0;
    }
    }
#endif /* !HAVE_WIN32_PROC */
#endif /* !defined(_WIN32) */
}
}


static int send_shellcommand(transport_type transport, char* serial, char* buf)
static int send_shellcommand(transport_type transport, char* serial, char* buf)
+6 −6
Original line number Original line Diff line number Diff line
@@ -202,10 +202,10 @@ static void init_subproc_child()
static int create_subproc_pty(const char *cmd, const char *arg0, const char *arg1, pid_t *pid)
static int create_subproc_pty(const char *cmd, const char *arg0, const char *arg1, pid_t *pid)
{
{
    D("create_subproc_pty(cmd=%s, arg0=%s, arg1=%s)\n", cmd, arg0, arg1);
    D("create_subproc_pty(cmd=%s, arg0=%s, arg1=%s)\n", cmd, arg0, arg1);
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
    fprintf(stderr, "error: create_subproc_pty not implemented on Win32 (%s %s %s)\n", cmd, arg0, arg1);
    fprintf(stderr, "error: create_subproc_pty not implemented on Win32 (%s %s %s)\n", cmd, arg0, arg1);
    return -1;
    return -1;
#else /* !HAVE_WIN32_PROC */
#else
    int ptm;
    int ptm;


    ptm = unix_open("/dev/ptmx", O_RDWR | O_CLOEXEC); // | O_NOCTTY);
    ptm = unix_open("/dev/ptmx", O_RDWR | O_CLOEXEC); // | O_NOCTTY);
@@ -251,16 +251,16 @@ static int create_subproc_pty(const char *cmd, const char *arg0, const char *arg
    } else {
    } else {
        return ptm;
        return ptm;
    }
    }
#endif /* !HAVE_WIN32_PROC */
#endif /* !defined(_WIN32) */
}
}


static int create_subproc_raw(const char *cmd, const char *arg0, const char *arg1, pid_t *pid)
static int create_subproc_raw(const char *cmd, const char *arg0, const char *arg1, pid_t *pid)
{
{
    D("create_subproc_raw(cmd=%s, arg0=%s, arg1=%s)\n", cmd, arg0, arg1);
    D("create_subproc_raw(cmd=%s, arg0=%s, arg1=%s)\n", cmd, arg0, arg1);
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
    fprintf(stderr, "error: create_subproc_raw not implemented on Win32 (%s %s %s)\n", cmd, arg0, arg1);
    fprintf(stderr, "error: create_subproc_raw not implemented on Win32 (%s %s %s)\n", cmd, arg0, arg1);
    return -1;
    return -1;
#else /* !HAVE_WIN32_PROC */
#else


    // 0 is parent socket, 1 is child socket
    // 0 is parent socket, 1 is child socket
    int sv[2];
    int sv[2];
@@ -295,7 +295,7 @@ static int create_subproc_raw(const char *cmd, const char *arg0, const char *arg
        adb_close(sv[1]);
        adb_close(sv[1]);
        return sv[0];
        return sv[0];
    }
    }
#endif /* !HAVE_WIN32_PROC */
#endif /* !defined(_WIN32) */
}
}
#endif  /* !ABD_HOST */
#endif  /* !ABD_HOST */