---@meta posix.unistd

---@class posix_unistd*
---@field version string
---@field _PC_CHOWN_RESTRICTED integer
---@field _PC_LINK_MAX integer
---@field _PC_MAX_CANON integer
---@field _PC_MAX_INPUT integer
---@field _PC_NAME_MAX integer
---@field _PC_NO_TRUNC integer
---@field _PC_PATH_MAX integer
---@field _PC_PIPE_BUF integer
---@field _PC_VDISABLE integer
---@field _SC_ARG_MAX integer
---@field _SC_CHILD_MAX integer
---@field _SC_CLK_TCK integer
---@field _SC_JOB_CONTROL integer
---@field _SC_NGROUPS_MAX integer
---@field _SC_OPEN_MAX integer
---@field _SC_PAGESIZE integer
---@field _SC_SAVED_IDS integer
---@field _SC_STREAM_MAX integer
---@field _SC_TZNAME_MAX integer
---@field _SC_VERSION integer
---@field SEEK_CUR integer
---@field SEEK_END integer
---@field SEEK_SET integer
---@field STDERR_FILENO integer
---@field STDIN_FILENO integer
---@field STDOUT_FILENO integer
---@type posix_unistd*
local M = {}

---@param status? integer
function M._exit(status) end

---@param path string
---@param mode string|integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.access(path, mode) end

---@param seconds integer
---@return integer remaining
function M.alarm(seconds) end

---@param path string
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.chdir(path) end

---@param path string
---@param uid integer
---@param gid integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.chown(path, uid, gid) end

---@param fd integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.close(fd) end

---@param key string
---@param salt string
---@return string? hash
function M.crypt(key, salt) end

---@param fd integer
---@return integer? newfd
---@return string? errMsg
---@return integer? errno
function M.dup(fd) end

---@param fd integer
---@param newfd integer
---@return integer? result
---@return string? errMsg
---@return integer? errno
function M.dup2(fd, newfd) end

---@param path string
---@param argv string[]
function M.exec(path, argv) end

---@param file string
---@param argv string[]
function M.execp(file, argv) end

---@param fd integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.fdatasync(fd) end

---@return integer? pid
---@return string? errMsg
---@return integer? errno
function M.fork() end

---@param fd integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.fsync(fd) end

---@return string? cwd
---@return string? errMsg
---@return integer? errno
function M.getcwd() end

---@return integer[]? groups
function M.getgroups() end

---@return integer gid
function M.getegid() end

---@return integer uid
function M.geteuid() end

---@return integer gid
function M.getgid() end

---@return string? login
function M.getlogin() end

---@param optstring string
---@param args? string[]
---@return any ...
function M.getopt(optstring, args) end

---@return integer pgrp
function M.getpgrp() end

---@return integer pid
function M.getpid() end

---@return integer ppid
function M.getppid() end

---@return integer uid
function M.getuid() end

---@return integer hostid
function M.gethostid() end

---@param fd integer
---@return integer ok
function M.isatty(fd) end

---@param path string
---@param uid integer
---@param gid integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.lchown(path, uid, gid) end

---@param oldpath string
---@param newpath string
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.link(oldpath, newpath) end

---@param olddirfd integer
---@param oldpath string
---@param newdirfd integer
---@param newpath string
---@param flags? integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.linkat(olddirfd, oldpath, newdirfd, newpath, flags) end

---@param fd integer
---@param offset integer
---@param whence? integer
---@return integer? offset
---@return string? errMsg
---@return integer? errno
function M.lseek(fd, offset, whence) end

---@param inc integer
---@return integer? priority
---@return string? errMsg
---@return integer? errno
function M.nice(inc) end

---@param path string
---@param name integer
---@return integer? value
---@return string? errMsg
---@return integer? errno
function M.pathconf(path, name) end

---@return integer? readfd
---@return integer? writefd
---@return string? errMsg
---@return integer? errno
function M.pipe() end

---@param fd integer
---@param count integer
---@return string? data
---@return string? errMsg
---@return integer? errno
function M.read(fd, count) end

---@param path string
---@return string? target
---@return string? errMsg
---@return integer? errno
function M.readlink(path) end

---@param path string
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.rmdir(path) end

---@param how string
---@param id integer
---@param pid integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.setpid(how, id, pid) end

---@param seconds integer
---@return integer remaining
function M.sleep(seconds) end

function M.sync() end

---@param name integer
---@return integer? value
---@return string? errMsg
---@return integer? errno
function M.sysconf(name) end

---@param fd integer
---@return string? name
---@return string? errMsg
---@return integer? errno
function M.ttyname(fd) end

---@param fd integer
---@return integer? pgrp
---@return string? errMsg
---@return integer? errno
function M.tcgetpgrp(fd) end

---@param fd integer
---@param pgrp integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.tcsetpgrp(fd, pgrp) end

---@param path string
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.unlink(path) end

---@param fd integer
---@param data string
---@return integer? bytes
---@return string? errMsg
---@return integer? errno
function M.write(fd, data) end

---@param fd integer
---@param length integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.ftruncate(fd, length) end

---@param path string
---@param length integer
---@return integer? ok
---@return string? errMsg
---@return integer? errno
function M.truncate(path, length) end

return M
