Correct BSD License clause numbering from 1-2-4 to 1-2-3.
[dragonfly.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: src/share/man/man9/intro.9,v 1.10.2.5 2001/08/17 13:08:54 ru Exp $
29 .\" $DragonFly: src/share/man/man9/intro.9,v 1.2 2003/06/17 04:37:01 dillon Exp $
30 .\"
31 .Dd December 13, 1995
32 .Dt INTRO 9
33 .Os
34 .Sh NAME
35 .Nm intro
36 .Nd "introduction to system kernel interfaces"
37 .Sh DESCRIPTION
38 This section contains information about the interfaces and
39 subroutines in the kernel.
40 .Sh PROTOTYPES ANSI-C AND ALL THAT
41 Yes please.
42 .Pp
43 We would like all code to be fully prototyped.
44 .Pp
45 If your code compiles cleanly with
46 .Nm cc
47 .Ar -Wall
48 we would feel happy about it.
49 It is important to understand that this isn't a question of just shutting up
50 .Nm cc ,
51 it is a question about avoiding the things it complains about.
52 To put it bluntly, don't hide the problem by casting and other
53 obfuscating practices, solve the problem.
54 .Sh INDENTATION AND STYLE
55 Believe it or not, there actually exists a guide for indentation and style.
56 It isn't generally applied though.
57 .Pp
58 We would appreciate if people would pay attention to it, and at least not
59 violate it blatantly.
60 .Pp
61 We don't mind it too badly if you have your own style, but please make
62 sure we can read it too.
63 .Pp
64 Please take time to read
65 .Xr style 9
66 for more information.
67 .Sh NAMING THINGS
68 Some general rules exist:
69 .Bl -enum
70 .It
71 If a function is meant as a debugging aid in DDB, it should be enclosed
72 in
73 .Bd -literal -offset indent
74 #ifdef DDB
75
76 #endif /* DDB */
77 .Ed
78 .Pp
79 And the name of the procedure should start with the prefix
80 .Li DDB_
81 to clearly identify the procedure as a debugger routine.
82 .El
83 .Sh SCOPE OF SYMBOLS
84 It is important to carefully consider the scope of symbols in the kernel.
85 The default is to make everything static, unless some reason requires
86 the opposite.
87 .Pp
88 There are several reasons for this policy,
89 the main one is that the kernel is one monolithic name-space,
90 and pollution is not a good idea here either.
91 .Pp
92 For device drivers and other modules that don't add new internal interfaces
93 to the kernel, the entire source should be in one file if possible.
94 That way all symbols can be made static.
95 .Pp
96 If for some reason a module is split over multiple source files, then try
97 to split the module along some major fault-line and consider using the
98 number of global symbols as your guide.
99 The fewer the better.
100 .Sh SEE ALSO
101 .Xr style 9
102 .Sh HISTORY
103 The
104 .Nm
105 section manual page appeared in
106 .Fx 2.2 .