rewrite comments into one, unified style

This commit is contained in:
maksw committed 2026-06-15 10:17:48 +02:00
1 parent 6260de0085
commit 467a58c9c6
163 files changed
+3560 -2556

No files matched your search

+7 -1
View File
@@ -1,10 +1,12 @@
// posix_fd.c - file descriptor table
// POSIX compatibility support for posix fd.
#include <ntlite/syscall.h>
#include "posix.h"
#include "posix_fd.h"
int errno = 0;
// Implements the status To Errno operation.
int PosixStatusToErrno(uint32_t s) {
switch (s) {
case 0x0000: return 0; // STATUS_SUCCESS
@@ -26,6 +28,7 @@ int PosixStatusToErrno(uint32_t s) {
static FD_ENTRY gFdTable[FD_TABLE_PIDS][FD_MAX];
// Implements the fd Init operation.
__declspec(dllexport) void PosixFdInit(void) {
uint32_t pid = SysGetCurrentPid();
uint32_t slot = pid % FD_TABLE_PIDS;
@@ -40,6 +43,7 @@ __declspec(dllexport) void PosixFdInit(void) {
gFdTable[slot][2] = (FD_ENTRY){ FD_CONSOLE_W, 0, true };
}
// Implements the fd Alloc operation.
__declspec(dllexport) int FdAlloc(uint32_t pid, FD_TYPE type, uint32_t khandle) {
uint32_t slot = pid % FD_TABLE_PIDS;
for (int fd = 3; fd < FD_MAX; fd++) {
@@ -52,6 +56,7 @@ __declspec(dllexport) int FdAlloc(uint32_t pid, FD_TYPE type, uint32_t khandle)
return -1;
}
// Implements the fd Get operation.
__declspec(dllexport) FD_ENTRY* FdGet(uint32_t pid, int fd) {
if (fd < 0 || fd >= FD_MAX) { errno = EBADF; return (FD_ENTRY*)0; }
uint32_t slot = pid % FD_TABLE_PIDS;
@@ -60,6 +65,7 @@ __declspec(dllexport) FD_ENTRY* FdGet(uint32_t pid, int fd) {
return e;
}
// Implements the fd Free operation.
__declspec(dllexport) void FdFree(uint32_t pid, int fd) {
if (fd < 0 || fd >= FD_MAX) return;
uint32_t slot = pid % FD_TABLE_PIDS;