From 212cea4535d7f4bc6b3c12ecafaa3b5748365c9f Mon Sep 17 00:00:00 2001 From: stasoid Date: Sun, 15 Dec 2024 05:39:12 +0500 Subject: [PATCH] LibCore: Add System::getpid --- Libraries/LibCore/System.cpp | 5 +++++ Libraries/LibCore/System.h | 2 ++ Libraries/LibCore/SystemWindows.cpp | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/Libraries/LibCore/System.cpp b/Libraries/LibCore/System.cpp index de3aab10667..500e8eaec08 100644 --- a/Libraries/LibCore/System.cpp +++ b/Libraries/LibCore/System.cpp @@ -999,4 +999,9 @@ ErrorOr set_resource_limits(int resource, rlim_t limit) return {}; } +int getpid() +{ + return ::getpid(); +} + } diff --git a/Libraries/LibCore/System.h b/Libraries/LibCore/System.h index 0a6edcbff15..850e9324e8b 100644 --- a/Libraries/LibCore/System.h +++ b/Libraries/LibCore/System.h @@ -179,4 +179,6 @@ ErrorOr get_resource_limits(int resource); ErrorOr set_resource_limits(int resource, rlim_t limit); #endif +int getpid(); + } diff --git a/Libraries/LibCore/SystemWindows.cpp b/Libraries/LibCore/SystemWindows.cpp index a9f6165192f..8fe6f69021f 100644 --- a/Libraries/LibCore/SystemWindows.cpp +++ b/Libraries/LibCore/SystemWindows.cpp @@ -184,4 +184,9 @@ ErrorOr munmap(void* address, size_t size) return {}; } +int getpid() +{ + return GetCurrentProcessId(); +} + }