1<!-- Creator     : groff version 1.22.2 -->
2<!-- CreationDate: Thu Feb  2 23:56:35 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_setsockopt</title>
17
18</head>
19<body>
20
21<h1 align="center">mtcp_setsockopt</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
41<p style="margin-left:11%; margin-top: 1em">mtcp_setsockopt
42&minus; set options on mTCP/mOS sockets</p>
43
44<h2>SYNOPSIS
45<a name="SYNOPSIS"></a>
46</h2>
47
48
49<p style="margin-left:11%; margin-top: 1em"><b>#include
50&lt;mtcp_api.h&gt;</b></p>
51
52<p style="margin-left:11%; margin-top: 1em"><b>int
53mtcp_setsockopt(mctx_t</b> <i>mctx</i><b>, int</b>
54<i>sockid</i><b>, int</b> <i>level</i><b>, int</b>
55<i>optname</i><b>, const void *</b><i>optval</i><b>,
56socklen_t</b> <i>optlen</i><b>);</b></p>
57
58<h2>DESCRIPTION
59<a name="DESCRIPTION"></a>
60</h2>
61
62
63
64<p style="margin-left:11%; margin-top: 1em"><b>mtcp_setsockopt</b>()
65manipulate options for the socket referred to by the
66<i>sockid</i> descriptor. These options may exist at
67multiple protocol levels. When manipulating socket options,
68the level at which the options resides and the name of the
69option must be specified. A user can use
70<b>SOL_MONSOCKET</b> <i>level</i> to adjust options for
71monitoring sockets.</p>
72
73<p style="margin-left:11%; margin-top: 1em">The arguments
74<i>optval</i> and <i>optlen</i> are used to set options
75values for mtcp_setsockopt().</p>
76
77<p style="margin-left:11%; margin-top: 1em">SOL_MONSOCKET
78socket <i>level</i> can be used by <b>mtcp_setsockopt()</b>
79to set a number of attributes pertaining to the socket.</p>
80
81<table width="100%" border="0" rules="none" frame="void"
82       cellspacing="0" cellpadding="0">
83<tr valign="top" align="left">
84<td width="11%"></td>
85<td width="15%">
86
87
88<p style="margin-top: 1em">MOS_CLIBUF</p></td>
89<td width="23%"></td>
90<td width="51%">
91
92
93<p style="margin-top: 1em">Dynamically adjust the size of
94the TCP receive ring buffer of the emulated client stack.
95The <i>optval</i> contains the size of the buffer that needs
96to be set as int, while <i>optlen</i> is equal to
97sizeof(int).</p> </td></tr>
98<tr valign="top" align="left">
99<td width="11%"></td>
100<td width="15%">
101
102
103<p>MOS_SVRBUF</p></td>
104<td width="23%"></td>
105<td width="51%">
106
107
108<p>Dynamically adjust the size of the TCP receive ring
109buffer of the emulated client stack. The <i>optval</i>
110contains the size of the buffer that needs to be set as int,
111while <i>optlen</i> is equal to sizeof(int).</p></td></tr>
112</table>
113
114<h2>RETURN VALUE
115<a name="RETURN VALUE"></a>
116</h2>
117
118
119<p style="margin-left:11%; margin-top: 1em">Returns 0 on
120success; -1 on failure. In case of failure, <i>errno</i> is
121set appropriately.</p>
122
123<h2>ERRORS
124<a name="ERRORS"></a>
125</h2>
126
127
128<table width="100%" border="0" rules="none" frame="void"
129       cellspacing="0" cellpadding="0">
130<tr valign="top" align="left">
131<td width="11%"></td>
132<td width="12%">
133
134
135<p style="margin-top: 1em"><b>EACCES</b></p></td>
136<td width="3%"></td>
137<td width="74%">
138
139
140<p style="margin-top: 1em"><i>mctx</i> is not valid.</p></td></tr>
141<tr valign="top" align="left">
142<td width="11%"></td>
143<td width="12%">
144
145
146<p><b>EBADF</b></p></td>
147<td width="3%"></td>
148<td width="74%">
149
150
151<p><i>sockid</i> is not a valid socket descriptor.</p></td></tr>
152<tr valign="top" align="left">
153<td width="11%"></td>
154<td width="12%">
155
156
157<p><b>ENOTSOCK</b></p></td>
158<td width="3%"></td>
159<td width="74%">
160
161
162<p>The socket referred to by <i>sockid</i> is not
163valid.</p> </td></tr>
164<tr valign="top" align="left">
165<td width="11%"></td>
166<td width="12%">
167
168
169<p><b>ENOSYS</b></p></td>
170<td width="3%"></td>
171<td width="74%">
172
173
174<p>Either the <i>level</i> or the <i>optname</i> is not
175implemented.</p> </td></tr>
176<tr valign="top" align="left">
177<td width="11%"></td>
178<td width="12%">
179
180
181<p><b>EPERM</b></p></td>
182<td width="3%"></td>
183<td width="74%">
184
185
186<p>Permission to access a socket option is denied.</p></td></tr>
187</table>
188
189<h2>AUTHORS
190<a name="AUTHORS"></a>
191</h2>
192
193
194<p style="margin-left:22%; margin-top: 1em">mOS development
195team &lt;[email protected]&gt;</p>
196
197<h2>SEE ALSO
198<a name="SEE ALSO"></a>
199</h2>
200
201
202
203<p style="margin-left:11%; margin-top: 1em"><b>mtcp_socket</b>(),
204<b>mtcp_getsockopt</b>()</p>
205
206<h2>COLOPHON
207<a name="COLOPHON"></a>
208</h2>
209
210
211<p style="margin-left:11%; margin-top: 1em">This page is
212part of mOS release 0.3 <i>docs</i> section. A description
213of the project, and information about reporting bugs, can be
214found at http://mos.kaist.edu/.</p>
215<hr>
216</body>
217</html>
218