#endif
#include "xlat/clone_flags.h"
+#include "xlat/setns_types.h"
+#include "xlat/unshare_flags.h"
#if defined IA64
# define ARG_FLAGS 0
# define ARG_STACK 1
-# define ARG_STACKSIZE (tcp->scno == SYS_clone2 ? 2 : -1)
-# define ARG_PTID (tcp->scno == SYS_clone2 ? 3 : 2)
-# define ARG_CTID (tcp->scno == SYS_clone2 ? 4 : 3)
-# define ARG_TLS (tcp->scno == SYS_clone2 ? 5 : 4)
+# define ARG_STACKSIZE (tcp->scno == __NR_clone2 ? 2 : -1)
+# define ARG_PTID (tcp->scno == __NR_clone2 ? 3 : 2)
+# define ARG_CTID (tcp->scno == __NR_clone2 ? 4 : 3)
+# define ARG_TLS (tcp->scno == __NR_clone2 ? 5 : 4)
#elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
# define ARG_STACK 0
# define ARG_FLAGS 1
# define ARG_PTID 2
# define ARG_CTID ((current_personality != 1) ? 3 : 4)
# define ARG_TLS ((current_personality != 1) ? 4 : 3)
-#elif defined ALPHA || defined TILE || defined OR1K
+#elif defined ALPHA || defined TILE || defined OR1K || defined RISCV
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_PTID 2
# define ARG_CTID 4
#endif
-#if defined I386 || defined X86_64 || defined X32
-extern void print_user_desc(struct tcb *, long);
-#endif /* I386 || X86_64 || X32 */
+static void
+print_tls_arg(struct tcb *const tcp, const kernel_ureg_t addr)
+{
+#ifdef HAVE_STRUCT_USER_DESC
+# if SUPPORTED_PERSONALITIES > 1
+ if (current_personality == 1)
+# endif
+ {
+ print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
+ }
+# if SUPPORTED_PERSONALITIES > 1
+ else
+# endif
+#endif /* HAVE_STRUCT_USER_DESC */
+ {
+ printaddr(tcp->u_arg[ARG_TLS]);
+ }
+}
SYS_FUNC(clone)
{
if (exiting(tcp)) {
const char *sep = "|";
unsigned long flags = tcp->u_arg[ARG_FLAGS];
- tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]);
+ tprints("child_stack=");
+ printaddr(tcp->u_arg[ARG_STACK]);
+ tprints(", ");
#ifdef ARG_STACKSIZE
if (ARG_STACKSIZE != -1)
tprintf("stack_size=%#lx, ",
if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
|CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
return 0;
- if (flags & CLONE_PARENT_SETTID)
- tprintf(", parent_tidptr=%#lx", tcp->u_arg[ARG_PTID]);
+ if (flags & CLONE_PARENT_SETTID) {
+ tprints(", parent_tidptr=");
+ printaddr(tcp->u_arg[ARG_PTID]);
+ }
if (flags & CLONE_SETTLS) {
-#if defined I386 || defined X86_64 || defined X32
-# ifndef I386
- if (current_personality == 1)
-# endif
- {
- tprints(", tls=");
- print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
- }
-# ifndef I386
- else
-# endif
-#endif /* I386 || X86_64 || X32 */
- tprintf(", tls=%#lx", tcp->u_arg[ARG_TLS]);
+ tprints(", tls=");
+ print_tls_arg(tcp, tcp->u_arg[ARG_TLS]);
+ }
+ if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) {
+ tprints(", child_tidptr=");
+ printaddr(tcp->u_arg[ARG_CTID]);
}
- if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID))
- tprintf(", child_tidptr=%#lx", tcp->u_arg[ARG_CTID]);
}
/* TODO on syscall entry:
* We can clear CLONE_PTRACE here since it is an ancient hack
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
- printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
+ printxval(setns_types, tcp->u_arg[1], "CLONE_NEW???");
return RVAL_DECODED;
}
SYS_FUNC(unshare)
{
- printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
+ printflags64(unshare_flags, getarg_klu(tcp, 0), "CLONE_???");
return RVAL_DECODED;
}