task.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* include/kernel/task.h
  2. *
  3. * This file is part of evx.
  4. *
  5. * evx is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * evx is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with evx. If not, see <https://www.gnu.org/licenses/>
  17. */
  18. #ifndef __TASK_H
  19. #define __TASK_H
  20. #ifndef __ASSEMBLER__
  21. #include <sys/types.h>
  22. #include <arch/arch_task.h>
  23. /* exit()'ed, but not be wait()'ed by its parent */
  24. #define TASK_ZOMB 0
  25. /* it's ready to run but not running */
  26. #define TASK_READY 1
  27. /* running on current cpu, and the current points to the struct task of it */
  28. #define TASK_RUNNING 2
  29. /* waiting for some resources */
  30. #define TASK_WAIT 3
  31. struct task {
  32. int state;
  33. int pid;
  34. struct task *parent;
  35. /* other things such as pgid or sid are strange for me, well,
  36. * support them later */
  37. /* for x86, it includes sp, ptable etc */
  38. struct arch_task_descr arch_descr;
  39. int nice;
  40. };
  41. extern struct task *current;
  42. extern struct task init_task;
  43. /* returns a new task copied from current */
  44. struct task *dup_task(void);
  45. #endif
  46. #endif