open_exclusive()
#
open_exclusive()
opens a file with exclusive access, ensuring that no other process can lock it simultaneously.
Prototype
int open_exclusive(
const char *path,
int flags,
int permission
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
The file path to be opened. |
|
|
Flags for opening the file. If set to 0, default flags ( |
|
|
The file permission mode, used when creating a new file. |
Return Value
Returns a file descriptor on success, or -1 on failure.
Notes
This function applies an exclusive lock (LOCK_EX | LOCK_NB
) to the file, ensuring that no other process can acquire a lock on it.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples