mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 07:26:09 +00:00

The implementation currently ignores all spawn attributes. Support for them will be added in future changes. A simple allocator for integration tests has been added so that the integration test for posix_spawn can use the posix_spawn_file_actions_add* functions. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D135752
33 lines
999 B
C++
33 lines
999 B
C++
//===-- Simple malloc and free for use with integration tests -------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
// Integration tests cannot use the SCUDO standalone allocator as SCUDO pulls
|
|
// various other parts of the libc. Since SCUDO development does not use
|
|
// LLVM libc build rules, it is very hard to keep track or pull all that SCUDO
|
|
// requires. Hence, as a work around for this problem, we use a simple allocator
|
|
// which just hands out continuous blocks from a statically allocated chunk of
|
|
// memory.
|
|
|
|
static uint8_t memory[16384];
|
|
static uint8_t *ptr = memory;
|
|
|
|
extern "C" {
|
|
|
|
void *malloc(size_t s) {
|
|
void *mem = ptr;
|
|
ptr += s;
|
|
return mem;
|
|
}
|
|
|
|
void free(void *) {}
|
|
|
|
} // extern "C"
|