wahern / lunix Goto Github PK
View Code? Open in Web Editor NEWLua Unix Module.
Home Page: http://25thandclement.com/~william/projects/lunix.html
License: MIT License
Lua Unix Module.
Home Page: http://25thandclement.com/~william/projects/lunix.html
License: MIT License
There appears to be two release tags, latest rel-20190403, here in Github; however the current latest version available from LuaRocks is 20170920.
Add bindings for fstat, lstat, and stat.
If the tree isn't a git repository, the expansion fails and prints an error message.
Need to add a guard to only define those rules when building a release.
It would be nice to also retrieve the interface, which the datagram was delivered on.
I will develop a patch for linux only. The ifindex will be returned as 4th return value.
I would do a PR, but I am not sure, if you you want such an linux only solution. Also passing it as 4th return value is a bit ugly to, I guess.
The current code copies the semantics from luaposix
However there are a couple of potential changes to make
WIFCONTINUED
(as in https://github.com/daurnimator/lua-spawn/blob/22685350e0f6965b0bec32dafead026aeb5ecbed/spawn/wait.c#L62)luaL_execresult
strings instead of luaposix ones (I currently have to maintain a mapping table: https://github.com/daurnimator/lua-spawn/blob/76906e5adad96635150ca63a465e5d3748614998/spawn/wait.lua#L7)gcc -O2 -fPIC -I/usr/include -c src/unix.c -o src/unix.o -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE
src/unix.c: In function ‘u_readdir_r’:
src/unix.c:2242:2: warning: ‘readdir_r’ is deprecated [-Wdeprecated-declarations]
return readdir_r(dp, ent, res);
^~~~~~
In file included from src/unix.c:46:
/usr/include/dirent.h:183:12: note: declared here
extern int readdir_r (DIR *__restrict __dirp,
^~~~~~~~~
src/unix.c: In function ‘u_reallocarray.constprop’:
src/unix.c:789:14: warning: argument 2 value ‘18446744073709551615’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
if (!(tmp = realloc(*arr, tmpsiz)))
^~~~~~~~~~~~~~~~~~~~~
In file included from src/unix.c:20:
/usr/include/stdlib.h:549:14: note: in a call to allocation function ‘realloc’ declared here
extern void *realloc (void *__ptr, size_t __size)
^~~~~~~
getgrgid_r returns -1 on error, and places the real error value in errno. And getgrgid_r fails with EINVAL if given a buffer size of length 0, instead of ERANGE.
Make the default build target print a help message. Currently the default is to build "all", which builds 5.1 and 5.2 modules.
The last version on LuaRocks is pretty old, 20140819-6, but the last on GitHub is 20150923. Could you please upload latest rockspec to LuaRock?
O_RDONLY is often defined as 0. In such cases, even if a user specifies O_RDONLY we assume the user didn't specify any access mode and instead query the accmode of an existing descriptor.
Need to define a magic value like U_NONE to use as the default value when calling unixL_optinteger in unixL_checkflags. u_getaccmode will then be able to tell whether to query the mode.
Hello,
I'm trying to compile lunix against uClibc for use on an embedded device and because of the usage of this glibc-internal function, lunix is failing to find the symbol __libc_enable_secure() at runtime. Can the more portable function be used instead for that purpose?
Thanks.
Installing http://luarocks.org/manifests/daurnimator/lunix-20161026-1.src.rock
gcc -O2 -fPIC -I/home/travis/hererocks/include -c src/unix.c -o src/unix.o -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE
src/unix.c:486:14: error: static declaration of ‘luaL_testudata’ follows non-static declaration
static void *luaL_testudata(lua_State *L, int index, const char *tname) {
^
In file included from src/unix.c:55:0:
/home/travis/hererocks/include/lauxlib.h:91:19: note: previous declaration of ‘luaL_testudata’ was here
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
^
src/unix.c:501:13: error: static declaration of ‘luaL_setmetatable’ follows non-static declaration
static void luaL_setmetatable(lua_State *L, const char *tname) {
^
In file included from src/unix.c:55:0:
/home/travis/hererocks/include/lauxlib.h:92:18: note: previous declaration of ‘luaL_setmetatable’ was here
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname);
^
src/unix.c:507:13: error: static declaration of ‘luaL_setfuncs’ follows non-static declaration
static void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) {
^
In file included from src/unix.c:55:0:
/home/travis/hererocks/include/lauxlib.h:88:18: note: previous declaration of ‘luaL_setfuncs’ was here
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
^
src/unix.c:521:0: warning: "luaL_newlibtable" redefined [enabled by default]
#define luaL_newlibtable(L, l) \
^
In file included from src/unix.c:55:0:
/home/travis/hererocks/include/lauxlib.h:123:0: note: this is the location of the previous definition
#define luaL_newlibtable(L, l) \
^
src/unix.c:524:0: warning: "luaL_newlib" redefined [enabled by default]
#define luaL_newlib(L, l) \
^
In file included from src/unix.c:55:0:
/home/travis/hererocks/include/lauxlib.h:125:0: note: this is the location of the previous definition
#define luaL_newlib(L, l) (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0))
^
Error: Failed installing dependency: http://luarocks.org/manifests/daurnimator/lunix-20161026-1.src.rock - Build error: Failed compiling object src/unix.o
The docs say I don't need to do anything other than run make, but then I run into this:
$ make all5.1
enabling Lua 5.1
mkdir -p lunix/src/5.1
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-override-init -Wno-unused -I/nix/store/nl45sii2pigq7j
ndb3wpz9kl3xk0p4qn-lua-5.1.5/include -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -o lunix/src/5.1/unix.so lunix/src/unix.c -shared -L/usr/local/lib -L/usr/local/lib -lrt -lm
lunix/src/unix.c:576:10: fatal error: sys/sysctl.h: No such file or directory
576 | #if HAVE_SYS_SYSCTL_H
| ^~~~~~~~~~~~
compilation terminated.
make: *** [lunix/src/GNUmakefile:58: lunix/src/5.1/unix.so] Error 1
If I do run bootstrap and configure, things compile.
(I'm not using configure.ac, just compiling manually)
musl-gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/unix.c -o src/unix.o -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE
src/unix.c: In function ‘unixL_strsignal’:
src/unix.c:2635:44: error: ‘sys_siglist’ undeclared (first use in this function)
if (signo >= 0 && signo < NSIG && (info = sys_siglist[signo]))
musl doesn't have a sys_siglist
. defaulting HAVE_SYS_SIGLIST
to 1 seems wrong.
however it does have strsignal
, but doesn't meet any of the requirements in the #ifdef
:
(USE_STRSIGNAL || __sun || GLIBC_PREREQ(0,0) || FREEBSD_PREREQ(8,1) || defined __APPLE__ || defined _AIX)
A sufficient check should just be _POSIX_C_SOURCE >= 200809L
AIX uses long long type for open flags, breaking our assumption that system flags are only in the lower-half of our custom u_flags_t type.
Redefine the U_SYSFLAGS mask to include everything except our internal magic flags.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.