Skip to main content

Name

io_wrapper_open — Open a handle to a resource

Synopsis

#include "io_wrapper.h"

| io_object * **io_wrapper_open** ( | filename, |   | |   | options, |   | |   | mode); |   |

const char * <var class="pdparam">filename</var>; int <var class="pdparam">options</var>; int <var class="pdparam">mode</var>;

Description

Open a handle to a resource.

Note

This function may induce IO or otherwise block the caller. Blocking in the scheduler thread will lead to degraded performance and should be avoided at all costs. If your code is running in the IO subsystem, the core will have already taken steps to ensure that blocking is acceptable. Otherwise, you should look at using the thread pool API to run a job in the IO pool.

You must use io_wrapper_delref to dispose of any object opened using this function. The object won't be destroyed until its last reference is dropped.

Parameters

filename

The name of the resource.

options

Options can be any bitwise OR of the flags used with open(3), for example O_RDWR, O_CREAT etc.

mode

The file mode in octal notation.

Return Values

This function returns a handle to the resource.

Threading

It is legal to call this function in any thread.

See Also

Was this page helpful?