lua-users home
lua-l archive

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


On Thu, 08 Apr 2021 15:25:29 -0500 Javier Guerra Giraldez <javier@guerrag.com> wrote:
> On Thu, 8 Apr 2021 at 13:22, Nicholas Joll <nicholasjoll@mailfence.com> wrote:
> >     I am told by the maintainers of the 'luaposix' module that, when running on Linux, lua can detect whether a process of a given name is running, in the manner of the Linux utility `pidof`.
> 
> most of these utilities just traverse the /proc filesystem

You can try sending signal 0 to the process using the kill(2) system call.
The man page has this little gem:

  "If sig is 0, then no signal is sent, but existence and permission checks
   are still performed; this can be used to check for the existence of a
   process ID or process group ID that the caller is permitted to signal."

I hope this helps :)
-Adrian

Attachment: pgp_QOMlCWKbJ.pgp
Description: PGP signature