4 * Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
6 * Released under the GPL v2. (and only v2, not any later version)
9 #include "trace/beauty/beauty.h"
10 #include <linux/kernel.h>
11 #include <sys/types.h>
12 #include <uapi/linux/sched.h>
14 static size_t clone__scnprintf_flags(unsigned long flags
, char *bf
, size_t size
)
19 if (flags & CLONE_##n) { \
20 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
21 flags &= ~CLONE_##n; \
35 P_FLAG(PARENT_SETTID
);
36 P_FLAG(CHILD_CLEARTID
);
50 printed
+= scnprintf(bf
+ printed
, size
- printed
, "%s%#x", printed
? "|" : "", flags
);
55 size_t syscall_arg__scnprintf_clone_flags(char *bf
, size_t size
, struct syscall_arg
*arg
)
57 unsigned long flags
= arg
->val
;
58 enum syscall_clone_args
{
60 SCC_CHILD_STACK
= (1 << 1),
61 SCC_PARENT_TIDPTR
= (1 << 2),
62 SCC_CHILD_TIDPTR
= (1 << 3),
65 if (!(flags
& CLONE_PARENT_SETTID
))
66 arg
->mask
|= SCC_PARENT_TIDPTR
;
68 if (!(flags
& (CLONE_CHILD_SETTID
| CLONE_CHILD_CLEARTID
)))
69 arg
->mask
|= SCC_CHILD_TIDPTR
;
71 if (!(flags
& CLONE_SETTLS
))
74 return clone__scnprintf_flags(flags
, bf
, size
);