|
Karsten Hopp |
53cf4e |
To: vim-dev@vim.org
|
|
Karsten Hopp |
53cf4e |
Subject: Patch 7.1.279
|
|
Karsten Hopp |
53cf4e |
Fcc: outbox
|
|
Karsten Hopp |
53cf4e |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
53cf4e |
Mime-Version: 1.0
|
|
Karsten Hopp |
53cf4e |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
53cf4e |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
53cf4e |
------------
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
Patch 7.1.279
|
|
Karsten Hopp |
53cf4e |
Problem: When using cscope temporary files are left behind.
|
|
Karsten Hopp |
53cf4e |
Solution: Send the quit command to cscope and give it two seconds to exit
|
|
Karsten Hopp |
53cf4e |
nicely before killing it. (partly by Dominique Pelle)
|
|
Karsten Hopp |
53cf4e |
Files: src/if_cscope.c
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
*** ../vim-7.1.278/src/if_cscope.c Fri Sep 14 19:56:18 2007
|
|
Karsten Hopp |
53cf4e |
--- src/if_cscope.c Sat Mar 15 12:38:12 2008
|
|
Karsten Hopp |
53cf4e |
***************
|
|
Karsten Hopp |
53cf4e |
*** 2096,2101 ****
|
|
Karsten Hopp |
53cf4e |
--- 2096,2113 ----
|
|
Karsten Hopp |
53cf4e |
return CSCOPE_SUCCESS;
|
|
Karsten Hopp |
53cf4e |
}
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
+ #if defined(UNIX) && defined(SIGALRM)
|
|
Karsten Hopp |
53cf4e |
+ /*
|
|
Karsten Hopp |
53cf4e |
+ * Used to catch and ignore SIGALRM below.
|
|
Karsten Hopp |
53cf4e |
+ */
|
|
Karsten Hopp |
53cf4e |
+ /* ARGSUSED */
|
|
Karsten Hopp |
53cf4e |
+ static RETSIGTYPE
|
|
Karsten Hopp |
53cf4e |
+ sig_handler SIGDEFARG(sigarg)
|
|
Karsten Hopp |
53cf4e |
+ {
|
|
Karsten Hopp |
53cf4e |
+ /* do nothing */
|
|
Karsten Hopp |
53cf4e |
+ SIGRETURN;
|
|
Karsten Hopp |
53cf4e |
+ }
|
|
Karsten Hopp |
53cf4e |
+ #endif
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
/*
|
|
Karsten Hopp |
53cf4e |
* PRIVATE: cs_release_csp
|
|
Karsten Hopp |
53cf4e |
***************
|
|
Karsten Hopp |
53cf4e |
*** 2108,2116 ****
|
|
Karsten Hopp |
53cf4e |
int i;
|
|
Karsten Hopp |
53cf4e |
int freefnpp;
|
|
Karsten Hopp |
53cf4e |
{
|
|
Karsten Hopp |
53cf4e |
- #if defined(UNIX)
|
|
Karsten Hopp |
53cf4e |
- int pstat;
|
|
Karsten Hopp |
53cf4e |
- #else
|
|
Karsten Hopp |
53cf4e |
/*
|
|
Karsten Hopp |
53cf4e |
* Trying to exit normally (not sure whether it is fit to UNIX cscope
|
|
Karsten Hopp |
53cf4e |
*/
|
|
Karsten Hopp |
53cf4e |
--- 2120,2125 ----
|
|
Karsten Hopp |
53cf4e |
***************
|
|
Karsten Hopp |
53cf4e |
*** 2119,2124 ****
|
|
Karsten Hopp |
53cf4e |
--- 2128,2179 ----
|
|
Karsten Hopp |
53cf4e |
(void)fputs("q\n", csinfo[i].to_fp);
|
|
Karsten Hopp |
53cf4e |
(void)fflush(csinfo[i].to_fp);
|
|
Karsten Hopp |
53cf4e |
}
|
|
Karsten Hopp |
53cf4e |
+ #if defined(UNIX)
|
|
Karsten Hopp |
53cf4e |
+ {
|
|
Karsten Hopp |
53cf4e |
+ int pstat;
|
|
Karsten Hopp |
53cf4e |
+ pid_t pid;
|
|
Karsten Hopp |
53cf4e |
+
|
|
Karsten Hopp |
53cf4e |
+ # if defined(HAVE_SIGACTION)
|
|
Karsten Hopp |
53cf4e |
+ struct sigaction sa, old;
|
|
Karsten Hopp |
53cf4e |
+
|
|
Karsten Hopp |
53cf4e |
+ /* Use sigaction() to limit the waiting time to two seconds. */
|
|
Karsten Hopp |
53cf4e |
+ sa.sa_handler = sig_handler;
|
|
Karsten Hopp |
53cf4e |
+ sa.sa_flags = SA_NODEFER;
|
|
Karsten Hopp |
53cf4e |
+ sigaction(SIGALRM, &sa, &old;;
|
|
Karsten Hopp |
53cf4e |
+ alarm(2); /* 2 sec timeout */
|
|
Karsten Hopp |
53cf4e |
+
|
|
Karsten Hopp |
53cf4e |
+ /* Block until cscope exits or until timer expires */
|
|
Karsten Hopp |
53cf4e |
+ pid = waitpid(csinfo[i].pid, &pstat, 0);
|
|
Karsten Hopp |
53cf4e |
+
|
|
Karsten Hopp |
53cf4e |
+ /* cancel pending alarm if still there and restore signal */
|
|
Karsten Hopp |
53cf4e |
+ alarm(0);
|
|
Karsten Hopp |
53cf4e |
+ sigaction(SIGALRM, &old, NULL);
|
|
Karsten Hopp |
53cf4e |
+ # else
|
|
Karsten Hopp |
53cf4e |
+ int waited;
|
|
Karsten Hopp |
53cf4e |
+
|
|
Karsten Hopp |
53cf4e |
+ /* Can't use sigaction(), loop for two seconds. First yield the CPU
|
|
Karsten Hopp |
53cf4e |
+ * to give cscope a chance to exit quickly. */
|
|
Karsten Hopp |
53cf4e |
+ sleep(0);
|
|
Karsten Hopp |
53cf4e |
+ for (waited = 0; waited < 40; ++waited)
|
|
Karsten Hopp |
53cf4e |
+ {
|
|
Karsten Hopp |
53cf4e |
+ pid = waitpid(csinfo[i].pid, &pstat, WNOHANG);
|
|
Karsten Hopp |
53cf4e |
+ if (pid != 0)
|
|
Karsten Hopp |
53cf4e |
+ break; /* break unless the process is still running */
|
|
Karsten Hopp |
53cf4e |
+ mch_delay(50, FALSE); /* sleep 50 ms */
|
|
Karsten Hopp |
53cf4e |
+ }
|
|
Karsten Hopp |
53cf4e |
+ # endif
|
|
Karsten Hopp |
53cf4e |
+ /*
|
|
Karsten Hopp |
53cf4e |
+ * If the cscope process is still running: kill it.
|
|
Karsten Hopp |
53cf4e |
+ * Safety check: If the PID would be zero here, the entire X session
|
|
Karsten Hopp |
53cf4e |
+ * would be killed. -1 and 1 are dangerous as well.
|
|
Karsten Hopp |
53cf4e |
+ */
|
|
Karsten Hopp |
53cf4e |
+ if (pid < 0 && csinfo[i].pid > 1)
|
|
Karsten Hopp |
53cf4e |
+ {
|
|
Karsten Hopp |
53cf4e |
+ kill(csinfo[i].pid, SIGTERM);
|
|
Karsten Hopp |
53cf4e |
+ (void)waitpid(csinfo[i].pid, &pstat, 0);
|
|
Karsten Hopp |
53cf4e |
+ }
|
|
Karsten Hopp |
53cf4e |
+ }
|
|
Karsten Hopp |
53cf4e |
+ #else /* !UNIX */
|
|
Karsten Hopp |
53cf4e |
if (csinfo[i].hProc != NULL)
|
|
Karsten Hopp |
53cf4e |
{
|
|
Karsten Hopp |
53cf4e |
/* Give cscope a chance to exit normally */
|
|
Karsten Hopp |
53cf4e |
***************
|
|
Karsten Hopp |
53cf4e |
*** 2133,2150 ****
|
|
Karsten Hopp |
53cf4e |
if (csinfo[i].to_fp != NULL)
|
|
Karsten Hopp |
53cf4e |
(void)fclose(csinfo[i].to_fp);
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
- /*
|
|
Karsten Hopp |
53cf4e |
- * Safety check: If the PID would be zero here, the entire X session would
|
|
Karsten Hopp |
53cf4e |
- * be killed. -1 and 1 are dangerous as well.
|
|
Karsten Hopp |
53cf4e |
- */
|
|
Karsten Hopp |
53cf4e |
- #if defined(UNIX)
|
|
Karsten Hopp |
53cf4e |
- if (csinfo[i].pid > 1)
|
|
Karsten Hopp |
53cf4e |
- {
|
|
Karsten Hopp |
53cf4e |
- kill(csinfo[i].pid, SIGTERM);
|
|
Karsten Hopp |
53cf4e |
- (void)waitpid(csinfo[i].pid, &pstat, 0);
|
|
Karsten Hopp |
53cf4e |
- }
|
|
Karsten Hopp |
53cf4e |
- #endif
|
|
Karsten Hopp |
53cf4e |
-
|
|
Karsten Hopp |
53cf4e |
if (freefnpp)
|
|
Karsten Hopp |
53cf4e |
{
|
|
Karsten Hopp |
53cf4e |
vim_free(csinfo[i].fname);
|
|
Karsten Hopp |
53cf4e |
--- 2188,2193 ----
|
|
Karsten Hopp |
53cf4e |
*** ../vim-7.1.278/src/version.c Wed Mar 12 21:47:31 2008
|
|
Karsten Hopp |
53cf4e |
--- src/version.c Sat Mar 15 12:38:58 2008
|
|
Karsten Hopp |
53cf4e |
***************
|
|
Karsten Hopp |
53cf4e |
*** 668,669 ****
|
|
Karsten Hopp |
53cf4e |
--- 668,671 ----
|
|
Karsten Hopp |
53cf4e |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
53cf4e |
+ /**/
|
|
Karsten Hopp |
53cf4e |
+ 279,
|
|
Karsten Hopp |
53cf4e |
/**/
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
--
|
|
Karsten Hopp |
53cf4e |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
53cf4e |
130. You can't get out of your desk even if it's time to eat or time
|
|
Karsten Hopp |
53cf4e |
to go to the bathroom.
|
|
Karsten Hopp |
53cf4e |
|
|
Karsten Hopp |
53cf4e |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
53cf4e |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
53cf4e |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
53cf4e |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|