serenity.cpp 909 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include <Kernel/Syscall.h>
  2. #include <errno.h>
  3. #include <serenity.h>
  4. extern "C" {
  5. int module_load(const char* path, size_t path_length)
  6. {
  7. int rc = syscall(SC_module_load, path, path_length);
  8. __RETURN_WITH_ERRNO(rc, rc, -1);
  9. }
  10. int module_unload(const char* name, size_t name_length)
  11. {
  12. int rc = syscall(SC_module_unload, name, name_length);
  13. __RETURN_WITH_ERRNO(rc, rc, -1);
  14. }
  15. int profiling_enable(pid_t pid)
  16. {
  17. int rc = syscall(SC_profiling_enable, pid);
  18. __RETURN_WITH_ERRNO(rc, rc, -1);
  19. }
  20. int profiling_disable(pid_t pid)
  21. {
  22. int rc = syscall(SC_profiling_disable, pid);
  23. __RETURN_WITH_ERRNO(rc, rc, -1);
  24. }
  25. int futex(int32_t* userspace_address, int futex_op, int32_t value, const struct timespec* timeout)
  26. {
  27. Syscall::SC_futex_params params { userspace_address, futex_op, value, timeout };
  28. int rc = syscall(SC_futex, &params);
  29. __RETURN_WITH_ERRNO(rc, rc, -1);
  30. }
  31. }