This is the mail archive of the
cygwin-patches@cygwin.com
mailing list for the Cygwin project.
Re: (small) kill.cc patch
- From: Earnie Boyd <earnie_boyd at yahoo dot com>
- To: Joshua Daniel Franklin <joshuadfranklin at yahoo dot com>
- Cc: cygwin-patches at cygwin dot com
- Date: Mon, 11 Mar 2002 13:30:02 -0500
- Subject: Re: (small) kill.cc patch
- References: <20020311181627.8971.qmail@web20001.mail.yahoo.com>
- Reply-to: Earnie Boyd <Cygwin-Patches at Cygwin dot Com>
Your ChangeLog entry is improper format. Try again.
Earnie.
Joshua Daniel Franklin wrote:
>
> Here is a patch that moves the functions in kill.cc to the top.
> That's all it does.
>
> This is for consistency with the other utils.
>
> 2001-03-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
> * kill.cc (usage) move to top of file
> (getsig) ditto
> (forcekill) ditto
>
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free email!
> http://mail.yahoo.com/
>
> ------------------------------------------------------------------------
> --- kill.cc-orig Sun Feb 24 13:28:27 2002
> +++ kill.cc Mon Mar 11 12:07:40 2002
> @@ -17,9 +17,42 @@ details. */
> #include <windows.h>
> #include <sys/cygwin.h>
>
> -static void usage (void);
> -static int __stdcall getsig (char *);
> -static void __stdcall forcekill (int, int, int);
> +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);
> +}
>
> int
> main (int argc, char **argv)
> @@ -82,41 +115,4 @@ sig0:
> argv++;
> }
> 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);
> }
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com