#endif
#if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF)
-#include <sys/param.h>
+/* #include <sys/param.h> */
#endif
/* Define one of these according to your system. */
#endif /* SUNOS_LIB_PROTOTYPES */
+/*
+ * Transition macros from old-style configuration to autoconf
+ */
+#ifndef HAVE_CONFIG_H
+
+#if !defined(NO_KILLPG) && !defined(HAVE_KILLPG)
+#define HAVE_KILLPG
+#endif
+
+#if !defined(NEED_STRDUP) && !defined(HAVE_STRDUP)
+#define HAVE_STRDUP
+#endif
+
+#if !defined(NEED_STRCASECMP) && !defined(HAVE_STRCASECMP)
+#define HAVE_STRCASECMP
+#endif
+
+#if !defined(NEED_STRNCASECMP) && !defined(HAVE_STRNCASECMP)
+#define HAVE_STRNCASECMP
+#endif
+
+#if !defined(NEED_STRSTR) && !defined(HAVE_STRSTR)
+#define HAVE_STRSTR
+#endif
+
+#if !defined(NEED_INITGROUPS) && !defined(HAVE_INITGROUPS)
+#define HAVE_INITGROUPS
+#endif
+
+#if !defined(NEED_WAITPID) && !defined(HAVE_WAITPID)
+#define HAVE_WAITPID
+#endif
+
+#if !defined(NEED_STRERROR) && !defined(HAVE_STRERROR)
+#define HAVE_STRERROR
+#endif
+
+#if !defined(NEED_DIFFTIME) && !defined(HAVE_DIFFTIME)
+#define HAVE_DIFFTIME
+#endif
+
+#if !defined(NEED_GETTIMEOFDAY) && !defined(HAVE_GETTIMEOFDAY)
+#define HAVE_GETTIMEOFDAY
+#endif
+
+#if !defined(NEED_SETSID) && !defined(HAVE_SETSID)
+#define HAVE_SETSID
+#endif
+
+#endif /* HAVE_CONFIG_H */
+
/* The assumption is that when the functions are missing,
* then there's no matching prototype available either.
* Declare what is needed exactly as the replacement routines implement it.
*/
-#ifdef NEED_STRDUP
+#ifndef HAVE_STRDUP
extern char *strdup (const char *str);
#endif
-#ifdef NEED_STRCASECMP
+#ifndef HAVE_STRCASECMP
extern int strcasecmp (const char *a, const char *b);
#endif
-#ifdef NEED_STRNCASECMP
+#ifndef HAVE_STRNCASECMP
extern int strncasecmp (const char *a, const char *b, int n);
#endif
-#ifdef NEED_INITGROUPS
+#ifndef HAVE_INITGROUPS
extern int initgroups(const char *name, gid_t basegid);
#endif
-#ifdef NEED_WAITPID
+#ifndef HAVE_WAITPID
extern int waitpid(pid_t pid, int *statusp, int options);
#endif
-#ifdef NEED_STRERROR
+#ifndef HAVE_STRERROR
extern char *strerror (int err);
#endif
-#ifdef NEED_DIFFTIME
+#ifndef HAVE_DIFFTIME
extern double difftime(time_t time1, time_t time0);
#endif
#endif
char str[MAXHOSTNAMELEN + 1];
struct hostent *hent;
-#ifndef NO_GETTIMEOFDAY
+#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
#endif
* But protecting against it is relatively cheap. We just sleep into the
* next second.
*/
-#ifdef NO_GETTIMEOFDAY
+#ifndef HAVE_GETTIMEOFDAY
sleep(1);
#else
if (gettimeofday(&tv, NULL) == -1) {
static void unique_id_child_init(server_rec *s, ap_context_t *p)
{
pid_t pid;
-#ifndef NO_GETTIMEOFDAY
+#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
#endif
* against restart problems, and a little less protection against a clock
* going backwards in time.
*/
-#ifndef NO_GETTIMEOFDAY
+#ifdef HAVE_GETTIMEOFDAY
if (gettimeofday(&tv, NULL) == -1) {
cur_unique_id.counter = 0;
}
{
cookie_log_state *cls = ap_get_module_config(r->server->module_config,
&usertrack_module);
-#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
+#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES)
clock_t mpe_times;
struct tms mpe_tms;
#elif !defined(WIN32)
dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module);
-#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
+#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES)
/* We lack gettimeofday(), so we must use time() to obtain the epoch
seconds, and then times() to obtain CPU clock ticks (milliseconds).
Combine this together to obtain a hopefully unique cookie ID. */
#define INIT_SIGLIST() /* nothing */
+#define beosd_killpg(x, y) (kill (-(x), (y)))
+
#define UNIX_DAEMON_COMMANDS \
{ "User", beosd_set_user, NULL, RSRC_CONF, TAKE1, \
"Effective user id for this server"}, \
}
RAISE_SIGSTOP(DETACH);
#endif
-#ifndef NO_SETSID
+#ifdef HAVE_SETSID
if ((pgrp = setsid()) == -1) {
perror("setsid");
ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
#ifdef SYS_SIGLIST /* platform has sys_siglist[] */
#define INIT_SIGLIST() /* nothing */
-#else /* platform has no sys_siglist[], define our own */
+#elif defined(SYS_SIGLIST_DECLARED) /* from autoconf */
+#define INIT_SIGLIST() /* nothing */
+#define SYS_SIGLIST sys_siglist
+#else
#define NEED_AP_SYS_SIGLIST
extern const char *ap_sys_siglist[NumSIG];
#define SYS_SIGLIST ap_sys_siglist
#define INIT_SIGLIST() unixd_siglist_init();
#endif /* platform has sys_siglist[] */
+#ifdef HAVE_KILLPG
+#define unixd_killpg(x, y) (killpg ((x), (y)))
+#else /* HAVE_KILLPG */
+#define unixd_killpg(x, y) (kill (-(x), (y)))
+#endif /* HAVE_KILLPG */
+
#define UNIX_DAEMON_COMMANDS \
{ "User", unixd_set_user, NULL, RSRC_CONF, TAKE1, \
"Effective user id for this server"}, \
#endif
#define CASE_BLIND_FILESYSTEM
#define NO_WRITEV
-#define NO_SETSID
#define NO_USE_SIGACTION
#define NO_TIMES
-#define NO_GETTIMEOFDAY
+/* #undef HAVE_GETTIMEOFDAY */
#define USE_LONGJMP
#define HAVE_MMAP
#define USE_MMAP_SCOREBOARD
/* Time to gracefully shut down:
* Kill child processes, tell them to call child_exit, etc...
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"killpg SIGTERM");
}
* and a SIGHUP, we may as well use the same signal, because some user
* pthreads are stealing signals from us left and right.
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"killpg SIGTERM");
}
/* Time to gracefully shut down:
* Kill child processes, tell them to call child_exit, etc...
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (beosd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"killpg SIGTERM");
}
* and a SIGHUP, we may as well use the same signal, because some user
* pthreads are stealing signals from us left and right.
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (beosd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf,
"killpg SIGTERM");
}
/* Time to gracefully shut down:
* Kill child processes, tell them to call child_exit, etc...
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
}
reclaim_child_processes(1); /* Start with SIGTERM */
* and a SIGHUP, we may as well use the same signal, because some user
* pthreads are stealing signals from us left and right.
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
}
reclaim_child_processes(1); /* Start with SIGTERM */
unsigned long my_bytes_served;
unsigned long conn_bytes;
unsigned short conn_count;
-#if defined(NO_GETTIMEOFDAY)
+#ifndef HAVE_GETTIMEOFDAY
clock_t start_time;
clock_t stop_time;
#else
void ap_time_process_request(int child_num, int status)
{
short_score *ss;
-#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
+#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES)
struct tms tms_blk;
#endif
ss = &ap_scoreboard_image->servers[child_num];
if (status == START_PREQUEST) {
-#if defined(NO_GETTIMEOFDAY)
+#if !defined(HAVE_GETTIMEOFDAY)
#ifndef NO_TIMES
if ((ss->start_time = times(&tms_blk)) == -1)
#endif /* NO_TIMES */
#endif
}
else if (status == STOP_PREQUEST) {
-#if defined(NO_GETTIMEOFDAY)
+#if !defined(HAVE_GETTIMEOFDAY)
#ifndef NO_TIMES
if ((ss->stop_time = times(&tms_blk)) == -1)
#endif
/* Time to gracefully shut down:
* Kill child processes, tell them to call child_exit, etc...
*/
- if (ap_killpg(getpgrp(), SIGTERM) < 0) {
+ if (unixd_killpg(getpgrp(), SIGTERM) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM");
}
reclaim_child_processes(1); /* Start with SIGTERM */
"SIGUSR1 received. Doing graceful restart");
/* kill off the idle ones */
- if (ap_killpg(getpgrp(), SIGUSR1) < 0) {
+ if (unixd_killpg(getpgrp(), SIGUSR1) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGUSR1");
}
#ifndef SCOREBOARD_FILE
}
else {
/* Kill 'em off */
- if (ap_killpg(getpgrp(), SIGHUP) < 0) {
+ if (unixd_killpg(getpgrp(), SIGHUP) < 0) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGHUP");
}
reclaim_child_processes(0); /* Not when just starting up */
unsigned long my_bytes_served;
unsigned long conn_bytes;
unsigned short conn_count;
-#if defined(NO_GETTIMEOFDAY)
+#if !defined(HAVE_GETTIMEOFDAY)
clock_t start_time;
clock_t stop_time;
#else
unsigned long my_bytes_served;
unsigned long conn_bytes;
unsigned short conn_count;
-#if defined(NO_GETTIMEOFDAY)
+#if !defined(HAVE_GETTIMEOFDAY)
clock_t start_time;
clock_t stop_time;
#else
void ap_time_process_request(int child_num, int status)
{
short_score *ss;
-#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES)
+#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES)
struct tms tms_blk;
#endif
ss = &ap_scoreboard_image->servers[child_num];
if (status == START_PREQUEST) {
-#if defined(NO_GETTIMEOFDAY)
+#if !defined(HAVE_GETTIMEOFDAY)
#ifndef NO_TIMES
if ((ss->start_time = times(&tms_blk)) == -1)
#endif /* NO_TIMES */
#endif
}
else if (status == STOP_PREQUEST) {
-#if defined(NO_GETTIMEOFDAY)
+#if !defined(HAVE_GETTIMEOFDAY)
#ifndef NO_TIMES
if ((ss->stop_time = times(&tms_blk)) == -1)
#endif
return (x ? 1 : 0); /* If the first character is ':', it's broken, too */
}
-#ifdef NEED_STRDUP
+#ifndef HAVE_STRDUP
char *strdup(const char *str)
{
char *sdup;
#endif
/* The following two routines were donated for SVR4 by Andreas Vogel */
-#ifdef NEED_STRCASECMP
+#ifndef HAVE_STRCASECMP
int strcasecmp(const char *a, const char *b)
{
const char *p = a;
#endif
-#ifdef NEED_STRNCASECMP
+#ifndef HAVE_STRNCASECMP
int strncasecmp(const char *a, const char *b, int n)
{
const char *p = a;
#endif
/* The following routine was donated for UTS21 by dwd@bell-labs.com */
-#ifdef NEED_STRSTR
+#ifndef HAVE_STRSTR
char *strstr(char *s1, char *s2)
{
char *p1, *p2;
}
#endif
-#ifdef NEED_INITGROUPS
+#ifndef HAVE_INITGROUPS
int initgroups(const char *name, gid_t basegid)
{
#if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) || defined(__TANDEM)
}
#endif /* def NEED_INITGROUPS */
-#ifdef NEED_WAITPID
+#ifndef HAVE_WAITPID
/* From ikluft@amdahl.com
* this is not ideal but it works for SVR3 variants
* Modified by dwd@bell-labs.com to call wait3 instead of wait because
#endif
-#ifdef NEED_STRERROR
+#ifndef HAVE_STRERROR
char *
strerror(int err)
{
}
#endif
-#if defined(NEED_DIFFTIME)
+#ifndef HAVE_DIFFTIME
double difftime(time_t time1, time_t time0)
{
return (time1 - time0);