aboutsummaryrefslogtreecommitdiffstats
path: root/linux/os.h
blob: 8e2eb5ccd7bfe0cf30c23764a933591fb7f16a51 (plain) (blame)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* See LICENSE file for copyright and license details. */
#include <linux/elf.h>
#include <sys/ptrace.h>
#include <linux/ptrace.h> /* after <sys/ptrace.h> */
#include <sys/syscall.h>
#include <sys/user.h>

#ifndef ERESTARTSYS
# define ERESTARTSYS 512
# define ALSO_ERESTARTSYS
#endif
#ifndef ERESTARTNOINTR
# define ERESTARTNOINTR 513
# define ALSO_ERESTARTNOINTR
#endif
#ifndef ERESTARTNOHAND
# define ERESTARTNOHAND 514
# define ALSO_ERESTARTNOHAND
#endif
#ifndef ERESTART_RESTARTBLOCK
# define ERESTART_RESTARTBLOCK 516
# define ALSO_ERESTART_RESTARTBLOCK
#endif

#define RETURN_IS_ERROR(RET)\
	((RET) > -(unsigned long long int)4096) /* I guess Linux promises to never use a smaller page size */

#if defined(__x86_64__) && !defined(__IPL32__)
# include "x86-64.h"
#else
# error "This program is only implemented for x86-64 on Linux"
#endif

#if defined(__sparc__)
# define REGARGS(a, b) b, a
#else
# define REGARGS(a, b) a, b
#endif

#if defined(__arm__) || defined(__thumb__)
# define USE_PTRACE_SET_SYSCALL
#endif


#ifndef KEY_SPEC_THREAD_KEYRING
# define KEY_SPEC_THREAD_KEYRING         -1
# define KEY_SPEC_PROCESS_KEYRING        -2
# define KEY_SPEC_SESSION_KEYRING        -3
# define KEY_SPEC_USER_KEYRING           -4
# define KEY_SPEC_USER_SESSION_KEYRING   -5
# define KEY_SPEC_GROUP_KEYRING          -6
# define KEY_SPEC_REQKEY_AUTH_KEY        -7
#endif