dr_open_file

Function dr_open_file 

Source
pub unsafe extern "C" fn dr_open_file(
    fname: *const c_char,
    mode_flags: uint,
) -> file_t
Expand description

Opens the file \p fname. If no such file exists then one is created. The file access mode is set by the \p mode_flags argument which is drawn from the DR_FILE_* defines ORed together. Returns INVALID_FILE if unsuccessful.

On Windows, \p fname is safest as an absolute path (when using Windows system calls directly there is no such thing as a relative path). A relative path passed to this routine will be converted to absolute on a best-effort basis using the current directory that was set at process initialization time. (The most recently set current directory can be retrieved (albeit with no safety guarantees) with dr_get_current_directory().) Drive-implied-absolute paths (“\foo.txt”) and other-drive-relative paths (“c:foo.txt”) are not supported.

On Linux, the file descriptor will be marked as close-on-exec. The DR_FILE_CLOSE_ON_FORK flag can be used to automatically close a file on a fork.

\note No more then one write mode flag can be specified.

\note On Linux, DR hides files opened by clients from the application by using file descriptors that are separate from the application’s and preventing the application from closing client-opened files.