prctl.cpp 548 B

123456789101112131415161718192021222324252627
  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. VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
  12. switch (option) {
  13. case PR_GET_DUMPABLE:
  14. return is_dumpable();
  15. case PR_SET_DUMPABLE:
  16. set_dumpable(arg1);
  17. return 0;
  18. default:
  19. return EINVAL;
  20. }
  21. return 0;
  22. }
  23. }