1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
6 <title>Porting Hints
</title>
7 <link href=
"scripts/style.css" type=
"text/css" rel=
"stylesheet">
11 <h3>Porting Hints
</h3>
12 <p>Porting Dorothy in Oz
14 <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>
17 <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>
18 <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>"l_stdlib.h
"</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>
19 <p>These are the rules so that older bsd systems and the POSIX standard system can coexist together.
</p>
21 <li>If you use
<tt>select
</tt> then include
<tt>"ntp_select.h
"</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>"ntp_select.h
"</tt>.
22 <li>Always use POSIX definition of strings. Include
<tt>"ntp_string.h
"</tt> instead of
<tt><string.h
></tt>.
23 <li>Always include
<tt>"ntp_malloc.h
"</tt> if you use
<tt>malloc
</tt>.
24 <li>Always include
<tt>"ntp_io.h
"</tt> instead of
<tt><sys/file.h
></tt> or
<tt><fnctl.h
></tt> to get
<tt>O_*
</tt> flags.
25 <li>Always include
<tt>"ntp_if.h
"</tt> instead of
<tt><net/if.h
></tt>.
26 <li>Always include
<tt>"ntp_stdlib.h
"</tt> instead of
<tt><stdlib.h
></tt>.
27 <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>"ntp_types.h
"</tt> file and should always be placed first after the
<tt><></tt> defines.
28 <li>Define any special library prototypes left over from the system library and include files in the
<tt>"l_stdlib.h
"</tt> file. This file is included by the
<tt>"ntp_stdlib.h
"</tt> file and should ordinarily be placed last in the includes list.
29 <li>Don't define a include file by the same name as a system include file.
31 <p><tt>"l_stdlib.h
"</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>
32 <p>See
<tt>include/ntp_machines.h
</tt> for the various compile time options.
</p>
33 <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>
36 <script type=
"text/javascript" language=
"javascript" src=
"scripts/footer.txt"></script>