10786f79cSPoul-Henning Kamp.\" Copyright (c) 1983, 1991, 1993 20786f79cSPoul-Henning Kamp.\" The Regents of the University of California. All rights reserved. 30786f79cSPoul-Henning Kamp.\" 40786f79cSPoul-Henning Kamp.\" Redistribution and use in source and binary forms, with or without 50786f79cSPoul-Henning Kamp.\" modification, are permitted provided that the following conditions 60786f79cSPoul-Henning Kamp.\" are met: 70786f79cSPoul-Henning Kamp.\" 1. Redistributions of source code must retain the above copyright 80786f79cSPoul-Henning Kamp.\" notice, this list of conditions and the following disclaimer. 90786f79cSPoul-Henning Kamp.\" 2. Redistributions in binary form must reproduce the above copyright 100786f79cSPoul-Henning Kamp.\" notice, this list of conditions and the following disclaimer in the 110786f79cSPoul-Henning Kamp.\" documentation and/or other materials provided with the distribution. 120786f79cSPoul-Henning Kamp.\" 3. All advertising materials mentioning features or use of this software 130786f79cSPoul-Henning Kamp.\" must display the following acknowledgement: 140786f79cSPoul-Henning Kamp.\" This product includes software developed by the University of 150786f79cSPoul-Henning Kamp.\" California, Berkeley and its contributors. 160786f79cSPoul-Henning Kamp.\" 4. Neither the name of the University nor the names of its contributors 170786f79cSPoul-Henning Kamp.\" may be used to endorse or promote products derived from this software 180786f79cSPoul-Henning Kamp.\" without specific prior written permission. 190786f79cSPoul-Henning Kamp.\" 200786f79cSPoul-Henning Kamp.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 210786f79cSPoul-Henning Kamp.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 220786f79cSPoul-Henning Kamp.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 230786f79cSPoul-Henning Kamp.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 240786f79cSPoul-Henning Kamp.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 250786f79cSPoul-Henning Kamp.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 260786f79cSPoul-Henning Kamp.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 270786f79cSPoul-Henning Kamp.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 280786f79cSPoul-Henning Kamp.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 290786f79cSPoul-Henning Kamp.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 300786f79cSPoul-Henning Kamp.\" SUCH DAMAGE. 310786f79cSPoul-Henning Kamp.Dd December 13, 1995 320786f79cSPoul-Henning Kamp.Dt INTRO 9 330786f79cSPoul-Henning Kamp.Os FreeBSD 2.2 340786f79cSPoul-Henning Kamp.Sh NAME 350786f79cSPoul-Henning Kamp.Nm intro 360786f79cSPoul-Henning Kamp.Nd "introduction to system kernel interfaces" 370786f79cSPoul-Henning Kamp.Sh DESCRIPTION 380786f79cSPoul-Henning KampThis section contains information about the interfaces and 390786f79cSPoul-Henning Kampsubroutines in the kernel. 400786f79cSPoul-Henning Kamp.Sh PROTOTYPES ANSI-C AND ALL THAT 410786f79cSPoul-Henning KampYes please. 42aab5e1b6SMike Pritchard.Pp 430786f79cSPoul-Henning KampWe would like all code to be fully prototyped. 44aab5e1b6SMike Pritchard.Pp 450786f79cSPoul-Henning KampIf your code compiles cleanly with 460786f79cSPoul-Henning Kamp.Nm cc 470786f79cSPoul-Henning Kamp.Ar -Wall 480786f79cSPoul-Henning Kampwe would feel happy about it. 490786f79cSPoul-Henning KampIt is important to understand that this isn't a question of just shutting up 500786f79cSPoul-Henning Kamp.Nm cc , 510786f79cSPoul-Henning Kampit is a question about avoiding the things it complains about. 520786f79cSPoul-Henning KampTo put it bluntly, don't hide the problem by casting and other 530786f79cSPoul-Henning Kampobfuscating practices, solve the problem. 540786f79cSPoul-Henning Kamp.Sh INDENTATION AND STYLE 550786f79cSPoul-Henning KampBelive it or not, there actually exists a guide for indentation and style. 560786f79cSPoul-Henning KampIt isn't generally applied though. 57aab5e1b6SMike Pritchard.Pp 580786f79cSPoul-Henning KampWe would appreciate if people would pay attention to it, and at least not 590786f79cSPoul-Henning Kampviolate it blatantly. 60aab5e1b6SMike Pritchard.Pp 610786f79cSPoul-Henning KampWe don't mind it too badly if you have your own style, but please make 620786f79cSPoul-Henning Kampsure we can read it too. 63aab5e1b6SMike Pritchard.Pp 64b030a305SPoul-Henning KampPlease take time to read 65b030a305SPoul-Henning Kamp.Xr style 9 66b030a305SPoul-Henning Kampfor more information. 670786f79cSPoul-Henning Kamp.Sh NAMING THINGS 680786f79cSPoul-Henning KampSome general rules exist: 690786f79cSPoul-Henning Kamp.Bl -enum 700786f79cSPoul-Henning Kamp.It 710786f79cSPoul-Henning KampIf a function is meant as a debugging aid in DDB, it should be enclosed 720786f79cSPoul-Henning Kampin 730786f79cSPoul-Henning Kamp.Bd -literal -offset indent 740786f79cSPoul-Henning Kamp#ifdef DDB 750786f79cSPoul-Henning Kamp 760786f79cSPoul-Henning Kamp#endif /* DDB */ 770786f79cSPoul-Henning Kamp.Ed 780786f79cSPoul-Henning Kamp 794a8d0283SMike PritchardAnd the name of the procedure should start with the prefix 800786f79cSPoul-Henning Kamp.Li DDB_ 810786f79cSPoul-Henning Kampto clearly identify the procedure as a debugger routine. 820786f79cSPoul-Henning Kamp.El 830786f79cSPoul-Henning Kamp.Sh SCOPE OF SYMBOLS 840786f79cSPoul-Henning KampIt is important to carefully consider the scope of symbols in the kernel. 850786f79cSPoul-Henning KampThe default is to make everything static, unless some reason requires 860786f79cSPoul-Henning Kampthe opposite. 87aab5e1b6SMike Pritchard.Pp 880786f79cSPoul-Henning KampThere are several reasons for this policy, 890786f79cSPoul-Henning Kampthe main one is that the kernel is one monolithic name-space, 904a8d0283SMike Pritchardand pollution is not a good idea here either. 91aab5e1b6SMike Pritchard.Pp 920786f79cSPoul-Henning KampFor device drivers and other modules that don't add new internal interfaces 930786f79cSPoul-Henning Kampto the kernel, the entire source should be in one file it possible. 940786f79cSPoul-Henning KampThat way all symbols can be made static. 95aab5e1b6SMike Pritchard.Pp 960786f79cSPoul-Henning KampIf for some reason a module is split over multiple source files, then try 970786f79cSPoul-Henning Kampto split the module along some major fault-line and consider using the 980786f79cSPoul-Henning Kampnumber of global symbols as your guide. 990786f79cSPoul-Henning KampThe fewer the better. 1000786f79cSPoul-Henning Kamp.Sh HISTORY 1010786f79cSPoul-Henning KampThe 1020786f79cSPoul-Henning Kamp.Nm intro 103fe6869c2SMike Pritchardsection manual page appeared in 104fe6869c2SMike Pritchard.Fx 2.2 . 105