Commit graph

22 commits

Author SHA1 Message Date
1d2a6bcf8b process: fix inconsistent signal detection
Previously strtosig() detected the signal count at runtime, mutating
the value of a static global variable. The signals were detected using
\#ifdef directives and were taken from <signal.h> on my OpenBSD install.

Extract the common signals that should be found in every POSIX
implementation [1] and remove any vendor-specific signals with
possibly differing names across implementations.

Do not detect the signal count at runtime anymore. Keep it in a static
const variable which holds the signal count known _at compile time_.

Fix the logic error in the for loop in strtosig().

[1]: <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html>
2024-04-07 06:43:30 +12:00
1a5a54d808 process: remove documentation comments 2024-04-06 19:59:09 +13:00
41829c3170 process: fix segmentation fault in strtosig
Refactor some of the magic behind strtosig;
store the signal count in a static variable,
avoiding the complexity of accessing the Lua registry.
2024-03-26 16:30:38 +13:00
820ed598d9 process: reformat 2024-03-14 10:32:15 +13:00
6f123e5665 process: add clang-format on comment 2024-03-14 10:29:53 +13:00
30a1097bb0 tree: reformat
Done automatically by clang-format
2024-03-12 12:21:39 +13:00
669eb3fd28 tree: add clang-format off labels
When I figure out how to make clang-format ignore struct array
initialisers, I'll get rid of this.
2024-03-12 12:19:23 +13:00
e63e7a77a2 tree: specify the lua/ directory for includes 2024-03-11 12:37:50 +13:00
bbf9b88c66 tree: clean up whitespace and includes 2024-03-11 12:28:50 +13:00
8c5777fb98 tree: add standard copyright phrasing
Callisto - standalone scripting platform for Lua 5.4
Copyright (c) 2023-2024 Jeremy Baxter.
2024-02-19 10:16:45 +13:00
b5d61a25cb rename the statically linked strlcpy to strbcpy
stands for "string bounds copy". Some systems like macOS include their
very own version of strlcpy and testing for that would require some
bloat like gnu automake so I'm just gonna rename it to prevent any
future conflicts. I only test on Linux and OpenBSD anyway. ;)
2024-01-25 19:47:57 +13:00
099a9c33e6 fix crash in process.signum, use pgrep over pidof in process.pidof
pidof is, as far as I know, only available on Linux. pgrep is much
more portable (even though it is not part of a standard), and can
be found in the base system on most BSDs and included in most
Linux distributions as part of the procps-ng package.
2023-12-27 14:18:07 +13:00
cae9985747 change BSD ifndefs to __OpenBSD__ and remove unnecessary ifdefs
I'm not sure if any operating system other than OpenBSD
has strlcpy/strlcat. May need to use a configure script
for this later on.
2023-12-23 16:33:38 +13:00
290289cbf5 Refactor and fix up a lot of code
Don't tell the boss I forgot a couple of free()s...
2023-11-26 17:13:41 +13:00
02fae90b69 Rename lcallisto.h -> callisto.h 2023-07-24 12:31:21 +12:00
941722cb01 Rename callistoopen_* functions to luaopen_* 2023-07-08 18:35:59 +12:00
69b4227271 Split process.pid into two functions: process.pid (get the current process's PID) and process.pidof (get another process's PID) 2023-07-02 08:39:46 +12:00
97f527fde8 Remove unnecessary (char *) casts 2023-07-01 19:29:22 +12:00
d1c7b71043 Define streq macro in util.h and use it over strcmp in lprocess.c 2023-07-01 09:53:43 +12:00
0d7604cb96 Remove unnecessary header files 2023-06-27 18:19:03 +12:00
6aa4b6de39 Remove libbsd support 2023-06-27 12:33:51 +12:00
b124d99c36 Initial import 2023-06-25 16:47:09 +12:00