#define sys_setsid printargs
#define sys_set_tid_address printargs
#define sys_setup printargs
-#define sys_socketcall printargs
#define sys_sync printargs
#define sys_syscall printargs
#define sys_vhangup printargs
--- /dev/null
+/*
+ * Copyright (c) 2016 Dmitry V. Levin <ldv@altlinux.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "defs.h"
+#include "xlat/socketcalls.h"
+
+SYS_FUNC(socketcall)
+{
+ const unsigned int call = tcp->u_arg[0];
+ const char *str = xlookup(socketcalls, call);
+
+ if (str)
+ tprints(str);
+ else
+ tprintf("%d", call);
+
+ unsigned int i;
+ for (i = 1; i < MAX_ARGS; ++i)
+ tprintf(", %#lx", tcp->u_arg[i]);
+
+ return RVAL_DECODED;
+}
static void
decode_socket_subcall(struct tcb *tcp)
{
- unsigned long addr;
- unsigned int n;
+ const int call = tcp->u_arg[0];
- if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= SYS_socket_nsubcalls)
+ if (call < 1 || call >= SYS_socket_nsubcalls)
return;
- tcp->scno = SYS_socket_subcall + tcp->u_arg[0];
- tcp->qual_flg = qual_flags[tcp->scno];
- tcp->s_ent = &sysent[tcp->scno];
- addr = tcp->u_arg[1];
- n = tcp->s_ent->nargs;
- if (sizeof(tcp->u_arg[0]) == current_wordsize) {
- memset(tcp->u_arg, 0, n * sizeof(tcp->u_arg[0]));
- (void) umoven(tcp, addr, n * sizeof(tcp->u_arg[0]), tcp->u_arg);
- } else {
- unsigned int args[n];
- unsigned int i;
+ const unsigned long scno = SYS_socket_subcall + call;
+ const unsigned int nargs = sysent[scno].nargs;
+ uint64_t buf[nargs];
- memset(args, 0, sizeof(args));
- (void) umove(tcp, addr, &args);
- for (i = 0; i < n; ++i)
- tcp->u_arg[i] = args[i];
- }
+ if (umoven(tcp, tcp->u_arg[1], nargs * current_wordsize, buf) < 0)
+ return;
+
+ tcp->scno = scno;
+ tcp->qual_flg = qual_flags[scno];
+ tcp->s_ent = &sysent[scno];
+
+ unsigned int i;
+ for (i = 0; i < nargs; ++i)
+ tcp->u_arg[i] = (sizeof(uint32_t) == current_wordsize)
+ ? ((uint32_t *) buf)[i] : buf[i];
}
#endif