1<!-- Creator : groff version 1.22.2 --> 2<!-- CreationDate: Wed Feb 1 22:24:31 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_create_context</title> 17<link rel="stylesheet" href="./common.css"> 18</head> 19<body> 20<div class="main"> 21<h1 align="center">mtcp_create_context</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="#NOTES">NOTES</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 40<p style="margin-left:11%; margin-top: 1em">mtcp_create_context 41− create mTCP context for network communication</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>mctx_t 52mtcp_create_context(int</b> <i>cpu</i><b>);</b></p> 53 54<h2>DESCRIPTION 55<a name="DESCRIPTION"></a> 56</h2> 57 58 59 60<p style="margin-left:11%; margin-top: 1em"><b>mtcp_create_context</b>() 61creates the underlying mTCP stack based on the parameters 62passed by the <b>mtcp_init()</b> function call. Each mTCP 63thread requires its own exclusive invocation of the 64<b>mtcp_create_context()</b> routine before the stack can be 65used for network communication. The function requires a sole 66<i>cpu</i> integer argument that passes the CPU core-id of 67the system on which the stack is instantiated.</p> 68 69<h2>RETURN VALUE 70<a name="RETURN VALUE"></a> 71</h2> 72 73 74<p style="margin-left:11%; margin-top: 1em">Returns 75<i>mctx</i> on success; NULL on failure. Please see the 76<b>NOTES</b> section for details.</p> 77 78<h2>NOTES 79<a name="NOTES"></a> 80</h2> 81 82 83<p style="margin-left:11%; margin-top: 1em">The user cannot 84call <b>mtcp_create_context()</b> function more than once 85using the same cpu-id in a process.</p> 86 87<p style="margin-left:11%; margin-top: 1em">Passing an 88invalid CPU core-id (value < 0 or value > max_cpus) 89will prevent the creation of the mTCP stack.</p> 90 91<p style="margin-left:11%; margin-top: 1em">It is suggested 92that the user creates only 1 mTCP context thread per core 93for performance reasons.</p> 94 95<h2>AUTHORS 96<a name="AUTHORS"></a> 97</h2> 98 99 100<p style="margin-left:11%; margin-top: 1em">mOS 101development team <[email protected]></p> 102 103<!-----------------------------------------------------------> 104<h2>EXAMPLES 105<a name="EXAMPLES"></a> 106</h2> 107 108<p style="margin-left:11%; margin-top: 1em"> 109 <a href="http://mos.kaist.edu/guide/programmer/05_api_example.html#per-core-initialization-routine"> 110 http://mos.kaist.edu/guide/programmer/05_api_example.html#per-core-initialization-routine 111 </a> 112</p> 113<!-----------------------------------------------------------> 114 115 116<h2>SEE ALSO 117<a name="SEE ALSO"></a> 118</h2> 119 120 121<p style="margin-left:11%; margin-top: 1em"><b>mtcp_destroy_context</b>(), 122<b>mtcp_init</b>(), <b>mtcp_destroy</b>()</p> 123 124<h2>COLOPHON 125<a name="COLOPHON"></a> 126</h2> 127 128 129<p style="margin-left:11%; margin-top: 1em">This page is 130part of mOS release 0.3 <i>docs</i> section. A description 131of the project, and information about reporting bugs, can be 132found at http://mos.kaist.edu/.</p> 133<!-- <hr>--> 134<br> 135<div class="footer"> 136 <img src="back-arrow.jpg" width="2%" height="2%"><a href="http://mos.kaist.edu/index_man.html">Back to Index</a> 137</div> 138</div> 139</body> 140</html> 141