blob: d9b90f00b382e241de60c63b67b0e8eba3c5d17c [file] [log] [blame]
#include <fcntl.h>
#include <sys/socket.h>
#include <stdplus/fd/create.hpp>
#include <stdplus/util/cexec.hpp>
#include <format>
namespace stdplus
{
namespace fd
{
DupableFd open(const char* pathname, OpenFlags flags, mode_t mode)
{
return DupableFd(
CHECK_ERRNO(::open(pathname, static_cast<int>(flags), mode),
std::format("open `{}`", pathname)));
}
DupableFd socket(SocketDomain domain, SocketType type, SocketProto protocol)
{
return DupableFd(
CHECK_ERRNO(::socket(static_cast<int>(domain), static_cast<int>(type),
static_cast<int>(protocol)),
"socket"));
}
} // namespace fd
} // namespace stdplus