summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/html/porting.html
blob: 44db2ab289e84f763af444f14a196c098e1bb09b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

    <head>
        <title>Porting Hints</title>
        <link href="scripts/style.css" type="text/css" rel="stylesheet">
    </head>

    <body>
        <h3>Porting Hints</h3>
        <img src="pic/wingdorothy.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>The Wizard of Oz</i>, L. Frank Baum</a>
        <p>Porting Dorothy in Oz
        </p>
        <p>Last update: <csobj format="ShortTime" h="24" locale="00000409" region="0" t="DateTime" w="50">20:17</csobj> UTC <csobj format="LongDate" h="24" locale="00000409" region="0" t="DateTime" w="257">Monday, December 02, 2002</csobj></p>
        <br clear="left">
        <hr>
        <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>
        <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>
        <p>These are the rules so that older bsd systems and the POSIX standard system can coexist together.</p>
        <ol>
            <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>.
            <li>Always use POSIX definition of strings. Include <tt>&quot;ntp_string.h&quot;</tt> instead of <tt>&lt;string.h&gt;</tt>.
            <li>Always include <tt>&quot;ntp_malloc.h&quot;</tt> if you use <tt>malloc</tt>.
            <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.
            <li>Always include <tt>&quot;ntp_if.h&quot;</tt> instead of <tt>&lt;net/if.h&gt;</tt>.
            <li>Always include <tt>&quot;ntp_stdlib.h&quot;</tt> instead of <tt>&lt;stdlib.h&gt;</tt>.
            <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.
            <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.
            <li>Don't define a include file by the same name as a system include file.
        </ol>
        <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>
        <p>See <tt>include/ntp_machines.h</tt> for the various compile time options.</p>
        <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>
        <p>Good luck.</p>
        <hr>
        <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
    </body>

</html>
OpenPOWER on IntegriCloud