Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl2/xcvs/dist/src support SIGINFO



details:   https://anonhg.NetBSD.org/src/rev/d69a44ba9955
branches:  trunk
changeset: 992261:d69a44ba9955
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Aug 21 15:37:33 2018 +0000

description:
support SIGINFO

diffstat:

 external/gpl2/xcvs/dist/src/main.c |  31 ++++++++++++++++++++++++++++++-
 external/gpl2/xcvs/dist/src/run.c  |   8 +++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)

diffs (87 lines):

diff -r cd2d3c1e9d86 -r d69a44ba9955 external/gpl2/xcvs/dist/src/main.c
--- a/external/gpl2/xcvs/dist/src/main.c        Tue Aug 21 14:59:13 2018 +0000
+++ b/external/gpl2/xcvs/dist/src/main.c        Tue Aug 21 15:37:33 2018 +0000
@@ -17,7 +17,7 @@
  *
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: main.c,v 1.6 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.7 2018/08/21 15:37:33 christos Exp $");
 
 #include "cvs.h"
 
@@ -498,6 +498,32 @@
     return carry;
 }
 
+#ifdef SIGINFO
+#include <paths.h>
+
+static void
+show_status (int n)
+{
+       char wd[PATH_MAX];
+       char buf[2048];
+       static int ttyfd = -2;
+
+       if (ttyfd == -2)
+               ttyfd = open(_PATH_TTY, O_RDWR, O_CLOEXEC);
+
+       if (ttyfd == -1)
+               return;
+
+       if (getcwd(wd, sizeof(wd)) == NULL)
+               return;
+       n = snprintf(buf, sizeof(buf), "%s[%d]: working in %s\n", getprogname(),
+           (int)getpid(), wd);
+       if (n <= 0)
+               return;
+       write(ttyfd, buf, (size_t)n);
+}
+#endif
+
 static void
 convert (char const input[COMMITID_RAW_SIZE], char *output)
 {
@@ -967,6 +993,9 @@
 
        /* make sure we clean up on error */
        signals_register (main_cleanup);
+#ifdef SIGINFO
+       signal (SIGINFO, show_status);
+#endif
 
 #ifdef KLUDGE_FOR_WNT_TESTSUITE
        /* Probably the need for this will go away at some point once
diff -r cd2d3c1e9d86 -r d69a44ba9955 external/gpl2/xcvs/dist/src/run.c
--- a/external/gpl2/xcvs/dist/src/run.c Tue Aug 21 14:59:13 2018 +0000
+++ b/external/gpl2/xcvs/dist/src/run.c Tue Aug 21 15:37:33 2018 +0000
@@ -12,7 +12,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: run.c,v 1.3 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: run.c,v 1.4 2018/08/21 15:37:33 christos Exp $");
 
 #include "cvs.h"
 
@@ -239,6 +239,9 @@
 #endif
     if (pid == 0)
     {
+#ifdef SIGINFO
+       signal (SIGINFO, SIG_DFL);
+#endif
 #ifdef SETXID_SUPPORT
        if (flags & RUN_UNSETXID) {
            (void) setgid (getgid ());
@@ -570,6 +573,9 @@
        error (1, errno, "cannot fork");
     if (pid == 0)
     {
+#ifdef SIGINFO
+       signal (SIGINFO, SIG_DFL);
+#endif
        if (dup2 (to_child_pipe[0], STDIN_FILENO) < 0)
            error (1, errno, "cannot dup2 pipe");
        if (close (to_child_pipe[1]) < 0)



Home | Main Index | Thread Index | Old Index