[ntp:questions] Unresolved Symbol

Danny Mayer mayer at ntp.isc.org
Sun Aug 26 19:47:46 UTC 2007


Harlan Stenn wrote:
> Kevin,
> 
> First, please ask these things in a public place so others can see the
> answers.
> 
> I took the liberty of replying to this on questions@ .
> 
>> Here's the list: SetLastError, getpagesize, sys_nerr,
>> adjtime, pipe, wait, fork, sys_errlist, canonicalize_file_name_exit.
>>
>> SetLastError:
>>  you said "You should never, ever call SetLastError(). The Windows code
>> certainly does not so I don't understand where you are finding this." But in
>> /ntp-4.2.4p3/ntpd/ntp_filegen.c, it is called in line 266.  Can I just
>> comment this out?
> 
> I see from line 265 that at one time SYS_WINNT and SYS_VXWORKS expected
> to call SetLastError().  If you don't need SetLastError, you can remove
> the || defined SYS_VXWORKS from line 265 and use whatever code you want
> to make that code work.  The purpose of that section of code is to
> create a filename link.
> 

Windows doesn't need this either. It shouldn't be calling SetLastError()
at all. This is usually used in DLL's to notify a calling application
but we are not using a DLL here. The error code will already be set but
this ends up resetting it to 0 which means that there was no error. In
this case it is trying to deal with directory file links which are not
usually used on Windows. I believe that there's a way to do it, but I've
never tried. Looking at this code, we can probably comment out the whole
condition if (gen->flag & FGEN_FLAG_LINK) since I don't believe that
this flag would ever get set. I'd have to understand what ntp_config is
doing to be sure. It looks like it only gets set if you use the link
option on the filegen command based on my reading of the code and the
documentation (see monopt.html).


>> sys_nerr & sys_errlist:
>>   I don't think I will need these either, so I comment this out too. They
>> are used in /ntp-4.2.4p3/libisc/isc_strerror.c, /ntp-4.2.4p3/libisc/strerror.
>> c,
>> /ntp-4.2.4pc/libntp/strerror.c
> 
> OK, this is all in various error reporting functions.  I recommend you
> provide equivalent functionality.

You do need these. It should be available anyway on cygwin. It may
require some additional configuration if it doesn't get included.

> 
>> adjtime:
>>   "Use the one already in the code unless it doesn't work, in which case we
>> would have to address the question of why it doesn't work. Let's not include
>> additional code unnecessarily."
>> The reason why the adjtime() in /libntp/adjtime.c doesn't work is because
>> they often need to call some other varilable or function which are not
>> defined in VxWorks.
> 
> I believe I earlier posted a URL to whatever toolkit contained the
> VxWorks equivalent of adjtime.  Found it:
> 
>  http://www.borkhuis.com/vxworks/ftp.atd.ucar.edu/usrtime.shar
> 
>> pipe, wait:
>> pipe and wait are only called in makeshell.c   So I can bascially comment
>> this file right?
> 
> Sure, and I recommend you simply create stub functions instead, as that
> will make it easier to port the next release.  You can create a
> vxworkslib.c file (or something) for these.
> 
>> fork:
>> You said I do need to call fork()?? but the thing is there's no fork()
>> function implement in VxWorks. Then what do i do?
> 

Windows creates a thread instead of fork. ntpd.c only calls fork if
HAVE_DAEMON is set so maybe you could undef that macro if it is set.

Danny



More information about the questions mailing list