machines.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* machines.c - provide special support for peculiar architectures
*
* Real bummers unite !
*
*/
#include "ntp_stdlib.h"
#ifndef SYS_WINNT
#ifdef SYS_VXWORKS
#include "taskLib.h"
#include "sysLib.h"
#include "time.h"
#include "ntp_syslog.h"
/* some translations to the world of vxWorkings -casey */
/* first some netdb type things */
#include "ioLib.h"
#include <socket.h>
int h_errno;
{
h_errno = 0; /* we are always successful!!! */
return host1;
}
{
h_errno = 0; /* we are always successful!!! */
return host1;
}
{
return serv1;
}
/* second
* vxworks thinks it has insomnia
* we have to sleep for number of seconds
*/
#define CLKRATE sysClkRateGet()
/* I am not sure how valid the granularity is - it is from G. Eger's port */
/* On a VCOM-100, PIT gets 8 MHz clk, */
/* & it prescales by 32, thus 4 usec */
/* on mv167, granularity is 1usec anyway*/
/* To defeat rounding, set to 1 */
/* emulate unix sleep
* casey
*/
{
}
/* emulate unix alarm
* that pauses and calls SIGALRM after the seconds are up...
* so ... taskDelay() fudged for seconds should amount to the same thing.
* casey
*/
{
}
#endif /* SYS_VXWORKS */
#ifdef SYS_PTX /* Does PTX still need this? */
#include <sys/procstats.h>
int
{
/*
* hi, this is Sequents sneak path to get to a clock
* this is also the most logical syscall for such a function
*/
(struct procstats *) 0));
}
#endif /* SYS_PTX */
#if defined(HAVE_CLOCK_SETTIME) && defined(CLOCK_REALTIME)
const char *set_tod_using = "clock_settime";
/*#include <time.h> */
int
void *tzp;
{
/* Convert timeval to timespec */
}
#else /* not HAVE_CLOCK_SETTIME || not CLOCK_REALTIME */
# ifdef HAVE_SETTIMEOFDAY
const char *set_tod_using = "settimeofday";
# else /* not (HAVE_SETTIMEOFDAY || HAVE_CLOCK_SETTIME) */
# ifdef HAVE_STIME
char *set_tod_using = "stime";
int
void *tzp;
{
}
# else
# endif /* HAVE_STIME */
# endif /* not (HAVE_SETTIMEOFDAY || HAVE_CLOCK_SETTIME) */
#endif /* not HAVE_CLOCK_SETTIME */
#else /* SYS_WINNT */
#include <time.h>
#include <conio.h>
#include "ntp_syslog.h"
char * set_tod_using = "SetSystemTime";
/* Windows NT versions of gettimeofday and settimeofday
*
* ftime() has internal DayLightSavings related BUGS
* therefore switched to GetSystemTimeAsFileTime()
*/
/* 100ns intervals between 1/1/1601 and 1/1/1970 as reported by
* SystemTimeToFileTime()
*/
#define FILETIME_1970 0x019db1ded53e8000
int
{
return 0;
}
int
{
if (!SetSystemTime(&st)) {
return -1;
}
return 0;
}
#endif /* SYS_WINNT */
#if defined (SYS_WINNT) || defined (SYS_VXWORKS)
char *
{
int c, i;
static char password[32];
password[i] = c;
}
password[i] = '\0';
return password;
}
#endif /* SYS_WINNT */
#if !defined(HAVE_MEMSET) || defined(NTP_NEED_BOPS)
void
ntp_memset(a, x, c)
char *a;
int x, c;
{
while (c-- > 0)
*a++ = x;
}
#endif /*POSIX*/