kill HAVE_FORKEXEC

Bug: 18317407
Change-Id: I4eecb3c9d745e3dabfc46fa595aac7f94f6d93e3
This commit is contained in:
Yabin Cui 2014-11-11 09:24:11 -08:00
parent ca1797ae00
commit e77b6a0862
3 changed files with 18 additions and 20 deletions

View File

@ -947,7 +947,7 @@ nomem:
return INSTALL_STATUS_INTERNAL_ERROR;
}
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
static BOOL WINAPI ctrlc_handler(DWORD type)
{
exit(STATUS_CONTROL_C_EXIT);
@ -962,7 +962,7 @@ static void adb_cleanup(void)
void start_logging(void)
{
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
char temp[ MAX_PATH ];
FILE* fnul;
FILE* flog;
@ -1070,7 +1070,7 @@ void adb_set_affinity(void)
int launch_server(int server_port)
{
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
/* we need to start the server in the background */
/* 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 */
@ -1169,7 +1169,7 @@ int launch_server(int server_port)
return -1;
}
}
#elif defined(HAVE_FORKEXEC)
#else /* !defined(_WIN32) */
char path[PATH_MAX];
int fd[2];
@ -1220,12 +1220,10 @@ int launch_server(int server_port)
setsid();
}
#else
#error "cannot implement background server start on this platform"
#endif
#endif /* !defined(_WIN32) */
return 0;
}
#endif
#endif /* ADB_HOST */
/* Constructs a local name of form tcp:port.
* 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
atexit(adb_cleanup);
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
SetConsoleCtrlHandler( ctrlc_handler, TRUE );
#elif defined(HAVE_FORKEXEC)
#else
// No SIGCHLD. Let the service subproc handle its children.
signal(SIGPIPE, SIG_IGN);
#endif
@ -1425,10 +1423,10 @@ int adb_main(int is_daemon, int server_port)
if (is_daemon)
{
// inform our parent that we are up and running.
#ifdef HAVE_WIN32_PROC
#if defined(_WIN32)
DWORD count;
WriteFile( GetStdHandle( STD_OUTPUT_HANDLE ), "OK\n", 3, &count, NULL );
#elif defined(HAVE_FORKEXEC)
#else
fprintf(stderr, "OK\n");
#endif
start_logging();

View File

@ -729,7 +729,7 @@ static char *escape_arg(const char *s)
*/
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]);
return -1;
#else
@ -792,7 +792,7 @@ int ppp(int argc, char **argv)
adb_close(fd);
return 0;
}
#endif /* !HAVE_WIN32_PROC */
#endif /* !defined(_WIN32) */
}
static int send_shellcommand(transport_type transport, char* serial, char* buf)

View File

@ -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)
{
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);
return -1;
#else /* !HAVE_WIN32_PROC */
#else
int ptm;
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 {
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)
{
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);
return -1;
#else /* !HAVE_WIN32_PROC */
#else
// 0 is parent socket, 1 is child socket
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]);
return sv[0];
}
#endif /* !HAVE_WIN32_PROC */
#endif /* !defined(_WIN32) */
}
#endif /* !ABD_HOST */