Library

File

Synchronous Disk File I/O

Usable
Dependencies

No library-level dependencies

SaneCppFile.h is a library implementing synchronous I/O operations on files and pipes.

Dependencies

  • Dependencies: (none)
  • All dependencies: (none)

Dependency Graph

Features

SC::FileDescriptor SC::FileDescriptor
SC::FileDescriptor::read SC::FileDescriptor::read
SC::FileDescriptor::write SC::FileDescriptor::write
SC::FileDescriptor::seek SC::FileDescriptor::seek
SC::FileDescriptor::open SC::FileDescriptor::open
SC::FileDescriptor::openStdInDuplicate SC::FileDescriptor::openStdInDuplicate
SC::FileDescriptor::openStdOutDuplicate SC::FileDescriptor::openStdOutDuplicate
SC::FileDescriptor::openStdErrDuplicate SC::FileDescriptor::openStdErrDuplicate
SC::FileDescriptor::readUntilEOF SC::FileDescriptor::readUntilEOF
SC::FileDescriptor::stat SC::FileDescriptor::stat
SC::FileDescriptor::chmod SC::FileDescriptor::chmod
SC::FileDescriptor::chown SC::FileDescriptor::chown
SC::FileDescriptor::sync SC::FileDescriptor::sync
SC::FileDescriptor::syncData SC::FileDescriptor::syncData
SC::FileDescriptor::truncate SC::FileDescriptor::truncate
SC::PipeDescriptor SC::PipeDescriptor
SC::PipeDescriptor::readPipe SC::PipeDescriptor::readPipe
SC::PipeDescriptor::writePipe SC::PipeDescriptor::writePipe
SC::NamedPipeServer SC::NamedPipeServer
SC::NamedPipeServer::create SC::NamedPipeServer::create
SC::NamedPipeServer::accept SC::NamedPipeServer::accept
SC::NamedPipeServer::close SC::NamedPipeServer::close
SC::NamedPipeServerOptions SC::NamedPipeServerOptions
SC::NamedPipeClient SC::NamedPipeClient
SC::NamedPipeClient::connect SC::NamedPipeClient::connect
SC::NamedPipeClientOptions SC::NamedPipeClientOptions
SC::NamedPipeName SC::NamedPipeName
SC::NamedPipeName::build SC::NamedPipeName::build
SC::NamedPipeNameOptions SC::NamedPipeNameOptions

Status

Usable This library now covers synchronous descriptor I/O together with descriptor metadata, synchronization and descriptor-bound permission/ownership updates. sendfile is still intentionally deferred until a dependency-safe cross-library API is defined.

Blog

Some relevant blog posts are:

Description

SC::FileDescriptor object can be created by SC::FileDescriptor::open-ing a path on file system and it can be SC::FileDescriptor::read or SC::FileDescriptor::write.
Also non-blocking mode can be controlled with SC::FileDescriptor::setBlocking.
A file can be marked as inheritable with SC::FileDescriptor::setInheritable so that in can be accessed by child processes. SC::PipeDescriptor creates a pipe for InterProcess communication.
A pipe has read and write SC::FileDescriptor endpoints and it's used by Process library to redirect standard input, output or error to other processes.
It can also be used to read or write the standard input, output or error from current process into a binary buffer or a string (as done by SC::ProcessChain::readStdOutUntilEOFSync or other similar methods).

SC::NamedPipeServer and SC::NamedPipeClient provide named endpoint creation and connection. Accepted/connected named pipe endpoints are exposed as SC::PipeDescriptor, so they can be used with the same read/write APIs and with Async / Async Streams compositions. SC::NamedPipeName::build can be used to compose platform-native endpoint names from a logical pipe name, avoiding platform-specific #if path conventions at call sites.

Roadmap

Complete Features:

  • sendfile deferred until a dependency-safe API is defined

💡 Unplanned Features:

  • None for now

Statistics

Type Lines Of Code Comments Sum
Headers 189 203 392
Sources 1342 202 1544
Sum 1531 405 1936