You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Alexei Kosut <ak...@organic.com> on 1997/08/27 10:52:33 UTC

[PATCH] Port to BeOS

So... I installed the BeOS Preview Release (available free with MacUser's
October 1997 newsstand issue - $4 isn't bad for an OS) on my Power
Mac. Interesting operating system. Buggy as hell, but interesting. And
for some reason, they don't provide a "clear" command, which annoyed me
more than anything else - I like my shell windows to be uncluttered :)

Anyhow, here's a patch that should make Apache run under BeOS. I say
"should" because I can't test it; while it compiles cleanly, the cc that
Be provides won't do the final step of building any executable larger
than 64k, unless you shell out a few hundred bucks to Metrowerks. I
understand there's a gcc port in the works, but the BeOS linker format is
proprietary, and Be isn't giving out that information. But I'm 80%
confident that with this patch, Apache will work. At least it's a
starting point. So according to dev.apache.org/project-plan, we should be
ready to release 3.0 now, right?

Even so, I must say... Apache compiles faster under BeOS on my PowerBase
180 than on any other machine I can remember using... much faster than
the SPARCstation 5 running Solaris 2.5.1 I usually use.

One note, though: Sometime recently, the #define SCOREBOARD_FILE
dissapeared from http_main.c, making all non-shared memory OSes stop
working (which is why there's a #define SCOREBOARD_FILE in the BeOS
section in the patch below - that's wrong, http_main.c should be fixed,
but I didn't feel like taking the time to go back and do that). I'm going
to sleep now (1:49 am), but someone should fix this.

The patch:

--- Configure.old	Wed Aug 27 00:07:15 1997
+++ Configure	Wed Aug 27 00:23:41 1997
@@ -480,6 +480,11 @@
 	MAKE="make"
 	DEF_WANTHSREGEX=yes
 	;;
+    *-BeOS*)
+	OS='BeOS';
+	CFLAGS="$CFLAGS -DBEOS"
+	DEF_WANTHSREGEX=yes
+	;;
     *) # default: Catch systems we don't know about
     	echo Sorry, but we cannot grok \"$PLAT\"
 	echo uname -m
--- main/conf.h.old	Wed Aug 27 00:13:26 1997
+++ main/conf.h	Wed Aug 27 01:31:33 1997
@@ -577,6 +577,21 @@
 #define NEED_STRNCASECMP
 #define NEED_STRDUP
 
+#elif defined(BEOS)
+#include <stddef.h>
+
+#define JMP_BUF sigjmp_buf
+#define NO_WRITEV
+#define NO_KILLPG
+#define NEED_INITGROUPS
+
+/* BeOS doesn't have a couple signals... redefine to close ones*/
+#define SIGBUS SIGSEGV
+#define SIGURG SIGPIPE
+
+#define isascii(c)	(!((c) & ~0177))
+#define SCOREBOARD_FILE
+
 #elif defined(WIN32)     
 /* Put your NT stuff here - Ambarish */
 
@@ -728,9 +743,9 @@
 #include <netinet/in.h>
 #include <netdb.h>
 #include <sys/ioctl.h>
-#ifndef MPE
+#if !defined(MPE) && !defined(BEOS)
 #include <arpa/inet.h>  /* for inet_ntoa */
-#endif /* ndef MPE */
+#endif
 #include <sys/wait.h>
 #include <pwd.h>
 #include <grp.h>
--- main/http_main.c.old	Wed Aug 27 00:36:40 1997
+++ main/http_main.c	Wed Aug 27 01:06:02 1997
@@ -98,7 +98,7 @@
 #endif
 #ifdef WIN32
 #include "../os/win32/getopt.h"
-#else
+#elif !defined(BEOS)
 #include <netinet/tcp.h>
 #endif
 
@@ -1946,7 +1946,7 @@
       name = ent->pw_name;
     } else name = user_name;
 
-#ifndef __EMX__ 
+#ifndef __EMX__
     /* OS/2 dosen't support groups. */
 
     /* Reset `groups' attributes. */
@@ -2306,11 +2306,14 @@
         exit(1);
     }
     one = 1;
+#ifndef BEOS
+/* BeOS does not support SO_KEEPALIVE */
     if (setsockopt(s, SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(int)) < 0) {
         log_unixerr("setsockopt", "(SO_KEEPALIVE)", NULL, server_conf);
         exit(1);
     }
 #endif
+#endif
 
     sock_disable_nagle(s);
     sock_enable_linger(s);
@@ -2334,6 +2337,7 @@
      *
      * If no size is specified, use the kernel default.
      */
+#ifndef BEOS	/* BeOS does not support SO_SNDBUF */
     if (server_conf->send_buffer_size) {
         if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
               (char *)&server_conf->send_buffer_size, sizeof(int)) < 0) {
@@ -2343,6 +2347,7 @@
 	    /* not a fatal error */
 	}
     }
+#endif
 
 #ifdef MPE
 /* MPE requires CAP=PM and GETPRIVMODE to bind to ports less than 1024 */
--- main/util.c.old	Wed Aug 27 01:12:03 1997
+++ main/util.c	Wed Aug 27 01:10:59 1997
@@ -1079,8 +1079,8 @@
 #ifdef NEED_INITGROUPS
 int initgroups(const char *name, gid_t basegid)
 {
-#if defined(QNX) || defined(MPE)
-/* QNX and MPE do not appear to support supplementary groups. */
+#if defined(QNX) || defined(MPE) || defined(BEOS)
+/* QNX, MPE and BeOS do not appear to support supplementary groups. */
 	return 0;
 #else /* ndef QNX */
   gid_t groups[NGROUPS_MAX];


-- Alexei Kosut <ak...@organic.com>


Re: [PATCH] Port to BeOS

Posted by Ben Laurie <be...@algroup.co.uk>.
Alexei Kosut wrote:
> Even so, I must say... Apache compiles faster under BeOS on my PowerBase
> 180 than on any other machine I can remember using... much faster than
> the SPARCstation 5 running Solaris 2.5.1 I usually use.

What do you expect if you insist on using a machine that the average
handheld can outgun? :-)

Though I must admit the fastest compile I get anywhere is on the Ultras
we're doing some work on at the mo...

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 994 6435|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 994 6472|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Re: [PATCH] Port to BeOS

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 2 Sep 1997, Alexei Kosut wrote:

> Well, if you moved it, it never showed up at its destination, so I added
> it back to http_main.c

Oh sorry.

> > > +#ifndef BEOS
> > > +/* BeOS does not support SO_KEEPALIVE */
> > >      if (setsockopt(s, SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(int)) < 0) {
> > >          log_unixerr("setsockopt", "(SO_KEEPALIVE)", NULL, server_conf);
> > >          exit(1);
> > >      }
> > >  #endif
> > > +#endif
> > 
> > Can you use #ifdef SO_KEEPALIVE ?
> 
> Probably. I just copied what was already there a few lines above for MPE
> and SO_REUSEADDR.

Yeah, I'm just saying it'd be nice to change this once and be done with it
... except for systems that define these symbols but don't implement them.

Dean


Re: [PATCH] Port to BeOS

Posted by Alexei Kosut <ak...@organic.com>.
On Mon, 1 Sep 1997, Dean Gaudet wrote:

[SCOREBOARD_FILE]

> I believe I moved it to httpd.h ... or maybe scoreboard.h.  I'm too zoned
> right now to check.  I remember having a reason to move it ... 

Well, if you moved it, it never showed up at its destination, so I added
it back to http_main.c

> > +#ifndef BEOS
> > +/* BeOS does not support SO_KEEPALIVE */
> >      if (setsockopt(s, SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(int)) < 0) {
> >          log_unixerr("setsockopt", "(SO_KEEPALIVE)", NULL, server_conf);
> >          exit(1);
> >      }
> >  #endif
> > +#endif
> 
> Can you use #ifdef SO_KEEPALIVE ?

Probably. I just copied what was already there a few lines above for MPE
and SO_REUSEADDR.

-- Alexei Kosut <ak...@organic.com>


Re: [PATCH] Port to BeOS

Posted by Dean Gaudet <dg...@arctic.org>.

On Wed, 27 Aug 1997, Alexei Kosut wrote:

> One note, though: Sometime recently, the #define SCOREBOARD_FILE
> dissapeared from http_main.c, making all non-shared memory OSes stop
> working (which is why there's a #define SCOREBOARD_FILE in the BeOS
> section in the patch below - that's wrong, http_main.c should be fixed,
> but I didn't feel like taking the time to go back and do that). I'm going
> to sleep now (1:49 am), but someone should fix this.

I believe I moved it to httpd.h ... or maybe scoreboard.h.  I'm too zoned
right now to check.  I remember having a reason to move it ... 

> +#ifndef BEOS
> +/* BeOS does not support SO_KEEPALIVE */
>      if (setsockopt(s, SOL_SOCKET,SO_KEEPALIVE,(char *)&one,sizeof(int)) < 0) {
>          log_unixerr("setsockopt", "(SO_KEEPALIVE)", NULL, server_conf);
>          exit(1);
>      }
>  #endif
> +#endif

Can you use #ifdef SO_KEEPALIVE ?

> +#ifndef BEOS	/* BeOS does not support SO_SNDBUF */

ditto.

> +#if defined(QNX) || defined(MPE) || defined(BEOS)
> +/* QNX, MPE and BeOS do not appear to support supplementary groups. */

Time for #define NO_SUPPLEMENTARY_GROUPS I think.

Dean