2005-11-17 Marcus Brinkmann <marcus@g10code.de>

* 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.
This commit is contained in:
Marcus Brinkmann 2005-11-17 16:12:27 +00:00
parent 3acdcbf67b
commit d19cc31e06
4 changed files with 31 additions and 87 deletions

View File

@ -1,3 +1,10 @@
2005-11-17 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de>
* w32-io.c (_gpgme_io_spawn): Don't minimize window, hide it.

View File

@ -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

View File

@ -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 */

View File

@ -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