Sha256: ab5de3b77814bfea7019686bd4208aa2bd328d62088e3e18f5595973b94460f2

Contents?: true

Size: 841 Bytes

Versions: 8

Compression:

Stored size: 841 Bytes

Contents

/* SPDX-License-Identifier: MIT */

#ifndef CONFIG_NOLIBC
# error "This file should only be compiled for no libc build"
#endif

#include "lib.h"
#include "syscall.h"

void *memset(void *s, int c, size_t n)
{
	size_t i;
	unsigned char *p = s;

	for (i = 0; i < n; i++)
		p[i] = (unsigned char) c;

	return s;
}

struct uring_heap {
	size_t		len;
	char		user_p[] __attribute__((__aligned__));
};

void *__uring_malloc(size_t len)
{
	struct uring_heap *heap;

	heap = __sys_mmap(NULL, sizeof(*heap) + len, PROT_READ | PROT_WRITE,
			  MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
	if (IS_ERR(heap))
		return NULL;

	heap->len = sizeof(*heap) + len;
	return heap->user_p;
}

void __uring_free(void *p)
{
	struct uring_heap *heap;

	if (uring_unlikely(!p))
		return;

	heap = container_of(p, struct uring_heap, user_p);
	__sys_munmap(heap, heap->len);
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
polyphony-0.94 vendor/liburing/src/nolibc.c
polyphony-0.93 vendor/liburing/src/nolibc.c
polyphony-0.92 vendor/liburing/src/nolibc.c
polyphony-0.91 vendor/liburing/src/nolibc.c
polyphony-0.90 vendor/liburing/src/nolibc.c
polyphony-0.89 vendor/liburing/src/nolibc.c
polyphony-0.87 vendor/liburing/src/nolibc.c
polyphony-0.86 vendor/liburing/src/nolibc.c