LUALIB_API int luaopen_posix_sys_statvfs(lua_State *L) { luaL_register(L, "posix.sys.statvfs", posix_sys_statvfs_fns); lua_pushliteral(L, "posix.sys.statvfs for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); LPOSIX_CONST( ST_RDONLY ); LPOSIX_CONST( ST_NOSUID ); return 1; }
LUALIB_API int luaopen_posix_sys_wait(lua_State *L) { luaL_register(L, "posix.sys.wait", posix_sys_wait_fns); lua_pushliteral(L, "posix.sys.wait for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); LPOSIX_CONST( WNOHANG ); LPOSIX_CONST( WUNTRACED ); return 1; }
LUALIB_API int luaopen_posix_sys_wait(lua_State *L) { luaL_newlib(L, posix_sys_wait_fns); lua_pushstring(L, LPOSIX_VERSION_STRING("sys.wait")); lua_setfield(L, -2, "version"); LPOSIX_CONST( WNOHANG ); LPOSIX_CONST( WUNTRACED ); return 1; }
int luaopen_posix_fnmatch(lua_State *L) { luaL_register(L, "posix.fnmatch", posix_fnmatch_fns); lua_pushliteral(L, "posix.fnmatch for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); /* from fnmatch.h */ LPOSIX_CONST( FNM_PATHNAME ); LPOSIX_CONST( FNM_NOESCAPE ); LPOSIX_CONST( FNM_NOMATCH ); LPOSIX_CONST( FNM_PERIOD ); return 1; }
LUALIB_API int luaopen_posix_time(lua_State *L) { luaL_register(L, "posix.time", posix_time_fns); lua_pushstring(L, LPOSIX_VERSION_STRING("time")); lua_setfield(L, -2, "version"); #if defined _XOPEN_REALTIME && _XOPEN_REALTIME != -1 LPOSIX_CONST( CLOCK_MONOTONIC ); LPOSIX_CONST( CLOCK_PROCESS_CPUTIME_ID ); LPOSIX_CONST( CLOCK_REALTIME ); LPOSIX_CONST( CLOCK_THREAD_CPUTIME_ID ); #endif return 1; }
LUALIB_API int luaopen_posix_glob(lua_State *L) { luaL_register(L, "posix.glob", posix_glob_fns); lua_pushstring(L, LPOSIX_VERSION_STRING("glob")); lua_setfield(L, -2, "version"); LPOSIX_CONST( GLOB_MARK ); return 1; }
int luaopen_posix_sched(lua_State *L) { luaL_register(L, "posix.sched", posix_sched_fns); lua_pushliteral(L, "posix.sched for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); /* Psched_setscheduler flags */ #ifdef SCHED_FIFO LPOSIX_CONST( SCHED_FIFO ); #endif #ifdef SCHED_RR LPOSIX_CONST( SCHED_RR ); #endif #ifdef SCHED_OTHER LPOSIX_CONST( SCHED_OTHER ); #endif return 1; }
LUALIB_API int luaopen_posix_stdio(lua_State *L) { luaL_register(L, "posix.stdio", posix_stdio_fns); lua_pushliteral(L, "posix.stdio for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); /* stdio.h constants */ /* Those that are omitted already have a Lua interface, or alternative. */ LPOSIX_CONST( _IOFBF ); LPOSIX_CONST( _IOLBF ); LPOSIX_CONST( _IONBF ); LPOSIX_CONST( BUFSIZ ); LPOSIX_CONST( EOF ); LPOSIX_CONST( FOPEN_MAX ); LPOSIX_CONST( FILENAME_MAX ); return 1; }
LUALIB_API int luaopen_posix_sys_msg(lua_State *L) { luaL_register(L, "posix.sys.msg", posix_sys_msg_fns); lua_pushliteral(L, "posix.sys.msg for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); #if HAVE_SYSV_MESSAGING LPOSIX_CONST( IPC_CREAT ); LPOSIX_CONST( IPC_EXCL ); LPOSIX_CONST( IPC_PRIVATE ); LPOSIX_CONST( IPC_NOWAIT ); # ifdef MSG_EXCEPT LPOSIX_CONST( MSG_EXCEPT ); # endif # ifdef MSG_NOERROR LPOSIX_CONST( MSG_NOERROR ); # endif #endif return 1; }
LUALIB_API int luaopen_posix_unistd(lua_State *L) { luaL_register(L, "posix.unistd", posix_unistd_fns); lua_pushliteral(L, "posix.unistd for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); /* pathconf arguments */ LPOSIX_CONST( _PC_CHOWN_RESTRICTED ); LPOSIX_CONST( _PC_LINK_MAX ); LPOSIX_CONST( _PC_MAX_CANON ); LPOSIX_CONST( _PC_MAX_INPUT ); LPOSIX_CONST( _PC_NAME_MAX ); LPOSIX_CONST( _PC_NO_TRUNC ); LPOSIX_CONST( _PC_PATH_MAX ); LPOSIX_CONST( _PC_PIPE_BUF ); LPOSIX_CONST( _PC_VDISABLE ); /* sysconf arguments */ LPOSIX_CONST( _SC_ARG_MAX ); LPOSIX_CONST( _SC_CHILD_MAX ); LPOSIX_CONST( _SC_CLK_TCK ); LPOSIX_CONST( _SC_JOB_CONTROL ); LPOSIX_CONST( _SC_OPEN_MAX ); LPOSIX_CONST( _SC_NGROUPS_MAX ); LPOSIX_CONST( _SC_SAVED_IDS ); LPOSIX_CONST( _SC_STREAM_MAX ); LPOSIX_CONST( _SC_TZNAME_MAX ); LPOSIX_CONST( _SC_VERSION ); /* lseek arguments */ LPOSIX_CONST( SEEK_CUR ); LPOSIX_CONST( SEEK_END ); LPOSIX_CONST( SEEK_SET ); /* Miscellaneous */ LPOSIX_CONST( STDERR_FILENO ); LPOSIX_CONST( STDIN_FILENO ); LPOSIX_CONST( STDOUT_FILENO ); return 1; }
/*** Error constants. Any constants not available in the underlying system will be `nil` valued. If you find one of the luaposix APIs returns an error code not listed here, please raise an issue [here](http://github.com/luaposix/luaposixissues), stating the symbolic name of the constant (from `/usr/include/errno.h` or equivalent). @table posix.errno @int E2BIG argument list too long @int EACCES permission denied @int EADDRINUSE address already in use @int EADDRNOTAVAIL can't assign requested address @int EAFNOSUPPORT address family not supported by protocol family @int EAGAIN resource temporarily unavailable @int EALREADY operation already in progress @int EBADF bad file descriptor @int EBADMSG bad message @int EBUSY resource busy @int ECANCELED operation canceled @int ECHILD no child processes @int ECONNABORTED software caused connection abort @int ECONNREFUSED connection refused @int ECONNRESET connection reset by peer @int EDEADLK resource deadlock avoided @int EDESTADDRREQ destination address required @int EDOM numerical argument out of domain @int EEXIST file exists @int EFAULT bad address @int EFBIG file too large @int EHOSTUNREACH no route to host @int EIDRM identifier removed @int EILSEQ illegal byte sequence @int EINPROGRESS operation now in progress @int EINTR interrupted system call @int EINVAL invalid argument @int EIO input/output error @int EISCONN socket is already connected @int EISDIR is a directory @int ELOOP too many levels of symbolic links @int EMFILE too many open files @int EMLINK too many links @int EMSGSIZE message too long @int ENAMETOOLONG file name too long @int ENETDOWN network is down @int ENETRESET network dropped connection on reset @int ENETUNREACH network is unreachable @int ENFILE too many open files in system @int ENOBUFS no buffer space available @int ENODEV operation not supported by device @int ENOENT no such file or directory @int ENOEXEC exec format error @int ENOLCK no locks available @int ENOMEM cannot allocate memory @int ENOMSG no message of desired type @int ENOPROTOOPT protocol not available @int ENOSPC no space left on device @int ENOSYS function not implemented @int ENOTCONN socket is not connected @int ENOTDIR not a directory @int ENOTEMPTY directory not empty @int ENOTSOCK socket operation on non-socket @int ENOTSUP operation not supported @int ENOTTY inappropriate ioctl for device @int ENXIO device not configured @int EOPNOTSUPP operation not supported on socket @int EOVERFLOW value too large to be stored in data type @int EPERM operation not permitted @int EPIPE broken pipe @int EPROTO protocol error @int EPROTONOSUPPORT protocol not supported @int EPROTOTYPE protocol wrong type for socket @int ERANGE result too large @int EROFS read-only file system @int ESPIPE illegal seek @int ESRCH no such process @int ETIMEDOUT operation timed out @int ETXTBSY text file busy @int EWOULDBLOCK operation would block @int EXDEV cross-device link @usage -- Print errno constants supported on this host. for name, value in pairs (require "posix.errno") do if type (value) == "number" then print (name, value) end end */ LUALIB_API int luaopen_posix_errno(lua_State *L) { luaL_register(L, "posix.errno", posix_errno_fns); lua_pushliteral(L, "posix.errno for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); #ifdef E2BIG LPOSIX_CONST( E2BIG ); #endif #ifdef EACCES LPOSIX_CONST( EACCES ); #endif #ifdef EADDRINUSE LPOSIX_CONST( EADDRINUSE ); #endif #ifdef EADDRNOTAVAIL LPOSIX_CONST( EADDRNOTAVAIL ); #endif #ifdef EAFNOSUPPORT LPOSIX_CONST( EAFNOSUPPORT ); #endif #ifdef EAGAIN LPOSIX_CONST( EAGAIN ); #endif #ifdef EALREADY LPOSIX_CONST( EALREADY ); #endif #ifdef EBADF LPOSIX_CONST( EBADF ); #endif #ifdef EBADMSG LPOSIX_CONST( EBADMSG ); #endif #ifdef EBUSY LPOSIX_CONST( EBUSY ); #endif #ifdef ECANCELED LPOSIX_CONST( ECANCELED ); #endif #ifdef ECHILD LPOSIX_CONST( ECHILD ); #endif #ifdef ECONNABORTED LPOSIX_CONST( ECONNABORTED ); #endif #ifdef ECONNREFUSED LPOSIX_CONST( ECONNREFUSED ); #endif #ifdef ECONNRESET LPOSIX_CONST( ECONNRESET ); #endif #ifdef EDEADLK LPOSIX_CONST( EDEADLK ); #endif #ifdef EDESTADDRREQ LPOSIX_CONST( EDESTADDRREQ ); #endif #ifdef EDOM LPOSIX_CONST( EDOM ); #endif #ifdef EEXIST LPOSIX_CONST( EEXIST ); #endif #ifdef EFAULT LPOSIX_CONST( EFAULT ); #endif #ifdef EFBIG LPOSIX_CONST( EFBIG ); #endif #ifdef EHOSTUNREACH LPOSIX_CONST( EHOSTUNREACH ); #endif #ifdef EIDRM LPOSIX_CONST( EIDRM ); #endif #ifdef EILSEQ LPOSIX_CONST( EILSEQ ); #endif #ifdef EINPROGRESS LPOSIX_CONST( EINPROGRESS ); #endif #ifdef EINTR LPOSIX_CONST( EINTR ); #endif #ifdef EINVAL LPOSIX_CONST( EINVAL ); #endif #ifdef EIO LPOSIX_CONST( EIO ); #endif #ifdef EISCONN LPOSIX_CONST( EISCONN ); #endif #ifdef EISDIR LPOSIX_CONST( EISDIR ); #endif #ifdef ELOOP LPOSIX_CONST( ELOOP ); #endif #ifdef EMFILE LPOSIX_CONST( EMFILE ); #endif #ifdef EMLINK LPOSIX_CONST( EMLINK ); #endif #ifdef EMSGSIZE LPOSIX_CONST( EMSGSIZE ); #endif #ifdef ENAMETOOLONG LPOSIX_CONST( ENAMETOOLONG ); #endif #ifdef ENETDOWN LPOSIX_CONST( ENETDOWN ); #endif #ifdef ENETRESET LPOSIX_CONST( ENETRESET ); #endif #ifdef ENETUNREACH LPOSIX_CONST( ENETUNREACH ); #endif #ifdef ENFILE LPOSIX_CONST( ENFILE ); #endif #ifdef ENOBUFS LPOSIX_CONST( ENOBUFS ); #endif #ifdef ENODEV LPOSIX_CONST( ENODEV ); #endif #ifdef ENOENT LPOSIX_CONST( ENOENT ); #endif #ifdef ENOEXEC LPOSIX_CONST( ENOEXEC ); #endif #ifdef ENOLCK LPOSIX_CONST( ENOLCK ); #endif #ifdef ENOMEM LPOSIX_CONST( ENOMEM ); #endif #ifdef ENOMSG LPOSIX_CONST( ENOMSG ); #endif #ifdef ENOPROTOOPT LPOSIX_CONST( ENOPROTOOPT ); #endif #ifdef ENOSPC LPOSIX_CONST( ENOSPC ); #endif #ifdef ENOSYS LPOSIX_CONST( ENOSYS ); #endif #ifdef ENOTCONN LPOSIX_CONST( ENOTCONN ); #endif #ifdef ENOTDIR LPOSIX_CONST( ENOTDIR ); #endif #ifdef ENOTEMPTY LPOSIX_CONST( ENOTEMPTY ); #endif #ifdef ENOTSOCK LPOSIX_CONST( ENOTSOCK ); #endif #ifdef ENOTSUP LPOSIX_CONST( ENOTSUP ); #endif #ifdef ENOTTY LPOSIX_CONST( ENOTTY ); #endif #ifdef ENXIO LPOSIX_CONST( ENXIO ); #endif #ifdef EOPNOTSUPP LPOSIX_CONST( EOPNOTSUPP ); #endif #ifdef EOVERFLOW LPOSIX_CONST( EOVERFLOW ); #endif #ifdef EPERM LPOSIX_CONST( EPERM ); #endif #ifdef EPIPE LPOSIX_CONST( EPIPE ); #endif #ifdef EPROTO LPOSIX_CONST( EPROTO ); #endif #ifdef EPROTONOSUPPORT LPOSIX_CONST( EPROTONOSUPPORT ); #endif #ifdef EPROTOTYPE LPOSIX_CONST( EPROTOTYPE ); #endif #ifdef ERANGE LPOSIX_CONST( ERANGE ); #endif #ifdef EROFS LPOSIX_CONST( EROFS ); #endif #ifdef ESPIPE LPOSIX_CONST( ESPIPE ); #endif #ifdef ESRCH LPOSIX_CONST( ESRCH ); #endif #ifdef ETIMEDOUT LPOSIX_CONST( ETIMEDOUT ); #endif #ifdef ETXTBSY LPOSIX_CONST( ETXTBSY ); #endif #ifdef EWOULDBLOCK LPOSIX_CONST( EWOULDBLOCK ); #endif #ifdef EXDEV LPOSIX_CONST( EXDEV ); #endif return 1; }
LUALIB_API int luaopen_posix_sys_stat(lua_State *L) { luaL_register(L, "posix.sys.stat", posix_sys_stat_fns); lua_pushliteral(L, "posix.sys.stat for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); LPOSIX_CONST( S_IFMT ); LPOSIX_CONST( S_IFBLK ); LPOSIX_CONST( S_IFCHR ); LPOSIX_CONST( S_IFDIR ); LPOSIX_CONST( S_IFIFO ); LPOSIX_CONST( S_IFLNK ); LPOSIX_CONST( S_IFREG ); LPOSIX_CONST( S_IFSOCK ); LPOSIX_CONST( S_IRWXU ); LPOSIX_CONST( S_IRUSR ); LPOSIX_CONST( S_IWUSR ); LPOSIX_CONST( S_IXUSR ); LPOSIX_CONST( S_IRWXG ); LPOSIX_CONST( S_IRGRP ); LPOSIX_CONST( S_IWGRP ); LPOSIX_CONST( S_IXGRP ); LPOSIX_CONST( S_IRWXO ); LPOSIX_CONST( S_IROTH ); LPOSIX_CONST( S_IWOTH ); LPOSIX_CONST( S_IXOTH ); LPOSIX_CONST( S_ISGID ); LPOSIX_CONST( S_ISUID ); return 1; }
LUALIB_API int luaopen_posix_termio(lua_State *L) { luaL_register(L, "posix.termio", posix_termio_fns); lua_pushliteral(L, "posix.termio for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); /* tcsetattr */ LPOSIX_CONST( TCSANOW ); LPOSIX_CONST( TCSADRAIN ); LPOSIX_CONST( TCSAFLUSH ); /* tcflush */ LPOSIX_CONST( TCIFLUSH ); LPOSIX_CONST( TCOFLUSH ); LPOSIX_CONST( TCIOFLUSH ); /* tcflow() */ LPOSIX_CONST( TCOOFF ); LPOSIX_CONST( TCOON ); LPOSIX_CONST( TCIOFF ); LPOSIX_CONST( TCION ); /* cflag */ #ifdef B0 LPOSIX_CONST( B0 ); #endif #ifdef B50 LPOSIX_CONST( B50 ); #endif #ifdef B75 LPOSIX_CONST( B75 ); #endif #ifdef B110 LPOSIX_CONST( B110 ); #endif #ifdef B134 LPOSIX_CONST( B134 ); #endif #ifdef B150 LPOSIX_CONST( B150 ); #endif #ifdef B200 LPOSIX_CONST( B200 ); #endif #ifdef B300 LPOSIX_CONST( B300 ); #endif #ifdef B600 LPOSIX_CONST( B600 ); #endif #ifdef B1200 LPOSIX_CONST( B1200 ); #endif #ifdef B1800 LPOSIX_CONST( B1800 ); #endif #ifdef B2400 LPOSIX_CONST( B2400 ); #endif #ifdef B4800 LPOSIX_CONST( B4800 ); #endif #ifdef B9600 LPOSIX_CONST( B9600 ); #endif #ifdef B19200 LPOSIX_CONST( B19200 ); #endif #ifdef B38400 LPOSIX_CONST( B38400 ); #endif #ifdef B57600 LPOSIX_CONST( B57600 ); #endif #ifdef B115200 LPOSIX_CONST( B115200 ); #endif #ifdef CSIZE LPOSIX_CONST( CSIZE ); #endif #ifdef BS5 LPOSIX_CONST( CS5 ); #endif #ifdef CS6 LPOSIX_CONST( CS6 ); #endif #ifdef CS7 LPOSIX_CONST( CS7 ); #endif #ifdef CS8 LPOSIX_CONST( CS8 ); #endif #ifdef CSTOPB LPOSIX_CONST( CSTOPB ); #endif #ifdef CREAD LPOSIX_CONST( CREAD ); #endif #ifdef PARENB LPOSIX_CONST( PARENB ); #endif #ifdef PARODD LPOSIX_CONST( PARODD ); #endif #ifdef HUPCL LPOSIX_CONST( HUPCL ); #endif #ifdef CLOCAL LPOSIX_CONST( CLOCAL ); #endif #ifdef CRTSCTS LPOSIX_CONST( CRTSCTS ); #endif /* lflag */ #ifdef ISIG LPOSIX_CONST( ISIG ); #endif #ifdef ICANON LPOSIX_CONST( ICANON ); #endif #ifdef ECHO LPOSIX_CONST( ECHO ); #endif #ifdef ECHOE LPOSIX_CONST( ECHOE ); #endif #ifdef ECHOK LPOSIX_CONST( ECHOK ); #endif #ifdef ECHONL LPOSIX_CONST( ECHONL ); #endif #ifdef NOFLSH LPOSIX_CONST( NOFLSH ); #endif #ifdef IEXTEN LPOSIX_CONST( IEXTEN ); #endif #ifdef TOSTOP LPOSIX_CONST( TOSTOP ); #endif /* iflag */ #ifdef INPCK LPOSIX_CONST( INPCK ); #endif #ifdef IGNPAR LPOSIX_CONST( IGNPAR ); #endif #ifdef PARMRK LPOSIX_CONST( PARMRK ); #endif #ifdef ISTRIP LPOSIX_CONST( ISTRIP ); #endif #ifdef IXON LPOSIX_CONST( IXON ); #endif #ifdef IXOFF LPOSIX_CONST( IXOFF ); #endif #ifdef IXANY LPOSIX_CONST( IXANY ); #endif #ifdef IGNBRK LPOSIX_CONST( IGNBRK ); #endif #ifdef BRKINT LPOSIX_CONST( BRKINT ); #endif #ifdef INLCR LPOSIX_CONST( INLCR ); #endif #ifdef IGNCR LPOSIX_CONST( IGNCR ); #endif #ifdef ICRNL LPOSIX_CONST( ICRNL ); #endif #ifdef IMAXBEL LPOSIX_CONST( IMAXBEL ); #endif /* oflag */ #ifdef OPOST LPOSIX_CONST( OPOST ); #endif #ifdef ONLCR LPOSIX_CONST( ONLCR ); #endif #ifdef OCRNL LPOSIX_CONST( OCRNL ); #endif #ifdef ONLRET LPOSIX_CONST( ONLRET ); #endif #ifdef OFILL LPOSIX_CONST( OFILL ); #endif #ifdef OFDEL LPOSIX_CONST( OFDEL ); #endif #ifdef NLDLY LPOSIX_CONST( NLDLY ); #endif #ifdef NL0 LPOSIX_CONST( NL0 ); #endif #ifdef NL1 LPOSIX_CONST( NL1 ); #endif #ifdef CRDLY LPOSIX_CONST( CRDLY ); #endif #ifdef CR0 LPOSIX_CONST( CR0 ); #endif #ifdef CR1 LPOSIX_CONST( CR1 ); #endif #ifdef CR2 LPOSIX_CONST( CR2 ); #endif #ifdef CR3 LPOSIX_CONST( CR3 ); #endif #ifdef TABDLY LPOSIX_CONST( TABDLY ); #endif #ifdef TAB0 LPOSIX_CONST( TAB0 ); #endif #ifdef TAB1 LPOSIX_CONST( TAB1 ); #endif #ifdef TAB2 LPOSIX_CONST( TAB2 ); #endif #ifdef TAB3 LPOSIX_CONST( TAB3 ); #endif #ifdef BSDLY LPOSIX_CONST( BSDLY ); #endif #ifdef BS0 LPOSIX_CONST( BS0 ); #endif #ifdef BS1 LPOSIX_CONST( BS1 ); #endif #ifdef VTDLY LPOSIX_CONST( VTDLY ); #endif #ifdef VT0 LPOSIX_CONST( VT0 ); #endif #ifdef VT1 LPOSIX_CONST( VT1 ); #endif #ifdef FFDLY LPOSIX_CONST( FFDLY ); #endif #ifdef FF0 LPOSIX_CONST( FF0 ); #endif #ifdef FF1 LPOSIX_CONST( FF1 ); #endif /* cc */ #ifdef VINTR LPOSIX_CONST( VINTR ); #endif #ifdef VQUIT LPOSIX_CONST( VQUIT ); #endif #ifdef VERASE LPOSIX_CONST( VERASE ); #endif #ifdef VKILL LPOSIX_CONST( VKILL ); #endif #ifdef VEOF LPOSIX_CONST( VEOF ); #endif #ifdef VEOL LPOSIX_CONST( VEOL ); #endif #ifdef VEOL2 LPOSIX_CONST( VEOL2 ); #endif #ifdef VMIN LPOSIX_CONST( VMIN ); #endif #ifdef VTIME LPOSIX_CONST( VTIME ); #endif #ifdef VSTART LPOSIX_CONST( VSTART ); #endif #ifdef VSTOP LPOSIX_CONST( VSTOP ); #endif #ifdef VSUSP LPOSIX_CONST( VSUSP ); #endif /* XSI extensions - don't use these if you care about portability * to strict POSIX conforming machines, such as Mac OS X. */ #ifdef CBAUD LPOSIX_CONST( CBAUD ); #endif #ifdef EXTA LPOSIX_CONST( EXTA ); #endif #ifdef EXTB LPOSIX_CONST( EXTB ); #endif #ifdef DEFECHO LPOSIX_CONST( DEFECHO ); #endif #ifdef ECHOCTL LPOSIX_CONST( ECHOCTL ); #endif #ifdef ECHOPRT LPOSIX_CONST( ECHOPRT ); #endif #ifdef ECHOKE LPOSIX_CONST( ECHOKE ); #endif #ifdef FLUSHO LPOSIX_CONST( FLUSHO ); #endif #ifdef PENDIN LPOSIX_CONST( PENDIN ); #endif #ifdef LOBLK LPOSIX_CONST( LOBLK ); #endif #ifdef SWTCH LPOSIX_CONST( SWTCH ); #endif #ifdef VDISCARD LPOSIX_CONST( VDISCARD ); #endif #ifdef VDSUSP LPOSIX_CONST( VDSUSP ); #endif #ifdef VLNEXT LPOSIX_CONST( VLNEXT ); #endif #ifdef VREPRINT LPOSIX_CONST( VREPRINT ); #endif #ifdef VSTATUS LPOSIX_CONST( VSTATUS ); #endif #ifdef VWERASE LPOSIX_CONST( VWERASE ); #endif return 1; }
LUALIB_API int luaopen_posix_sys_socket(lua_State *L) { luaL_register(L, "posix.sys.socket", posix_sys_socket_fns); lua_pushliteral(L, "posix.sys.socket for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); #if _POSIX_VERSION >= 200112L LPOSIX_CONST( SOMAXCONN ); LPOSIX_CONST( AF_UNSPEC ); LPOSIX_CONST( AF_INET ); LPOSIX_CONST( AF_INET6 ); LPOSIX_CONST( AF_UNIX ); # if HAVE_LINUX_NETLINK_H LPOSIX_CONST( AF_NETLINK ); # endif LPOSIX_CONST( SOL_SOCKET ); LPOSIX_CONST( IPPROTO_TCP ); LPOSIX_CONST( IPPROTO_UDP ); LPOSIX_CONST( IPPROTO_IP ); LPOSIX_CONST( IPPROTO_IPV6 ); # ifdef IPPROTO_ICMP LPOSIX_CONST( IPPROTO_ICMP ); # endif LPOSIX_CONST( SOCK_STREAM ); LPOSIX_CONST( SOCK_DGRAM ); # ifdef SOCK_RAW LPOSIX_CONST( SOCK_RAW ); # endif LPOSIX_CONST( SHUT_RD ); LPOSIX_CONST( SHUT_WR ); LPOSIX_CONST( SHUT_RDWR ); LPOSIX_CONST( SO_ACCEPTCONN ); LPOSIX_CONST( SO_BROADCAST ); LPOSIX_CONST( SO_LINGER ); LPOSIX_CONST( SO_RCVTIMEO ); LPOSIX_CONST( SO_SNDTIMEO ); # ifdef SO_BINDTODEVICE LPOSIX_CONST( SO_BINDTODEVICE ); # endif LPOSIX_CONST( SO_DEBUG ); LPOSIX_CONST( SO_DONTROUTE ); LPOSIX_CONST( SO_ERROR ); LPOSIX_CONST( SO_KEEPALIVE ); LPOSIX_CONST( SO_OOBINLINE ); LPOSIX_CONST( SO_RCVBUF ); LPOSIX_CONST( SO_RCVLOWAT ); LPOSIX_CONST( SO_REUSEADDR ); LPOSIX_CONST( SO_SNDBUF ); LPOSIX_CONST( SO_SNDLOWAT ); LPOSIX_CONST( SO_TYPE ); LPOSIX_CONST( TCP_NODELAY ); LPOSIX_CONST( AI_ADDRCONFIG ); LPOSIX_CONST( AI_ALL ); LPOSIX_CONST( AI_CANONNAME ); LPOSIX_CONST( AI_NUMERICHOST ); LPOSIX_CONST( AI_NUMERICSERV ); LPOSIX_CONST( AI_PASSIVE ); LPOSIX_CONST( AI_V4MAPPED ); # ifdef IPV6_JOIN_GROUP LPOSIX_CONST( IPV6_JOIN_GROUP ); # endif # ifdef IPV6_LEAVE_GROUP LPOSIX_CONST( IPV6_LEAVE_GROUP ); # endif # ifdef IPV6_MULTICAST_HOPS LPOSIX_CONST( IPV6_MULTICAST_HOPS ); # endif # ifdef IPV6_MULTICAST_IF LPOSIX_CONST( IPV6_MULTICAST_IF ); # endif # ifdef IPV6_MULTICAST_LOOP LPOSIX_CONST( IPV6_MULTICAST_LOOP ); # endif # ifdef IPV6_UNICAST_HOPS LPOSIX_CONST( IPV6_UNICAST_HOPS ); # endif # ifdef IPV6_V6ONLY LPOSIX_CONST( IPV6_V6ONLY ); # endif # if HAVE_LINUX_NETLINK_H LPOSIX_CONST( NETLINK_ROUTE ); LPOSIX_CONST( NETLINK_UNUSED ); LPOSIX_CONST( NETLINK_USERSOCK ); LPOSIX_CONST( NETLINK_FIREWALL ); LPOSIX_CONST( NETLINK_NFLOG ); LPOSIX_CONST( NETLINK_XFRM ); LPOSIX_CONST( NETLINK_SELINUX ); LPOSIX_CONST( NETLINK_ISCSI ); LPOSIX_CONST( NETLINK_AUDIT ); LPOSIX_CONST( NETLINK_FIB_LOOKUP ); LPOSIX_CONST( NETLINK_CONNECTOR ); LPOSIX_CONST( NETLINK_NETFILTER ); LPOSIX_CONST( NETLINK_IP6_FW ); LPOSIX_CONST( NETLINK_DNRTMSG ); LPOSIX_CONST( NETLINK_KOBJECT_UEVENT ); LPOSIX_CONST( NETLINK_GENERIC ); LPOSIX_CONST( NETLINK_SCSITRANSPORT ); LPOSIX_CONST( NETLINK_ECRYPTFS ); # endif #endif return 1; }
LUALIB_API int luaopen_posix_signal(lua_State *L) { luaL_newlib(L, posix_signal_fns); lua_pushstring(L, LPOSIX_VERSION_STRING("signal")); lua_setfield(L, -2, "version"); /* Signals table stored in registry for Psignal and sig_handle */ lua_pushlightuserdata(L, &signalL); lua_newtable(L); lua_rawset(L, LUA_REGISTRYINDEX); signalL = L; /* For sig_postpone */ /* Signals */ #ifdef SIGABRT LPOSIX_CONST( SIGABRT ); #endif #ifdef SIGALRM LPOSIX_CONST( SIGALRM ); #endif #ifdef SIGBUS LPOSIX_CONST( SIGBUS ); #endif #ifdef SIGCHLD LPOSIX_CONST( SIGCHLD ); #endif #ifdef SIGCONT LPOSIX_CONST( SIGCONT ); #endif #ifdef SIGFPE LPOSIX_CONST( SIGFPE ); #endif #ifdef SIGHUP LPOSIX_CONST( SIGHUP ); #endif #ifdef SIGILL LPOSIX_CONST( SIGILL ); #endif #ifdef SIGINT LPOSIX_CONST( SIGINT ); #endif #ifdef SIGKILL LPOSIX_CONST( SIGKILL ); #endif #ifdef SIGPIPE LPOSIX_CONST( SIGPIPE ); #endif #ifdef SIGQUIT LPOSIX_CONST( SIGQUIT ); #endif #ifdef SIGSEGV LPOSIX_CONST( SIGSEGV ); #endif #ifdef SIGSTOP LPOSIX_CONST( SIGSTOP ); #endif #ifdef SIGTERM LPOSIX_CONST( SIGTERM ); #endif #ifdef SIGTSTP LPOSIX_CONST( SIGTSTP ); #endif #ifdef SIGTTIN LPOSIX_CONST( SIGTTIN ); #endif #ifdef SIGTTOU LPOSIX_CONST( SIGTTOU ); #endif #ifdef SIGUSR1 LPOSIX_CONST( SIGUSR1 ); #endif #ifdef SIGUSR2 LPOSIX_CONST( SIGUSR2 ); #endif #ifdef SIGSYS LPOSIX_CONST( SIGSYS ); #endif #ifdef SIGTRAP LPOSIX_CONST( SIGTRAP ); #endif #ifdef SIGURG LPOSIX_CONST( SIGURG ); #endif #ifdef SIGVTALRM LPOSIX_CONST( SIGVTALRM ); #endif #ifdef SIGXCPU LPOSIX_CONST( SIGXCPU ); #endif #ifdef SIGXFSZ LPOSIX_CONST( SIGXFSZ ); #endif /* String constants */ lua_pushliteral(L, "SIG_DFL"); lua_setfield(L, -2, "SIG_DFL"); lua_pushliteral(L, "SIG_IGN"); lua_setfield(L, -2, "SIG_IGN"); /* Signal flags */ #ifdef SA_NOCLDSTOP LPOSIX_CONST( SA_NOCLDSTOP ); #endif #ifdef SA_NOCLDWAIT LPOSIX_CONST( SA_NOCLDWAIT ); #endif #ifdef SA_RESETHAND LPOSIX_CONST( SA_RESETHAND ); #endif #ifdef SA_NODEFER LPOSIX_CONST( SA_NODEFER ); #endif return 1; }
int luaopen_posix_syslog(lua_State *L) { luaL_register(L, "posix.syslog", posix_syslog_fns); lua_pushliteral(L, "posix.syslog for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); #if LPOSIX_2001_COMPLIANT LPOSIX_CONST( LOG_CONS ); LPOSIX_CONST( LOG_NDELAY ); LPOSIX_CONST( LOG_PID ); LPOSIX_CONST( LOG_AUTH ); LPOSIX_CONST( LOG_CRON ); LPOSIX_CONST( LOG_DAEMON ); LPOSIX_CONST( LOG_KERN ); LPOSIX_CONST( LOG_LOCAL0 ); LPOSIX_CONST( LOG_LOCAL1 ); LPOSIX_CONST( LOG_LOCAL2 ); LPOSIX_CONST( LOG_LOCAL3 ); LPOSIX_CONST( LOG_LOCAL4 ); LPOSIX_CONST( LOG_LOCAL5 ); LPOSIX_CONST( LOG_LOCAL6 ); LPOSIX_CONST( LOG_LOCAL7 ); LPOSIX_CONST( LOG_LPR ); LPOSIX_CONST( LOG_MAIL ); LPOSIX_CONST( LOG_NEWS ); LPOSIX_CONST( LOG_USER ); LPOSIX_CONST( LOG_UUCP ); LPOSIX_CONST( LOG_EMERG ); LPOSIX_CONST( LOG_ALERT ); LPOSIX_CONST( LOG_CRIT ); LPOSIX_CONST( LOG_ERR ); LPOSIX_CONST( LOG_WARNING ); LPOSIX_CONST( LOG_NOTICE ); LPOSIX_CONST( LOG_INFO ); LPOSIX_CONST( LOG_DEBUG ); /* Remainder for backwards compatibility - not defined by POSIX */ # ifdef LOG_AUTHPRIV LPOSIX_CONST( LOG_AUTHPRIV ); # endif # ifdef LOG_FTP LPOSIX_CONST( LOG_FTP ); # endif # ifdef LOG_SYSLOG LPOSIX_CONST( LOG_SYSLOG ); # endif #endif return 1; }
LUALIB_API int luaopen_posix_fcntl(lua_State *L) { luaL_register(L, "posix.fcntl", posix_fcntl_fns); lua_pushliteral(L, "posix.fcntl for " LUA_VERSION " / " PACKAGE_STRING); lua_setfield(L, -2, "version"); /* fcntl flags */ LPOSIX_CONST( F_DUPFD ); LPOSIX_CONST( F_GETFD ); LPOSIX_CONST( F_SETFD ); LPOSIX_CONST( F_GETFL ); LPOSIX_CONST( F_SETFL ); LPOSIX_CONST( F_GETLK ); LPOSIX_CONST( F_SETLK ); LPOSIX_CONST( F_SETLKW ); LPOSIX_CONST( F_GETOWN ); LPOSIX_CONST( F_SETOWN ); LPOSIX_CONST( F_RDLCK ); LPOSIX_CONST( F_WRLCK ); LPOSIX_CONST( F_UNLCK ); /* file creation & status flags */ LPOSIX_CONST( O_RDONLY ); LPOSIX_CONST( O_WRONLY ); LPOSIX_CONST( O_RDWR ); LPOSIX_CONST( O_APPEND ); LPOSIX_CONST( O_CREAT ); LPOSIX_CONST( O_DSYNC ); LPOSIX_CONST( O_EXCL ); LPOSIX_CONST( O_NOCTTY ); LPOSIX_CONST( O_NONBLOCK ); LPOSIX_CONST( O_RSYNC ); LPOSIX_CONST( O_SYNC ); LPOSIX_CONST( O_TRUNC ); /* posix_fadvise flags */ #ifdef POSIX_FADV_NORMAL LPOSIX_CONST( POSIX_FADV_NORMAL ); #endif #ifdef POSIX_FADV_SEQUENTIAL LPOSIX_CONST( POSIX_FADV_SEQUENTIAL ); #endif #ifdef POSIX_FADV_RANDOM LPOSIX_CONST( POSIX_FADV_RANDOM ); #endif #ifdef POSIX_FADV_NOREUSE LPOSIX_CONST( POSIX_FADV_NOREUSE ); #endif #ifdef POSIX_FADV_WILLNEED LPOSIX_CONST( POSIX_FADV_WILLNEED ); #endif #ifdef POSIX_FADV_DONTNEED LPOSIX_CONST( POSIX_FADV_DONTNEED ); #endif return 1; }