]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/intro.9
ofw_bus_is_compatible(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / share / man / man9 / intro.9
1 .\" Copyright (c) 1983, 1991, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\" $FreeBSD$
29 .\"
30 .Dd December 13, 1995
31 .Dt INTRO 9
32 .Os
33 .Sh NAME
34 .Nm intro
35 .Nd "introduction to system kernel interfaces"
36 .Sh DESCRIPTION
37 This section contains information about the interfaces and
38 subroutines in the kernel.
39 .Sh PROTOTYPES ANSI-C AND ALL THAT
40 Yes please.
41 .Pp
42 We would like all code to be fully prototyped.
43 .Pp
44 If your code compiles cleanly with
45 .Nm cc
46 .Ar -Wall
47 we would feel happy about it.
48 It is important to understand that this is not a question of just shutting up
49 .Nm cc ,
50 it is a question about avoiding the things it complains about.
51 To put it bluntly, do not hide the problem by casting and other
52 obfuscating practices, solve the problem.
53 .Sh INDENTATION AND STYLE
54 Believe it or not, there actually exists a guide for indentation and style.
55 It is not generally applied though.
56 .Pp
57 We would appreciate if people would pay attention to it, and at least not
58 violate it blatantly.
59 .Pp
60 We do not mind it too badly if you have your own style, but please make
61 sure we can read it too.
62 .Pp
63 Please take time to read
64 .Xr style 9
65 for more information.
66 .Sh NAMING THINGS
67 Some general rules exist:
68 .Bl -enum
69 .It
70 If a function is meant as a debugging aid in DDB, it should be enclosed
71 in
72 .Bd -literal -offset indent
73 #ifdef DDB
74
75 #endif /* DDB */
76 .Ed
77 .Pp
78 And the name of the procedure should start with the prefix
79 .Li DDB_
80 to clearly identify the procedure as a debugger routine.
81 .El
82 .Sh SCOPE OF SYMBOLS
83 It is important to carefully consider the scope of symbols in the kernel.
84 The default is to make everything static, unless some reason requires
85 the opposite.
86 .Pp
87 There are several reasons for this policy,
88 the main one is that the kernel is one monolithic name-space,
89 and pollution is not a good idea here either.
90 .Pp
91 For device drivers and other modules that do not add new internal interfaces
92 to the kernel, the entire source should be in one file if possible.
93 That way all symbols can be made static.
94 .Pp
95 If for some reason a module is split over multiple source files, then try
96 to split the module along some major fault-line and consider using the
97 number of global symbols as your guide.
98 The fewer the better.
99 .Sh SEE ALSO
100 .Xr style 9
101 .Sh HISTORY
102 The
103 .Nm
104 section manual page appeared in
105 .Fx 2.2 .