2022-04-16 11:00:32 +00:00
|
|
|
#if !defined(LUMENARIUM_OS)
|
|
|
|
#define LUMENARIUM_OS
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
// Memory
|
|
|
|
|
|
|
|
u8* os_mem_reserve(u64 size);
|
|
|
|
u8* os_mem_commit(u8* base, u64 size);
|
|
|
|
bool os_mem_decommit(u8* base, u64 size);
|
|
|
|
bool os_mem_release(u8* base, u64 size);
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
// File I/O
|
|
|
|
|
|
|
|
File_Async_Job_System os_file_jobs_init();
|
|
|
|
File_Handle os_file_open(String path, File_Access_Flags flags_access, File_Create_Flags flags_create);
|
|
|
|
void os_file_close(File_Handle file_handle);
|
2022-08-21 23:34:15 +00:00
|
|
|
bool os_file_delete(String path);
|
2022-04-16 11:00:32 +00:00
|
|
|
File_Info os_file_get_info(File_Handle file_handle, Allocator* allocator);
|
|
|
|
Data os_file_read_all(File_Handle file_handle, Allocator* allocator);
|
|
|
|
bool os_file_write_all(File_Handle file_handle, Data file_data);
|
2022-05-25 12:30:20 +00:00
|
|
|
bool os_file_write(File_Handle file_handle, Data file_data);
|
2022-04-16 11:00:32 +00:00
|
|
|
|
|
|
|
String os_get_exe_path(Allocator* allocator);
|
|
|
|
bool os_pwd_set(String path);
|
|
|
|
|
|
|
|
File_Info_List os_dir_enum(String path, Platform_Enum_Dir_Flags flags, Allocator* allocator);
|
|
|
|
|
|
|
|
// Asnyc Jobs
|
|
|
|
void os_file_async_work_on_job(File_Async_Job* job);
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
// Time
|
|
|
|
|
|
|
|
Ticks os_get_ticks();
|
|
|
|
r64 os_get_ticks_per_second();
|
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
// Threads
|
|
|
|
|
|
|
|
Thread_Handle os_thread_begin(Thread_Proc* proc, u8* user_data);
|
|
|
|
void os_thread_end(Thread_Handle thread_handle);
|
|
|
|
|
2022-08-21 23:34:15 +00:00
|
|
|
// returns the new value of the provided variable
|
|
|
|
u32 os_interlocked_increment(volatile u32* value);
|
|
|
|
|
|
|
|
// returns true if dest was equal to old_value, and the exchange was successful,
|
|
|
|
// returns false otherwise
|
|
|
|
bool os_interlocked_cmp_exchg(volatile u32* dest, u32 old_value, u32 new_value);
|
2022-04-16 11:00:32 +00:00
|
|
|
|
|
|
|
///////////////////////////////////////
|
|
|
|
// Network Access
|
|
|
|
|
2022-04-22 18:57:52 +00:00
|
|
|
Socket_Handle os_socket_create(s32 domain, s32 type, s32 protocol);
|
2022-04-16 11:00:32 +00:00
|
|
|
bool os_socket_bind();
|
|
|
|
bool os_socket_connect();
|
2022-08-21 23:34:15 +00:00
|
|
|
bool os_socket_close(Socket_Handle handle);
|
2022-04-16 11:00:32 +00:00
|
|
|
Data os_socket_recv();
|
2022-08-21 23:34:15 +00:00
|
|
|
Data os_socket_recvfrom(Socket_Handle handle, u8* buffer, u32 buffer_size, Socket_Error* err_out);
|
2022-04-22 18:57:52 +00:00
|
|
|
s32 os_socket_set_listening();
|
|
|
|
s32 os_socket_send();
|
|
|
|
s32 os_socket_send_to(Socket_Handle handle, u32 addr, u32 port, Data data, s32 flags);
|
|
|
|
s32 os_socket_set_opt(Socket_Handle handle, int level, int option_name,
|
2022-08-21 23:34:15 +00:00
|
|
|
u8* option_value, s32 option_len);
|
2022-04-22 18:57:52 +00:00
|
|
|
|
|
|
|
void open_sockets_init();
|
2022-04-16 11:00:32 +00:00
|
|
|
|
|
|
|
#endif // LUMENARIUM_OS
|