MySQL 8.0.39
Source Code Documentation
net::impl::file Namespace Reference

Classes

class  file_control_option
 
class  file_control_option< Name, void >
 

Typedefs

using file_handle_type = int
 
using dup_fd = file_control_option< F_DUPFD, int >
 
using dup_fd_cloexec = file_control_option< F_DUPFD_CLOEXEC, int >
 
using get_file_flags = file_control_option< F_GETFD, void >
 
using set_file_flags = file_control_option< F_SETFD, int >
 
using get_file_status = file_control_option< F_GETFL, void >
 
using set_file_status = file_control_option< F_SETFL, int >
 
using get_own = file_control_option< F_GETOWN, void >
 
using set_own = file_control_option< F_SETOWN, int >
 

Functions

std::error_code last_error_code ()
 
template<class FileControlOption >
stdx::expected< int, std::error_code > fcntl (file_handle_type fd, const FileControlOption &cmd)
 
stdx::expected< std::pair< file_handle_type, file_handle_type >, std::error_code > pipe (int flags=0)
 create pipe. More...
 
stdx::expected< size_t, std::error_code > write (file_handle_type handle, const void *buf, size_t buf_len)
 write a buffer to a file handle. More...
 
stdx::expected< size_t, std::error_code > read (file_handle_type handle, void *buf, size_t buf_len)
 read from file handle into a buffer. More...
 
stdx::expected< void, std::error_code > close (file_handle_type native_handle)
 close file handle. More...
 

Variables

constexpr file_handle_type kInvalidHandle {-1}
 

Typedef Documentation

◆ dup_fd

using net::impl::file::dup_fd = typedef file_control_option<F_DUPFD, int>

◆ dup_fd_cloexec

using net::impl::file::dup_fd_cloexec = typedef file_control_option<F_DUPFD_CLOEXEC, int>

◆ file_handle_type

using net::impl::file::file_handle_type = typedef int

◆ get_file_flags

using net::impl::file::get_file_flags = typedef file_control_option<F_GETFD, void>

◆ get_file_status

using net::impl::file::get_file_status = typedef file_control_option<F_GETFL, void>

◆ get_own

using net::impl::file::get_own = typedef file_control_option<F_GETOWN, void>

◆ set_file_flags

◆ set_file_status

◆ set_own

using net::impl::file::set_own = typedef file_control_option<F_SETOWN, int>

Function Documentation

◆ close()

stdx::expected< void, std::error_code > net::impl::file::close ( file_handle_type  native_handle)
inline

close file handle.

calls close() on POSIX, CloseHandle() on win32

◆ fcntl()

template<class FileControlOption >
stdx::expected< int, std::error_code > net::impl::file::fcntl ( file_handle_type  fd,
const FileControlOption &  cmd 
)
inline

◆ last_error_code()

std::error_code net::impl::file::last_error_code ( )
inline

◆ pipe()

stdx::expected< std::pair< file_handle_type, file_handle_type >, std::error_code > net::impl::file::pipe ( int  flags = 0)
inline

create pipe.

Parameters
flagsflags passed to pipe2() like O_NONBLOCK or O_CLOEXEC
Returns
pair file-handles or std::error_code

◆ read()

stdx::expected< size_t, std::error_code > net::impl::file::read ( file_handle_type  handle,
void *  buf,
size_t  buf_len 
)
inline

read from file handle into a buffer.

calls read() on POSIX, ReadFile() on win32

◆ write()

stdx::expected< size_t, std::error_code > net::impl::file::write ( file_handle_type  handle,
const void *  buf,
size_t  buf_len 
)
inline

write a buffer to a file handle.

calls write() on POSIX, WriteFile() on win32

Variable Documentation

◆ kInvalidHandle

constexpr file_handle_type net::impl::file::kInvalidHandle {-1}
constexpr