*/
#include "defs.h"
-#include "msghdr.h"
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/uio.h>
{
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
- decode_sockaddr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
- tprintf(", %lu", tcp->u_arg[2]);
+ const int addrlen = tcp->u_arg[2];
+ decode_sockaddr(tcp, tcp->u_arg[1], addrlen);
+ tprintf(", %d", addrlen);
return RVAL_DECODED;
}
return RVAL_DECODED;
}
+static bool
+fetch_socklen(struct tcb *tcp, int *plen,
+ const unsigned long sockaddr, const unsigned long socklen)
+{
+ return verbose(tcp) && sockaddr && socklen
+ && umove(tcp, socklen, plen) == 0;
+}
+
static int
decode_sockname(struct tcb *tcp)
{
+ int ulen, rlen;
+
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
- return 0;
+ if (fetch_socklen(tcp, &ulen, tcp->u_arg[1], tcp->u_arg[2])) {
+ set_tcb_priv_ulong(tcp, ulen);
+ return 0;
+ } else {
+ printaddr(tcp->u_arg[1]);
+ tprints(", ");
+ printaddr(tcp->u_arg[2]);
+ return RVAL_DECODED;
+ }
}
- int len;
- if (!tcp->u_arg[2] || !verbose(tcp) || syserror(tcp) ||
- umove(tcp, tcp->u_arg[2], &len) < 0) {
+ ulen = get_tcb_priv_ulong(tcp);
+
+ if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &rlen) < 0) {
printaddr(tcp->u_arg[1]);
- tprints(", ");
- printaddr(tcp->u_arg[2]);
+ tprintf(", [%d]", ulen);
} else {
- decode_sockaddr(tcp, tcp->u_arg[1], len);
- tprintf(", [%d]", len);
+ decode_sockaddr(tcp, tcp->u_arg[1], ulen > rlen ? rlen : ulen);
+ if (ulen != rlen)
+ tprintf(", [%d->%d]", ulen, rlen);
+ else
+ tprintf(", [%d]", rlen);
}
return RVAL_DECODED;
/* flags */
printflags(msg_flags, tcp->u_arg[3], "MSG_???");
/* to address */
+ const int addrlen = tcp->u_arg[5];
tprints(", ");
- decode_sockaddr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
+ decode_sockaddr(tcp, tcp->u_arg[4], addrlen);
/* to length */
- tprintf(", %lu", tcp->u_arg[5]);
+ tprintf(", %d", addrlen);
return RVAL_DECODED;
}
-SYS_FUNC(sendmsg)
-{
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- decode_msghdr(tcp, tcp->u_arg[1], (unsigned long) -1L);
- /* flags */
- tprints(", ");
- printflags(msg_flags, tcp->u_arg[2], "MSG_???");
-
- return RVAL_DECODED;
-}
-
-SYS_FUNC(sendmmsg)
-{
- if (entering(tcp)) {
- /* sockfd */
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- if (!verbose(tcp)) {
- printaddr(tcp->u_arg[1]);
- /* vlen */
- tprintf(", %u, ", (unsigned int) tcp->u_arg[2]);
- /* flags */
- printflags(msg_flags, tcp->u_arg[3], "MSG_???");
- return RVAL_DECODED;
- }
- } else {
- decode_mmsgvec(tcp, tcp->u_arg[1], tcp->u_rval, false);
- /* vlen */
- tprintf(", %u, ", (unsigned int) tcp->u_arg[2]);
- /* flags */
- printflags(msg_flags, tcp->u_arg[3], "MSG_???");
- }
- return 0;
-}
-
SYS_FUNC(recv)
{
if (entering(tcp)) {
SYS_FUNC(recvfrom)
{
- int fromlen;
+ int ulen, rlen;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
+ if (fetch_socklen(tcp, &ulen, tcp->u_arg[4], tcp->u_arg[5])) {
+ set_tcb_priv_ulong(tcp, ulen);
+ }
} else {
/* buf */
if (syserror(tcp)) {
decode_sockbuf(tcp, tcp->u_arg[0], tcp->u_arg[1],
tcp->u_rval);
}
- /* len */
+ /* size */
tprintf(", %lu, ", tcp->u_arg[2]);
/* flags */
printflags(msg_flags, tcp->u_arg[3], "MSG_???");
tprints(", ");
- if (syserror(tcp) || !tcp->u_arg[4] || !tcp->u_arg[5] ||
- umove(tcp, tcp->u_arg[5], &fromlen) < 0) {
- /* from address, len */
+
+ ulen = get_tcb_priv_ulong(tcp);
+
+ if (!fetch_socklen(tcp, &rlen, tcp->u_arg[4], tcp->u_arg[5])) {
+ /* from address */
printaddr(tcp->u_arg[4]);
tprints(", ");
+ /* from length */
printaddr(tcp->u_arg[5]);
return 0;
}
+ if (syserror(tcp)) {
+ /* from address */
+ printaddr(tcp->u_arg[4]);
+ /* from length */
+ tprintf(", [%d]", ulen);
+ return 0;
+ }
/* from address */
- decode_sockaddr(tcp, tcp->u_arg[4], fromlen);
+ decode_sockaddr(tcp, tcp->u_arg[4], ulen > rlen ? rlen : ulen);
/* from length */
- tprintf(", [%u]", fromlen);
- }
- return 0;
-}
-
-SYS_FUNC(recvmsg)
-{
- if (entering(tcp)) {
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- } else {
- if (syserror(tcp))
- printaddr(tcp->u_arg[1]);
+ if (ulen != rlen)
+ tprintf(", [%d->%d]", ulen, rlen);
else
- decode_msghdr(tcp, tcp->u_arg[1], tcp->u_rval);
- /* flags */
- tprints(", ");
- printflags(msg_flags, tcp->u_arg[2], "MSG_???");
+ tprintf(", [%d]", rlen);
}
return 0;
}
-SYS_FUNC(recvmmsg)
-{
- static char str[sizeof("left") + TIMESPEC_TEXT_BUFSIZE];
-
- if (entering(tcp)) {
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- if (verbose(tcp)) {
- /* Abusing tcp->auxstr as temp storage.
- * Will be used and cleared on syscall exit.
- */
- tcp->auxstr = sprint_timespec(tcp, tcp->u_arg[4]);
- } else {
- printaddr(tcp->u_arg[1]);
- /* vlen */
- tprintf(", %u, ", (unsigned int) tcp->u_arg[2]);
- /* flags */
- printflags(msg_flags, tcp->u_arg[3], "MSG_???");
- tprints(", ");
- print_timespec(tcp, tcp->u_arg[4]);
- }
- return 0;
- } else {
- if (verbose(tcp)) {
- decode_mmsgvec(tcp, tcp->u_arg[1], tcp->u_rval, true);
- /* vlen */
- tprintf(", %u, ", (unsigned int) tcp->u_arg[2]);
- /* flags */
- printflags(msg_flags, tcp->u_arg[3], "MSG_???");
- tprints(", ");
- /* timeout on entrance */
- tprints(tcp->auxstr);
- tcp->auxstr = NULL;
- }
- if (syserror(tcp))
- return 0;
- if (tcp->u_rval == 0) {
- tcp->auxstr = "Timeout";
- return RVAL_STR;
- }
- if (!verbose(tcp))
- return 0;
- /* timeout on exit */
- snprintf(str, sizeof(str), "left %s",
- sprint_timespec(tcp, tcp->u_arg[4]));
- tcp->auxstr = str;
- return RVAL_STR;
- }
-}
-
#include "xlat/shutdown_modes.h"
SYS_FUNC(shutdown)
tprintf("{gr_interface=%u, gr_group=", greq.gr_interface);
print_sockaddr(tcp, &greq.gr_group, sizeof(greq.gr_group));
- tprintf("}");
+ tprints("}");
}
#endif /* MCAST_JOIN_GROUP */