Make improvements

- Add rusage to redbean Lua API
- Add more redbean documentation
- Add pledge() to redbean Lua API
- Polyfill OpenBSD pledge() for Linux
- Increase PATH_MAX limit to 1024 characters
- Untrack sibling processes after fork() on Windows
This commit is contained in:
Justine Tunney 2022-04-28 09:42:36 -07:00
parent 9a6bd304a5
commit 47b3274665
212 changed files with 2251 additions and 834 deletions

View file

@ -22,7 +22,7 @@
TEST(GetDosArgv, empty) {
size_t max = 4;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(0, GetDosArgv(u"", buf, size, argv, max));
@ -33,7 +33,7 @@ TEST(GetDosArgv, empty) {
TEST(GetDosArgv, emptyish) {
size_t max = 4;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(0, GetDosArgv(u" ", buf, size, argv, max));
@ -44,7 +44,7 @@ TEST(GetDosArgv, emptyish) {
TEST(GetDosArgv, basicUsage) {
size_t max = 4;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(3, GetDosArgv(u"a\t \"b c\" d ", buf, size, argv, max));
@ -58,7 +58,7 @@ TEST(GetDosArgv, basicUsage) {
TEST(GetDosArgv, advancedUsage) {
size_t max = 4;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(2, GetDosArgv(u"(╯°□°)╯︵ ┻━┻", buf, size, argv, max));
@ -71,7 +71,7 @@ TEST(GetDosArgv, advancedUsage) {
TEST(GetDosArgv, testAegeanGothicSupplementaryPlanes) {
size_t max = 4; /* these symbols are almost as old as dos */
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(2, GetDosArgv(u"𐄷𐄸𐄹𐄺𐄻𐄼 𐌰𐌱𐌲𐌳𐌴𐌵𐌶𐌷", buf, size, argv, max));
@ -84,7 +84,7 @@ TEST(GetDosArgv, testAegeanGothicSupplementaryPlanes) {
TEST(GetDosArgv, realWorldUsage) {
size_t max = 512;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(5, GetDosArgv(u"C:\\Users\\jtunn\\printargs.com oh yes yes yes",
@ -145,7 +145,7 @@ TEST(GetDosArgv, quoteInMiddleOfArg_wontSplitArg) {
TEST(GetDosArgv, waqQuoting1) {
size_t max = 4;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(2,
@ -159,7 +159,7 @@ TEST(GetDosArgv, waqQuoting1) {
TEST(GetDosArgv, waqQuoting2) {
size_t max = 4;
size_t size = ARG_MAX;
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(2, GetDosArgv(u"\"a\\\"b c\" d", buf, size, argv, max));