uwt

libuv bindings
Library uwt-base
Module Uwt_base . Fs_types
type uv_open_flag =
| O_RDONLY(*

Open for reading

*)
| O_WRONLY(*

Open for writing

*)
| O_RDWR(*

Open for reading and writing

*)
| O_NONBLOCK(*

Open in non-blocking mode, ignored on Windows

*)
| O_CREAT(*

Create if nonexistent

*)
| O_EXCL(*

Fail if existing

*)
| O_TRUNC(*

Truncate to 0 length if existing

*)
| O_APPEND(*

Open for append

*)
| O_NOCTTY(*

Don't make this dev a controlling tty, ignored on Windows

*)
| O_DSYNC(*

Writes complete as `Synchronised I/O data integrity completion', ignored by some platforms

*)
| O_SYNC(*

Writes complete as `Synchronised I/O file integrity completion', ignored by some platforms

*)
| O_RSYNC(*

Reads complete as writes (depending on O_SYNC/O_DSYNC), only supported on some Unix platforms, ignored otherwise

*)
| O_TEMPORARY(*

windows only, ignored on Unix

*)
| O_SHORT_LIVED(*

windows only, ignored on Unix

*)
| O_SEQUENTIAL(*

windows only, ignored on Unix

*)
| O_RANDOM(*

windows only, ignored on Unix

*)
| O_DIRECT(*

On Windows supported since libuv 1.16

*)
| O_EXLOCK(*

OS X (and Windows, but with different semantic)

*)
| O_NOATIME(*

no windows, some Unix systems, ignored otherwise

*)
| O_NOFOLLOW(*

no windows, some Unix systems, ignored otherwise

*)
| O_DIRECTORY(*

no windows, some Unix systems, ignored otherwise

*)

Flags for Fs_functions.openfile

O_CLOEXEC doesn't exist, because this flag is unconditionally added by libuv. O_SHARE_DELETE, O_SHARE_WRITE, O_SHARE_READ are always added on Windows, unless O_EXLOCK is specified.

type file_kind =
| S_REG(*

Regular file

*)
| S_DIR(*

Directory

*)
| S_CHR(*

Character device

*)
| S_BLK(*

Block device

*)
| S_LNK(*

Symbolic link

*)
| S_FIFO(*

Named pipe

*)
| S_SOCK(*

Socket

*)
| S_UNKNOWN(*

Everything else - possible on some platforms.

*)

On Windows it can be specified how to create symlinks.

type access_permission =
| Read(*

Read permission

*)
| Write(*

Write permission

*)
| Exec(*

Execution permission

*)
| Exists(*

File exists

*)
type stats = {
st_dev : int;(*

Device number

*)
st_kind : file_kind;(*

Kind of the file

*)
st_perm : int;(*

Access rights

*)
st_uid : int;(*

User id of the owner

*)
st_gid : int;(*

Group ID of the file's group

*)
st_rdev : int;(*

Device minor number

*)
st_ino : int;(*

Inode number

*)
st_size : int64;(*

Size in bytes

*)
st_blksize : int;(*

"Preferred" block size for efficient filesystem I/O

*)
st_blocks : int;(*

Number of blocks allocated to the file, in 512-byte units

*)
st_flags : int;(*

User defined flags for file

*)
st_gen : int;(*

File generation number

*)
st_atime : int64;(*

Last access time

*)
st_atime_nsec : int;(*

Nanosecond components of last access time

*)
st_mtime : int64;(*

Last modification time

*)
st_mtime_nsec : int;(*

Nanosecond components of last modification time

*)
st_ctime : int64;(*

Last status change time

*)
st_ctime_nsec : int;(*

Nanosecond components of lastt status change time

*)
st_birthtime : int64;(*

File creation time

*)
st_birthtime_nsec : int;(*

Nanosecond components of File creation time

*)
}

File status information. Support for the various fields differs depending on the OS and filesystem.

type clone_mode =
| No_clone(*

Create a normal copy

*)
| Try_clone(*

Try to clone the file, but create a normal copy, if it fails

*)
| Force_clone(*

Try tlone the file, don't create a normal copy, if it fails

*)

Clone mode for Fs_functions.copyfile