From 86b249f02fa2293341c0da9c590df6271050cd1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= Date: Tue, 21 Dec 2021 16:15:24 +0100 Subject: [PATCH] Kernel: Implement sysconf(_SC_SYMLOOP_MAX) Not much to say here, this is an implementation of this call that accesses the actual limit constant that's used by the VirtualFileSystem class. As a side note, this is required for my eventual Qt port. --- Kernel/API/POSIX/unistd.h | 2 ++ Kernel/Syscalls/sysconf.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Kernel/API/POSIX/unistd.h b/Kernel/API/POSIX/unistd.h index f0286a5d0e..1058ea75ef 100644 --- a/Kernel/API/POSIX/unistd.h +++ b/Kernel/API/POSIX/unistd.h @@ -38,6 +38,7 @@ enum { _SC_PAGESIZE, _SC_GETPW_R_SIZE_MAX, _SC_CLK_TCK, + _SC_SYMLOOP_MAX, }; #define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK @@ -49,6 +50,7 @@ enum { #define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX #define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX #define _SC_CLK_TCK _SC_CLK_TCK +#define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX #ifdef __cplusplus } diff --git a/Kernel/Syscalls/sysconf.cpp b/Kernel/Syscalls/sysconf.cpp index 6f9c562650..ce6b649480 100644 --- a/Kernel/Syscalls/sysconf.cpp +++ b/Kernel/Syscalls/sysconf.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include @@ -30,6 +31,8 @@ ErrorOr Process::sys$sysconf(int name) return 4096; // idk case _SC_CLK_TCK: return TimeManagement::the().ticks_per_second(); + case _SC_SYMLOOP_MAX: + return Kernel::VirtualFileSystem::symlink_recursion_limit; default: return EINVAL; }