Cthulhu
0.2.10
Cthulhu compiler collection
|
Go to the source code of this file.
Macros | |
#define | OS_ACCESS(ID, STR, BIT) ID = (BIT), |
#define | OS_PROTECT(ID, STR, BIT) ID = (BIT), |
#define | OS_DIRENT(ID, STR) ID, |
Typedefs | |
typedef struct path_t | path_t |
enum | os_access_t { eOsAccessMask = eOsAccessRead | eOsAccessWrite | eOsAccessTruncate } |
file access mode More... | |
enum | os_protect_t { eOsProtectMask = eOsProtectRead | eOsProtectWrite | eOsProtectExecute } |
file mapping memory protection More... | |
enum | os_dirent_t { eOsNodeCount } |
directory entry type More... | |
typedef typedefCT_BEGIN_API struct os_file_t | os_file_t |
file handle More... | |
typedef int | os_exitcode_t |
program exit code More... | |
typedef unsigned | os_status_t |
thread return code More... | |
typedef size_t | os_thread_id_t |
thread id More... | |
typedef void(* | os_symbol_t) (void) |
function pointer used for shared library symbols rather than void* because casting a function pointer to void* is undefined behavior More... | |
typedef | STA_SUCCESS_TYPE (return==eOsSuccess) size_t os_error_t |
error code More... | |
CT_OS_API void | os_init (void) |
initialize the os api More... | |
CT_NORETURN CT_OS_API | os_exit (os_exitcode_t code) |
exit the program More... | |
CT_NORETURN CT_OS_API | os_thread_exit (os_status_t status) |
exit the current thread of execution More... | |
CT_OS_API os_thread_id_t | os_get_thread_id (void) |
get the current thread id More... | |
CT_NORETURN CT_OS_API | os_abort (void) |
abort the program More... | |
CT_NODISCARD CT_OS_API size_t | os_error_get_string (os_error_t error, STA_WRITES(size) char *buffer, size_t size) |
convert an os error code to a string writes to a buffer rather than allocating. if size is 0, the function will return the number of characters needed to write the string. More... | |
CT_NODISCARD CT_OS_API size_t | os_cwd_get_string (STA_WRITES(size) char *buffer, size_t size) |
get the current working directory More... | |
CT_NODISCARD STA_RET_STRING CT_OS_API char * | os_error_string (os_error_t error, arena_t *arena) |
convert an os error code to a string More... | |
CT_OS_API char * | os_cwd_string (arena_t *arena) |
get the current working directory More... | |
CT_OS_API os_error_t | os_getcwd (OUT_NOTNULL text_t *text, arena_t *arena) |
get the current working directory More... | |
CT_NODISCARD CT_PUREFN CT_OS_API os_dirent_t | os_inode_type (const os_inode_t *node) |
get the type of an inode More... | |
CT_NODISCARD STA_RET_STRING CT_PUREFN CT_OS_API const char * | os_inode_name (const os_inode_t *node) |
get the name of an inode More... | |
CT_NODISCARD CT_CONSTFN STA_RET_STRING CT_OS_API const char * | os_dirent_string (os_dirent_t type) |
get the string representation of a directory entry type More... | |
CT_NODISCARD CT_CONSTFN STA_RET_STRING CT_OS_API const char * | os_access_string (os_access_t access) |
get the string representation of a file access mode More... | |
CT_NODISCARD CT_CONSTFN STA_RET_STRING CT_OS_API const char * | os_protect_string (os_protect_t protect) |
get the string representation of a file mapping memory protection More... | |
typedef int os_exitcode_t |
typedef void(* os_symbol_t) (void) |
enum os_access_t |
enum os_dirent_t |
enum os_protect_t |
CT_NORETURN CT_OS_API os_abort | ( | void | ) |
CT_NODISCARD CT_CONSTFN STA_RET_STRING CT_OS_API const char* os_access_string | ( | os_access_t | access | ) |
get the string representation of a file access mode
access | the file access mode |
Definition at line 32 of file os_common.c.
CT_NODISCARD CT_OS_API size_t os_cwd_get_string | ( | STA_WRITES(size) char * | buffer, |
size_t | size | ||
) |
get the current working directory
buffer
must point to a valid buffer of at least size
charsbuffer | the buffer to write to |
size | the size of the buffer |
CT_OS_API char* os_cwd_string | ( | arena_t * | arena | ) |
CT_NODISCARD CT_CONSTFN STA_RET_STRING CT_OS_API const char* os_dirent_string | ( | os_dirent_t | type | ) |
get the string representation of a directory entry type
type | the directory entry type |
Definition at line 13 of file os_common.c.
CT_NODISCARD CT_OS_API size_t os_error_get_string | ( | os_error_t | error, |
STA_WRITES(size) char * | buffer, | ||
size_t | size | ||
) |
convert an os error code to a string writes to a buffer rather than allocating. if size
is 0, the function will return the number of characters needed to write the string.
buffer
must point to a valid buffer of at least size
charserror | the error code to convert |
buffer | the buffer to write to |
size | the size of the buffer |
CT_NODISCARD STA_RET_STRING CT_OS_API char* os_error_string | ( | os_error_t | error, |
arena_t * | arena | ||
) |
CT_NORETURN CT_OS_API os_exit | ( | os_exitcode_t | code | ) |
CT_OS_API os_error_t os_getcwd | ( | OUT_NOTNULL text_t * | text, |
arena_t * | arena | ||
) |
get the current working directory
text | the text to write to |
arena | the arena to allocate from |
CT_OS_API void os_init | ( | void | ) |
CT_NODISCARD STA_RET_STRING CT_PUREFN CT_OS_API const char* os_inode_name | ( | const os_inode_t * | node | ) |
CT_NODISCARD CT_PUREFN CT_OS_API os_dirent_t os_inode_type | ( | const os_inode_t * | node | ) |
CT_NODISCARD CT_CONSTFN STA_RET_STRING CT_OS_API const char* os_protect_string | ( | os_protect_t | protect | ) |
get the string representation of a file mapping memory protection
protect | the file mapping memory protection |
Definition at line 50 of file os_common.c.
typedef STA_SUCCESS_TYPE | ( | return | = =eOsSuccess | ) |
error code