Skip to content

recvmsg

Implemented in Antinomie 0.7.0 · Syscall list

long recvmsg(int fd, struct user_msghdr *msg, unsigned int flags);
Number (x86-64) 47
ABI 64
Kernel entry point sys_recvmsg

This is the raw kernel prototype from the pinned Linux 6.12.94 schema, not the libc wrapper.

Receives a message into a msghdr (address, buffers and ancillary data) from a socket.

Name Type Meaning
fd (arg0) int File descriptor to operate on.
msg (arg1) struct user_msghdr * Pointer to a message structure.
flags (arg2) unsigned int Option flags that change the behavior of the call.

On success: The number of bytes transferred (see the description for what 0 means).

In an Antinomie trace the Return column and the ret filter field show the raw kernel return value. On failure that is the negative errno, for example -2 for ENOENT, not the -1 plus errno that the libc wrapper gives. syscall.errno holds the positive errno and syscall.success is false.

Raw return Name Meaning
-11 EAGAIN The call would block, or a resource is temporarily unavailable.
-111 ECONNREFUSED The connection was refused.
-4 EINTR The call was interrupted by a signal.

recvmsg(2) on man7.org

Coverage mark: Implemented. Every pointer argument has a capture rule in the pinned kernel patch and none of them records a “no decoder”, “address only” or “not observed” gap on any code path. Individual values can still be incomplete on a particular call; see the capture statuses.

Every call is recorded as an Entry record (the six argument words and the pointees copied at entry) and an Exit record (the return value and the pointees copied at exit).

Argument When How Recorded field key Condition
fd (arg0) Entry raw scalar word args.0, args.fd
msg (arg1) Entry the pointer itself, as a raw word args.1, args.raw[1]
↳ pointee Entry structure msghdr (56 bytes), the input arg1.msghdr always
↳ pointee Exit structure msghdr, as the kernel updated it arg1.msghdr.output result is 0 or greater
↳ pointee Exit the bytes received, min(result, MAX_RW_COUNT) arg1.msghdr.iov[i].data result is 0 or greater
↳ pointee Exit sender address (sockaddr), length min(entry, written) up to sizeof(sockaddr_storage) arg1.msghdr.name result is 0 or greater and msg_name is not NULL
↳ pointee Exit ancillary data, length min(entry, written) arg1.msghdr.control result is 0 or greater
flags (arg2) Entry raw scalar word; Syscall Trace also decodes it into flag names (message group), listing unknown bits separately args.2, args.flags
  • Result: ret, syscall.errno, syscall.success, syscall.duration_ns.
  • Argument words: args.fd (arg0), args.msg (arg1), args.flags (arg2); args.0 to args.5 by position.
  • Captured strings: the args.<name> field of a path argument, and args.path, give the captured text instead of the pointer.
  • Structure msghdr behind msg (arg1): args.msg.<member> for msg_control, msg_controllen, msg_flags, msg_iov, msg_iovlen, msg_name, msg_namelen.

See Syscall Trace filter for the full syntax.

For what the capture statuses mean, see Capture statuses. For what is never recorded, see Known gaps.