1/* qnx.h 2 3 System dependencies for QNX... */ 4 5/* 6 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") 7 * Copyright (c) 1996-2003 by Internet Software Consortium 8 * 9 * Permission to use, copy, modify, and distribute this software for any 10 * purpose with or without fee is hereby granted, provided that the above 11 * copyright notice and this permission notice appear in all copies. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 * 21 * Internet Systems Consortium, Inc. 22 * 950 Charter Street 23 * Redwood City, CA 94063 24 * <info@isc.org> 25 * http://www.isc.org/ 26 * 27 * This software has been written for Internet Systems Consortium 28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. 29 * To learn more about Internet Systems Consortium, see 30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises, 31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see 32 * ``http://www.nominum.com''. 33 */ 34 35#include <sys/types.h> 36#include <stdlib.h> 37#include <string.h> 38#include <errno.h> 39#include <unistd.h> 40#include <setjmp.h> 41#include <limits.h> 42#include <syslog.h> 43#include <sys/select.h> 44 45#include <sys/wait.h> 46#include <signal.h> 47 48#ifdef __QNXNTO__ 49#include <sys/param.h> 50#endif 51 52#include <netdb.h> 53extern int h_errno; 54 55#include <net/if.h> 56#ifndef __QNXNTO__ 57# define INADDR_LOOPBACK ((u_long)0x7f000001) 58#endif 59 60/* Varargs stuff... */ 61#include <stdarg.h> 62#define VA_DOTDOTDOT ... 63#define va_dcl 64#define VA_start(list, last) va_start (list, last) 65 66#ifndef _PATH_DHCPD_PID 67#define _PATH_DHCPD_PID "/etc/dhcpd.pid" 68#endif 69#ifndef _PATH_DHCLIENT_PID 70#define _PATH_DHCLIENT_PID "/etc/dhclient.pid" 71#endif 72#ifndef _PATH_DHCRELAY_PID 73#define _PATH_DHCRELAY_PID "/etc/dhcrelay.pid" 74#endif 75 76#define EOL '\n' 77#define VOIDPTR void * 78 79/* Time stuff... */ 80#include <sys/time.h> 81#define TIME time_t 82#define GET_TIME(x) time ((x)) 83#define TIME_DIFF(high, low) (*(high) - *(low)) 84#define SET_TIME(x, y) (*(x) = (y)) 85#define ADD_TIME(d, s1, s2) (*(d) = *(s1) + *(s2)) 86#define SET_MAX_TIME(x) (*(x) = INT_MAX) 87 88#ifndef __QNXNTO__ 89typedef unsigned char u_int8_t; 90typedef unsigned short u_int16_t; 91typedef unsigned long u_int32_t; 92typedef signed short int16_t; 93typedef signed long int32_t; 94#endif 95 96#ifdef __QNXNTO__ 97typedef int socklen_t; 98#endif 99 100#define strcasecmp( s1, s2 ) stricmp( s1, s2 ) 101#define strncasecmp( s1, s2, n ) strnicmp( s1, s2, n ) 102#define random() rand() 103 104#define HAVE_SA_LEN 105#define BROKEN_TM_GMT 106#define USE_SOCKETS 107#undef AF_LINK 108 109#ifndef __QNXNTO__ 110# define NO_SNPRINTF 111#endif 112 113#ifdef __QNXNTO__ 114# define GET_HOST_ID_MISSING 115#endif 116 117/* 118 NOTE: to get the routing of the 255.255.255.255 broadcasts to work 119 under QNX, you need to issue the following command before starting 120 the daemon: 121 122 route add -interface 255.255.255.0 <hostname> 123 124 where <hostname> is replaced by the hostname or IP number of the 125 machine that dhcpd is running on. 126*/ 127 128#ifndef __QNXNTO__ 129# if defined (NSUPDATE) 130# error NSUPDATE is not supported on QNX at this time!! 131# endif 132#endif 133 134 135#ifdef NEED_PRAND_CONF 136#ifndef HAVE_DEV_RANDOM 137/* You should find and install the /dev/random driver */ 138 # define HAVE_DEV_RANDOM 1 139 #endif /* HAVE_DEV_RANDOM */ 140 141const char *cmds[] = { 142 "/bin/ps -a 2>&1", 143 "/bin/sin 2>&1", 144 "/sbin/arp -an 2>&1", 145 "/bin/netstat -an 2>&1", 146 "/bin/df 2>&1", 147 "/bin/sin fds 2>&1", 148 "/bin/netstat -s 2>&1", 149 "/bin/sin memory 2>&1", 150 NULL 151}; 152 153const char *dirs[] = { 154 "/tmp", 155 ".", 156 "/", 157 "/var/spool", 158 "/dev", 159 "/var/spool/mail", 160 "/home", 161 NULL 162}; 163 164const char *files[] = { 165 "/proc/ipstats", 166 "/proc/dumper", 167 "/proc/self/as", 168 "/var/log/messages", 169 NULL 170}; 171#endif /* NEED_PRAND_CONF */ 172 173