FD

File descriptor wrapper

This wrapper's main purpose is to protect the fd against leakage. It does not actually do anything.

Constructors

this
this(int fd)

Initialize from an OS file descriptor.

this
this(string path, int flags, mode_t mode)

Open a new file.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Functions

checkedCall
auto checkedCall(T args, string errorMessage)

Run an fd based function and throw if it fails

close
void close()

Close the OS handle prematurely.

dup
FD dup()

Duplicate an FD

osCall
auto osCall(T args)

Call an OS function that accepts an FD as the first argument.

read
auto read(void[] buffer)

@safe read

write
auto write(void[] buffer)

@safe write

Properties

fileNo
int fileNo [@property getter]

Obtain the underlying OS handle

isValid
bool isValid [@property getter]

Report whether the FD currently holds a valid fd

Static functions

adopt
FD adopt(int fd)

Wrapper for adopting an fd immediately after being returned from external function

Meta