commit 176c9f869a217e82c93d26f837ac2810017438e6
parent d0238937e1772129fb816963ca1a644c1565eb76
Author: Roberto E. Vargas Caballero <roberto.vargas@midokura.com>
Date: Wed, 16 Nov 2022 22:38:17 +0100
os9: Remove obsolete fields from Task
Diffstat:
3 files changed, 31 insertions(+), 43 deletions(-)
diff --git a/include/os9/os9.h b/include/os9/os9.h
@@ -92,11 +92,6 @@ enum tmode {
TFREE,
};
-enum start_reason {
- SNORMAL,
- SKERNEL,
-};
-
enum map_attr {
MR = 1 << 0,
MW = 1 << 1,
@@ -163,10 +158,8 @@ struct mpoint {
};
/**
- * @tid: Task identifier.
- * @ptid: Parent Task identifier. -1 for the initial task.
- * @tname: Name of the task.
- * @tentry: Entry point for the task.
+ * @name: Name of the task.
+ * @entry: Entry point for the task.
* @prio:
* @baseprio:
* @retainprio:
@@ -182,7 +175,6 @@ struct mpoint {
* @deadtime:
* @flags:
* @state:
- * @start: Denotes the reason the task is started.
* @ctx:
* @ptable:
* @text:
@@ -192,13 +184,11 @@ struct mpoint {
* @fds:
*/
struct task {
- int tid;
- int ptid;
int pid;
int ppid;
- char *tname;
- void *tentry;
+ char *name;
+ void *entry;
int prio;
int baseprio;
@@ -217,7 +207,6 @@ struct task {
int flags;
int state;
- int start;
mutex_t m;
diff --git a/src/os9/dev/devproc.c b/src/os9/dev/devproc.c
@@ -33,7 +33,7 @@ procfsgen(Chan *c, int n, Dir *dir)
case NR_TASKS:
mkentry(c, dir,
"cur", 0,
- QID(CHDIR, 0, PATH(Qtaskdir, proc->tid)),
+ QID(CHDIR, 0, PATH(Qtaskdir, proc->pid)),
O_READ);
return 1;
case NR_TASKS+1:
@@ -45,10 +45,10 @@ procfsgen(Chan *c, int n, Dir *dir)
if (n == 0)
return 0;
- ksnprint(nam, NAMELEN, "%d", tp->tid);
+ ksnprint(nam, NAMELEN, "%d", tp->pid);
mkentry(c, dir,
nam, 0,
- QID(CHDIR, 0, PATH(Qtaskdir, tp->tid)),
+ QID(CHDIR, 0, PATH(Qtaskdir, tp->pid)),
O_READ);
unlock(&tp->m);
return 1;
@@ -58,10 +58,10 @@ procfsgen(Chan *c, int n, Dir *dir)
static int
taskgen(Chan *c, int n, Dir *dir)
{
- int r, tid = TASK(c->qid);
+ int r, pid = TASK(c->qid);
if ((r = devgen(c, tasktab, NELEM(tasktab), n, dir)) == 1)
- dir->qid.path = PATH(dir->qid.path, tid);
+ dir->qid.path = PATH(dir->qid.path, pid);
return r;
}
@@ -97,16 +97,16 @@ taskattrread(Chan *c, void *buf, int n)
len = ksnprint(tmp,
sizeof(tmp),
"name: %s\n"
- "tid: %d\n"
+ "pid: %d\n"
"entry: %p\n"
"stack size: %zd\n"
"base prio: %d\n"
"period: %ld\n"
"capacity: %ld\n"
"deadline: %ld\n",
- tp->tname,
- tp->tid,
- tp->tentry,
+ tp->name,
+ tp->pid,
+ tp->entry,
tp->stack,
tp->prio,
tp->period,
diff --git a/src/os9/proc.c b/src/os9/proc.c
@@ -37,7 +37,7 @@ iproc(void)
Task *tp;
for (tp = tasktab; tp < &tasktab[NR_TASKS]; ++tp) {
- tp->tid = tp->ptid = -1;
+ tp->pid = tp->ppid = -1;
tp->state = TFREE;
}
@@ -97,7 +97,7 @@ getntask(int n, Task **tpp)
}
Task *
-gettask(int tid)
+gettask(int pid)
{
Task *tp, *p;
@@ -105,7 +105,7 @@ gettask(int tid)
lock(&procm);
for (p = tasktab; p < &tasktab[NR_TASKS]; ++p) {
lock(&p->m);
- if (p->tid == tid && p->state != TFREE) {
+ if (p->pid == pid && p->state != TFREE) {
tp = p;
break;
}
@@ -203,7 +203,7 @@ newslot(void)
static Task *
newtask(void)
{
- int tid;
+ int pid;
Task *tp;
static int last;
static mutex_t m;
@@ -212,15 +212,15 @@ newtask(void)
lock(&m);
tp = NULL;
- tid = last;
+ pid = last;
for (;;) {
- if (tid == MAXTID)
- tid = -1;
- tid++;
- if (tid == last)
+ if (pid == MAXTID)
+ pid = -1;
+ pid++;
+ if (pid == last)
goto err;
- if ((tp = gettask(tid)) == NULL)
+ if ((tp = gettask(pid)) == NULL)
break;
unlock(&tp->m);
}
@@ -228,8 +228,8 @@ newtask(void)
if ((tp = newslot()) == NULL)
goto err;
- last = tid;
- tp->tid = tid;
+ last = pid;
+ tp->pid = pid;
unlock(&m);
return tp;
@@ -313,7 +313,7 @@ clone(Task *parent)
if ((tp = newtask()) == NULL)
return NULL;
- tp->ptid = parent->tid;
+ tp->ppid = parent->pid;
if (!initptable(tp) || !newstack(tp))
goto err;
@@ -401,7 +401,7 @@ rfork(int flags)
if (flags & RFPROC) {
unlock(&tp->m);
- return tp->tid;
+ return tp->pid;
}
return 0;
@@ -435,11 +435,11 @@ kproc(void *fn)
tp->fds = NULL;
tp->ns = NULL;
- tp->tid = 1;
- tp->ptid = -1;
+ tp->pid = 1;
+ tp->ppid = -1;
- tp->tname = "init";
- tp->tentry = fn;
+ tp->name = "init";
+ tp->entry = fn;
tp->prio = 0;
tp->baseprio = 0;
@@ -459,7 +459,6 @@ kproc(void *fn)
tp->flags = 0;
tp->state = TREADY;
- tp->start = SKERNEL;
if ((tp->kstack = allocb(1)) == NULL)
goto err;