aboutsummaryrefslogtreecommitdiffstats
path: root/src/kernel/task.h
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-10-29 18:11:53 -0400
committerClyne Sullivan <tullivan99@gmail.com>2018-10-29 18:11:53 -0400
commit3a798edb836a30f612b6dd40334b69a2dbeeca22 (patch)
tree0b65f27939645a2f91824e9ae7457240309f4127 /src/kernel/task.h
parent3919219d9bfbf0d50407878c92869485eaaacd44 (diff)
good tasks, svc cleaning
Diffstat (limited to 'src/kernel/task.h')
-rw-r--r--src/kernel/task.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/kernel/task.h b/src/kernel/task.h
index 0e2e07a..d78e1da 100644
--- a/src/kernel/task.h
+++ b/src/kernel/task.h
@@ -21,8 +21,14 @@
#ifndef TASK_H_
#define TASK_H_
+#include "vfs.h"
#include <stdint.h>
+#define WIFEXITED(w) (w & (1 << 8))
+#define WEXITSTATUS(w) (w & 0xFF)
+
+typedef uint16_t pid_t;
+
/**
* A structure to contain task data.
*/
@@ -30,10 +36,22 @@ typedef struct task_t {
struct task_t *next; /**< pointer to the next task_t instance */
uint32_t *sp; /**< pointer to the task's last sp register value */
uint32_t *stack; /**< pointer to the task's stack */
- uint32_t sleep; /**< number of milliseconds task is sleeping for */
- uint32_t pid;
+ pid_t pid; /**< Task (Process) ID */
+ pid_t pgid; /**< Process Group ID */
+ struct {
+ uint32_t state : 8;
+ uint32_t value : 24;
+ } status;
+// vfs_node *cwd;
} task_t;
+enum TASK_STATUS_FLAGS {
+ TASK_RUNNING, /**< Task is actively running */
+ TASK_SLEEPING, /**< Task is sleeping for task_t.sleep ms */
+ TASK_EXITED, /**< Task has exited, task_t.sleep has code */
+ TASK_ZOMBIE /**< Task exited, accounted for, ready to go bye bye */
+};
+
/**
* Enters multitasking mode. The given function acts as the initial thread.
* This task is given a 4kb stack.
@@ -56,14 +74,8 @@ void task_start(void (*task)(void), uint16_t stackSize);
*/
void task_hold(uint8_t hold);
-/**
- * Frees the task's resources and removes it from the running task list.
- * @param code An unused exit code
- */
-void _exit(int code);
-
void task_sleep(uint32_t ms);
-uint32_t task_getpid(void);
+//vfs_node *task_getcwd(void);
#endif // TASK_H_