xref: /netbsd-src/share/man/man9/splraiseipl.9 (revision 533063d806136325a35058ed9130f2894146057b)
1.\"	$NetBSD: splraiseipl.9,v 1.9 2018/02/08 09:03:23 dholland Exp $
2.\"
3.\" Copyright (c)2006 YAMAMOTO Takashi,
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" ------------------------------------------------------------
28.Dd July 9, 2015
29.Dt SPLRAISEIPL 9
30.Os
31.\" ------------------------------------------------------------
32.Sh NAME
33.Nm splraiseipl
34.Nd raise the system priority level
35.\" ------------------------------------------------------------
36.Sh SYNOPSIS
37.In sys/intr.h
38.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39.Ft int
40.Fn splraiseipl \
41"ipl_cookie_t icookie"
42.\" ------------------------------------------------------------
43.Sh DESCRIPTION
44.Fn splraiseipl
45raises the system priority level to the level specified by
46.Fa icookie .
47.Fa icookie
48should be a value returned by
49.Fn makeiplcookie .
50.Pp
51In general, device drivers should not make use of this interface.
52To ensure correct synchronization, device drivers should use the
53.Xr condvar 9 ,
54.Xr mutex 9 ,
55and
56.Xr rwlock 9
57interfaces.
58.Pp
59See the
60.Xr spl 9
61manual page for a description of interrupt priority levels.
62.\" ------------------------------------------------------------
63.Sh RETURN VALUES
64.Fn splraiseipl
65returns saved priority level which can be used for
66.Fn splx .
67.\" ------------------------------------------------------------
68.Sh EXAMPLES
69The following two lines are functional equivalents.
70.Bd -literal
71	s = splraiseipl(makeiplcookie(IPL_VM));
72.Ed
73.Bd -literal
74	s = splvm();
75.Ed
76.Pp
77Because
78.Fn makeiplcookie
79can be slow and is not expected to be used in a performance critical path,
80it's better to do it beforehand.
81.Bd -literal
82	initialization_code(ipl_t ipl)
83	{
84
85		ourcookie = makeiplcookie(ipl);
86	}
87
88	performance_critical_code()
89	{
90		int s;
91
92		s = splraiseipl(ourcookie);
93		do_something();
94		splx(s);
95	}
96.Ed
97.\" ------------------------------------------------------------
98.Sh SEE ALSO
99.Xr condvar 9 ,
100.Xr makeiplcookie 9 ,
101.Xr mutex 9 ,
102.Xr rwlock 9 ,
103.Xr spl 9
104