---@meta posix.fcntl

---@class posix_flock*
---@field l_start integer
---@field l_len integer
---@field l_pid? integer
---@field l_type integer
---@field l_whence integer

---@class posix_fcntl*
---@field version string
---@field AT_EACCESS integer
---@field AT_FDCWD integer
---@field AT_REMOVEDIR integer
---@field AT_SYMLINK_FOLLOW integer
---@field AT_SYMLINK_NOFOLLOW integer
---@field AT_EMPTY_PATH integer
---@field AT_NO_AUTOMOUNT integer
---@field FD_CLOEXEC integer
---@field F_DUPFD integer
---@field F_GETFD integer
---@field F_SETFD integer
---@field F_GETFL integer
---@field F_SETFL integer
---@field F_GETLK integer
---@field F_SETLK integer
---@field F_SETLKW integer
---@field F_GETOWN integer
---@field F_SETOWN integer
---@field F_RDLCK integer
---@field F_WRLCK integer
---@field F_UNLCK integer
---@field O_RDONLY integer
---@field O_WRONLY integer
---@field O_RDWR integer
---@field O_APPEND integer
---@field O_CREAT integer
---@field O_DSYNC integer
---@field O_EXCL integer
---@field O_NOCTTY integer
---@field O_NONBLOCK integer
---@field O_RSYNC integer
---@field O_SYNC integer
---@field O_TRUNC integer
---@field O_CLOEXEC integer
---@field O_TMPFILE integer
---@field POSIX_FADV_NORMAL integer
---@field POSIX_FADV_SEQUENTIAL integer
---@field POSIX_FADV_RANDOM integer
---@field POSIX_FADV_NOREUSE integer
---@field POSIX_FADV_WILLNEED integer
---@field POSIX_FADV_DONTNEED integer
---@type posix_fcntl*
local M = {}

---@param fd integer
---@param cmd integer
---@param arg? integer|posix_flock*
---@return integer? result
---@return string? errMsg
---@return integer? errno
function M.fcntl(fd, cmd, arg) end

---@param path string
---@param oflags integer
---@param mode? integer
---@return integer? fd
---@return string? errMsg
---@return integer? errno
function M.open(path, oflags, mode) end

---@param fd integer
---@param offset integer
---@param len integer
---@param advice integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.posix_fadvise(fd, offset, len, advice) end

return M
