process.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * process.h
  3. *
  4. * Copyright (C) 2016 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __MONOLITHIUM_PROCESS_H__
  20. #define __MONOLITHIUM_PROCESS_H__
  21. #include "object.h"
  22. #define CLONE_MAGIC 0x79706F43
  23. #define PROCESS_CREATE_NO_INHERIT (1 << 0)
  24. #define PROCESS_CREATE_NO_THREADS (1 << 1)
  25. #define PROCESS_CREATE_FROZEN_THREAD (1 << 2)
  26. typedef enum
  27. {
  28. PROCESS_PID_INFO,
  29. PROCESS_NAME_INFO,
  30. PROCESS_START_TIME_INFO,
  31. PROCESS_MEMORY_INFO,
  32. PROCESS_EXIT_CODE_INFO,
  33. PROCESS_USER_INFO,
  34. PROCESS_THREAD_INFO,
  35. PROCESS_HANDLE_INFO,
  36. } process_info_t;
  37. typedef struct
  38. {
  39. char *command_line;
  40. char *working_directory;
  41. handle_t standard_input;
  42. handle_t standard_output;
  43. handle_t standard_error;
  44. } process_params_t;
  45. sysret_t syscall_open_process(dword_t pid, handle_t *handle);
  46. sysret_t syscall_create_process(const char *path, dword_t flags, process_params_t *parameters, handle_t *process_handle, handle_t *thread_handle);
  47. sysret_t syscall_terminate(handle_t handle, dword_t exit_code);
  48. sysret_t syscall_query_process(handle_t handle, process_info_t info_type, void *buffer, dword_t size);
  49. sysret_t syscall_enum_processes(dword_t *pid_array, dword_t *count);
  50. #endif