1<!-- Creator : groff version 1.22.2 --> 2<!-- CreationDate: Tue Feb 7 13:27:07 2017 --> 3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 4"http://www.w3.org/TR/html4/loose.dtd"> 5<html> 6<head> 7<meta name="generator" content="groff -Thtml, see www.gnu.org"> 8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 9<meta name="Content-Style" content="text/css"> 10<style type="text/css"> 11 p { margin-top: 0; margin-bottom: 0; vertical-align: top } 12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top } 13 table { margin-top: 0; margin-bottom: 0; vertical-align: top } 14 h1 { text-align: center } 15</style> 16<title>mtcp_ioctl</title> 17 18</head> 19<body> 20 21<h1 align="center">mtcp_ioctl</h1> 22 23<a href="#NAME">NAME</a><br> 24<a href="#SYNOPSIS">SYNOPSIS</a><br> 25<a href="#DESCRIPTION">DESCRIPTION</a><br> 26<a href="#RETURN VALUE">RETURN VALUE</a><br> 27<a href="#ERRORS">ERRORS</a><br> 28<a href="#AUTHORS">AUTHORS</a><br> 29<a href="#SEE ALSO">SEE ALSO</a><br> 30<a href="#COLOPHON">COLOPHON</a><br> 31 32<hr> 33 34 35<h2>NAME 36<a name="NAME"></a> 37</h2> 38 39 40<p style="margin-left:11%; margin-top: 1em">mtcp_ioctl 41− control mTCP socket</p> 42 43<h2>SYNOPSIS 44<a name="SYNOPSIS"></a> 45</h2> 46 47 48<p style="margin-left:11%; margin-top: 1em"><b>#include 49<mtcp_api.h></b></p> 50 51<p style="margin-left:11%; margin-top: 1em"><b>int 52mtcp_ioctl(mctx_t</b> <i>mctx</i><b>, int</b> 53<i>sockid</i><b>, int</b> <i>request</i><b>, void *</b> 54<i>argp</i><b>);</b></p> 55 56<h2>DESCRIPTION 57<a name="DESCRIPTION"></a> 58</h2> 59 60 61 62<p style="margin-left:11%; margin-top: 1em"><b>mtcp_ioctl</b>() 63can be used to retrieve certain attributes from an mTCP (of 64type SOCK_STREAM) socket via descriptor id, <i>sockid.</i> 65The third argument, <i>request</i> is used by the caller to 66fetch the attribute type. The fourth argument, <i>argp</i> 67is an untyped pointer to memory that <b>mtcp_ioctl</b>() 68uses for storing the returning value.</p> 69 70<p style="margin-left:11%; margin-top: 1em">Currently, 71<b>mtcp_ioctl</b>() only supports 1 type of 72<i>request.</i></p> 73 74<table width="100%" border="0" rules="none" frame="void" 75 cellspacing="0" cellpadding="0"> 76<tr valign="top" align="left"> 77<td width="11%"></td> 78<td width="12%"> 79 80 81<p><b>FIONREAD</b></p></td> 82<td width="6%"></td> 83<td width="71%"> 84 85 86<p>The number of bytes that can be read from the receive 87buffer when <b>mtcp_read</b>() is called. The user should 88pass <i>argp</i> pointing to a memory region that can store 89a variable of size <b>ssize_t</b>.</p></td></tr> 90</table> 91 92<p style="margin-left:11%; margin-top: 1em">Note that 93<b>mtcp_ioctl()</b> assumes that the CPU core-id (as set 94inside <i>mctx</i> structure) will be used as the value for 95NIC queue-id, which the mTCP context will eventually access 96during its operation. For example, mTCP context running on 97core 3 will read traffic from NIC hardware queue-id 3.</p> 98 99<h2>RETURN VALUE 100<a name="RETURN VALUE"></a> 101</h2> 102 103 104<p style="margin-left:11%; margin-top: 1em">Returns 0 on 105success; -1 on failure. In case of failure, <i>errno</i> is 106set appropriately.</p> 107 108<h2>ERRORS 109<a name="ERRORS"></a> 110</h2> 111 112 113<table width="100%" border="0" rules="none" frame="void" 114 cellspacing="0" cellpadding="0"> 115<tr valign="top" align="left"> 116<td width="11%"></td> 117<td width="9%"> 118 119 120<p style="margin-top: 1em"><b>EACCES</b></p></td> 121<td width="9%"></td> 122<td width="28%"> 123 124 125<p style="margin-top: 1em"><i>mctx</i> is invalid</p></td> 126<td width="43%"> 127</td></tr> 128<tr valign="top" align="left"> 129<td width="11%"></td> 130<td width="9%"> 131 132 133<p><b>EBADF</b></p></td> 134<td width="9%"></td> 135<td width="28%"> 136 137 138<p><i>sockid</i> is invalid.</p></td> 139<td width="43%"> 140</td></tr> 141<tr valign="top" align="left"> 142<td width="11%"></td> 143<td width="9%"> 144 145 146<p><b>EFAULT</b></p></td> 147<td width="9%"></td> 148<td width="28%"> 149 150 151<p><i>argp</i> is NULL.</p></td> 152<td width="43%"> 153</td></tr> 154</table> 155 156<h2>AUTHORS 157<a name="AUTHORS"></a> 158</h2> 159 160 161<p style="margin-left:11%; margin-top: 1em">mOS development 162team <[email protected]></p> 163 164<h2>SEE ALSO 165<a name="SEE ALSO"></a> 166</h2> 167 168 169 170<p style="margin-left:11%; margin-top: 1em"><b>mtcp_getsockopt</b>(), 171<b>mtcp_socket</b>(), <b>mtcp_read</b>()</p> 172 173<h2>COLOPHON 174<a name="COLOPHON"></a> 175</h2> 176 177 178<p style="margin-left:11%; margin-top: 1em">This page is 179part of mOS release 0.3 <i>docs</i> section. A description 180of the project, and information about reporting bugs, can be 181found at http://mos.kaist.edu/.</p> 182<hr> 183</body> 184</html> 185