summaryrefslogtreecommitdiff
path: root/sys/tools/syscalls/examples/cpp/test_systrace_args.c
blob: 74d0aa0ee8623a9a8e8016102423b9c7bd758832 (plain)
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
/*
 * System call argument to DTrace register array conversion.
 *
 * This file is part of the DTrace syscall provider.
 *
 * DO NOT EDIT-- this file is automatically @generated.
 */

static void
systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
{
	int64_t *iarg = (int64_t *)uarg;
	int a = 0;
	switch (sysnum) {
#ifdef PLATFORM_FOO
	/* syscall1 */
	case 1: {
		struct syscall1_args *p = params;
		iarg[a++] = p->arg1; /* int */
		*n_args = 1;
		break;
	}
#else
#endif
#ifdef PLATFORM_FOO
#else
	/* syscall2 */
	case 2: {
		*n_args = 0;
		break;
	}
#endif
	default:
		*n_args = 0;
		break;
	};
}
static void
systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
{
	const char *p = NULL;
	switch (sysnum) {
#ifdef PLATFORM_FOO
	/* syscall1 */
	case 1:
		switch (ndx) {
		case 0:
			p = "int";
			break;
		default:
			break;
		};
		break;
#else
#endif
#ifdef PLATFORM_FOO
#else
	/* syscall2 */
	case 2:
		break;
#endif
	default:
		break;
	};
	if (p != NULL)
		strlcpy(desc, p, descsz);
}
static void
systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
{
	const char *p = NULL;
	switch (sysnum) {
#ifdef PLATFORM_FOO
	/* syscall1 */
	case 1:
		if (ndx == 0 || ndx == 1)
			p = "int";
		break;
#else
#endif
#ifdef PLATFORM_FOO
#else
	/* syscall2 */
	case 2:
#endif
	default:
		break;
	};
	if (p != NULL)
		strlcpy(desc, p, descsz);
}