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<link rel="stylesheet" href="./common.css">
18</head>
19<body>
20<div class="main">
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<hr>
32-->
33
34<h2>NAME
35<a name="NAME"></a>
36</h2>
37
38
39<p style="margin-left:11%; margin-top: 1em">mtcp_ioctl
40&minus; control mTCP socket</p>
41
42<h2>SYNOPSIS
43<a name="SYNOPSIS"></a>
44</h2>
45
46
47<p style="margin-left:11%; margin-top: 1em"><b>#include
48&lt;mtcp_api.h&gt;</b></p>
49
50<p style="margin-left:11%; margin-top: 1em"><b>int
51mtcp_ioctl(mctx_t</b> <i>mctx</i><b>, int</b>
52<i>sockid</i><b>, int</b> <i>request</i><b>, void *</b>
53<i>argp</i><b>);</b></p>
54
55<h2>DESCRIPTION
56<a name="DESCRIPTION"></a>
57</h2>
58
59
60
61<p style="margin-left:11%; margin-top: 1em"><b>mtcp_ioctl</b>()
62can be used to retrieve certain attributes from an mTCP (of
63type SOCK_STREAM) socket via descriptor id, <i>sockid.</i>
64The third argument, <i>request</i> is used by the caller to
65fetch the attribute type. The fourth argument, <i>argp</i>
66is an untyped pointer to memory that <b>mtcp_ioctl</b>()
67uses for storing the returning value.</p>
68
69<p style="margin-left:11%; margin-top: 1em">Currently,
70<b>mtcp_ioctl</b>() only supports 1 type of
71<i>request.</i></p>
72
73<table width="100%" border="0" rules="none" frame="void"
74       cellspacing="0" cellpadding="0">
75<tr valign="top" align="left">
76<td width="11%"></td>
77<td width="12%">
78
79
80<p><b>FIONREAD</b></p></td>
81<td width="6%"></td>
82<td width="71%">
83
84
85<p>The number of bytes that can be read from the receive
86buffer when <b>mtcp_read</b>() is called. The user should
87pass <i>argp</i> pointing to a memory region that can store
88a variable of size <b>ssize_t</b>.</p></td></tr>
89</table>
90
91<p style="margin-left:11%; margin-top: 1em">Note that
92<b>mtcp_ioctl()</b> assumes that the CPU core-id (as set
93inside <i>mctx</i> structure) will be used as the value for
94NIC queue-id, which the mTCP context will eventually access
95during its operation. For example, mTCP context running on
96core 3 will read traffic from NIC hardware queue-id 3.</p>
97
98<h2>RETURN VALUE
99<a name="RETURN VALUE"></a>
100</h2>
101
102
103<p style="margin-left:11%; margin-top: 1em">Returns 0 on
104success; -1 on failure. In case of failure, <i>errno</i> is
105set appropriately.</p>
106
107<h2>ERRORS
108<a name="ERRORS"></a>
109</h2>
110
111
112<table width="100%" border="0" rules="none" frame="void"
113       cellspacing="0" cellpadding="0">
114<tr valign="top" align="left">
115<td width="11%"></td>
116<td width="9%">
117
118
119<p style="margin-top: 1em"><b>EACCES</b></p></td>
120<td width="9%"></td>
121<td width="28%">
122
123
124<p style="margin-top: 1em"><i>mctx</i> is invalid</p></td>
125<td width="43%">
126</td></tr>
127<tr valign="top" align="left">
128<td width="11%"></td>
129<td width="9%">
130
131
132<p><b>EBADF</b></p></td>
133<td width="9%"></td>
134<td width="28%">
135
136
137<p><i>sockid</i> is invalid.</p></td>
138<td width="43%">
139</td></tr>
140<tr valign="top" align="left">
141<td width="11%"></td>
142<td width="9%">
143
144
145<p><b>EFAULT</b></p></td>
146<td width="9%"></td>
147<td width="28%">
148
149
150<p><i>argp</i> is NULL.</p></td>
151<td width="43%">
152</td></tr>
153</table>
154
155<h2>AUTHORS
156<a name="AUTHORS"></a>
157</h2>
158
159
160<p style="margin-left:11%; margin-top: 1em">mOS development
161team &lt;[email protected]&gt;</p>
162
163<h2>SEE ALSO
164<a name="SEE ALSO"></a>
165</h2>
166
167
168
169<p style="margin-left:11%; margin-top: 1em"><b>mtcp_getsockopt</b>(),
170<b>mtcp_socket</b>(), <b>mtcp_read</b>()</p>
171
172<h2>COLOPHON
173<a name="COLOPHON"></a>
174</h2>
175
176
177<p style="margin-left:11%; margin-top: 1em">This page is
178part of mOS release 0.3 <i>docs</i> section. A description
179of the project, and information about reporting bugs, can be
180found at http://mos.kaist.edu/.</p>
181<!-- <hr> -->
182<br>
183<div class="footer">
184  <img src="back-arrow.jpg" width="2%" height="2%"><a href="http://mos.kaist.edu/index_man.html">Back to Index</a>
185</div>
186</div>
187</body>
188</html>
189