File: mman.h

package info (click to toggle)
intel-gpu-tools 2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 63,360 kB
  • sloc: xml: 781,458; ansic: 360,567; python: 8,336; yacc: 2,781; perl: 1,196; sh: 1,177; lex: 487; asm: 227; lisp: 35; makefile: 30
file content (37 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (4)
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
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-License-Identifier: MIT */

#pragma once

#include_next <sys/mman.h>

#if !defined(HAVE_MEMFD_CREATE) || !HAVE_MEMFD_CREATE
#include <errno.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>

#ifndef __NR_memfd_create
#if defined __x86_64__
#define __NR_memfd_create 319
#elif defined __i386__
#define __NR_memfd_create 356
#elif defined __arm__
#define __NR_memfd_create 385
#else
#warning "__NR_memfd_create unknown for your architecture"
#endif
#endif

static inline int missing_memfd_create(const char *name, unsigned int flags)
{
#ifdef __NR_memfd_create
	return syscall(__NR_memfd_create, name, flags);
#else
	errno = ENOSYS;
	return -1;
#endif
}

#define memfd_create missing_memfd_create

#endif