struct fdio

Defined at line 115 of file ../../sdk/lib/fdio/internal.h

Lifecycle notes:

Upon creation, objects have a refcount of 1. |acquire| and |release| are used to upref and

downref, respectively. Upon downref to 0, the object will be freed.

The close hook must be called before free and should only be called once. In normal use, objects

are accessed through the fdio_fdtab, and when close is called they are removed from the fdtab and

the reference that the fdtab itself is holding is released, at which point they will be free()'d

unless somebody is holding a ref due to an ongoing io transaction, which will certainly fail due

to underlying handles being closed at which point a downref will happen and destruction will

follow.

Public Methods

zx::result<fdio_ptr> open (std::string_view path, fuchsia_io::Flags flags)

Defined at line 11 of file ../../sdk/lib/fdio/null.cc

zx_status_t clone (zx_handle_t * out_handle)

Defined at line 15 of file ../../sdk/lib/fdio/null.cc

zx_status_t unwrap (zx_handle_t * out_handle)

|unwrap| releases the underlying handle if applicable. The caller must ensure there are no

concurrent operations on |io|.

For example, |fdio_fd_transfer| will call |fdio_unbind_from_fd| which will only succeed when

the caller has the last unique reference to the |fdio_t|, thus ensuring that the fd is only

transferred when there are no concurrent operations.

Defined at line 17 of file ../../sdk/lib/fdio/null.cc

zx_status_t borrow_channel (zx_handle_t * out_handle)

|borrow_channel| borrows the underlying handle if applicable.

Defined at line 19 of file ../../sdk/lib/fdio/null.cc

void wait_begin (uint32_t events, zx_handle_t * out_handle, zx_signals_t * out_signals)

Defined at line 21 of file ../../sdk/lib/fdio/null.cc

void wait_end (zx_signals_t signals, uint32_t * out_events)

Defined at line 25 of file ../../sdk/lib/fdio/null.cc

Errno posix_ioctl (int req, va_list va)

|posix_ioctl| returns an |Errno|, which wraps an errno to be set on failure, or |Errno::Ok| (0)

on success.

Defined at line 27 of file ../../sdk/lib/fdio/null.cc

zx_status_t get_token (zx_handle_t * out)

Defined at line 29 of file ../../sdk/lib/fdio/null.cc

zx_status_t get_attr (zxio_node_attributes_t * out)

Defined at line 31 of file ../../sdk/lib/fdio/null.cc

zx_status_t set_attr (const zxio_node_attributes_t * attr)

Defined at line 33 of file ../../sdk/lib/fdio/null.cc

zx_status_t dirent_iterator_init (zxio_dirent_iterator_t * iterator, zxio_t * directory)

Defined at line 35 of file ../../sdk/lib/fdio/null.cc

zx_status_t dirent_iterator_next (zxio_dirent_iterator_t * iterator, zxio_dirent_t * inout_entry)

Defined at line 39 of file ../../sdk/lib/fdio/null.cc

zx_status_t dirent_iterator_rewind (zxio_dirent_iterator_t * iterator)

Defined at line 44 of file ../../sdk/lib/fdio/null.cc

void dirent_iterator_destroy (zxio_dirent_iterator_t * iterator)

Defined at line 48 of file ../../sdk/lib/fdio/null.cc

zx_status_t watch_directory (zxio_watch_directory_cb cb, zx_time_t deadline, void * context)

Defined at line 50 of file ../../sdk/lib/fdio/null.cc

zx_status_t unlink (std::string_view name, int flags)

Defined at line 54 of file ../../sdk/lib/fdio/null.cc

zx_status_t truncate (uint64_t off)

Defined at line 56 of file ../../sdk/lib/fdio/null.cc

zx_status_t rename (std::string_view , zx_handle_t , std::string_view )

Defined at line 58 of file ../../sdk/lib/fdio/null.cc

zx_status_t link (std::string_view , zx_handle_t , std::string_view )

Defined at line 63 of file ../../sdk/lib/fdio/null.cc

zx_status_t get_flags (fuchsia_io::wire::Flags * out_flags)

Defined at line 68 of file ../../sdk/lib/fdio/null.cc

zx_status_t set_flags (fuchsia_io::wire::Flags flags)

Defined at line 70 of file ../../sdk/lib/fdio/null.cc

zx_status_t get_flags_deprecated (fuchsia_io::wire::OpenFlags * out_flags)

Defined at line 72 of file ../../sdk/lib/fdio/null.cc

zx_status_t set_flags_deprecated (fuchsia_io::wire::OpenFlags flags)

Defined at line 76 of file ../../sdk/lib/fdio/null.cc

zx_status_t recvmsg (struct msghdr * msg, int flags, size_t * out_actual, int16_t * out_code)

Defined at line 80 of file ../../sdk/lib/fdio/null.cc

zx_status_t sendmsg (const struct msghdr * msg, int flags, size_t * out_actual, int16_t * out_code)

Defined at line 84 of file ../../sdk/lib/fdio/null.cc

zx_status_t init_token_resolver ()

Defined at line 69 of file ../../sdk/lib/fdio/remoteio.cc

template <typename F>
zx::result<fdio_ptr> create (F fn)

Defined at line 117 of file ../../sdk/lib/fdio/internal.h

zx::result<fdio_ptr> create (zx::handle handle)

Defined at line 136 of file ../../sdk/lib/fdio/remoteio.cc

zx::result<fdio_ptr> create (fidl::ClientEnd<fuchsia_io::Node> node, fuchsia_io::wire::Representation representation)

Defined at line 142 of file ../../sdk/lib/fdio/remoteio.cc

bool is_local_dir ()

Defined at line 167 of file ../../sdk/lib/fdio/internal.h

uint32_t & ioflag ()

|ioflag| contains mutable properties of this object, shared by

different transports. Possible values are |IOFLAG_*| in private.h.

TODO(https://fxbug.dev/42155608): The value of this field is not preserved when

fdio_fd_transfer is used.

Defined at line 174 of file ../../sdk/lib/fdio/internal.h

zxio_storage_t & zxio_storage ()

The zxio object, if the zxio transport is selected in |ops|.

Defined at line 177 of file ../../sdk/lib/fdio/internal.h

const zxio_storage_t & zxio_storage ()

Defined at line 178 of file ../../sdk/lib/fdio/internal.h

zx::duration & rcvtimeo ()

Used to implement SO_RCVTIMEO. See `man 7 socket` for details.

Defined at line 181 of file ../../sdk/lib/fdio/internal.h

zx::duration & sndtimeo ()

Used to implement SO_SNDTIMEO. See `man 7 socket` for details.

Defined at line 183 of file ../../sdk/lib/fdio/internal.h

Protected Methods

void ~fdio ()

Defined at line 9 of file ../../sdk/lib/fdio/null.cc

void deleter (fdio_t * ptr)

Defined at line 228 of file ../../sdk/lib/fdio/internal.h

void fdio ()

Defined at line 230 of file ../../sdk/lib/fdio/internal.h

void fbl_recycle ()

Defined at line 233 of file ../../sdk/lib/fdio/internal.h

Records

Friends

std::variant<last_reference, fdio_ptr> fdio (fdio_ptr io)
class Recyclable
class RefPtr
class MakeRefCountedHelper