4 * Collect all machine dependent idiosyncrasies in one place.
6 * The functionality formerly in this file is mostly handled by
13 #ifdef HAVE_SYS_TIME_H
14 # include <sys/time.h>
18 #include "ntp_proto.h"
24 The per-system SYS_* #defins ARE NO LONGER USED, with the temporary
25 exception of SYS_WINNT.
27 If you find a hunk of code that is bracketed by a SYS_* macro and you
28 *know* that it is still needed, please let us know. In many cases the
29 code fragment is now handled somewhere else by autoconf choices.
35 HOW TO GET IP INTERFACE INFORMATION
37 Some UNIX V.4 machines implement a sockets library on top of
38 streams. For these systems, you must use send the SIOCGIFCONF down
39 the stream in an I_STR ioctl. This ususally also implies
40 USE_STREAMS_DEVICE FOR IF_CONFIG. Dell UNIX is a notable exception.
42 WHAT DOES IOCTL(SIOCGIFCONF) RETURN IN THE BUFFER
44 UNIX V.4 machines implement a sockets library on top of streams.
45 When requesting the IP interface configuration with an ioctl(2) calll,
46 an array of ifreq structures are placed in the provided buffer. Some
47 implementations also place the length of the buffer information in
48 the first integer position of the buffer.
50 SIZE_RETURNED_IN_BUFFER - size integer is in the buffer
52 WILL IOCTL(SIOCGIFCONF) WORK ON A SOCKET
54 Some UNIX V.4 machines do not appear to support ioctl() requests for the
55 IP interface configuration on a socket. They appear to require the use
56 of the streams device instead.
58 USE_STREAMS_DEVICE_FOR_IF_CONFIG - use the /dev/ip device for configuration
62 DOSYNCTODR - Resync TODR clock every hour.
63 RETSIGTYPE - Define signal function type.
64 NO_SIGNED_CHAR_DECL - No "signed char" see include/ntp.h
65 LOCK_PROCESS - Have plock.
68 int ntp_set_tod (struct timeval *tvp, void *tzp);
70 /*casey Tue May 27 15:45:25 SAT 1997*/
73 /* casey's new defines */
74 #define NO_MAIN_ALLOWED 1
78 /* in vxWorks we use FIONBIO, but the others are defined for old systems, so
79 * all hell breaks loose if we leave them defined we define USE_FIONBIO to
80 * undefine O_NONBLOCK FNDELAY O_NDELAY where necessary.
83 /* end my new defines */
85 #define TIMEOFDAY 0x0 /* system wide realtime clock */
86 #define HAVE_GETCLOCK 1 /* configure does not set this ... */
87 #define HAVE_NO_NICE 1 /* configure does not set this ... */
88 #define HAVE_RANDOM 1 /* configure does not set this ... */
89 #define HAVE_SRANDOM 1 /* configure does not set this ... */
91 /* vxWorks specific additions to take care of its
92 * unix (non)complicance
100 extern int sysClkRateGet ();
103 * Bob Herlien's excellent time code find it at:
104 * ftp://ftp.atd.ucar.edu/pub/vxworks/vx/usrTime.shar
105 * I would recommend this instead of clock_[g|s]ettime() plus you get
106 * adjtime() too ... casey
109 extern int gettimeofday ( struct timeval *tp, struct timezone *tzp );
110 extern int settimeofday (struct timeval *, struct timezone *);
111 extern int adjtime ( struct timeval *delta, struct timeval *olddelta );
115 extern void sleep (int seconds);
116 extern void alarm (int seconds);
120 /* this is really this */
121 #define getpid taskIdSelf
122 #define getclock clock_gettime
124 #define _getch getchar
126 /* define this away for vxWorks */
128 /* use local defines for these */
132 #endif /* SYS_VXWORKS */
135 /* These structures are needed for gethostbyname() etc... */
136 /* structures used by netdb.h */
138 char *h_name; /* official name of host */
139 char **h_aliases; /* alias list */
140 int h_addrtype; /* host address type */
141 int h_length; /* length of address */
142 char **h_addr_list; /* list of addresses from name server */
143 #define h_addr h_addr_list[0] /* address, for backward compatibility */
147 char *s_name; /* official service name */
148 char **s_aliases; /* alias list */
149 int s_port; /* port # */
150 char *s_proto; /* protocol to use */
156 struct hostent *gethostbyname (char * netnum);
157 struct hostent *gethostbyaddr (char * netnum, int size, int addr_type);
158 /* type is the protocol */
159 struct servent *getservbyname (char *name, char *type);
160 #endif /* NO_NETDB */
162 #ifdef NO_MAIN_ALLOWED
163 /* we have no main routines so lets make a plan */
164 #define CALL(callname, progname, callmain) \
165 extern int callmain (int,char**); \
166 void callname (a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) \
181 char *argv[] = {progname,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}; \
197 for (i=0; i<11;i++) \
200 argv[argc++] = x[i]; \
202 callmain(argc,argv); \
204 #endif /* NO_MAIN_ALLOWED */
205 /*casey Tue May 27 15:45:25 SAT 1997*/
208 * Here's where autoconfig starts to take over
210 #ifdef HAVE_SYS_STROPTS_H
211 # ifdef HAVE_SYS_STREAM_H
217 # if defined(NTP_POSIX_SOURCE)
218 # define RETSIGTYPE void
220 # define RETSIGTYPE int
224 #ifdef NTP_SYSCALLS_STD
225 # ifndef NTP_SYSCALL_GET
226 # define NTP_SYSCALL_GET 235
228 # ifndef NTP_SYSCALL_ADJ
229 # define NTP_SYSCALL_ADJ 236
231 #endif /* NTP_SYSCALLS_STD */
234 # include <sys/types.h>
235 # include <netinet/in.h>
239 /* missing functions that are easily renamed */
241 # define _getch getchar
243 /* special functions that require MPE-specific wrappers */
245 # define bind __ntp_mpe_bind
246 # define fcntl __ntp_mpe_fcntl
248 /* standard macros missing from MPE include files */
250 # define IN_CLASSD(i) ((((long)(i))&0xf0000000)==0xe0000000)
251 # define IN_MULTICAST IN_CLASSD
252 # define ITIMER_REAL 0
254 /* standard structures missing from MPE include files */
257 struct timeval it_interval; /* timer interval */
258 struct timeval it_value; /* current value */
261 /* various declarations to make gcc stop complaining */
263 extern int __filbuf(FILE *);
264 extern int __flsbuf(int, FILE *);
265 extern int gethostname(char *, int);
266 extern unsigned long inet_addr(char *);
267 extern char *strdup(const char *);
269 /* miscellaneous NTP macros */
271 # define HAVE_NO_NICE
275 # define HAVE_NO_NICE
277 # ifdef HAVE_SETPRIORITY
278 # define HAVE_BSD_NICE
281 # define HAVE_ATT_NICE
286 #if !defined(HAVE_ATT_NICE) \
287 && !defined(HAVE_BSD_NICE) \
288 && !defined(HAVE_NO_NICE)
289 #include "ERROR: You must define one of the HAVE_xx_NICE defines!"
293 extern time_t timegm (struct tm *);
297 #endif /* NTP_MACHINE_H */