File: port.h

package info (click to toggle)
dtrace 2.0.5-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 24,408 kB
  • sloc: ansic: 61,247; sh: 17,997; asm: 1,717; lex: 947; awk: 754; yacc: 695; perl: 37; sed: 17; makefile: 15
file content (109 lines) | stat: -rw-r--r-- 2,442 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
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * Oracle Linux DTrace.
 * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
 * Licensed under the Universal Permissive License v 1.0 as shown at
 * http://oss.oracle.com/licenses/upl.
 */

#ifndef _PORT_H
#define _PORT_H

#include <pthread.h>
#include <stdarg.h>
#include <unistd.h>
#include <sys/compiler.h>
#include <sys/types.h>
#include <sys/dtrace_types.h>
#include <sys/ptrace.h>
#include <config.h>

extern size_t strlcpy(char *, const char *, size_t);
extern size_t strlcat(char *, const char *, size_t);

extern int gmatch(const char *s, const char *p);

hrtime_t gethrtime(void);

int p_online(int cpun);

#define MUTEX_HELD(x)	((x)->__data.__count == 0)

int daemonize(int close_fds);
int systemd_notify(const char *message);

_dt_noreturn_ void daemon_perr(int fd, const char *err, int err_no);
_dt_printflike_(2, 3) void daemon_log(int fd, const char *fmt, ...);
void daemon_vlog(int fd, const char *fmt, va_list ap);

unsigned long linux_version_code(void);

#ifndef HAVE_ELF_GETSHDRSTRNDX
#define elf_getshdrstrndx elf_getshstrndx
#define elf_getshdrnum elf_getshnum
#endif

#ifndef HAVE_CLOSE_RANGE
int close_range(unsigned int first, unsigned int last, unsigned int flags);
#endif

#ifndef HAVE_GETTID
pid_t gettid(void);
#endif

/*
 * New open() flags not supported in OL6 glibc.
 */
#ifndef O_PATH
#define O_PATH          010000000
#endif

/*
 * New ptrace requests not widely supported in glibc headers.
 */
#ifndef PTRACE_SEIZE
#define PTRACE_SEIZE		0x4206
#endif
#ifndef PTRACE_INTERRUPT
#define PTRACE_INTERRUPT	0x4207
#endif
#ifndef PTRACE_LISTEN
#define PTRACE_LISTEN		0x4208
#endif
#ifndef PTRACE_GETMAPFD
#define PTRACE_GETMAPFD		0x42A5
#endif
#ifndef PTRACE_EVENT_STOP
#define PTRACE_EVENT_STOP       128
#endif

/*
 * Machine and relocation types for BPF (only available in newer glibc headers).
 */
#ifndef EM_BPF
#define EM_BPF			247	/* Linux BPF -- in-kernel virtual machine */
#endif
#ifndef R_BPF_NONE
#define R_BPF_NONE		0	/* No reloc */
#endif
#ifndef R_BPF_64_64
#define R_BPF_64_64		1
#endif
#ifndef R_BPF_64_ABS64
#define R_BPF_64_ABS64		2
#endif
#ifndef R_BPF_64_ABS32
#define R_BPF_64_ABS32		3
#endif
#ifndef R_BPF_64_32
#define R_BPF_64_32		10
#endif

/*
 * Error code returned by the uprobes kernel facility (only available in kernel
 * headers that are not part of the UAPI).
 */
#ifndef ENOTSUPP
#define ENOTSUPP		524	/* Operation is not supported */
#endif

#endif