diff options
Diffstat (limited to 'contrib/ntp/include/ntp_machine.h')
-rw-r--r-- | contrib/ntp/include/ntp_machine.h | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/contrib/ntp/include/ntp_machine.h b/contrib/ntp/include/ntp_machine.h index 17026a7..65ef5be 100644 --- a/contrib/ntp/include/ntp_machine.h +++ b/contrib/ntp/include/ntp_machine.h @@ -235,29 +235,60 @@ typedef unsigned long u_long; #endif /* 0 */ /* + * Define these here for non-Windows NT systems + * SOCKET and INVALID_SOCKET are native macros + * on Windows NT and since they have different + * requirements we use them in the code and + * make them macros for everyone else + */ +#ifndef SYS_WINNT +# define SOCKET int +# define INVALID_SOCKET -1 +# define closesocket close +#endif +/* * Windows NT */ #if defined(SYS_WINNT) # if !defined(HAVE_CONFIG_H) || !defined(__config) - error "NT requires config.h to be included" +# include <config.h> # endif /* HAVE_CONFIG_H) */ +# include <windows.h> +# include <ws2tcpip.h> +# include <winsock2.h> # define ifreq _INTERFACE_INFO # define ifr_flags iiFlags # define ifr_addr iiAddress.AddressIn # define ifr_broadaddr iiBroadcastAddress.AddressIn # define ifr_mask iiNetmask.AddressIn +# define zz_family sin_family +# define S_IFREG _S_IFREG +# define stat _stat # define isascii __isascii # define isatty _isatty # define mktemp _mktemp -# if 0 -# define getpid GetCurrentProcessId -# endif -# include <windows.h> -# include <ws2tcpip.h> +# define unlink _unlink +# define fileno _fileno +# define write _write +# define vsnprintf _vsnprintf +# define snprintf _snprintf +#ifndef close +# define close _close +#endif # undef interface +# include <process.h> +#define getpid _getpid +/* + * Defining registers are not a good idea on Windows + * This gets rid of the usage + */ +#ifndef register +# define register +#endif typedef char *caddr_t; +# define vsnprintf _vsnprintf #endif /* SYS_WINNT */ int ntp_set_tod P((struct timeval *tvp, void *tzp)); @@ -518,6 +549,10 @@ extern char *strdup(const char *); # undef HAVE_SYSV_TTYS #endif +#ifndef HAVE_TIMEGM +extern time_t timegm P((struct tm *)); +#endif + #ifdef HAVE_SYSV_TTYS # undef HAVE_BSD_TTYS #endif @@ -537,8 +572,8 @@ extern char *strdup(const char *); #endif /* - * Byte order woes. The DES code is sensitive to byte order. This - * used to be resolved by calling ntohl() and htonl() to swap things + * Byte order woes. + * This used to be resolved by calling ntohl() and htonl() to swap things * around, but this turned out to be quite costly on Vaxes where those * things are actual functions. The code now straightens out byte * order troubles on its own, with no performance penalty for little |