mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
Kernel: Stop requiring working malloc for syscall.h includes
Fixes #13869
This commit is contained in:
parent
e02579bdab
commit
0bd131ad06
7 changed files with 37 additions and 16 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/StringView.h>
|
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
#include <AK/Userspace.h>
|
#include <AK/Userspace.h>
|
||||||
|
|
||||||
|
@ -201,21 +200,6 @@ enum Function {
|
||||||
__Count
|
__Count
|
||||||
};
|
};
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __serenity__
|
#ifdef __serenity__
|
||||||
struct StringArgument {
|
struct StringArgument {
|
||||||
char const* characters;
|
char const* characters;
|
||||||
|
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#include <Kernel/API/SyscallString.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/FileStream.h>
|
#include <AK/FileStream.h>
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
|
#include <Kernel/API/SyscallString.h>
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/NonnullOwnPtr.h>
|
#include <AK/NonnullOwnPtr.h>
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
|
#include <Kernel/API/SyscallString.h>
|
||||||
#include <LibC/sys/arch/i386/regs.h>
|
#include <LibC/sys/arch/i386/regs.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <AK/IPv4Address.h>
|
#include <AK/IPv4Address.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
#include <AK/Types.h>
|
#include <AK/Types.h>
|
||||||
|
#include <Kernel/API/SyscallString.h>
|
||||||
#include <LibC/sys/arch/i386/regs.h>
|
#include <LibC/sys/arch/i386/regs.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/File.h>
|
#include <LibCore/File.h>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <AK/Debug.h>
|
#include <AK/Debug.h>
|
||||||
#include <AK/Iterator.h>
|
#include <AK/Iterator.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#include <Kernel/API/SyscallString.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <errno_codes.h>
|
#include <errno_codes.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue