From: Luke Mewburn Date: Fri, 17 Apr 2015 01:25:41 GMT Subject: Re: [PATCH] compat/mingw: stubs for getpgid() and tcgetpgrp() Message-ID: <20150417012541.GI23475@mewburn.net> In-Reply-To: <552EAE0A.3040208@kdbg.org> On Wed, Apr 15, 2015 at 08:29:30PM +0200, Johannes Sixt wrote: | Windows does not have process groups. It is, therefore, the simplest | to pretend that each process is in its own process group. | | [...] | | diff --git a/compat/mingw.h b/compat/mingw.h | index 7b523cf..a552026 100644 | @@ -118,6 +116,12 @@ static inline int sigaddset(sigset_t *set, int signum) | #define SIG_UNBLOCK 0 | static inline int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) | { return 0; } | +static inline pid_t getppid(void) | +{ return 1; } | +static inline pid_t getpgid(pid_t pid) | +{ return pid == 0 ? getpid() : pid; } | +static inline pid_t tcgetpgrp(int fd) | +{ return getpid(); } This appears to be similar to the approach that tcsh uses too; return the current process ID for the process group ID. See https://github.com/tcsh-org/tcsh/blob/master/win32/ntport.h for tcsh's implementation of getpgrp() (a variation of getpgid()) and tcgetpgrp(). regards, Luke.