* defs.h (fetch_msghdr_namelen, decode_msghdr): Remove.
* net.c (SYS_FUNC(sendmsg), SYS_FUNC(recvmsg)): Move ...
* msghdr.c: ... here.
(fetch_msghdr_namelen, decode_msghdr): Add static qualifier.
extern const char *sprintflags(const char *, const struct xlat *, uint64_t);
extern const char *sprintmode(unsigned int);
extern const char *sprinttime(time_t);
-extern bool fetch_msghdr_namelen(struct tcb *, long, int *);
-extern void decode_msghdr(struct tcb *, const int *, long, unsigned long);
extern void dumpiov_in_msghdr(struct tcb *, long, unsigned long);
extern void dumpiov_in_mmsghdr(struct tcb *, long);
extern void dumpiov_upto(struct tcb *, int, long, unsigned long);
tprints("}");
}
-bool
+static bool
fetch_msghdr_namelen(struct tcb *tcp, const long addr, int *const p_msg_namelen)
{
struct msghdr msg;
}
}
-void
+static void
decode_msghdr(struct tcb *tcp, const int *const p_user_msg_namelen,
const long addr, const unsigned long data_size)
{
if (fetch_struct_msghdr(tcp, addr, &msg))
dumpiov_upto(tcp, msg.msg_iovlen, (long)msg.msg_iov, data_size);
}
+
+SYS_FUNC(sendmsg)
+{
+ printfd(tcp, tcp->u_arg[0]);
+ tprints(", ");
+ decode_msghdr(tcp, 0, tcp->u_arg[1], (unsigned long) -1L);
+ /* flags */
+ tprints(", ");
+ printflags(msg_flags, tcp->u_arg[2], "MSG_???");
+
+ return RVAL_DECODED;
+}
+
+SYS_FUNC(recvmsg)
+{
+ int msg_namelen;
+
+ if (entering(tcp)) {
+ printfd(tcp, tcp->u_arg[0]);
+ tprints(", ");
+ if (fetch_msghdr_namelen(tcp, tcp->u_arg[1], &msg_namelen)) {
+ /* abuse of auxstr to retain state */
+ tcp->auxstr = (void *) (long) msg_namelen;
+ return 0;
+ }
+ printaddr(tcp->u_arg[1]);
+ } else {
+ msg_namelen = (long) tcp->auxstr;
+ tcp->auxstr = NULL;
+
+ if (syserror(tcp))
+ tprintf("{msg_namelen=%d}", msg_namelen);
+ else
+ decode_msghdr(tcp, &msg_namelen, tcp->u_arg[1],
+ tcp->u_rval);
+ }
+
+ /* flags */
+ tprints(", ");
+ printflags(msg_flags, tcp->u_arg[2], "MSG_???");
+
+ return RVAL_DECODED;
+}
return RVAL_DECODED;
}
-SYS_FUNC(sendmsg)
-{
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- decode_msghdr(tcp, 0, tcp->u_arg[1], (unsigned long) -1L);
- /* flags */
- tprints(", ");
- printflags(msg_flags, tcp->u_arg[2], "MSG_???");
-
- return RVAL_DECODED;
-}
-
SYS_FUNC(recv)
{
if (entering(tcp)) {
return 0;
}
-SYS_FUNC(recvmsg)
-{
- int msg_namelen;
-
- if (entering(tcp)) {
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- if (fetch_msghdr_namelen(tcp, tcp->u_arg[1], &msg_namelen)) {
- /* abuse of auxstr to retain state */
- tcp->auxstr = (void *) (long) msg_namelen;
- return 0;
- }
- printaddr(tcp->u_arg[1]);
- } else {
- msg_namelen = (long) tcp->auxstr;
- tcp->auxstr = NULL;
-
- if (syserror(tcp))
- tprintf("{msg_namelen=%d}", msg_namelen);
- else
- decode_msghdr(tcp, &msg_namelen, tcp->u_arg[1],
- tcp->u_rval);
- }
-
- /* flags */
- tprints(", ");
- printflags(msg_flags, tcp->u_arg[2], "MSG_???");
-
- return RVAL_DECODED;
-}
-
#include "xlat/shutdown_modes.h"
SYS_FUNC(shutdown)