Mercurial > hg
diff contrib/chg/procutil.c @ 30693:baee0f47b533
chg: add procutil.h
This patch adds a formal header procutil.h for procutil.c, and changes
Makefile to build procutil.c independently.
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 02 Jan 2017 14:57:14 +0000 |
parents | 23ddd43ba866 |
children | 68c94f286e25 |
line wrap: on
line diff
--- a/contrib/chg/procutil.c Mon Jan 02 14:43:37 2017 +0000 +++ b/contrib/chg/procutil.c Mon Jan 02 14:57:14 2017 +0000 @@ -7,6 +7,17 @@ * GNU General Public License version 2 or any later version. */ +#include <assert.h> +#include <errno.h> +#include <signal.h> +#include <stdio.h> +#include <string.h> +#include <sys/wait.h> +#include <unistd.h> + +#include "procutil.h" +#include "util.h" + static pid_t pagerpid = 0; static pid_t peerpgid = 0; static pid_t peerpid = 0; @@ -71,7 +82,7 @@ kill(peerpid, SIGPIPE); } -static void setupsignalhandler(pid_t pid, pid_t pgid) +void setupsignalhandler(pid_t pid, pid_t pgid) { if (pid <= 0) return; @@ -121,7 +132,7 @@ abortmsgerrno("failed to set up signal handlers"); } -static void restoresignalhandler() +void restoresignalhandler(void) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); @@ -157,7 +168,7 @@ /* This implementation is based on hgext/pager.py (post 369741ef7253) * Return 0 if pager is not started, or pid of the pager */ -static pid_t setuppager(const char *pagercmd) +pid_t setuppager(const char *pagercmd) { assert(pagerpid == 0); if (!pagercmd) @@ -199,7 +210,7 @@ return 0; } -static void waitpager(void) +void waitpager(void) { if (pagerpid == 0) return;