feat: added state to ps output
This commit is contained in:
@@ -25,6 +25,26 @@
|
|||||||
#define TASK_STATE_STOPPED (1 << 6)
|
#define TASK_STATE_STOPPED (1 << 6)
|
||||||
#define TASK_STATE_ERROR (1 << 7)
|
#define TASK_STATE_ERROR (1 << 7)
|
||||||
|
|
||||||
|
const char *task_state_str(uint8_t state) {
|
||||||
|
switch (state) {
|
||||||
|
case TASK_STATE_RUNNABLE:
|
||||||
|
return "RUNNABLE ";
|
||||||
|
case TASK_STATE_RUNNING:
|
||||||
|
return "RUNNING ";
|
||||||
|
case TASK_STATE_WAIT_IRQ:
|
||||||
|
return "WAIT_IRQ ";
|
||||||
|
case TASK_STATE_WAIT_SIGNAL:
|
||||||
|
return "WAIT_SIGNAL";
|
||||||
|
case TASK_STATE_STOPPED:
|
||||||
|
return "STOPPED ";
|
||||||
|
case TASK_STATE_ERROR:
|
||||||
|
return "ERROR ";
|
||||||
|
case TASK_STATE_UNKNOWN:
|
||||||
|
default:
|
||||||
|
return "UNKNOWN ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int errno = 0;
|
int errno = 0;
|
||||||
|
|
||||||
typedef struct task {
|
typedef struct task {
|
||||||
@@ -321,7 +341,7 @@ void task_print_all() {
|
|||||||
printf("tasks:\n");
|
printf("tasks:\n");
|
||||||
task_t *c = first_task;
|
task_t *c = first_task;
|
||||||
while (c != NULL) {
|
while (c != NULL) {
|
||||||
printf("%d - %s\n", c->tid, c->name);
|
printf("%d - %s %s\n", c->tid, task_state_str(c->state), c->name);
|
||||||
c = c->next;
|
c = c->next;
|
||||||
}
|
}
|
||||||
task_lock_free();
|
task_lock_free();
|
||||||
|
|||||||
Reference in New Issue
Block a user