l0.DependencyControl.helpers.ffi-posix¶
Functions¶
getFileMode ¶
Builds the numeric file mode for the given symbolic permissions.
| param | type | description |
|---|---|---|
| user? | string |
Any combination of "r", "w" and "x" for the owner, or "" for none. |
| group? | string |
Same, for the owner's group. |
| other? | string |
Same, for all other users. |
Returns:
modenumber— The file mode, e.g. getFileMode("rwx", "r", "r") -> 0o744 (484).
open ¶
Opens a file, creating it when the flags include Create (O_CREAT), and returns the raw descriptor.
| param | type | description |
|---|---|---|
| path | string |
|
| flags | integer |
open(2) flags, e.g. FileAccessMode.ReadWrite | FileCreationFlags.Create. |
| mode | integer |
Permission bits for a newly created file (from getFileMode). |
Returns:
fdinteger— The open descriptor, or a negative value on failure.
close ¶
Closes an open file descriptor.
| param | type | description |
|---|---|---|
| fd | integer |
A descriptor returned by open. |
Returns:
statusinteger— Zero on success, or a negative value on failure.
Fields¶
| field | type | description |
|---|---|---|
| FileAccessMode | table |
|
| FileCreationFlags | table |