General Purpose library for Freestanding C++ and POSIX systems
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
1.0 KiB

#pragma once
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <string>
namespace gp{
using open_opt_flags = int;
enum class open_options : open_opt_flags {
append = O_APPEND,
create = O_CREAT,
async = O_ASYNC,
direct = O_DIRECT,
data_sync = O_DSYNC,
file_sync = O_SYNC,
exclusive = O_EXCL,
no_access_time = O_NOATIME,
no_follow = O_NOFOLLOW,
#ifdef O_TEMP
temporary = O_TEMP,
#endif
#ifdef O_TRUC
truncate = O_TRUC,
#endif
};
using open_opt_mode = int;
enum class open_modes : open_opt_mode {
user_read = S_IRUSR,
user_write = S_IWUSR,
user_exec = S_IXUSR,
group_read = S_IRGRP,
group_write = S_IWGRP,
group_exec = S_IXGRP,
other_read = S_IROTH,
other_write = S_IWOTH,
other_exec = S_IXOTH,
set_uid = S_ISUID,
set_gid = S_ISGID,
sticky_bit = S_ISVTX,
};
class shared_fd {
const int fd;
shared_fd(int fd_v)
: fd(fd_v) {}
public:
static shared_fd open(const std::string& filename, const open_opt_flags& flags) {
}
};
}