|
file | edge_io_lib.h |
| Testable functions relating to file input/output.
|
|
that is needed by Edge Core or related components.
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
-
path | Path to the Unix Domain Socket file. |
lock_fd | The 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
-
path | Path 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
-
path | Path to the Unix Domain Socket file. |
lock_fd | The 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'.