4 * Platform compatibility cruft.
6 * Contributed by Riccardo Facchetti <riccardo@master.oasi.gpa.it>
7 * Modify it accordingly to configure.in file. Do _not_ use it for
8 * apcupsd-specific things, just for configure.
12 * Copyright (C) 1999-2002 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
13 * Copyright (C) 1996-1999 Andre M. Hedrick <andre@suse.com>
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of version 2 of the GNU General
17 * Public License as published by the Free Software Foundation.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
24 * You should have received a copy of the GNU General Public
25 * License along with this program; if not, write to the Free
26 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
34 # define strftime(msg, max, format, tm) \
35 strncpy(msg, "time not available", max)
36 #endif /* !HAVE_STRFTIME */
42 # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
45 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
48 #ifndef HAVE_SOCKLEN_T
49 # define socklen_t unsigned int
54 # define _SEM_SEMUN_UNDEFINED 1
58 # define _SEM_SEMUN_UNDEFINED 1
61 * These defines, related to serial devices, need to be clarified for HP-UX
71 # define _SEM_SEMUN_UNDEFINED 1
75 # define _SEM_SEMUN_UNDEFINED 1
79 # define _SEM_SEMUN_UNDEFINED 1
82 #ifdef HAVE_OPENSERVER_OS
83 # define _SEM_SEMUN_UNDEFINED 1
87 # define SHUT_RDWR 2 /* for socket shutdown() calls */
91 # define SETPGRP_ARGS(x, y) /* No arguments */
93 # define SETPGRP_ARGS(x, y) x,y
96 /* If we have it, the init is not needed */
97 #ifdef HAVE_SETPROCTITLE
98 # undef init_proctitle
99 # define init_proctitle(x)
103 # define textdomain(x)
111 * For HP-UX the definition of FILENAME_MAX seems not conformant with
112 * POSIX standard. To avoid any problem we are forced to define a
113 * private macro. This accounts also for other possible problematic OSes.
114 * If none of the standard macros is defined, fall back to 256.
116 #if defined(FILENAME_MAX) && FILENAME_MAX > 255
117 # define APC_FILENAME_MAX FILENAME_MAX
118 #elif defined(PATH_MAX) && PATH_MAX > 255
119 # define APC_FILENAME_MAX PATH_MAX
120 #elif defined(MAXPATHLEN) && MAXPATHLEN > 255
121 # define APC_FILENAME_MAX MAXPATHLEN
123 # define APC_FILENAME_MAX 256
126 /* ETIME not on BSD, incl. Darwin */
128 # define ETIME ETIMEDOUT
132 * apcupsd requires SHM_RDONLY even if compiling for pthreads: the
133 * attach_ipc interface is a wrapper for both.
135 #if !defined(HAVE_SYS_SHM_H) && !defined SHM_RDONLY
136 # define SHM_RDONLY O_RDONLY
139 /* If no system localtime_r(), forward declaration of our internal substitute. */
140 #if !defined(HAVE_LOCALTIME_R)
141 extern struct tm
*localtime_r(const time_t *timep
, struct tm
*tm
);
144 /* If no system inet_pton(), forward declaration of our internal substitute. */
145 #if !defined(HAVE_INETPTON)
147 /* Define constants based on RFC 883, RFC 1034, RFC 1035 */
148 #define NS_PACKETSZ 512 /* maximum packet size */
149 #define NS_MAXDNAME 1025 /* maximum domain name */
150 #define NS_MAXCDNAME 255 /* maximum compressed domain name */
151 #define NS_MAXLABEL 63 /* maximum length of domain label */
152 #define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
153 #define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
154 #define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
155 #define NS_INT32SZ 4 /* #/bytes of data in a u_int32_t */
156 #define NS_INT16SZ 2 /* #/bytes of data in a u_int16_t */
157 #define NS_INT8SZ 1 /* #/bytes of data in a u_int8_t */
158 #define NS_INADDRSZ 4 /* IPv4 T_A */
159 #define NS_IN6ADDRSZ 16 /* IPv6 T_AAAA */
160 #define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
161 #define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
162 extern int inet_pton(int af
, const char *src
, void *dst
);
165 /* Determine if the C(++) compiler requires complete function prototype */
167 # if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
180 #endif /* _APC_CONFIG */