This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: (small) kill.cc patch



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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]