mtcp_ioctl

NAME

mtcp_ioctl − control mTCP socket

SYNOPSIS

#include <mtcp_api.h>

int mtcp_ioctl(mctx_t mctx, int sockid, int request, void * argp);

DESCRIPTION

mtcp_ioctl() can be used to retrieve certain attributes from an mTCP (of type SOCK_STREAM) socket via descriptor id, sockid. The third argument, request is used by the caller to fetch the attribute type. The fourth argument, argp is an untyped pointer to memory that mtcp_ioctl() uses for storing the returning value.

Currently, mtcp_ioctl() only supports 1 type of request.

FIONREAD

The number of bytes that can be read from the receive buffer when mtcp_read() is called. The user should pass argp pointing to a memory region that can store a variable of size ssize_t.

Note that mtcp_ioctl() assumes that the CPU core-id (as set inside mctx structure) will be used as the value for NIC queue-id, which the mTCP context will eventually access during its operation. For example, mTCP context running on core 3 will read traffic from NIC hardware queue-id 3.

RETURN VALUE

Returns 0 on success; -1 on failure. In case of failure, errno is set appropriately.

ERRORS

EACCES

mctx is invalid

EBADF

sockid is invalid.

EFAULT

argp is NULL.

AUTHORS

mOS development team <mtcp-user@list.ndsl.kaist.edu>

SEE ALSO

mtcp_getsockopt(), mtcp_socket(), mtcp_read()

COLOPHON

This page is part of mOS release 0.3 docs section. A description of the project, and information about reporting bugs, can be found at http://mos.kaist.edu/.