From 60dd7c8a794ed9f460d8ae9d3a6bba8e32494325 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 4 Aug 2019 16:17:37 -0500 Subject: Add TOYFLAG_MAYFORK and annotate a couple commands. A TOYFLAG_NOFORK command must run in the context of toysh, but a MAYFORK can either run standalone or run in the toysh process. MAYFORK means it cleans up after itself: no leaked resources (malloc, mmap, filehandles, etc), even in error_exit() paths that would longjmp() back to the shell. It also doesn't discard anything we need to retain (don't close stdout, change toys.optargs[] so we can't free it, etc)... --- toys/posix/test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toys/posix/test.c') diff --git a/toys/posix/test.c b/toys/posix/test.c index 052b8deb..87a866a7 100644 --- a/toys/posix/test.c +++ b/toys/posix/test.c @@ -4,7 +4,8 @@ * * See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html -USE_TEST(NEWTOY(test, 0, TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_NOHELP)) +USE_TEST(NEWTOY(test, 0, TOYFLAG_USR|TOYFLAG_BIN|TOYFLAG_NOHELP|TOYFLAG_MAYFORK)) +USE_TEST(OLDTOY([, test, TOYFLAG_NOFORK|TOYFLAG_NOHELP)) config TEST bool "test" -- cgit v1.2.3