Add pipelining to cocmd

This commit is contained in:
Justine Tunney 2022-07-15 20:47:20 -07:00
parent b4e38851ff
commit aa34340f3d
4 changed files with 90 additions and 68 deletions

View file

@ -1124,9 +1124,13 @@ static void SetPromises(const char *promises) {
* OpenBSD just kills the process while logging a helpful message to
* /var/log/messages explaining which promise category you needed.
*
* By default exit and exit_group are always allowed. This is useful
* for processes that perform pure computation and interface with the
* parent via shared memory.
* By default exit() is allowed. This is useful for processes that
* perform pure computation and interface with the parent via shared
* memory. On Linux we mean sys_exit (_Exit1), not sys_exit_group
* (_Exit). The difference is effectively meaningless, since _Exit()
* will attempt both. All it means is that, if you're using threads,
* then a `pledge("", 0)` thread can't kill all your threads unless you
* `pledge("stdio", 0)`.
*
* Once pledge is in effect, the chmod functions (if allowed) will not
* permit the sticky/setuid/setgid bits to change. Linux will EPERM here

View file

@ -26,12 +26,6 @@
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
static char *_stkbase;
__attribute__((__constructor__)) static void init(void) {
_stkbase = (char *)kFixedmapStart;
}
/**
* Allocates stack.
*
@ -47,13 +41,12 @@ __attribute__((__constructor__)) static void init(void) {
*/
void *_mapstack(void) {
char *p;
if ((p = mmap(_stkbase, GetStackSize(), PROT_READ | PROT_WRITE,
MAP_STACK | MAP_ANONYMOUS | MAP_FIXED, -1, 0)) != MAP_FAILED) {
if ((p = mmap(0, GetStackSize(), PROT_READ | PROT_WRITE,
MAP_STACK | MAP_ANONYMOUS, -1, 0)) != MAP_FAILED) {
if (IsAsan()) {
__asan_poison(p + GetStackSize() - 16, 16, kAsanStackOverflow);
__asan_poison(p, 4096, kAsanStackOverflow);
}
_stkbase += GetStackSize() * 4;
return p;
} else {
return 0;