1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
<table class="head">
<tr>
<td class="head-ltitle">SYSCALL_HELPER_REGISTER(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">SYSCALL_HELPER_REGISTER(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">syscall_helper_register</code>,
<code class="Nm">syscall_helper_unregister</code> —
<span class="Nd">kernel syscall registration routines</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">sys/sysent.h</a>></code></p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">syscall_helper_register</code>(<var class="Fa" style="white-space: nowrap;">struct
syscall_helper_data *sd</var>,
<var class="Fa" style="white-space: nowrap;">int flags</var>);</p>
<p class="Pp"><var class="Ft">int</var>
<br/>
<code class="Fn">syscall_helper_unregister</code>(<var class="Fa" style="white-space: nowrap;">struct
syscall_helper_data *sd</var>);</p>
<section class="Ss">
<h2 class="Ss" id="INITIALIZER_MACROS"><a class="permalink" href="#INITIALIZER_MACROS">INITIALIZER
MACROS</a></h2>
<p class="Pp"><var class="Ft">struct syscall_helper_data</var>
<br/>
<code class="Fn">SYSCALL_INIT_HELPER</code>(<var class="Fa" style="white-space: nowrap;">syscallname</var>);</p>
<p class="Pp"><var class="Ft">struct syscall_helper_data</var>
<br/>
<code class="Fn">SYSCALL_INIT_HELPER_F</code>(<var class="Fa" style="white-space: nowrap;">syscallname</var>,
<var class="Fa" style="white-space: nowrap;">int flags</var>);</p>
</section>
<section class="Ss">
<h2 class="Ss" id="COMPATIBILITY_INITIALIZER_MACROS"><a class="permalink" href="#COMPATIBILITY_INITIALIZER_MACROS">COMPATIBILITY
INITIALIZER MACROS</a></h2>
<p class="Pp"><var class="Ft">struct syscall_helper_data</var>
<br/>
<code class="Fn">SYSCALL_INIT_HELPER_COMPAT</code>(<var class="Fa" style="white-space: nowrap;">syscallname</var>);</p>
<p class="Pp"><var class="Ft">struct syscall_helper_data</var>
<br/>
<code class="Fn">SYSCALL_INIT_HELPER_COMPAT_F</code>(<var class="Fa" style="white-space: nowrap;">syscallname</var>,
<var class="Fa" style="white-space: nowrap;">int flags</var>);</p>
</section>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The
<a class="permalink" href="#syscall_helper_register"><code class="Fn" id="syscall_helper_register">syscall_helper_register</code></a>()
registers a system call. This function takes the structure
<var class="Va">struct syscall_helper_data sd</var>, which specifies the
parameters for syscall registration:</p>
<p class="Pp"></p>
<div class="Bd Bd-indent Li">
<pre>struct syscall_helper_data {
struct sysent new_sysent;
struct sysent old_sysent;
int syscall_no;
int registered;
};</pre>
</div>
<p class="Pp" id="syscall_helper_register~2">The only valid flag for the
<var class="Fa">flags</var> argument to
<a class="permalink" href="#syscall_helper_register~2"><code class="Fn">syscall_helper_register</code></a>()
is <code class="Dv">SY_THR_STATIC</code>. This flag prevents the syscall
from being unregistered.</p>
<p class="Pp" id="SYSCALL_INIT_HELPER*">Before use, the structure must be
initialized with one of the
<a class="permalink" href="#SYSCALL_INIT_HELPER*"><code class="Fn">SYSCALL_INIT_HELPER*</code></a>()
macros. In new code, syscall implementation functions shall be named
<a class="permalink" href="#sys_syscallname"><code class="Fn" id="sys_syscallname">sys_syscallname</code></a>()
and the regular macros shall be used.</p>
<p class="Pp">For legacy syscall functions named without "sys_"
prefixes, the "COMPAT" versions of the macros may be used.</p>
<p class="Pp">The only valid flag for the <var class="Fa">flags</var> argument
to the "F" variants of the initializer macros is
<code class="Dv">SYF_CAPENABLED</code>. This flag indicates that the syscall
is allowed in capability mode.</p>
<p class="Pp" id="syscall_helper_unregister">The
<a class="permalink" href="#syscall_helper_unregister"><code class="Fn">syscall_helper_unregister</code></a>()
unregisters a system call. This function takes the same structure
<var class="Va">struct syscall_helper_data sd</var> that was previously
initialized in the manner described above and used in a successful
invocation of <code class="Fn">syscall_helper_register</code>().</p>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
VALUES</a></h1>
<p class="Pp">If successful, <code class="Fn">syscall_helper_register</code>()
and <code class="Fn">syscall_helper_unregister</code>() will return 0.
Otherwise, they will return an error.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp">The <code class="Fn">syscall_helper_register</code>() call will
fail and the syscall will not be registered if:</p>
<dl class="Bl-tag">
<dt id="EINVAL">[<a class="permalink" href="#EINVAL"><code class="Er">EINVAL</code></a>]</dt>
<dd>The <var class="Fa">flags</var> argument contained a value other than
<code class="Dv">SY_THR_STATIC</code>.</dd>
<dt id="EINVAL~2">[<a class="permalink" href="#EINVAL~2"><code class="Er">EINVAL</code></a>]</dt>
<dd>The specified syscall number, <code class="Dv">sd.syscall_no</code>
(<code class="Dv">SYS_syscallname</code>), was outside of the valid range
of system call numbers (zero through
<code class="Dv">SYS_MAXSYSCALL</code>).</dd>
<dt id="ENFILE">[<a class="permalink" href="#ENFILE"><code class="Er">ENFILE</code></a>]</dt>
<dd>The system call table does not have any available slots.</dd>
<dt id="EEXIST">[<a class="permalink" href="#EEXIST"><code class="Er">EEXIST</code></a>]</dt>
<dd>The specified syscall number, <code class="Dv">sd.syscall_no</code>
(<code class="Dv">SYS_syscallname</code>), was already in use.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
ALSO</a></h1>
<p class="Pp"><a class="Xr">SYSCALL_MODULE(9)</a></p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">February 10, 2018</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|