Sha256: 8795ae0f3d4948d76ae76145094c059fb50f3bd549a91bc55dc59e619868806e

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 KB

Contents

/* SPDX-License-Identifier: MIT */
#ifndef LIBURING_LIB_H
#define LIBURING_LIB_H

#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define __INTERNAL__LIBURING_LIB_H
#if defined(__x86_64__) || defined(__i386__)
	#include "arch/x86/lib.h"
#else
	/*
	 * We don't have nolibc support for this arch. Must use libc!
	 */
	#ifdef CONFIG_NOLIBC
		#error "This arch doesn't support building liburing without libc"
	#endif
	/* libc wrappers. */
	#include "arch/generic/lib.h"
#endif
#undef __INTERNAL__LIBURING_LIB_H


#ifndef offsetof
	#define offsetof(TYPE, FIELD) ((size_t) &((TYPE *)0)->FIELD)
#endif

#ifndef container_of
	#define container_of(PTR, TYPE, FIELD) ({			\
		__typeof__(((TYPE *)0)->FIELD) *__FIELD_PTR = (PTR);	\
		(TYPE *)((char *) __FIELD_PTR - offsetof(TYPE, FIELD));	\
	})
#endif

void *__uring_malloc(size_t len);
void __uring_free(void *p);

static inline void *uring_malloc(size_t len)
{
#ifdef CONFIG_NOLIBC
	return __uring_malloc(len);
#else
	return malloc(len);
#endif
}

static inline void uring_free(void *ptr)
{
#ifdef CONFIG_NOLIBC
	__uring_free(ptr);
#else
	free(ptr);
#endif
}

#endif /* #ifndef LIBURING_LIB_H */

Version data entries

8 entries across 8 versions & 1 rubygems

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