From: David Reid Date: Mon, 11 Oct 1999 20:25:08 +0000 (+0000) Subject: These changes allow the support programs to compile on BeOS. X-Git-Tag: 1.3.10~281 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9c5b29052fcc8b569acbbb761e3c4187f96f89d;p=thirdparty%2Fapache%2Fhttpd.git These changes allow the support programs to compile on BeOS. The biggest change is in ab.c where the functions that BeOS needs that aren't the standard format are hidden behind a new ab_* define. Tested on FreeBSD and BeOS. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83964 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/ab.c b/support/ab.c index 59cbc12cc8b..1f92ba18cd2 100644 --- a/support/ab.c +++ b/support/ab.c @@ -224,6 +224,16 @@ struct data *stats; /* date for each request */ fd_set readbits, writebits; /* bits for select */ struct sockaddr_in server; /* server addr structure */ +#ifndef BEOS +#define ab_close(s) close(s) +#define ab_read(a,b,c) read(a,b,c) +#define ab_write(a,b,c) write(a,b,c) +#else +#define ab_close(s) closesocket(s) +#define ab_read(a,b,c) recv(a,b,c,0) +#define ab_write(a,b,c) send(a,b,c,0) +#endif + /* --------------------------------------------------------- */ /* simple little function to perror and exit */ @@ -262,9 +272,9 @@ static void write_request(struct connection * c) } writev(c->fd,out, outcnt); #else - write(c->fd,request,reqlen); + ab_write(c->fd,request,reqlen); if (posting>0) { - write(c->fd,postdata,postlen); + ab_write(c->fd,postdata,postlen); totalposted += (reqlen + postlen); } #endif @@ -281,7 +291,11 @@ static void write_request(struct connection * c) static void nonblock(int fd) { int i = 1; +#ifdef BEOS + setsockopt(fd, SOL_SOCKET, SO_NONBLOCK, &i, sizeof(i)); +#else ioctl(fd, FIONBIO, &i); +#endif } /* --------------------------------------------------------- */ @@ -526,7 +540,7 @@ static void start_connect(struct connection * c) return; } else { - close(c->fd); + ab_close(c->fd); err_conn++; if (bad++ > 10) { err("\nTest aborted after 10 failures\n\n"); @@ -570,7 +584,7 @@ static void close_connection(struct connection * c) } } - close(c->fd); + ab_close(c->fd); FD_CLR(c->fd, &readbits); FD_CLR(c->fd, &writebits); @@ -589,7 +603,8 @@ static void read_connection(struct connection * c) char *part; char respcode[4]; /* 3 digits and null */ - r = read(c->fd, buffer, sizeof(buffer)); + r = ab_read(c->fd, buffer, sizeof(buffer)); + if (r == 0 || (r < 0 && errno != EAGAIN)) { good++; close_connection(c); @@ -635,7 +650,7 @@ static void read_connection(struct connection * c) return; else { /* header is in invalid or too big - close connection */ - close(c->fd); + ab_close(c->fd); if (bad++ > 10) { err("\nTest aborted after 10 failures\n\n"); } diff --git a/support/htdigest.c b/support/htdigest.c index d1fc41800fd..eb2818852f3 100644 --- a/support/htdigest.c +++ b/support/htdigest.c @@ -70,7 +70,7 @@ #include #include "ap.h" #include "ap_md5.h" -#if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) +#if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) || defined(BEOS) #include #else #include diff --git a/support/logresolve.c b/support/logresolve.c index f6436c57994..914c2ed2a44 100644 --- a/support/logresolve.c +++ b/support/logresolve.c @@ -52,6 +52,10 @@ static void cgethost(struct in_addr ipnum, char *string, int check); static int getline(char *s, int n); static void stats(FILE *output); +#ifdef BEOS +#define NO_ADDRESS NO_DATA +#endif + /* maximum line length */ #define MAXLINE 1024 @@ -99,7 +103,8 @@ struct nsrec { extern int h_errno; /* some machines don't have this in their headers */ #endif -/* largeste value for h_errno */ +/* largest value for h_errno */ + #define MAX_ERR (NO_ADDRESS) #define UNKNOWN_ERR (MAX_ERR+1) #define NO_REVERSE (MAX_ERR+2)