GithubHelp home page GithubHelp logo

wahern / lunix Goto Github PK

View Code? Open in Web Editor NEW
51.0 51.0 13.0 4.01 MB

Lua Unix Module.

Home Page: http://25thandclement.com/~william/projects/lunix.html

License: MIT License

Makefile 3.41% Shell 17.23% Lua 9.37% C 67.73% M4 2.25%

lunix's People

Contributors

daurnimator avatar fperrad avatar wahern avatar wahern-splunk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lunix's Issues

Luarocks Stale

There appears to be two release tags, latest rel-20190403, here in Github; however the current latest version available from LuaRocks is 20170920.

LUNIX_VERSION unconditionally expanded

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.

recvfromto ifindex

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.

Warnings when building

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)
              ^~~~~~~

Change default build target

Make the default build target print a help message. Currently the default is to build "all", which builds 5.1 and 5.2 modules.

Update module on LuaRocks

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?

Fix u_getaccmode O_ACCMODE check

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.

Fails to build with latest luaJIT

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

Unclear build steps (on my system?)

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.

musl doesn't have sys_siglist

(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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.