File: main.h

package info (click to toggle)
ceccomp 4.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,604 kB
  • sloc: ansic: 6,470; python: 1,039; makefile: 248; sh: 145
file content (36 lines) | stat: -rw-r--r-- 870 bytes parent folder | download | duplicates (2)
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
#ifndef MAIN_H
#define MAIN_H

// clang-format off
#include <stdbool.h>
#include <stdint.h>
#include <sys/ptrace.h>
#include <linux/filter.h>
#include <linux/ptrace.h>
#include <linux/seccomp.h>
#include <sys/types.h>
#include <sys/user.h>
#include "help.h"
// clang-format on

typedef struct sock_fprog fprog;
typedef struct sock_filter filter;
typedef struct seccomp_data seccomp_data;
typedef struct ptrace_syscall_info syscall_info;

typedef struct
{
  const char *start;
  uint32_t len;
} string_t;

#define STARTWITH(str, token) (!strncmp (str, token, strlen (token)))

#define LIKELY(x) __builtin_expect (!!(x), 1)
#define UNLIKELY(x) __builtin_expect (!!(x), 0)

#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
#define LITERAL_STRLEN(str) (ARRAY_SIZE (str) - 1)
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif