##// END OF EJS Templates
chg: change server's process title...
Jun Wu -
r30751:e882c7bb default
parent child Browse files
Show More
@@ -35,6 +35,7 b' enum {'
35 CAP_SETENV = 0x0800,
35 CAP_SETENV = 0x0800,
36 CAP_SETUMASK = 0x1000,
36 CAP_SETUMASK = 0x1000,
37 CAP_VALIDATE = 0x2000,
37 CAP_VALIDATE = 0x2000,
38 CAP_SETPROCNAME = 0x4000,
38 };
39 };
39
40
40 typedef struct {
41 typedef struct {
@@ -50,6 +51,7 b' static const cappair_t captable[] = {'
50 {"setenv", CAP_SETENV},
51 {"setenv", CAP_SETENV},
51 {"setumask", CAP_SETUMASK},
52 {"setumask", CAP_SETUMASK},
52 {"validate", CAP_VALIDATE},
53 {"validate", CAP_VALIDATE},
54 {"setprocname", CAP_SETPROCNAME},
53 {NULL, 0}, /* terminator */
55 {NULL, 0}, /* terminator */
54 };
56 };
55
57
@@ -362,6 +364,14 b' static void readhello(hgclient_t *hgc)'
362 debugmsg("capflags=0x%04x, pid=%d", hgc->capflags, hgc->pid);
364 debugmsg("capflags=0x%04x, pid=%d", hgc->capflags, hgc->pid);
363 }
365 }
364
366
367 static void updateprocname(hgclient_t *hgc)
368 {
369 size_t n = (size_t)snprintf(hgc->ctx.data, hgc->ctx.maxdatasize,
370 "chg[worker/%d]", (int)getpid());
371 hgc->ctx.datasize = n;
372 writeblockrequest(hgc, "setprocname");
373 }
374
365 static void attachio(hgclient_t *hgc)
375 static void attachio(hgclient_t *hgc)
366 {
376 {
367 debugmsg("request attachio");
377 debugmsg("request attachio");
@@ -491,6 +501,8 b' hgclient_t *hgc_open(const char *socknam'
491 readhello(hgc);
501 readhello(hgc);
492 if (!(hgc->capflags & CAP_RUNCOMMAND))
502 if (!(hgc->capflags & CAP_RUNCOMMAND))
493 abortmsg("insufficient capability: runcommand");
503 abortmsg("insufficient capability: runcommand");
504 if (hgc->capflags & CAP_SETPROCNAME)
505 updateprocname(hgc);
494 if (hgc->capflags & CAP_ATTACHIO)
506 if (hgc->capflags & CAP_ATTACHIO)
495 attachio(hgc);
507 attachio(hgc);
496 if (hgc->capflags & CAP_CHDIR)
508 if (hgc->capflags & CAP_CHDIR)
General Comments 0
You need to be logged in to leave comments. Login now