1995-12-14 10:08:31 +00:00
|
|
|
.\" Copyright (c) 1983, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
1997-03-07 02:53:37 +00:00
|
|
|
.\"
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1997-03-07 02:53:37 +00:00
|
|
|
.\"
|
1995-12-14 10:08:31 +00:00
|
|
|
.Dd December 13, 1995
|
|
|
|
.Dt INTRO 9
|
2000-12-14 11:52:05 +00:00
|
|
|
.Os FreeBSD
|
1995-12-14 10:08:31 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm intro
|
|
|
|
.Nd "introduction to system kernel interfaces"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
This section contains information about the interfaces and
|
|
|
|
subroutines in the kernel.
|
|
|
|
.Sh PROTOTYPES ANSI-C AND ALL THAT
|
|
|
|
Yes please.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
We would like all code to be fully prototyped.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
If your code compiles cleanly with
|
|
|
|
.Nm cc
|
|
|
|
.Ar -Wall
|
|
|
|
we would feel happy about it.
|
|
|
|
It is important to understand that this isn't a question of just shutting up
|
|
|
|
.Nm cc ,
|
|
|
|
it is a question about avoiding the things it complains about.
|
|
|
|
To put it bluntly, don't hide the problem by casting and other
|
|
|
|
obfuscating practices, solve the problem.
|
|
|
|
.Sh INDENTATION AND STYLE
|
1996-12-26 22:50:43 +00:00
|
|
|
Believe it or not, there actually exists a guide for indentation and style.
|
1995-12-14 10:08:31 +00:00
|
|
|
It isn't generally applied though.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
We would appreciate if people would pay attention to it, and at least not
|
|
|
|
violate it blatantly.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
We don't mind it too badly if you have your own style, but please make
|
|
|
|
sure we can read it too.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:50:27 +00:00
|
|
|
Please take time to read
|
|
|
|
.Xr style 9
|
|
|
|
for more information.
|
1995-12-14 10:08:31 +00:00
|
|
|
.Sh NAMING THINGS
|
|
|
|
Some general rules exist:
|
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
If a function is meant as a debugging aid in DDB, it should be enclosed
|
|
|
|
in
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#ifdef DDB
|
|
|
|
|
|
|
|
#endif /* DDB */
|
|
|
|
.Ed
|
2000-12-29 09:18:45 +00:00
|
|
|
.Pp
|
1996-01-30 13:52:50 +00:00
|
|
|
And the name of the procedure should start with the prefix
|
1995-12-14 10:08:31 +00:00
|
|
|
.Li DDB_
|
|
|
|
to clearly identify the procedure as a debugger routine.
|
|
|
|
.El
|
|
|
|
.Sh SCOPE OF SYMBOLS
|
|
|
|
It is important to carefully consider the scope of symbols in the kernel.
|
|
|
|
The default is to make everything static, unless some reason requires
|
|
|
|
the opposite.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
There are several reasons for this policy,
|
|
|
|
the main one is that the kernel is one monolithic name-space,
|
1996-01-30 13:52:50 +00:00
|
|
|
and pollution is not a good idea here either.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
For device drivers and other modules that don't add new internal interfaces
|
1999-05-11 01:19:34 +00:00
|
|
|
to the kernel, the entire source should be in one file if possible.
|
1995-12-14 10:08:31 +00:00
|
|
|
That way all symbols can be made static.
|
1996-12-09 07:45:59 +00:00
|
|
|
.Pp
|
1995-12-14 10:08:31 +00:00
|
|
|
If for some reason a module is split over multiple source files, then try
|
|
|
|
to split the module along some major fault-line and consider using the
|
|
|
|
number of global symbols as your guide.
|
|
|
|
The fewer the better.
|
1998-01-02 19:22:52 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr style 9
|
1995-12-14 10:08:31 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
1996-08-21 21:43:28 +00:00
|
|
|
section manual page appeared in
|
|
|
|
.Fx 2.2 .
|