lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Meino.Cramer@gmx.de once stated:
> Hi,
> 
> currently I am experimenting with a embedded system and
> need funktions like sleep, ppoll and such in lua.
> 
> I installed luaposix, because both were documented on the web.
> 
> But there was neither available via luaposix.
> 
> A "search" via luarocks shows different other posix related
> stuff...
> 
> I am confused...
> 
> Is there anything better than luaposix which has more posix stuff...

  It depends upon how much of Posix you want.  I have my own Posix layer [1]
but it's not one single module but a collection of modules.  I have one for
signals:

	https://github.com/spc476/lua-conmanorg/blob/master/src/signal-posix.c

one for select/poll [2]:

	https://github.com/spc476/lua-conmanorg/blob/master/src/pollset.c

one for process related calls (fork(), wait(), etc)

	https://github.com/spc476/lua-conmanorg/blob/master/src/process.c

one for time releated calls (including sleep) [3]:

	https://github.com/spc476/lua-conmanorg/blob/master/src/clock.c

one for network stuff:

	https://github.com/spc476/lua-conmanorg/blob/master/src/net.c [4]

and one for filesystem related calls:

	https://github.com/spc476/lua-conmanorg/blob/master/src/fsys.c

  The documentation ... could be better, and there are no rockspecs as of
yet (because of the lack of documentation).  The stuff works (I'm use it for
both personal and work related projects) and (disclaimer here) I like my API
better than luaposix or lposix, as I didn't slavishly follow the C API [5]
(this is probably more noticable in the network API than some of the other
ones).  Is what I have better than luaposix?  Eh ... hard to say.

  -spc

[1]	https://github.com/spc476/lua-conmanorg
	There are a few non-Posix modules there as well.

[2]	epoll under Linux; poll otherwise.  select() is available, but only
	if poll isn't.  The API is the same for all three.

[3]	No support yet for Mac OS-X, which doesn't support the latest Posix
	spec for time-releated calls.

[4]	Supports IPv4, IPv6 and Unix sockets.  This is a wrapper around the
	lower level network calls---there's no code that talks HTTP, FTP,
	SMTP, etc, unlike luasocket.

[5]	If I want the C API, I would use C.