Improve system calls

- Wrap clock_getres()
- Wrap sched_setscheduler()
- Make sleep() api conformant
- Polyfill sleep() using select()
- Improve clock_gettime() polyfill
- Make nanosleep() POSIX conformant
- Slightly improve some DNS functions
- Further strengthen pledge() sandboxing
- Improve rounding of timeval / timespec
- Allow layering of pledge() calls on Linux
- Polyfill sched_yield() using select() on XNU
- Delete more system constants we probably don't need
This commit is contained in:
Justine Tunney 2022-07-08 06:29:24 -07:00
parent 5df3e4e7a8
commit 853b6c3864
330 changed files with 1971 additions and 1223 deletions

View file

@ -268,12 +268,11 @@ void TearDownOnce(void);
Got = (intptr_t)(GOT); \
Want = (intptr_t)(WANT); \
if (Want != Got) { \
if (g_testlib_shoulddebugbreak) DebugBreak(); \
testlib_showerror_file = FILE; \
testlib_showerror_func = FUNC; \
testlib_error_enter(FILE, FUNC); \
testlib_showerror_##KIND##_eq(LINE, WANTCODE, GOTCODE, \
testlib_formatint(Want), \
testlib_formatint(Got), "" __VA_ARGS__); \
testlib_error_leave(); \
} \
(void)0; \
} while (0)
@ -285,12 +284,11 @@ void TearDownOnce(void);
Got = (intptr_t)(GOT); \
Want = (intptr_t)(WANT); \
if (Want == Got) { \
if (g_testlib_shoulddebugbreak) DebugBreak(); \
testlib_showerror_file = FILE; \
testlib_showerror_func = FUNC; \
testlib_error_enter(FILE, FUNC); \
testlib_showerror_##KIND##_ne(LINE, WANTCODE, GOTCODE, \
testlib_formatint(Want), \
testlib_formatint(Got), "" __VA_ARGS__); \
testlib_error_leave(); \
} \
} while (0)
@ -344,6 +342,8 @@ void testlib_showerror_expect_ne(int, const char *, const char *, char *,
void testlib_showerror_expect_true(int, const char *, const char *, char *,
char *, const char *, ...);
void testlib_error_leave(void);
void testlib_error_enter(const char *, const char *);
void testlib_showerror(const char *, int, const char *, const char *,
const char *, const char *, char *, char *);
@ -391,7 +391,9 @@ forceinline void testlib_ontest() {
forceinline void testlib_onfail2(bool isfatal) {
testlib_incrementfailed();
if (isfatal) testlib_abort();
if (isfatal) {
testlib_abort();
}
}
forceinline void assertNotEquals(FILIFU_ARGS intptr_t donotwant, intptr_t got,