From: Marcus Brinkmann Date: Thu, 17 Nov 2005 16:12:27 +0000 (+0000) Subject: 2005-11-17 Marcus Brinkmann X-Git-Tag: gpgme-1-1-1~26 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d19cc31e0683ca040ad4305abd49019f4514602d;p=gpgme.git 2005-11-17 Marcus Brinkmann * priv-io.h (_gpgme_io_waitpid, _gpgme_io_kill): Removed. * w32-io.c (_gpgme_io_waitpid, _gpgme_io_kill): Removed. * posix-io.c (_gpgme_io_kill): Removed. (_gpgme_io_waitpid): Declare static. --- diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index b7fb4e4..0f2c67b 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,10 @@ +2005-11-17 Marcus Brinkmann + + * priv-io.h (_gpgme_io_waitpid, _gpgme_io_kill): Removed. + * w32-io.c (_gpgme_io_waitpid, _gpgme_io_kill): Removed. + * posix-io.c (_gpgme_io_kill): Removed. + (_gpgme_io_waitpid): Declare static. + 2005-10-24 Marcus Brinkmann * w32-io.c (_gpgme_io_spawn): Don't minimize window, hide it. diff --git a/gpgme/posix-io.c b/gpgme/posix-io.c index d428984..3479483 100644 --- a/gpgme/posix-io.c +++ b/gpgme/posix-io.c @@ -174,6 +174,30 @@ _gpgme_io_set_nonblocking (int fd) } +static int +_gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal) +{ + int status; + + *r_status = 0; + *r_signal = 0; + if (_gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG) == pid) + { + if (WIFSIGNALED (status)) + { + *r_status = 4; /* Need some value here. */ + *r_signal = WTERMSIG (status); + } + else if (WIFEXITED (status)) + *r_status = WEXITSTATUS (status); + else + *r_status = 4; /* Oops. */ + return 1; + } + return 0; +} + + /* Returns 0 on success, -1 on error. */ int _gpgme_io_spawn (const char *path, char **argv, @@ -273,37 +297,6 @@ _gpgme_io_spawn (const char *path, char **argv, } -int -_gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal) -{ - int status; - - *r_status = 0; - *r_signal = 0; - if (_gpgme_ath_waitpid (pid, &status, hang? 0 : WNOHANG) == pid) - { - if (WIFSIGNALED (status)) - { - *r_status = 4; /* Need some value here. */ - *r_signal = WTERMSIG (status); - } - else if (WIFEXITED (status)) - *r_status = WEXITSTATUS (status); - else - *r_status = 4; /* Oops. */ - return 1; - } - return 0; -} - - -int -_gpgme_io_kill (int pid, int hard) -{ - return kill (pid, hard ? SIGKILL : SIGTERM); -} - - /* * Select on the list of fds. * Returns: -1 = error diff --git a/gpgme/priv-io.h b/gpgme/priv-io.h index 3a7150c..786f243 100644 --- a/gpgme/priv-io.h +++ b/gpgme/priv-io.h @@ -57,8 +57,6 @@ int _gpgme_io_set_nonblocking (int fd); int _gpgme_io_spawn (const char *path, char **argv, struct spawn_fd_item_s *fd_child_list, struct spawn_fd_item_s *fd_parent_list); -int _gpgme_io_waitpid (int pid, int hang, int *r_status, int *r_signal); -int _gpgme_io_kill (int pid, int hard); int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock); #endif /* IO_H */ diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c index 826347a..7ad10ec 100644 --- a/gpgme/w32-io.c +++ b/gpgme/w32-io.c @@ -942,60 +942,6 @@ _gpgme_io_spawn ( const char *path, char **argv, } - - -int -_gpgme_io_waitpid ( int pid, int hang, int *r_status, int *r_signal ) -{ - HANDLE proc = fd_to_handle (pid); - int code, ret = 0; - DWORD exc; - - *r_status = 0; - *r_signal = 0; - code = WaitForSingleObject ( proc, hang? INFINITE : 0 ); - switch (code) { - case WAIT_FAILED: - DEBUG2 ("WFSO pid=%d failed: %d\n", (int)pid, (int)GetLastError () ); - break; - - case WAIT_OBJECT_0: - if (!GetExitCodeProcess (proc, &exc)) { - DEBUG2 ("** GECP pid=%d failed: ec=%d\n", - (int)pid, (int)GetLastError () ); - *r_status = 4; - } - else { - DEBUG2 ("GECP pid=%d exit code=%d\n", (int)pid, exc); - *r_status = exc; - } - ret = 1; - break; - - case WAIT_TIMEOUT: - if (hang) - DEBUG1 ("WFSO pid=%d timed out\n", (int)pid); - break; - - default: - DEBUG2 ("WFSO pid=%d returned %d\n", (int)pid, code ); - break; - } - return ret; -} - -int -_gpgme_io_kill ( int pid, int hard ) -{ - HANDLE proc = fd_to_handle (pid); - - #warning I am not sure how to kill a process - /* fixme: figure out how this can be done */ - return 0; -} - - - /* * Select on the list of fds. * Returns: -1 = error