LLFIO
v2.00
|
A native handle type used for wrapping file descriptors, process ids or HANDLEs. Unmanaged, wrap in a handle object to manage. More...
#include "native_handle_type.hpp"
Public Member Functions | |
QUICKCPPLIB_BITFIELD_BEGIN_T (disposition, uint64_t) | |
The type of handle. More... | |
constexpr | native_handle_type () |
Constructs a default instance. More... | |
constexpr | native_handle_type (disposition _behaviour, int _fd) noexcept |
Construct from a POSIX file descriptor. | |
constexpr | native_handle_type (disposition _behaviour, win::handle _h) noexcept |
Construct from a Windows HANDLE. | |
native_handle_type (const native_handle_type &)=default | |
Copy construct. | |
constexpr | native_handle_type (native_handle_type &&o) noexcept |
Move construct. | |
constexpr | native_handle_type (native_handle_type &&o, uint16_t flags) noexcept |
Special move constructor to work around a constexpr bug in clang. | |
native_handle_type & | operator= (const native_handle_type &)=default |
Copy assign. | |
constexpr native_handle_type & | operator= (native_handle_type &&o) noexcept |
Move assign. | |
void | swap (native_handle_type &o) noexcept |
Swaps with another instance. | |
constexpr | operator bool () const noexcept |
True if valid. | |
constexpr bool | operator! () const noexcept |
True if invalid. | |
constexpr bool | operator== (const native_handle_type &o) const noexcept |
True if equal. | |
constexpr bool | operator!= (const native_handle_type &o) const noexcept |
True if unequal. | |
constexpr bool | is_valid () const noexcept |
True if the handle is valid. | |
constexpr bool | is_readable () const noexcept |
True if the handle is readable. | |
constexpr bool | is_writable () const noexcept |
True if the handle is writable. | |
constexpr bool | is_append_only () const noexcept |
True if the handle is append only. | |
constexpr bool | is_nonblocking () const noexcept |
True if nonblocking. | |
constexpr bool | is_seekable () const noexcept |
True if seekable. | |
constexpr bool | requires_aligned_io () const noexcept |
True if requires aligned i/o. | |
constexpr bool | is_kernel_handle () const noexcept |
True if handle is a valid kernel handle. | |
constexpr bool | is_regular () const noexcept |
True if a regular file or device. | |
constexpr bool | is_directory () const noexcept |
True if a directory. | |
constexpr bool | is_symlink () const noexcept |
True if a symlink. | |
constexpr bool | is_pipe () const noexcept |
True if a pipe. | |
constexpr bool | is_socket () const noexcept |
True if a socket. | |
constexpr bool | is_multiplexer () const noexcept |
True if a multiplexer like BSD kqueues, Linux epoll or Windows IOCP. | |
constexpr bool | is_process () const noexcept |
True if a process. | |
constexpr bool | is_section () const noexcept |
True if a memory section. | |
constexpr bool | is_allocation () const noexcept |
True if a memory allocation. | |
constexpr bool | is_path () const noexcept |
True if a path or a directory. | |
constexpr bool | is_tls_socket () const noexcept |
True if a TLS socket. | |
constexpr bool | is_http_socket () const noexcept |
True if a HTTP socket. | |
constexpr bool | is_third_party_pointer () const noexcept |
True if a third party pointer. | |
Public Attributes | |
union { | |
intptr_t _init {-1} | |
int fd | |
A POSIX file descriptor. | |
int pid | |
A POSIX process identifier. | |
win::handle h | |
A Windows HANDLE. | |
win::socket sock | |
A Windows SOCKET. | |
void * ptr | |
A third party pointer. | |
}; | |
disposition | behaviour {disposition::invalid} |
A native handle type used for wrapping file descriptors, process ids or HANDLEs. Unmanaged, wrap in a handle object to manage.
|
inlineconstexpr |
|
inline |
The type of handle.
< Invalid handle
< Is readable
< Is writable
< Is append only
< Requires additional synchronisation (Windows: OVERLAPPED
; POSIX: O_NONBLOCK
)
< Is seekable
< Requires sector aligned i/o (typically 512 or 4096)
< Handle is a valid kernel handle
< Is a regular file
< Is a directory
< Is a symlink
< Is a pipe
< Is a socket
< Is a kqueue/epoll/iocp
< Is a child process
< Is a memory section
< Is a memory allocation
< Is a path
< Is a TLS socket
< Is a HTTP or HTTPS socket
< Used to pack in handle::flag to save space (16 bits, bits 32 - 47)
< when ptr is being used to point at something elsewhere
< when we refer to an alternate e.g. for byte_socket_handle this would be IPv6 instead of IPv4
< Issue write reordering barriers at various points
< Is serving metadata from the kernel cache
< Is serving reads from the kernel cache
< Is writing back from kernel cache rather than writing through
< Writes are not flushed to storage quickly
< All the bits used to store kernel caching