PinCRT
Pin OS-APIs User Guide

@section INTRO Introduction

OS-APIs is a set of functions that provides a generic way to interact with the OS. The OS interaction types include: file operations, process creation and manipulation, inter-process communication, etc. See list of all supported operations here


@section COMPAT Mapping between OS specific API functions to OS-APIs functions

OS-APIs POSIX (Linux and macOS*) WIN32
OS_GetFileAttributes() stat() lstat() GetFileAttributes()
OS_GetFDAttributes() fstat() GetFileInformationByHandle()
OS_OpenFD() open() creat() CreateFile() CreateFileEx() OpenFile()
OS_WriteFD() write() WriteFile() WriteFileEx()
OS_ReadFD() read() ReadFile() ReadFileEx()
OS_SeekFD() lseek() llseek() lseek64() SetFilePointer() SetFilePointerEx()
OS_CloseFD() close() CloseHandle()
OS_DeleteFile() unlink() unlinkat() DeleteFile()
OS_FlushFD() fsync() fdatasync() FlushFileBuffers()
OS_FilePermissionsFD() fstat() GetFileAttributes()
OS_FileSizeFD() fstat() GetFileSize() GetFileSizeEx()
OS_Cwd() cwd() GetCurrentDirectory()
OS_Chdir() chdir() SetCurrentDirectory()
OS_OpenDirFD() open() OpenFile() CreateFile()
OS_MkDir() mkdir() CreateDirectory() CreateDirectoryEx()
OS_DeleteDirectory() rmdir() RemoveDirectory()
OS_IsConsoleFD() isatty() GetObjectType()
OS_GetFDAccessMode() fcntl() NtQueryObject()
OS_ReadDirectoryFD() getdents64() getdents()
OS_RenameFile() rename() MoveFile()
OS_ReadLink() readlink()
OS_Pipe() pipe() CreatePipe()
OS_GetHostName() uname() GetComputerName() GetComputerNameEx()
OS_GetHostCPUArch() uname() IsWow64Process()
OS_GetOSVersion() uname() GetVersion() GetVersionEx()
OS_AllocateMemory() mmap() VirtualAlloc() VirtualAllocEx()
OS_MapFileToMemory() mmap() MapViewOfFile() MapViewOfFileEx()
OS_FreeMemory() munmap() VirtualFree() VirtualFreeEx() UnmapViewOfFile()
OS_GetPageSize() getpagesize() GetSystemInfo()
OS_QueryMemory() VirtualQuery() VirtualQueryEx()
OS_ProtectMemory() mprotect() VirtualProtect() VirtualProtectEx()
OS_GetCommandLine() GetCommandLine()
OS_GetEnvironmentBlock() environ GetEnvironmentVariable() SetEnvironmentVariable()
OS_SuspendThread() kill() tkill() tgkill() SuspendThread()
OS_ResumeThread() kill() tkill() tgkill() ResumeThread()
OS_GetTid() gettid() GetCurrentThreadId()
OS_GetPid() getpid() GetCurrentProcessId()