# HG changeset patch # User Jun Wu # Date 1468793159 -3600 # Node ID c66bc06f1bf6f01124dcf24c2934398a0c1d2bde # Parent ee8186457516ed1341db5fdfd9cd98bac6db99d0 chg: add pgid to hgclient struct The previous patch makes the server tell the client its pgid. This patch stores it in hgclient_t and adds a function to get it. diff -r ee8186457516 -r c66bc06f1bf6 contrib/chg/hgclient.c --- a/contrib/chg/hgclient.c Sun Jul 17 22:56:05 2016 +0100 +++ b/contrib/chg/hgclient.c Sun Jul 17 23:05:59 2016 +0100 @@ -63,6 +63,7 @@ struct hgclient_tag_ { int sockfd; + pid_t pgid; pid_t pid; context_t ctx; unsigned int capflags; @@ -339,6 +340,8 @@ u = dataend; if (strncmp(s, "capabilities:", t - s + 1) == 0) { hgc->capflags = parsecapabilities(t + 2, u); + } else if (strncmp(s, "pgid:", t - s + 1) == 0) { + hgc->pgid = strtol(t + 2, NULL, 10); } else if (strncmp(s, "pid:", t - s + 1) == 0) { hgc->pid = strtol(t + 2, NULL, 10); } @@ -463,6 +466,12 @@ free(hgc); } +pid_t hgc_peerpgid(const hgclient_t *hgc) +{ + assert(hgc); + return hgc->pgid; +} + pid_t hgc_peerpid(const hgclient_t *hgc) { assert(hgc); diff -r ee8186457516 -r c66bc06f1bf6 contrib/chg/hgclient.h --- a/contrib/chg/hgclient.h Sun Jul 17 22:56:05 2016 +0100 +++ b/contrib/chg/hgclient.h Sun Jul 17 23:05:59 2016 +0100 @@ -18,6 +18,7 @@ hgclient_t *hgc_open(const char *sockname); void hgc_close(hgclient_t *hgc); +pid_t hgc_peerpgid(const hgclient_t *hgc); pid_t hgc_peerpid(const hgclient_t *hgc); const char **hgc_validate(hgclient_t *hgc, const char *const args[],