1181834Sroberto<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2181834Sroberto 3181834Sroberto<html> 4181834Sroberto 5181834Sroberto <head> 6181834Sroberto <title>Porting Hints</title> 7181834Sroberto <link href="scripts/style.css" type="text/css" rel="stylesheet"> 8181834Sroberto </head> 9181834Sroberto 10181834Sroberto <body> 11181834Sroberto <h3>Porting Hints</h3> 12181834Sroberto <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> 13181834Sroberto <p>Porting Dorothy in Oz 14181834Sroberto </p> 15181834Sroberto <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> 16181834Sroberto <br clear="left"> 17181834Sroberto <hr> 18181834Sroberto <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> 19181834Sroberto <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> 20181834Sroberto <p>These are the rules so that older bsd systems and the POSIX standard system can coexist together.</p> 21181834Sroberto <ol> 22181834Sroberto <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>. 23181834Sroberto <li>Always use POSIX definition of strings. Include <tt>"ntp_string.h"</tt> instead of <tt><string.h></tt>. 24181834Sroberto <li>Always include <tt>"ntp_malloc.h"</tt> if you use <tt>malloc</tt>. 25181834Sroberto <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. 26181834Sroberto <li>Always include <tt>"ntp_if.h"</tt> instead of <tt><net/if.h></tt>. 27181834Sroberto <li>Always include <tt>"ntp_stdlib.h"</tt> instead of <tt><stdlib.h></tt>. 28181834Sroberto <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. 29181834Sroberto <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. 30181834Sroberto <li>Don't define a include file by the same name as a system include file. 31181834Sroberto </ol> 32181834Sroberto <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> 33181834Sroberto <p>See <tt>include/ntp_machines.h</tt> for the various compile time options.</p> 34181834Sroberto <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> 35181834Sroberto <p>Good luck.</p> 36181834Sroberto <hr> 37181834Sroberto <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script> 38181834Sroberto </body> 39181834Sroberto 40181834Sroberto</html>