Minor formatting changes
[akaros.git] / kern / drivers / dev / proc.c
index 1ef993b..99c08cd 100644 (file)
@@ -73,16 +73,6 @@ enum {
        CMwaitstop,
        CMwired,
        CMtrace,
-       /* real time */
-       CMperiod,
-       CMdeadline,
-       CMcost,
-       CMsporadic,
-       CMdeadlinenotes,
-       CMadmit,
-       CMextra,
-       CMexpel,
-       CMevent,
        CMcore,
 };
 
@@ -90,11 +80,9 @@ enum {
        Nevents = 0x4000,
        Emask = Nevents - 1,
        Ntracedpids = 1024,
+       STATSIZE = 8 + 1 + 10 + 1 + 6 + 2,
 };
 
-/* + 6 * 12 for extra NIX counters. */
-#define STATSIZE       (2*KNAMELEN+12+9*12 +6*12)
-
 /*
  * Status, fd, and ns are left fully readable (0444) because of their use in debugging,
  * particularly on shared servers.
@@ -141,21 +129,9 @@ struct cmdtab proccmd[] = {
        {CMwaitstop, "waitstop", 1},
        {CMwired, "wired", 2},
        {CMtrace, "trace", 0},
-       {CMperiod, "period", 2},
-       {CMdeadline, "deadline", 2},
-       {CMcost, "cost", 2},
-       {CMsporadic, "sporadic", 1},
-       {CMdeadlinenotes, "deadlinenotes", 1},
-       {CMadmit, "admit", 1},
-       {CMextra, "extra", 1},
-       {CMexpel, "expel", 1},
-       {CMevent, "event", 1},
        {CMcore, "core", 2},
 };
 
-/* Segment type from portdat.h */
-static char *sname[] = { "Text", "Data", "Bss", "Stack", "Shared", "Phys", };
-
 /*
  * struct qids are, in path:
  *      5 bits of file type (qids above) (old comment said 4 here)
@@ -513,7 +489,6 @@ static struct chan *procopen(struct chan *c, int omode)
                        break;
 
                case Qmem:
-               case Qctl:
 //          if (p->privatemem)
                        error(Eperm);
                        //nonone(p);
@@ -536,6 +511,7 @@ static struct chan *procopen(struct chan *c, int omode)
                        c->aux = kzmalloc(sizeof(struct mntwalk), KMALLOC_WAIT);
                        break;
                case Qstatus:
+               case Qctl:
                        break;
                case Qnotepg:
                        error("not yet");
@@ -1134,10 +1110,12 @@ regread:
                        return n;
 #endif
                case Qstatus:{
-                               char buf[8 + 1 + 10 + 1 + 6 + 2];       /* 2 is paranoia */
+                               /* the extra 2 is paranoia */
+                               char buf[8 + 1 + PROC_PROGNAME_SZ + 1 + 10 + 1 + 6 + 2];
                                snprintf(buf, sizeof(buf),
-                                                "%8d %-10s %6d", p->pid, procstate2str(p->state),
-                                                p->ppid);
+                                        "%8d %-*s %-10s %6d", p->pid, PROC_PROGNAME_SZ,
+                                        p->progname, procstate2str(p->state),
+                                        p->ppid);
                                kref_put(&p->p_kref);
                                return readstr(off, va, n, buf);
                        }
@@ -1469,7 +1447,9 @@ static void procctlreq(struct proc *p, char *va, int n)
                default:
                        error("nope\n");
                        break;
-
+               case CMtrace:
+                       systrace_trace_pid(p);
+                       break;
                case CMclose:
                        procctlclosefiles(p, 0, atoi(cb->f[1]));
                        break;
@@ -1494,30 +1474,6 @@ static void procctlreq(struct proc *p, char *va, int n)
                         * hyperthreaded core. */
                        spin_on(p->env_cr3);
                        break;
-#if 0
-                       core ownership.From NIX.case CMcore:core = atoi(cb->f[1]);
-                       if (core >= MACHMAX)
-                               error("wrong core number");
-                       else if (core == 0) {
-                               if (p->ac == NULL)
-                                       error("not running in an ac");
-                               p->procctl = struct proc_totc;
-                               if (p != up && p->state == Exotic) {
-                                       /* see the comment in postnote */
-                                       intrac(p);
-                               }
-                       } else {
-                               if (p->ac != NULL)
-                                       error("running in an ac");
-                               if (core < 0)
-                                       p->ac = getac(p, -1);
-                               else
-                                       p->ac = getac(p, core);
-                               p->procctl = struct proc_toac;
-                               p->prepagemem = 1;
-                       }
-                       break;
-#endif
        }
        poperror();
        kfree(cb);