Initial import from FreeBSD RELENG_4:
[games.git] / contrib / ntp / html / porting.htm
1 <html><head><title>
2 Porting Hints
3 </title></head><body><h3>
4 Porting Hints
5 </h3>
6
7 <img align=left src=pic/wingdorothy.gif><a href=http://www.eecis.udel.edu/~mills/pictures.htm>from <i>The
8 Wizard of Oz</i>, L. Frank Baum</a>
9
10 <p>Porting Dorothy in Oz.
11 <br clear=left><hr>
12
13 <p>NOTE: The following procedures have been replaced by GNU automake and
14 autoconfigure. This page is to be updated in the next release.
15
16 <p>Porting to a new machine or operating system ordinarily requires
17 updating the <code>./machines</code> directory and the
18 <code>./compilers</code> directories in order to define the build
19 environment and autoconfigure means. You will probably have to modify
20 the <code>ntp_machines.h</code> file and <code>"l_stdlib.h"</code> files
21 as well. The two most famous trouble spots are the I/O code in
22 <code>./ntpd/ntp_io.c</code> and the clock adjustment code in
23 <code>./ntpd/ntp_unixclock.c</code>.
24
25 <p>These are the rules so that older bsd systems and the POSIX standard
26 system can coexist together.
27
28 <ol>
29
30 <li>If you use <code>select</code> then include
31 <code>"ntp_select.h"</code>. <code>select</code> is not standard, since
32 it is very system dependent as to where it is defined. The logic to
33 include the right system dependent include file is in
34 <code>"ntp_select.h"</code>.
35
36 <p><li>Always use POSIX definition of strings. Include
37 <code>"ntp_string.h"</code> instead of <code>&lt;string.h&gt;</code>.
38
39 <p><li>Always include <code>"ntp_malloc.h"</code> if you use
40 <code>malloc</code>.
41
42 <p><li>Always include <code>"ntp_io.h"</code> instead of
43 <code>&lt;sys/file.h&gt;</code> or <code>&lt;fnctl.h&gt;</code> to get
44 <code>O_*</code> flags.
45
46 <p><li>Always include <code>"ntp_if.h"</code> instead of
47 <code>&lt;net/if.h&gt;</code>.
48
49 <p><li>Always include <code>"ntp_stdlib.h"</code> instead of
50 <code>&lt;stdlib.h&gt;</code>.
51
52 <p><li>Define any special defines needed for a system in
53 <code>./include/ntp_machine.h</code> based on system identifier. This
54 file is included by the <code>"ntp_types.h"</code> file and should
55 always be placed first after the <code>&lt;&gt;</code> defines.
56
57 <p><li>Define any special library prototypes left over from the system
58 library and include files in the <code>"l_stdlib.h"</code> file. This
59 file is included by the <code>"ntp_stdlib.h"</code> file and should
60 ordinarily be placed last in the includes list.
61
62 <p><li>Don't define a include file by the same name as a system include
63 file.
64
65 </ol>
66
67 <p><code>"l_stdlib.h"</code> can contain any extra definitions that are
68 needed so that <code>gcc</code> will shut up. They should be controlled
69 by a system identifier and there should be a separate section for each
70 system. Really this will make it easier to maintain.
71
72 <p>See <code>include/ntp_machines.h</code> for the various compile time
73 options.
74
75 <p>When you are satisfied the port works and that other ports are not
76 adversely affected, please send <a href="patches.htm">patches</a> for
77 the system files you have changed, as well as any documentation that
78 should be updated, including the advice herein.
79
80 <p>Good luck.
81
82 <hr><a href=index.htm><img align=left src=pic/home.gif></a><address><a
83 href=mailto:mills@udel.edu> David L. Mills &lt;mills@udel.edu&gt;</a>
84 </address></a></body></html>