xref: /freebsd/share/man/man9/intro.9 (revision 0786f79c1fc7d0b7da683cf30a5168e7d8a09a75)
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. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	@(#)intro.8	8.2 (Berkeley) 12/11/93
33.\"
34.Dd December 13, 1995
35.Dt INTRO 9
36.Os FreeBSD 2.2
37.Sh NAME
38.Nm intro
39.Nd "introduction to system kernel interfaces"
40.Sh DESCRIPTION
41This section contains information about the interfaces and
42subroutines in the kernel.
43
44.Sh PROTOTYPES ANSI-C AND ALL THAT
45Yes please.
46
47We would like all code to be fully prototyped.
48
49If your code compiles cleanly with
50.Nm cc
51.Ar -Wall
52we would feel happy about it.
53It is important to understand that this isn't a question of just shutting up
54.Nm cc ,
55it is a question about avoiding the things it complains about.
56To put it bluntly, don't hide the problem by casting and other
57obfuscating practices, solve the problem.
58
59.Sh INDENTATION AND STYLE
60Belive it or not, there actually exists a guide for indentation and style.
61It isn't generally applied though.
62
63We would appreciate if people would pay attention to it, and at least not
64violate it blatantly.
65
66We don't mind it too badly if you have your own style, but please make
67sure we can read it too.
68
69In particular there are some iron-clad requirements:
70.Bl -enum -compact
71.It
72TAB stops is 8.
73.It
74All funtion names start in col 1.
75.El
76
77.Sh NAMING THINGS
78Some general rules exist:
79.Bl -enum
80.It
81If a function is meant as a debugging aid in DDB, it should be enclosed
82in
83.Bd -literal -offset indent
84#ifdef DDB
85
86#endif /* DDB */
87.Ed
88
89And the name of the procedure shoule start with the prefix
90.Li DDB_
91to clearly identify the procedure as a debugger routine.
92.El
93
94
95.Sh SCOPE OF SYMBOLS
96It is important to carefully consider the scope of symbols in the kernel.
97The default is to make everything static, unless some reason requires
98the opposite.
99
100There are several reasons for this policy,
101the main one is that the kernel is one monolithic name-space,
102and polution is not a good idea here either.
103
104For device drivers and other modules that don't add new internal interfaces
105to the kernel, the entire source should be in one file it possible.
106That way all symbols can be made static.
107
108If for some reason a module is split over multiple source files, then try
109to split the module along some major fault-line and consider using the
110number of global symbols as your guide.
111The fewer the better.
112
113.Sh HISTORY
114The
115.Nm intro
116section manual page appeared in FreeBSD 2.2
117