mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
Kernel: Stop requiring working malloc for syscall.h includes
Fixes #13869
This commit is contained in:
parent
e02579bdab
commit
0bd131ad06
Notes:
sideshowbarker
2024-07-17 11:23:18 +09:00
Author: https://github.com/HerrSpace
Commit: 0bd131ad06
Pull-request: https://github.com/SerenityOS/serenity/pull/13878
Issue: https://github.com/SerenityOS/serenity/issues/13869
Reviewed-by: https://github.com/linusg ✅
7 changed files with 37 additions and 16 deletions
32
Kernel/API/SyscallString.h
Normal file
32
Kernel/API/SyscallString.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, Patrick Meyer <git@the-space.agency>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
|
||||
namespace Kernel::Syscall {
|
||||
|
||||
// Separate header so syscall.h doesn't depend on malloc.
|
||||
// https://github.com/SerenityOS/serenity/issues/13869
|
||||
constexpr StringView to_string(Function function)
|
||||
{
|
||||
switch (function) {
|
||||
#undef __ENUMERATE_SYSCALL
|
||||
#define __ENUMERATE_SYSCALL(sys_call, needs_lock) \
|
||||
case SC_##sys_call: \
|
||||
return #sys_call##sv;
|
||||
ENUMERATE_SYSCALLS(__ENUMERATE_SYSCALL)
|
||||
#undef __ENUMERATE_SYSCALL
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Unknown"sv;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue