[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Low level Linux lib, was: C Based Hash Libs
- From: Sean Conner <sean@...>
- Date: Sat, 30 Oct 2021 22:00:24 -0400
It was thus said that the Great Paul Ducklin once stated:
> philanc, any chance that you could add signal() to your low-level Linux library?
>
> So you can set Lua functions to receive Linux signals? (Supporting fork()
> without signal() is zombie heaven.)
It depends upon how you use fork(). If in the parent you immediately call
wait(), then you don't need to deal with signal support. I do have a Lua
module (for 5.1 or higher) that supports *just* signals, here:
https://github.com/spc476/lua-conmanorg/blob/master/src/signal.c
I also have a separate module that deals with POSIX processes:
https://github.com/spc476/lua-conmanorg/blob/master/src/process.c
> This would make your microlibrary a replacement for luaposix for pretty
> much everything I do with it, at least :-)
>
> Oh, and at the risk of asking for too much, getpwnam() and getpwuid()
> would also be great because they are handy when supporting privilege drops
> to a low-powered account. These are easy to do in pure Lua by reading
> /etc/passwd, of course, so perhaps they don’t belong in a low-level
> library.
I found that reading /etc/passwd doesn't always work---think Mac OS-X. I
do have a Lua module that wraps Unix user accounting, but haven't released
it yet. Hmm ...
> Also glob() would be a handy addition to the file/directory functions but
> is probably too high level for a library like this as well.
My POSIX filesystem module has support for glob():
https://github.com/spc476/lua-conmanorg/blob/master/src/fsys.c
The modules were written to be fairly focused in an aspect of POSIX usage,
but not to include everything as I don't always need everything.
-spc