1
0

object.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * object.h
  3. *
  4. * Copyright (C) 2013 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_OBJECT_H__
  20. #define __MONOLITHIUM_OBJECT_H__
  21. #include "defs.h"
  22. #define INVALID_HANDLE (handle_t)-1
  23. #define NO_ACCESS (access_flags_t)0
  24. #define FULL_ACCESS (access_flags_t)-1
  25. #define OBJECT_ANY_TYPE OBJECT_TYPE_MAX
  26. typedef dword_t handle_t;
  27. typedef dword_t access_flags_t;
  28. typedef enum
  29. {
  30. OBJECT_FILE,
  31. OBJECT_FILE_INSTANCE,
  32. OBJECT_PIPELINE,
  33. OBJECT_PIPE,
  34. OBJECT_PROCESS,
  35. OBJECT_THREAD,
  36. OBJECT_MEMORY,
  37. OBJECT_SEMAPHORE,
  38. OBJECT_USER,
  39. OBJECT_TYPE_MAX
  40. } object_type_t;
  41. typedef enum
  42. {
  43. HANDLE_INFO_NAME,
  44. HANDLE_INFO_TYPE,
  45. } handle_info_type_t;
  46. sysret_t syscall_close_object(handle_t handle);
  47. sysret_t syscall_query_handle(handle_t handle, handle_info_type_t type, void *buffer, size_t size);
  48. sysret_t syscall_duplicate_handle(handle_t source_process, handle_t handle, handle_t dest_process, handle_t *duplicate);
  49. sysret_t syscall_wait_for_one(handle_t handle, void *parameter, timeout_t timeout);
  50. sysret_t syscall_wait_for_any(const handle_t *handles, void *const *parameters, size_t count, timeout_t timeout);
  51. sysret_t syscall_wait_for_all(const handle_t *handles, void *const *parameters, size_t count, timeout_t timeout);
  52. #endif