PageRenderTime 69ms CodeModel.GetById 60ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/ntp/html/build/porting.html

https://bitbucket.org/freebsd/freebsd-head/
HTML | 40 lines | 36 code | 4 blank | 0 comment | 0 complexity | 2091328889262a20a419034632a6f345 MD5 | raw file
 1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 2
 3<html>
 4
 5    <head>
 6        <title>Porting Hints</title>
 7        <link href="scripts/style.css" type="text/css" rel="stylesheet">
 8    </head>
 9
10    <body>
11        <h3>Porting Hints</h3>
12        <img src="../pic/wingdorothy.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/%7emills/pictures.html">from <i>The Wizard of Oz</i>, L. Frank Baum</a>
13        <p>Porting Dorothy in Oz
14        </p>
15        <p>Last update: <csobj format="ShortTime" h="25" locale="00000409" region="0" t="DateTime" w="99">12:56 AM</csobj> UTC <csobj format="LongDate" h="25" locale="00000409" region="0" t="DateTime" w="266">Saturday, March 20, 2004</csobj></p>
16        <br clear="left">
17        <hr>
18        <p>NOTE: The following procedures have been replaced by GNU <tt>automake</tt> and <tt>autoconfigure</tt>. This page is to be updated in the next release.</p>
19        <p>Porting to a new machine or operating system ordinarily requires updating the <tt>./machines</tt> directory and the <tt>./compilers</tt> directories in order to define the build environment and autoconfigure means. You will probably have to modify the <tt>ntp_machines.h</tt> file and <tt>&quot;l_stdlib.h&quot;</tt> files as well. The two most famous trouble spots are the I/O code in <tt>./ntpd/ntp_io.c</tt> and the clock adjustment code in <tt>./ntpd/ntp_unixclock.c</tt>.</p>
20        <p>These are the rules so that older bsd systems and the POSIX standard system can coexist together.</p>
21        <ol>
22            <li>If you use <tt>select</tt> then include <tt>&quot;ntp_select.h&quot;</tt>. <tt>select</tt> is not standard, since it is very system dependent as to where it is defined. The logic to include the right system dependent include file is in <tt>&quot;ntp_select.h&quot;</tt>.
23            <li>Always use POSIX definition of strings. Include <tt>&quot;ntp_string.h&quot;</tt> instead of <tt>&lt;string.h&gt;</tt>.
24            <li>Always include <tt>&quot;ntp_malloc.h&quot;</tt> if you use <tt>malloc</tt>.
25            <li>Always include <tt>&quot;ntp_io.h&quot;</tt> instead of <tt>&lt;sys/file.h&gt;</tt> or <tt>&lt;fnctl.h&gt;</tt> to get <tt>O_*</tt> flags.
26            <li>Always include <tt>&quot;ntp_if.h&quot;</tt> instead of <tt>&lt;net/if.h&gt;</tt>.
27            <li>Always include <tt>&quot;ntp_stdlib.h&quot;</tt> instead of <tt>&lt;stdlib.h&gt;</tt>.
28            <li>Define any special defines needed for a system in <tt>./include/ntp_machine.h</tt> based on system identifier. This file is included by the <tt>&quot;ntp_types.h&quot;</tt> file and should always be placed first after the <tt>&lt;&gt;</tt> defines.
29            <li>Define any special library prototypes left over from the system library and include files in the <tt>&quot;l_stdlib.h&quot;</tt> file. This file is included by the <tt>&quot;ntp_stdlib.h&quot;</tt> file and should ordinarily be placed last in the includes list.
30            <li>Don't define a include file by the same name as a system include file.
31        </ol>
32        <p><tt>&quot;l_stdlib.h&quot;</tt> can contain any extra definitions that are needed so that <tt>gcc</tt> will shut up. They should be controlled by a system identifier and there should be a separate section for each system. Really this will make it easier to maintain.</p>
33        <p>See <tt>include/ntp_machines.h</tt> for the various compile time options.</p>
34        <p>When you are satisfied the port works and that other ports are not adversely affected, please send <a href="patches.html">patches</a> for the system files you have changed, as well as any documentation that should be updated, including the advice herein.</p>
35        <p>Good luck.</p>
36        <hr>
37        <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
38    </body>
39
40</html>