Mistake on this page? Email us
Library for implementing various OS Input / Output related functionality

Files

file  edge_io_lib.h
 Testable functions relating to file input/output.
 

Functions

bool edge_io_file_exists (const char *path)
 Check if a file exists using underlying OS call. More...
 
bool edge_io_acquire_lock_for_socket (const char *path, int *lock_fd)
 Acquires a lock file for the given Unix Domain socket path. The lock file will the given socket path with '.lock' appended to it. More...
 
bool edge_io_release_lock_for_socket (const char *path, int lock_fd)
 Releases the lock and deletes the lock file for the Unix Domain socket. The lock file will the given socket path with '.lock' appended to it. More...
 
int edge_io_unlink (const char *path)
 Removes the file for the given path. More...
 

Detailed Description

that is needed by Edge Core or related components.

Function Documentation

bool edge_io_acquire_lock_for_socket ( const char *  path,
int *  lock_fd 
)

Acquires a lock file for the given Unix Domain socket path. The lock file will the given socket path with '.lock' appended to it.

Parameters
pathPath to the Unix Domain Socket file.
lock_fdThe returned file descriptor for the lock file. It's needed for releasing the lock.
Returns
true If acquiring the socket lock succeeded. fail If acquiring the socket lock failed.
bool edge_io_file_exists ( const char *  path)

Check if a file exists using underlying OS call.

Parameters
pathPath to the file to check.
Returns
true - the file exists. false - the file doesn't exist.
bool edge_io_release_lock_for_socket ( const char *  path,
int  lock_fd 
)

Releases the lock and deletes the lock file for the Unix Domain socket. The lock file will the given socket path with '.lock' appended to it.

Parameters
pathPath to the Unix Domain Socket file.
lock_fdThe file corresponding to the lock file that was returned by edge_io_acquire_lock_for_socket.
Returns
true Releasing the lock for the socket succeeded. false Releasing the lock for the socket failed.
int edge_io_unlink ( const char *  path)

Removes the file for the given path.

Returns
0 If removing the file succeeded. For other return values, see 'man 2 unlink'.