prctl.cpp 505 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <Kernel/Process.h>
  7. #include <LibC/sys/prctl_numbers.h>
  8. namespace Kernel {
  9. KResultOr<FlatPtr> Process::sys$prctl(int option, FlatPtr arg1, [[maybe_unused]] FlatPtr arg2)
  10. {
  11. switch (option) {
  12. case PR_GET_DUMPABLE:
  13. return is_dumpable();
  14. case PR_SET_DUMPABLE:
  15. set_dumpable(arg1);
  16. return 0;
  17. default:
  18. return EINVAL;
  19. }
  20. return 0;
  21. }
  22. }