blob: cedfbea526e9e96cf96f9792951a3770daa63838 (
plain)
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
|
<table class="head">
<tr>
<td class="head-ltitle">ZERO_REGION(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">ZERO_REGION(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">zero_region</code> —
<span class="Nd">Read-only region prefilled with zeroes</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/param.h</a>></code>
<br/>
<code class="In">#include <<a class="In">sys/systm.h</a>></code>
<br/>
<code class="In">#include <<a class="In">vm/vm_param.h</a>></code></p>
<p class="Pp"><var class="Vt">extern const void *zero_region</var>;</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The global variable <var class="Va">zero_region</var> points to a
read-only region prefilled with zeroes. The size of the region is specified
by the <code class="Dv">ZERO_REGION_SIZE</code> macro.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="IMPLEMENTATION_NOTES"><a class="permalink" href="#IMPLEMENTATION_NOTES">IMPLEMENTATION
NOTES</a></h1>
<p class="Pp">The region <var class="Va">zero_region</var> points to is mapped
to the same page multiple times.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
<div class="Bd Li">
<pre>/*
* This function writes zeroes to the vnode at offset 0
* with ZERO_REGION_SIZE length.
*/
static int
write_example(struct vnode *vp)
{
struct thread *td;
struct iovec aiov;
struct uio auio;
int error;
td = curthread;
aiov.iov_base = __DECONST(void *, zero_region);
aiov.iov_len = ZERO_REGION_SIZE;
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_offset = 0;
auio.uio_resid = ZERO_REGION_SIZE;
auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_WRITE;
auio.uio_td = td;
error = VOP_WRITE(vp, &auio, 0, td->td_ucred);
return (error);
}</pre>
</div>
</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">pmap(9)</a>, <a class="Xr">vm_map(9)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp">This manual page was written by <span class="An">Ka Ho Ng</span>
<<a class="Mt" href="mailto:khng@FreeBSDFoundation.org">khng@FreeBSDFoundation.org</a>>
under sponsorship from the FreeBSD Foundation.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">March 2, 2021</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|