Serenity Operating System
1/*
2 * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
3 * Copyright (c) 2022, Patrick Meyer <git@the-space.agency>
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <AK/StringView.h>
11#include <Kernel/API/Syscall.h>
12
13namespace Kernel::Syscall {
14
15// Separate header so syscall.h doesn't depend on malloc.
16// https://github.com/SerenityOS/serenity/issues/13869
17constexpr StringView to_string(Function function)
18{
19 switch (function) {
20#undef __ENUMERATE_SYSCALL
21#define __ENUMERATE_SYSCALL(sys_call, needs_lock) \
22 case SC_##sys_call: \
23 return #sys_call##sv;
24 ENUMERATE_SYSCALLS(__ENUMERATE_SYSCALL)
25#undef __ENUMERATE_SYSCALL
26 default:
27 break;
28 }
29 return "Unknown"sv;
30}
31
32}