1<!-- Creator : groff version 1.22.2 --> 2<!-- CreationDate: Wed Feb 1 23:55:12 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 18</head> 19<body> 20 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 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_create_context 42− create mTCP context for network communication</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<mtcp_api.h></b></p> 51 52<p style="margin-left:11%; margin-top: 1em"><b>mctx_t 53mtcp_create_context(int</b> <i>cpu</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_create_context</b>() 62creates the underlying mTCP stack based on the parameters 63passed by the <b>mtcp_init()</b> function call. Each mTCP 64thread requires its own exclusive invocation of the 65<b>mtcp_create_context()</b> routine before the stack can be 66used for network communication. The function requires a sole 67<i>cpu</i> integer argument that passes the CPU core-id of 68the system on which the stack is instantiated.</p> 69 70<h2>RETURN VALUE 71<a name="RETURN VALUE"></a> 72</h2> 73 74 75<p style="margin-left:11%; margin-top: 1em">Returns 76<i>mctx</i> on success; NULL on failure. Please see the 77<b>NOTES</b> section for details.</p> 78 79<h2>NOTES 80<a name="NOTES"></a> 81</h2> 82 83 84<p style="margin-left:11%; margin-top: 1em">The user cannot 85call <b>mtcp_create_context()</b> function more than once 86using the same cpu-id in a process.</p> 87 88<p style="margin-left:11%; margin-top: 1em">Passing an 89invalid CPU core-id (value < 0 or value > max_cpus) 90will prevent the creation of the mTCP stack.</p> 91 92<p style="margin-left:11%; margin-top: 1em">It is suggested 93that the user creates only 1 mTCP context thread per core 94for performance reasons.</p> 95 96<h2>AUTHORS 97<a name="AUTHORS"></a> 98</h2> 99 100 101<p style="margin-left:11%; margin-top: 1em">mOS development 102team <[email protected]></p> 103 104<h2>SEE ALSO 105<a name="SEE ALSO"></a> 106</h2> 107 108 109 110<p style="margin-left:11%; margin-top: 1em"><b>mtcp_destroy_context</b>(), 111<b>mtcp_init</b>(), <b>mtcp_destroy</b>()</p> 112 113<h2>COLOPHON 114<a name="COLOPHON"></a> 115</h2> 116 117 118<p style="margin-left:11%; margin-top: 1em">This page is 119part of mOS release 0.3 <i>docs</i> section. A description 120of the project, and information about reporting bugs, can be 121found at http://mos.kaist.edu/.</p> 122<hr> 123</body> 124</html> 125