From ba11888753c67407c7598171f398b6a6aa2d7522 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Thu, 28 Sep 2017 00:09:17 +0200 Subject: [PATCH] kern: proc, dup: _procfdprint OCEXEC and ORCLOSE In _procfdprint print additional informations in the second column: E is printed if the file was open with OCEXEC flag D is printed if the file was open with ORCLOSE flag Example output: 3 rE 9 46 (0000000000000001 0 00) 8192 13 /dev/cons --- sys/src/kern/port/devproc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/src/kern/port/devproc.c b/sys/src/kern/port/devproc.c index 6414c3c..bf019cf 100644 --- a/sys/src/kern/port/devproc.c +++ b/sys/src/kern/port/devproc.c @@ -558,15 +558,27 @@ procqidwidth(Chan *c) return jehanne_sprint(buf, "%lud", c->qid.vers); } + static int -_procfdprint(Chan *c, int fd, int w, char *s, int ns, char * modestr) +_procfdprint(Chan *c, int fd, int w, char *s, int ns, char *modestr) { int n; + char *flags; + if((c->mode&(OCEXEC|ORCLOSE)) == (OCEXEC|ORCLOSE)) + flags = "ED"; + else if(c->mode&OCEXEC) + flags = "E "; + else if(c->mode&ORCLOSE) + flags = "D "; + else + flags = " "; + if(w == 0) w = procqidwidth(c); - n = jehanne_snprint(s, ns, "%3d %.2s %C %4ud (%.16llux %*lud %.2ux) %5ld %8lld %s\n", + n = jehanne_snprint(s, ns, "%3d %.2s%s %C %4ud (%.16llux %*lud %.2ux) %5ld %8lld %s\n", fd, &modestr[(c->mode&3)<<1], + flags, c->dev->dc, c->devno, c->qid.path, w, c->qid.vers, c->qid.type, c->iounit, c->offset, c->path->s);