* kill.cc (usage): Move to top of file.
(getsig): Ditto. (forcekill): Ditto.
This commit is contained in:
parent
713fb38b7c
commit
af53a09c70
@ -1,3 +1,9 @@
|
|||||||
|
2001-03-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
|
||||||
|
* kill.cc (usage): Move to top of file.
|
||||||
|
(getsig): Ditto.
|
||||||
|
(forcekill): Ditto.
|
||||||
|
|
||||||
2002-03-06 Christopher Faylor <cgf@redhat.com>
|
2002-03-06 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* cygcheck.cc: Reformat.
|
* cygcheck.cc: Reformat.
|
||||||
|
@ -17,9 +17,42 @@ details. */
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <sys/cygwin.h>
|
#include <sys/cygwin.h>
|
||||||
|
|
||||||
static void usage (void);
|
static void
|
||||||
static int __stdcall getsig (char *);
|
usage (void)
|
||||||
static void __stdcall forcekill (int, int, int);
|
{
|
||||||
|
fprintf (stderr, "Usage: kill [-sigN] pid1 [pid2 ...]\n");
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
getsig (char *in_sig)
|
||||||
|
{
|
||||||
|
char *sig;
|
||||||
|
char buf[80];
|
||||||
|
|
||||||
|
if (strncmp (in_sig, "SIG", 3) == 0)
|
||||||
|
sig = in_sig;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf (buf, "SIG%s", in_sig);
|
||||||
|
sig = buf;
|
||||||
|
}
|
||||||
|
return (strtosigno (sig) ?: atoi (in_sig));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __stdcall
|
||||||
|
forcekill (int pid, int sig, int wait)
|
||||||
|
{
|
||||||
|
external_pinfo *p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
|
||||||
|
if (!p)
|
||||||
|
return;
|
||||||
|
HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) p->dwProcessId);
|
||||||
|
if (!h)
|
||||||
|
return;
|
||||||
|
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
|
||||||
|
TerminateProcess (h, sig << 8);
|
||||||
|
CloseHandle (h);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
@ -83,40 +116,3 @@ sig0:
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
usage (void)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "Usage: kill [-sigN] pid1 [pid2 ...]\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
getsig (char *in_sig)
|
|
||||||
{
|
|
||||||
char *sig;
|
|
||||||
char buf[80];
|
|
||||||
|
|
||||||
if (strncmp (in_sig, "SIG", 3) == 0)
|
|
||||||
sig = in_sig;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf (buf, "SIG%s", in_sig);
|
|
||||||
sig = buf;
|
|
||||||
}
|
|
||||||
return (strtosigno (sig) ?: atoi (in_sig));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __stdcall
|
|
||||||
forcekill (int pid, int sig, int wait)
|
|
||||||
{
|
|
||||||
external_pinfo *p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
|
|
||||||
if (!p)
|
|
||||||
return;
|
|
||||||
HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) p->dwProcessId);
|
|
||||||
if (!h)
|
|
||||||
return;
|
|
||||||
if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
|
|
||||||
TerminateProcess (h, sig << 8);
|
|
||||||
CloseHandle (h);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user