File: helpers.h

package info (click to toggle)
liburing 2.13-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,212 kB
  • sloc: ansic: 58,515; sh: 816; makefile: 598; cpp: 32
file content (25 lines) | stat: -rw-r--r-- 670 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* SPDX-License-Identifier: MIT */
#ifndef LIBURING_EX_HELPERS_H
#define LIBURING_EX_HELPERS_H

#include <stddef.h>

#define T_ALIGN_UP(v, align) (((v) + (align) - 1) & ~((align) - 1))

int setup_listening_socket(int port, int ipv6);

/*
 * Some Android versions lack aligned_alloc in stdlib.h.
 * To avoid making large changes in tests, define a helper
 * function that wraps posix_memalign as our own aligned_alloc.
 */
void *t_aligned_alloc(size_t alignment, size_t size);

void t_error(int status, int errnum, const char *format, ...);

#ifndef CONFIG_HAVE_MEMFD_CREATE
#include <linux/memfd.h>
#endif
int memfd_create(const char *name, unsigned int flags);

#endif