rewrite comments into one, unified style
This commit is contained in:
1 parent
6260de0085
commit
467a58c9c6
163 files changed
+3560
-2556
No files matched your search
@@ -1,4 +1,5 @@
|
||||
// posix_io.c - open, read, write, close, lseek
|
||||
// POSIX compatibility support for posix io.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <ntlite/syscall.h>
|
||||
@@ -6,14 +7,17 @@
|
||||
#include "posix_fd.h"
|
||||
#include "posix_path.h"
|
||||
|
||||
// Implements the clearscreen operation.
|
||||
__declspec(dllexport) void clearscreen(void) {
|
||||
SysClearScreen(0x012456);
|
||||
}
|
||||
|
||||
// Implements the clearkeyboard operation.
|
||||
__declspec(dllexport) void clearkeyboard(void) {
|
||||
while (SysPollKeyboard()) (void)SysReadKeyboardChar();
|
||||
}
|
||||
|
||||
// Opens the requested operation.
|
||||
__declspec(dllexport) int open(const char* path, int flags, ...) {
|
||||
char native[512];
|
||||
const char* p = PosixTranslatePath(path, native, sizeof(native));
|
||||
@@ -21,7 +25,7 @@ __declspec(dllexport) int open(const char* path, int flags, ...) {
|
||||
uint32_t pid = SysGetCurrentPid();
|
||||
FD_TYPE type = FD_FILE;
|
||||
|
||||
// Synthetic devices
|
||||
// Synthetic devices.
|
||||
if (strcmp(p, SYNTH_DEVNULL) == 0) {
|
||||
int fd = FdAlloc(pid, FD_DEVNULL, 0);
|
||||
return fd;
|
||||
@@ -53,6 +57,7 @@ __declspec(dllexport) int open(const char* path, int flags, ...) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
// Returns the requested value.
|
||||
__declspec(dllexport) ssize_t read(int fd, void* buf, size_t count) {
|
||||
if (count == 0) return 0;
|
||||
uint32_t pid = SysGetCurrentPid();
|
||||
@@ -92,6 +97,7 @@ __declspec(dllexport) ssize_t read(int fd, void* buf, size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
// Updates the requested value.
|
||||
__declspec(dllexport) ssize_t write(int fd, const void* buf, size_t count) {
|
||||
if (count == 0) return 0;
|
||||
uint32_t pid = SysGetCurrentPid();
|
||||
@@ -125,6 +131,7 @@ __declspec(dllexport) ssize_t write(int fd, const void* buf, size_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
// Releases the requested object.
|
||||
__declspec(dllexport) int close(int fd) {
|
||||
uint32_t pid = SysGetCurrentPid();
|
||||
FD_ENTRY* e = FdGet(pid, fd);
|
||||
@@ -135,6 +142,7 @@ __declspec(dllexport) int close(int fd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Implements the unlink operation.
|
||||
__declspec(dllexport) int unlink(const char* path) {
|
||||
if (!path) { errno = EINVAL; return -1; }
|
||||
|
||||
@@ -152,6 +160,7 @@ __declspec(dllexport) int unlink(const char* path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Implements the lseek operation.
|
||||
__declspec(dllexport) off_t lseek(int fd, off_t offset, int whence) {
|
||||
uint32_t pid = SysGetCurrentPid();
|
||||
FD_ENTRY* e = FdGet(pid, fd);
|
||||
|
||||
Reference in new issue
Block a user