From 2e76bb466a82110ca80d5d6d982842cf2f9cc964 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 9 Jun 2015 17:30:15 -0700 Subject: Use pid_t on UN*X, and HANDLE on Windows, for the process ID. This avoids type punning; at least with Xcode 7 beta on El Capitan beta, that produces warnings that get turned into errors. Change-Id: I57f47455b9630f359828c07c92a190b5cb33816f Reviewed-on: https://code.wireshark.org/review/8862 Reviewed-by: Guy Harris --- capchild/capture_sync.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'capchild/capture_sync.c') diff --git a/capchild/capture_sync.c b/capchild/capture_sync.c index b2a649be87..8efe26408a 100644 --- a/capchild/capture_sync.c +++ b/capchild/capture_sync.c @@ -118,12 +118,12 @@ static const char *sync_pipe_signame(int); static gboolean sync_pipe_input_cb(gint source, gpointer user_data); -static int sync_pipe_wait_for_child(intptr_t fork_child, gchar **msgp); +static int sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp); static void pipe_convert_header(const guchar *header, int header_len, char *indicator, int *block_len); static ssize_t pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, char **err_msg); -static void (*fetch_dumpcap_pid)(int) = NULL; +static void (*fetch_dumpcap_pid)(ws_process_id) = NULL; void @@ -659,7 +659,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi g_free( (gpointer) argv); return FALSE; } - cap_session->fork_child = (intptr_t) pi.hProcess; + cap_session->fork_child = pi.hProcess; g_string_free(args, TRUE); /* associate the operating system filehandle to a C run-time file handle */ @@ -771,7 +771,7 @@ sync_pipe_start(capture_options *capture_opts, capture_session *cap_session, voi #define PIPE_BUF_SIZE 5120 static int sync_pipe_open_command(char** argv, int *data_read_fd, - int *message_read_fd, intptr_t *fork_child, gchar **msg, void(*update_cb)(void)) + int *message_read_fd, ws_process_id *fork_child, gchar **msg, void(*update_cb)(void)) { enum PIPES { PIPE_READ, PIPE_WRITE }; /* Constants 0 and 1 for PIPE_READ and PIPE_WRITE */ #ifdef _WIN32 @@ -875,7 +875,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd, g_free( (gpointer) argv); return -1; } - *fork_child = (intptr_t) pi.hProcess; + *fork_child = pi.hProcess; g_string_free(args, TRUE); /* associate the operating system filehandles to C run-time file handles */ @@ -983,7 +983,7 @@ sync_pipe_open_command(char** argv, int *data_read_fd, */ static int sync_pipe_close_command(int *data_read_fd, int *message_read_fd, - intptr_t *fork_child, gchar **msgp) + ws_process_id *fork_child, gchar **msgp) { ws_close(*data_read_fd); if (message_read_fd != NULL) @@ -1018,7 +1018,7 @@ sync_pipe_run_command_actual(char** argv, gchar **data, gchar **primary_msg, { gchar *msg; int data_pipe_read_fd, sync_pipe_read_fd, ret; - intptr_t fork_child; + ws_process_id fork_child; char *wait_msg; gchar buffer[PIPE_BUF_SIZE+1] = {0}; ssize_t nread; @@ -1363,7 +1363,7 @@ sync_if_capabilities_open(const gchar *ifname, gboolean monitor_mode, * that must be g_free()d, and -1 will be returned. */ int -sync_interface_stats_open(int *data_read_fd, intptr_t *fork_child, gchar **msg, void (*update_cb)(void)) +sync_interface_stats_open(int *data_read_fd, ws_process_id *fork_child, gchar **msg, void (*update_cb)(void)) { int argc; char **argv; @@ -1515,7 +1515,7 @@ sync_interface_stats_open(int *data_read_fd, intptr_t *fork_child, gchar **msg, /* Close down the stats process */ int -sync_interface_stats_close(int *read_fd, intptr_t *fork_child, gchar **msg) +sync_interface_stats_close(int *read_fd, ws_process_id *fork_child, gchar **msg) { #ifndef _WIN32 /* @@ -1869,7 +1869,7 @@ sync_pipe_input_cb(gint source, gpointer user_data) * must be freed with g_free(). */ static int -sync_pipe_wait_for_child(intptr_t fork_child, gchar **msgp) +sync_pipe_wait_for_child(ws_process_id fork_child, gchar **msgp) { int fork_child_status; #ifndef _WIN32 @@ -2140,7 +2140,7 @@ sync_pipe_stop(capture_session *cap_session) /* Wireshark has to exit, force the capture child to close */ void -sync_pipe_kill(intptr_t fork_child) +sync_pipe_kill(ws_process_id fork_child) { if (fork_child != -1) { #ifndef _WIN32 @@ -2174,7 +2174,7 @@ sync_pipe_kill(intptr_t fork_child) } } -void capture_sync_set_fetch_dumpcap_pid_cb(void(*cb)(int pid)) { +void capture_sync_set_fetch_dumpcap_pid_cb(void(*cb)(ws_process_id pid)) { fetch_dumpcap_pid = cb; } -- cgit v1.2.1