diff options
Diffstat (limited to 'src/libPThread')
| -rw-r--r-- | src/libPThread/.keep | 0 | ||||
| -rw-r--r-- | src/libPThread/PThreadKit/.keep | 0 | ||||
| -rw-r--r-- | src/libPThread/PThreadKit/Thread.h | 14 | ||||
| -rw-r--r-- | src/libPThread/libPThread.json | 22 | ||||
| -rw-r--r-- | src/libPThread/src/.keep | 0 | ||||
| -rw-r--r-- | src/libPThread/src/Thread.cpp | 33 |
6 files changed, 69 insertions, 0 deletions
diff --git a/src/libPThread/.keep b/src/libPThread/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/libPThread/.keep diff --git a/src/libPThread/PThreadKit/.keep b/src/libPThread/PThreadKit/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/libPThread/PThreadKit/.keep diff --git a/src/libPThread/PThreadKit/Thread.h b/src/libPThread/PThreadKit/Thread.h new file mode 100644 index 00000000..053885e7 --- /dev/null +++ b/src/libPThread/PThreadKit/Thread.h @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/ne-foss-org/nekernel + +#ifndef LIBPOSIX_POSIXKIT_THREAD_H +#define LIBPOSIX_POSIXKIT_THREAD_H + +#include <libPOSIXWrapper/POSIXKit/unistd.h> + +#define PTHREAD_UNSAFE /* hint */ +#define PTHREAD_SAFE /* hint */ + +#endif // LIBPOSIX_POSIXKIT_THREAD_H diff --git a/src/libPThread/libPThread.json b/src/libPThread/libPThread.json new file mode 100644 index 00000000..a5cfba73 --- /dev/null +++ b/src/libPThread/libPThread.json @@ -0,0 +1,22 @@ +{ + "compiler_path": "x86_64-w64-mingw32-gcc", + "compiler_std": "c++20", + "headers_path": ["../", "./"], + "sources_path": ["src/*.cpp"], + "output_name": "libPThread.dll", + "compiler_flags": [ + "-ffreestanding", + "-shared", + "-std=c++20", + "-fno-rtti", + "-fno-exceptions", + "-Wl,--subsystem=17" + ], + "cpp_macros": [ + "__NEOSKRNL__", + "kPosixVersionHighest=0x0100", + "kPosixVersionLowest=0x0100", + "kPosixVersion=0x0100" + ], + "description": "The NeKernel PThread System. Refer to: https://man7.org/linux/man-pages/man7/pthreads.7.html" +} diff --git a/src/libPThread/src/.keep b/src/libPThread/src/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/libPThread/src/.keep diff --git a/src/libPThread/src/Thread.cpp b/src/libPThread/src/Thread.cpp new file mode 100644 index 00000000..34a610cd --- /dev/null +++ b/src/libPThread/src/Thread.cpp @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: Apache-2.0 +// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org) +// Licensed under the Apache License, Version 2.0 (see LICENSE file) +// Official repository: https://github.com/ne-foss-org/nekernel + +#include <libPThread/PThreadKit/Thread.h> + +namespace POSIXKit::Detail { + + /// @brief Max path structure. + constexpr auto kMaxPathLen = 255; + static constexpr auto kCanaryValue = 0xf0f0488f; + + /// @brief Thread Information Structure. + struct ThreadFrameParams final { + SInt64 fCanary; + VoidPtr fStackPtr; + VoidPtr fCodePtr; + SizeT fCodeSz; + SizeT fStackSz; + SInt64 fThrdID; + SInt64 fUsrID, fGrpID; + SInt64* fFD{}; + SizeT fFDCnt; + Char fCWD[kMaxPathLen]; + Char fRoot[kMaxPathLen]; + ThreadRef fRef; + }; + +} // namespace POSIX::Detail + + + |
