CT_NODISCARD STA_WRITES(size) void *dst
int os_exitcode_t
program exit code
os_dirent_t
directory entry type
os_protect_t
file mapping memory protection
os_access_t
file access mode
#define STA_RELEASE
annotate a pointer as invalid after the function returns
#define CT_PUREFN
mark a function as pure, always returns the same value for the same arguments
#define CT_NODISCARD
mark a function as returning a value that must be used
#define IN_NOTNULL
annotate a parameter as not being null
#define STA_READS(size)
annotate a parameter as reading expr elements
#define IN_DOMAIN(cmp, it)
annotate a parameter as being bounded by the expression of cmp and it
#define RET_INSPECT
annotate the return value as needing to be inspected this is the same as CT_NODISCARD but implies tha...
#define IN_STRING
annotate a parameter as being a null terminated string
CT_OS_API os_error_t os_file_copy(const char *dst, const char *src)
copy a file from one location to another
CT_OS_API os_error_t os_thread_join(os_thread_t *thread, OUT_NOTNULL os_status_t *status)
unsigned os_status_t
thread return code
size_t os_thread_id_t
thread id
CT_NODISCARD CT_OS_API const char * os_library_name(const os_library_t *library)
get the name of a shared library
CT_OS_API const char * os_thread_name(const os_thread_t *thread)
CT_OS_API os_error_t os_library_close(STA_RELEASE os_library_t *library)
close a shared library
CT_NODISCARD CT_OS_API os_error_t os_library_symbol(os_library_t *library, OUT_NOTNULL void **symbol, const char *name)
get a symbol from a shared library
CT_OS_API os_error_t os_library_open(const char *path, OUT_NOTNULL os_library_t *library)
open a shared library from disk
CT_OS_API bool os_thread_cmpid(const os_thread_t *thread, os_thread_id_t id)
os_exitcode_t(* os_thread_fn_t)(void *arg)
CT_OS_API os_error_t os_thread_init(OUT_NOTNULL os_thread_t *thread, const char *name, os_thread_fn_t fn, void *arg)
typedefCT_BEGIN_API struct os_file_t os_file_t
file handle
STA_DECL bool os_iter_next(os_iter_t *iter, os_inode_t *dir)
CT_OS_API os_error_t os_file_seek(os_file_t *file, size_t offset, OUT_NOTNULL size_t *actual)
seek to a position in a file
CT_OS_API os_error_t os_file_close(STA_RELEASE os_file_t *file)
close a file
CT_OS_API os_error_t os_file_create(const char *path)
create a file
CT_NODISCARD CT_OS_API os_dirent_t os_dirent_type(const char *path)
get the type of a paths inode entry
CT_NODISCARD STA_SUCCESS(return==true) CT_OS_API bool os_iter_next(os_iter_t *iter
get the next directory entry
CT_OS_API os_error_t os_dir_delete(const char *path)
delete a directory
CT_NODISCARD CT_PUREFN CT_OS_API bool os_mapping_active(const os_mapping_t *mapping)
does the mapping object contain a valid mapping checks if the mapping data exists,...
CT_OS_API os_error_t os_file_delete(const char *path)
delete a file
CT_OS_API os_error_t os_file_tell(os_file_t *file, OUT_NOTNULL size_t *actual)
get the current position in a file
CT_OS_API os_error_t os_tmpfile_open(OUT_NOTNULL os_file_t *file)
create a temporary file
CT_OS_API os_error_t os_file_exists(const char *path)
check if a file exists
CT_OS_API os_error_t os_file_size(os_file_t *file, OUT_NOTNULL size_t *actual)
get the size of a file
CT_NODISCARD CT_PUREFN CT_OS_API const char * os_file_name(const os_file_t *file)
get the name of a file
CT_OS_API os_error_t os_iter_end(STA_RELEASE os_iter_t *iter)
close a directory iterator
CT_OS_API os_error_t os_file_read(os_file_t *file, STA_WRITES(size) void *buffer, size_t size, OUT_NOTNULL size_t *actual)
read from a file
CT_OS_API os_error_t os_file_write(os_file_t *file, STA_READS(size) const void *buffer, size_t size, OUT_NOTNULL size_t *actual)
write to a file
CT_NODISCARD CT_OS_API size_t os_mapping_size(const os_mapping_t *mapping)
get the size of a file mapping
CT_OS_API os_error_t os_file_open(const char *path, os_access_t access, OUT_NOTNULL os_file_t *file)
file api
CT_NODISCARD OUT_NOTNULL os_inode_t * dir
CT_OS_API os_error_t os_file_resize(os_file_t *file, size_t size)
truncate/expand a file to a specific size
CT_OS_API os_error_t os_iter_error(const os_iter_t *iter)
get the error state of a directory iterator
CT_OS_API os_error_t os_file_map(os_file_t *file, os_protect_t protect, size_t size, OUT_NOTNULL os_mapping_t *mapping)
map a file into memory
CT_OS_API bool os_dir_exists(const char *path)
check if a directory exists
CT_OS_API os_error_t os_dir_create(const char *path)
check if a directory exists
CT_OS_API os_error_t os_unmap(INOUT_NOTNULL os_mapping_t *mapping)
unmap a file from memory
CT_NODISCARD CT_OS_API void * os_mapping_data(os_mapping_t *mapping)
get the data of a file mapping
CT_OS_API os_error_t os_iter_begin(const char *path, OUT_NOTNULL os_iter_t *iter)
directory iteration
pthread_t os_thread_impl_t
struct dirent * os_inode_impl_t
pthread_mutex_t os_mutex_impl_t
char name[CT_OS_NAME_MAX]