You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Wilfredo Sanchez <ws...@apple.com> on 1998/06/26 06:05:36 UTC
[PATCH] (Take II) Rhapsody port
The following patches are system-specific patches which are needed to build Apache 1.3.0 on Rhapsody. Of note:
- Changes to Configure and GuessOS to recognize Rhapsody.
- The change to httpd_main.c to not use __attribute__((noreturn)) on
Rhapsody or OpenStep/NeXTStep, since our gcc doesn't implement it.
- Use of __private_extern__. This is #defined to nothing for other than
Rhapsody or OpenStep systems. This tells the dynamic linker that a
symbol is locally scoped to the current library or executable (private,
not exported) and is needed in cases where a dylib you are using contains
symbols which conflict with your code (eg. regex routines in the System
framework). This fix allows us to build with the LD_PREBIND environment
variable set, which tells the linker to "prebind" symbols in your binary
at compile time. Assuming the dylib doesn't change underneath you, this
is a big launch-time optimization. (dyld does so the right thing and
ignores prebinding if your dylib changes, but you loose the optimization,
of course.) The only dylib currently used by Apache is the System
framework (contains the BSD libs).
- I didn't have time to implement DSO support. Maybe later.
- I enabled use of mmap() this time, but since we don't support MAP_ANON,
I worked around it as suggested by James H. Cloos Jr; the fix is to
add support for create/mmap/delete in setup_shared_mem. I used the
macro TMP_MAP_ANON to denote this mode.
- I left the #defines for path locations used in Rhapsody when I install
the version that's shipping with the OS (upgrade to 1.3 got approved
today, by the way). I don't actually use these, because I use APACI,
which defines these, so I have to specify this at build time. But they
would be used by old-style Configure and may be a good reference if
you care about what I did in the "standard" installed version. This
sorta depends on the Makefile/Configure changes I sent.
-Fred
Apple Computer, Core Operating Systems Group
wsanchez@apple.com, 408.974-5174
2 Infinite Loop 302-4K, Cupertino, CA 95014
Index: CoreOS/Services/apache/apache/src/Configure
diff -u CoreOS/Services/apache/apache/src/Configure:1.1.1.4 CoreOS/Services/apache/apache/src/Configure:1.14
--- CoreOS/Services/apache/apache/src/Configure:1.1.1.4 Tue Jun 16 08:35:26 1998
+++ CoreOS/Services/apache/apache/src/Configure Sun Jun 21 19:28:35 1998
@@ -489,6 +489,11 @@
RANLIB="sleep 5; /bin/ranlib"
# ranlib on most NeXTs sets the time wrong. 5 secs wait does much good
;;
+ *-apple-rhapsody*)
+ OS='Rhapsody'
+ CFLAGS="$CFLAGS -DRHAPSODY"
+ DEF_WANTHSREGEX=yes
+ ;;
*-dec-osf*)
OS='DEC OSF/1'
CFLAGS="$CFLAGS -DOSF1"
Index: CoreOS/Services/apache/apache/src/helpers/GuessOS
diff -u CoreOS/Services/apache/apache/src/helpers/GuessOS:1.1.1.3 CoreOS/Services/apache/apache/src/helpers/GuessOS:1.5
--- CoreOS/Services/apache/apache/src/helpers/GuessOS:1.1.1.3 Tue Jun 16 08:35:35 1998
+++ CoreOS/Services/apache/apache/src/helpers/GuessOS Tue Jun 16 11:10:40 1998
@@ -225,6 +225,13 @@
echo "${MACHINE}-tandem-sysv4"; exit 0;
;;
+ Rhapsody:*:*:*)
+ case "${MACHINE}" in
+ Power*) MACHINE=powerpc ;;
+ esac
+ echo "${MACHINE}-apple-rhapsody${RELEASE}"; exit 0
+ ;;
+
"RISC iX":*)
echo "arm-whatever-riscix"; exit 0;
;;
Index: CoreOS/Services/apache/apache/src/include/conf.h
diff -u CoreOS/Services/apache/apache/src/include/conf.h:1.1.1.1 CoreOS/Services/apache/apache/src/include/conf.h:1.5
--- CoreOS/Services/apache/apache/src/include/conf.h:1.1.1.1 Tue Jun 16 08:35:37 1998
+++ CoreOS/Services/apache/apache/src/include/conf.h Thu Jun 25 11:16:56 1998
@@ -362,6 +362,70 @@
#define NO_USE_SIGACTION
#define HAVE_SYSLOG 1
+#elif defined(RHAPSODY)
+#define HAVE_GMTOFF
+#define HAVE_MMAP
+#define USE_MMAP_FILES
+#define USE_MMAP_SCOREBOARD
+#define TMP_MAP_ANON
+#define HAVE_RESOURCE
+#define HAVE_SYS_RESOURCE_H
+#define HAVE_SYS_SELECT_H
+#define HAVE_SNPRINTF
+#define JMP_BUF jmp_buf
+#define USE_LONGJMP
+#define USE_FLOCK_SERIALIZED_ACCEPT
+/*
+ * If you are using APACI, these values are set at configure time.
+ * These are here as reference; the apache that is built into
+ * Rhapsody is configured with these values.
+ */
+#ifndef HTTPD_ROOT
+#define HTTPD_ROOT "/Local/Library/WebServer"
+#endif
+#ifndef DOCUMENT_LOCATION
+#define DOCUMENT_LOCATION HTTPD_ROOT "/Documents"
+#endif
+#ifndef DEFAULT_XFERLOG
+#define DEFAULT_XFERLOG "Logs/Access"
+#endif
+#ifndef DEFAULT_ERRORLOG
+#define DEFAULT_ERRORLOG "Logs/Errors"
+#endif
+#ifndef DEFAULT_PIDLOG
+#define DEFAULT_PIDLOG "Logs/Process"
+#endif
+#ifndef DEFAULT_SCOREBOARD
+#define DEFAULT_SCOREBOARD "Logs/Status"
+#endif
+#ifndef DEFAULT_LOCKFILE
+#define DEFAULT_LOCKFILE "Logs/Lock"
+#endif
+#ifndef SERVER_CONFIG_FILE
+#define SERVER_CONFIG_FILE "Configuration/Server"
+#endif
+#ifndef RESOURCE_CONFIG_FILE
+#define RESOURCE_CONFIG_FILE "Configuration/Resources"
+#endif
+#ifndef TYPES_CONFIG_FILE
+#define TYPES_CONFIG_FILE "Configuration/MIME"
+#endif
+#ifndef ACCESS_CONFIG_FILE
+#define ACCESS_CONFIG_FILE "Configuration/Access"
+#endif
+#ifndef DEFAULT_USER_DIR
+#define DEFAULT_USER_DIR "Library/Web Documents"
+#endif
+#ifndef DEFAULT_USER
+#define DEFAULT_USER "nobody"
+#endif
+#ifndef DEFAULT_GROUP
+#define DEFAULT_GROUP "nogroup"
+#endif
+#ifndef DEFAULT_PATH
+#define DEFAULT_PATH "/bin:/usr/bin:/usr/local/bin"
+#endif
+
#elif defined(LINUX)
#define HAVE_DLFCN_H 1
@@ -811,6 +875,15 @@
#endif
#ifndef CORE_EXPORT_NONSTD
#define CORE_EXPORT_NONSTD API_EXPORT_NONSTD
+#endif
+
+/* On OpenStep and Rhapsody, symbols that conflict with loaded dylibs
+ * (eg. System framework) need to be declared as private symbols with
+ * __private_extern__.
+ * For other systems, make that a no-op.
+ */
+#if !defined(RHAPSODY) && !defined(NEXT)
+#define __private_extern__
#endif
/* So that we can use inline on some critical functions, and use
Index: CoreOS/Services/apache/apache/src/main/http_main.c
diff -u CoreOS/Services/apache/apache/src/main/http_main.c:1.1.1.1 CoreOS/Services/apache/apache/src/main/http_main.c:1.4
--- CoreOS/Services/apache/apache/src/main/http_main.c:1.1.1.1 Tue Jun 16 08:35:38 1998
+++ CoreOS/Services/apache/apache/src/main/http_main.c Thu Jun 25 11:16:57 1998
@@ -412,7 +412,11 @@
static APACHE_TLS int volatile exit_after_unblock = 0;
/* a clean exit from a child with proper cleanup */
+#if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 7 || defined(NEXT) || defined(RHAPSODY)
+static void clean_child_exit(int code)
+#else
static void __attribute__((noreturn)) clean_child_exit(int code)
+#endif
{
if (pchild) {
ap_child_exit_modules(pchild, server_conf);
@@ -1591,7 +1595,7 @@
{
caddr_t m;
-#if defined(MAP_ANON) || defined(MAP_FILE)
+#if defined(MAP_ANON)
/* BSD style */
#ifdef CONVEXOS11
/*
@@ -1610,6 +1614,25 @@
m = mmap((caddr_t) 0xC0000000, &len,
PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, NOFD, 0);
}
+#elif defined(TMP_MAP_ANON)
+ {
+ char mfile[] = "/tmp/apache_shmem_XXXX";
+ int fd = mkstemp(mfile);
+ if (fd == -1) {
+ perror("open");
+ fprintf(stderr, "httpd: Could not open %s\n", mfile);
+ exit(APEXIT_INIT);
+ }
+ m = mmap((caddr_t) 0, SCOREBOARD_SIZE,
+ PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (m == (caddr_t) - 1) {
+ perror("mmap");
+ fprintf(stderr, "httpd: Could not mmap %s\n", mfile);
+ exit(APEXIT_INIT);
+ }
+ close(fd);
+ unlink(mfile);
+ }
#else
m = mmap((caddr_t) 0, SCOREBOARD_SIZE,
PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
@@ -1861,7 +1884,11 @@
}
/* a clean exit from the parent with proper cleanup */
+#ifdef RHAPSODY
+static void clean_parent_exit(int code)
+#else
static void __attribute__((noreturn)) clean_parent_exit(int code)
+#endif
{
/* Clear the pool - including any registered cleanups */
ap_destroy_pool(pconf);
Index: CoreOS/Services/apache/apache/src/regex/regcomp.c
diff -u CoreOS/Services/apache/apache/src/regex/regcomp.c:1.1.1.2 CoreOS/Services/apache/apache/src/regex/regcomp.c:1.4
--- CoreOS/Services/apache/apache/src/regex/regcomp.c:1.1.1.2 Tue Jun 16 08:35:55 1998
+++ CoreOS/Services/apache/apache/src/regex/regcomp.c Tue Jun 16 11:10:46 1998
@@ -82,6 +82,7 @@
= #define REG_PEND 0040
= #define REG_DUMP 0200
*/
+__private_extern__
API_EXPORT(int) /* 0 success, otherwise REG_something */
regcomp(preg, pattern, cflags)
regex_t *preg;
Index: CoreOS/Services/apache/apache/src/regex/regexec.c
diff -u CoreOS/Services/apache/apache/src/regex/regexec.c:1.1.1.2 CoreOS/Services/apache/apache/src/regex/regexec.c:1.4
--- CoreOS/Services/apache/apache/src/regex/regexec.c:1.1.1.2 Tue Jun 16 08:35:59 1998
+++ CoreOS/Services/apache/apache/src/regex/regexec.c Tue Jun 16 11:10:47 1998
@@ -111,6 +111,7 @@
* when choosing which matcher to call. Also, by this point the matchers
* have been prototyped.
*/
+__private_extern__
API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
regexec(preg, string, nmatch, pmatch, eflags)
const regex_t *preg;
Index: CoreOS/Services/apache/apache/src/regex/regfree.c
diff -u CoreOS/Services/apache/apache/src/regex/regfree.c:1.1.1.2 CoreOS/Services/apache/apache/src/regex/regfree.c:1.4
--- CoreOS/Services/apache/apache/src/regex/regfree.c:1.1.1.2 Tue Jun 16 08:36:00 1998
+++ CoreOS/Services/apache/apache/src/regex/regfree.c Tue Jun 16 11:10:48 1998
@@ -10,6 +10,7 @@
- regfree - free everything
= API_EXPORT(void) regfree(regex_t *);
*/
+__private_extern__
API_EXPORT(void)
regfree(preg)
regex_t *preg;
Re: [PATCH] (Take II) Rhapsody port
Posted by Alexei Kosut <ak...@leland.Stanford.EDU>.
On Thu, 25 Jun 1998, Wilfredo Sanchez wrote:
> The following patches are system-specific patches which are needed to build Apache 1.3.0 on Rhapsody. Of note:
>
> - Changes to Configure and GuessOS to recognize Rhapsody.
>
> - The change to httpd_main.c to not use __attribute__((noreturn)) on
> Rhapsody or OpenStep/NeXTStep, since our gcc doesn't implement it.
I think you may have missed Dean's point here - you only need to add "||
RHAPSODY" to line 845 of conf.h, and any uses of __attribute__ will be
eliminated by the preprocessor. That's simpler than adding each case in
everywhere (and redundent).
Other than that, the patch looks good. I haven't tested it, not having a
Rhapsody machine to test on (does the latest release work on Alchemy
motherboards yet? Maybe I should look into it), but it looks all right.
I'd like to see Rhapsody support in 1.3.1, if possible.
-- Alexei Kosut <ak...@stanford.edu> <http://www.stanford.edu/~akosut/>
Stanford University, Class of 2001 * Apache <http://www.apache.org> *