File: memfd_create.c

package info (click to toggle)
systemtap 4.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 39,000 kB
  • sloc: cpp: 78,785; ansic: 62,419; xml: 49,443; exp: 42,735; sh: 11,254; python: 3,062; perl: 2,252; tcl: 1,305; makefile: 1,072; lisp: 105; awk: 101; asm: 91; java: 56; sed: 16
file content (35 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (3)
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
/* COVERAGE: memfd_create */

/*
 * Glibc doesn't support memfd_create yet, so we have to use syscall(2)
 */
#include <sys/syscall.h>
#include <unistd.h>
#ifndef MFD_CLOEXEC
#define MFD_CLOEXEC 0x0001u
#endif
#ifndef MFD_ALLOW_SEALING
#define MFD_ALLOW_SEALING 0x0002u
#endif

int main()
{
#ifdef __NR_memfd_create
   syscall(__NR_memfd_create,"memfd_create", MFD_CLOEXEC|MFD_ALLOW_SEALING);
   //staptest// [[[[memfd_create ("memfd_create", MFD_CLOEXEC|MFD_ALLOW_SEALING)!!!!ni_syscall ()]]]] = NNNN
   syscall(__NR_memfd_create, (size_t)-1, MFD_CLOEXEC|MFD_ALLOW_SEALING);
#if __WORDSIZE == 64
   //staptest// [[[[memfd_create (0x[16]?[f]+, MFD_CLOEXEC|MFD_ALLOW_SEALING)!!!!ni_syscall ()]]]] = -NNNN
#else
#ifdef __s390__
   //staptest// [[[[memfd_create (0x[7]?[f]+, MFD_CLOEXEC|MFD_ALLOW_SEALING)!!!!ni_syscall ()]]]] = -NNNN
#else
   //staptest// [[[[memfd_create (0x[8]?[f]+, MFD_CLOEXEC|MFD_ALLOW_SEALING)!!!!ni_syscall ()]]]] = -NNNN
#endif
#endif
   syscall(__NR_memfd_create,"memfd_create1", -1);
   //staptest// [[[[memfd_create ("memfd_create1", MFD_[^ ]+|XXXX)!!!!ni_syscall ()]]]] = -NNNN
#endif

  return 0;
}