You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rodent of Unusual Size <CO...@PROCESS.COM> on 1997/11/13 19:02:00 UTC

[PATCH] start on libap (fixes PR#905 et alia)

    Okey, here's a start on the libap stuff.  For the moment it just
    moves ap_signal() out of http_main.c into src/ap/ap_signal.c and
    builds a library in that directory for others to use.  It also
    updates the support directory so this stuff will build.  One new
    directory, three new files.

    Look for "%<--" below to find the new-file boundaries.

    Works for me.. any thoughts on this for 1.3b3?

    #ken    P-)}

Index: Configure
===================================================================
RCS file: /export/home/cvs/apachen/src/Configure,v
retrieving revision 1.170
diff -u -r1.170 Configure
--- Configure	1997/11/08 21:47:33	1.170
+++ Configure	1997/11/13 18:55:45
@@ -26,7 +26,7 @@
 tmpfile2=$tmpfile.2
 tmpfile3=$tmpfile.3
 awkfile=$tmpfile.4
-SUBDIRS='$(OSDIR) main modules'
+SUBDIRS='$(OSDIR) main ap modules'
 
 ####################################################################
 ## Now handle any arguments, which, for now, is -file
@@ -1031,7 +1031,7 @@
 #
 # directories to create makefiles in
 #
-MAKEDIRS="support main regex $OSDIR"
+MAKEDIRS="support main ap regex $OSDIR"
 for dir in $MAKEDIRS ; do
 	echo Creating Makefile in $dir
 	cat Makefile.config $dir/Makefile.tmpl > $dir/Makefile
Index: Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/Makefile.tmpl,v
retrieving revision 1.70
diff -u -r1.70 Makefile.tmpl
--- Makefile.tmpl	1997/11/05 12:48:13	1.70
+++ Makefile.tmpl	1997/11/13 18:56:37
@@ -12,7 +12,8 @@
   modules.o \
   $(MODULES) \
   main/libmain.a \
-  $(OSDIR)/libos.a
+  $(OSDIR)/libos.a \
+  ap/libap.a
 
 .c.o:
 	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
Index: main/http_main.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
retrieving revision 1.249
diff -u -r1.249 http_main.c
--- http_main.c	1997/11/12 23:22:07	1.249
+++ http_main.c	1997/11/13 18:57:00
@@ -714,28 +714,6 @@
 static APACHE_TLS int volatile alarm_pending = 0;
 static APACHE_TLS int volatile exit_after_unblock = 0;
 
-#ifndef NO_USE_SIGACTION
-/*
- * Replace standard signal() with the more reliable sigaction equivalent
- * from W. Richard Stevens' "Advanced Programming in the UNIX Environment"
- * (the version that does not automatically restart system calls).
- */
-Sigfunc *signal(int signo, Sigfunc * func)
-{
-    struct sigaction act, oact;
-
-    act.sa_handler = func;
-    sigemptyset(&act.sa_mask);
-    act.sa_flags = 0;
-#ifdef  SA_INTERRUPT		/* SunOS */
-    act.sa_flags |= SA_INTERRUPT;
-#endif
-    if (sigaction(signo, &act, &oact) < 0)
-	return SIG_ERR;
-    return oact.sa_handler;
-}
-#endif
-
 /* a clean exit from a child with proper cleanup */
 static void __attribute__((noreturn)) clean_child_exit(int code)
 {
Index: support/Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/support/Makefile.tmpl,v
retrieving revision 1.7
diff -u -r1.7 Makefile.tmpl
--- Makefile.tmpl	1997/10/22 23:31:25	1.7
+++ Makefile.tmpl	1997/11/13 18:57:17
@@ -4,9 +4,9 @@
 # by the configure script to make the actual Makefile.
 
 CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
-LIBS=$(EXTRA_LIBS) $(LIBS1)
+LIBS=$(EXTRA_LIBS) $(LIBS1) -lap
 INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH1) $(EXTRA_INCLUDES)
-LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
+LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) -L../ap
 
 .c.o: 
 	$(CC) -c $(CFLAGS) $(INCLUDES) $<
@@ -16,16 +16,16 @@
 all: $(TARGETS)
 
 htpasswd: htpasswd.o
-	$(CC) $(CFLAGS) htpasswd.o -o htpasswd $(LIBS)
+	$(CC) $(CFLAGS) htpasswd.o -o htpasswd $(LDFLAGS) $(LIBS)
 
 htdigest: htdigest.o
-	$(CC) $(CFLAGS) htdigest.o -o htdigest $(LIBS)
+	$(CC) $(CFLAGS) htdigest.o -o htdigest $(LDFLAGS) $(LIBS)
 
 rotatelogs: rotatelogs.o
 	$(CC) $(INCLUDES) $(CFLAGS) rotatelogs.o -o rotatelogs
 
 logresolve: logresolve.o
-	$(CC) $(INCLUDES) $(CFLAGS) logresolve.o -o logresolve $(LIBS)
+	$(CC) $(INCLUDES) $(CFLAGS) logresolve.o -o logresolve $(LDFLAGS) $(LIBS)
 
 clean:
 	rm -f $(TARGETS) *.o
%<------ ap/Makefile.tmpl
CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
LIBS=$(EXTRA_LIBS) $(LIBS1)
INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH1) $(EXTRA_INCLUDES)
LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
INCDIR=../main

LIB=libap.a

OBJS=ap_signal.o

.c.o:
	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<

all: $(LIB)

clean:
	rm -f *.o *.a

$(OBJS): Makefile

$(LIB): $(OBJS)
	ar cr $(LIB) $(OBJS)

# dependencies
ap_signal.o: $(INCDIR)/httpd.h
%<------ ap/ap_signal.c
/* ====================================================================
 * Copyright (c) 1995-1997 The Apache Group.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer. 
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the Apache Group
 *    for use in the Apache HTTP server project (http://www.apache.org/)."
 *
 * 4. The names "Apache Server" and "Apache Group" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    apache@apache.org.
 *
 * 5. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the Apache Group
 *    for use in the Apache HTTP server project (http://www.apache.org/)."
 *
 * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Group and was originally based
 * on public domain software written at the National Center for
 * Supercomputing Applications, University of Illinois, Urbana-Champaign.
 * For more information on the Apache Group and the Apache HTTP server
 * project, please see <http://www.apache.org/>.
 *
 */

#include "httpd.h"

#ifndef NO_USE_SIGACTION
/*
 * Replace standard signal() with the more reliable sigaction equivalent
 * from W. Richard Stevens' "Advanced Programming in the UNIX Environment"
 * (the version that does not automatically restart system calls).
 */
Sigfunc *signal(int signo, Sigfunc * func)
{
    struct sigaction act, oact;

    act.sa_handler = func;
    sigemptyset(&act.sa_mask);
    act.sa_flags = 0;
#ifdef  SA_INTERRUPT		/* SunOS */
    act.sa_flags |= SA_INTERRUPT;
#endif
    if (sigaction(signo, &act, &oact) < 0)
	return SIG_ERR;
    return oact.sa_handler;
}
#endif
%<------ ap/.cvsignore
Makefile

Re: [PATCH] start on libap (fixes PR#905 et alia)

Posted by Dean Gaudet <dg...@arctic.org>.
Looks fine to me ... +1 untested.

Dean

On Thu, 13 Nov 1997, Rodent of Unusual Size wrote:

>     Okey, here's a start on the libap stuff.  For the moment it just
>     moves ap_signal() out of http_main.c into src/ap/ap_signal.c and
>     builds a library in that directory for others to use.  It also
>     updates the support directory so this stuff will build.  One new
>     directory, three new files.
> 
>     Look for "%<--" below to find the new-file boundaries.
> 
>     Works for me.. any thoughts on this for 1.3b3?
> 
>     #ken    P-)}
> 
> Index: Configure
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/Configure,v
> retrieving revision 1.170
> diff -u -r1.170 Configure
> --- Configure	1997/11/08 21:47:33	1.170
> +++ Configure	1997/11/13 18:55:45
> @@ -26,7 +26,7 @@
>  tmpfile2=$tmpfile.2
>  tmpfile3=$tmpfile.3
>  awkfile=$tmpfile.4
> -SUBDIRS='$(OSDIR) main modules'
> +SUBDIRS='$(OSDIR) main ap modules'
>  
>  ####################################################################
>  ## Now handle any arguments, which, for now, is -file
> @@ -1031,7 +1031,7 @@
>  #
>  # directories to create makefiles in
>  #
> -MAKEDIRS="support main regex $OSDIR"
> +MAKEDIRS="support main ap regex $OSDIR"
>  for dir in $MAKEDIRS ; do
>  	echo Creating Makefile in $dir
>  	cat Makefile.config $dir/Makefile.tmpl > $dir/Makefile
> Index: Makefile.tmpl
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/Makefile.tmpl,v
> retrieving revision 1.70
> diff -u -r1.70 Makefile.tmpl
> --- Makefile.tmpl	1997/11/05 12:48:13	1.70
> +++ Makefile.tmpl	1997/11/13 18:56:37
> @@ -12,7 +12,8 @@
>    modules.o \
>    $(MODULES) \
>    main/libmain.a \
> -  $(OSDIR)/libos.a
> +  $(OSDIR)/libos.a \
> +  ap/libap.a
>  
>  .c.o:
>  	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
> Index: main/http_main.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_main.c,v
> retrieving revision 1.249
> diff -u -r1.249 http_main.c
> --- http_main.c	1997/11/12 23:22:07	1.249
> +++ http_main.c	1997/11/13 18:57:00
> @@ -714,28 +714,6 @@
>  static APACHE_TLS int volatile alarm_pending = 0;
>  static APACHE_TLS int volatile exit_after_unblock = 0;
>  
> -#ifndef NO_USE_SIGACTION
> -/*
> - * Replace standard signal() with the more reliable sigaction equivalent
> - * from W. Richard Stevens' "Advanced Programming in the UNIX Environment"
> - * (the version that does not automatically restart system calls).
> - */
> -Sigfunc *signal(int signo, Sigfunc * func)
> -{
> -    struct sigaction act, oact;
> -
> -    act.sa_handler = func;
> -    sigemptyset(&act.sa_mask);
> -    act.sa_flags = 0;
> -#ifdef  SA_INTERRUPT		/* SunOS */
> -    act.sa_flags |= SA_INTERRUPT;
> -#endif
> -    if (sigaction(signo, &act, &oact) < 0)
> -	return SIG_ERR;
> -    return oact.sa_handler;
> -}
> -#endif
> -
>  /* a clean exit from a child with proper cleanup */
>  static void __attribute__((noreturn)) clean_child_exit(int code)
>  {
> Index: support/Makefile.tmpl
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/support/Makefile.tmpl,v
> retrieving revision 1.7
> diff -u -r1.7 Makefile.tmpl
> --- Makefile.tmpl	1997/10/22 23:31:25	1.7
> +++ Makefile.tmpl	1997/11/13 18:57:17
> @@ -4,9 +4,9 @@
>  # by the configure script to make the actual Makefile.
>  
>  CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
> -LIBS=$(EXTRA_LIBS) $(LIBS1)
> +LIBS=$(EXTRA_LIBS) $(LIBS1) -lap
>  INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH1) $(EXTRA_INCLUDES)
> -LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
> +LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) -L../ap
>  
>  .c.o: 
>  	$(CC) -c $(CFLAGS) $(INCLUDES) $<
> @@ -16,16 +16,16 @@
>  all: $(TARGETS)
>  
>  htpasswd: htpasswd.o
> -	$(CC) $(CFLAGS) htpasswd.o -o htpasswd $(LIBS)
> +	$(CC) $(CFLAGS) htpasswd.o -o htpasswd $(LDFLAGS) $(LIBS)
>  
>  htdigest: htdigest.o
> -	$(CC) $(CFLAGS) htdigest.o -o htdigest $(LIBS)
> +	$(CC) $(CFLAGS) htdigest.o -o htdigest $(LDFLAGS) $(LIBS)
>  
>  rotatelogs: rotatelogs.o
>  	$(CC) $(INCLUDES) $(CFLAGS) rotatelogs.o -o rotatelogs
>  
>  logresolve: logresolve.o
> -	$(CC) $(INCLUDES) $(CFLAGS) logresolve.o -o logresolve $(LIBS)
> +	$(CC) $(INCLUDES) $(CFLAGS) logresolve.o -o logresolve $(LDFLAGS) $(LIBS)
>  
>  clean:
>  	rm -f $(TARGETS) *.o
> %<------ ap/Makefile.tmpl
> CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
> LIBS=$(EXTRA_LIBS) $(LIBS1)
> INCLUDES=$(INCLUDES1) $(INCLUDES_DEPTH1) $(EXTRA_INCLUDES)
> LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
> INCDIR=../main
> 
> LIB=libap.a
> 
> OBJS=ap_signal.o
> 
> .c.o:
> 	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
> 
> all: $(LIB)
> 
> clean:
> 	rm -f *.o *.a
> 
> $(OBJS): Makefile
> 
> $(LIB): $(OBJS)
> 	ar cr $(LIB) $(OBJS)
> 
> # dependencies
> ap_signal.o: $(INCDIR)/httpd.h
> %<------ ap/ap_signal.c
> /* ====================================================================
>  * Copyright (c) 1995-1997 The Apache Group.  All rights reserved.
>  *
>  * Redistribution and use in source and binary forms, with or without
>  * modification, are permitted provided that the following conditions
>  * are met:
>  *
>  * 1. Redistributions of source code must retain the above copyright
>  *    notice, this list of conditions and the following disclaimer. 
>  *
>  * 2. Redistributions in binary form must reproduce the above copyright
>  *    notice, this list of conditions and the following disclaimer in
>  *    the documentation and/or other materials provided with the
>  *    distribution.
>  *
>  * 3. All advertising materials mentioning features or use of this
>  *    software must display the following acknowledgment:
>  *    "This product includes software developed by the Apache Group
>  *    for use in the Apache HTTP server project (http://www.apache.org/)."
>  *
>  * 4. The names "Apache Server" and "Apache Group" must not be used to
>  *    endorse or promote products derived from this software without
>  *    prior written permission. For written permission, please contact
>  *    apache@apache.org.
>  *
>  * 5. Redistributions of any form whatsoever must retain the following
>  *    acknowledgment:
>  *    "This product includes software developed by the Apache Group
>  *    for use in the Apache HTTP server project (http://www.apache.org/)."
>  *
>  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
>  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
>  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
>  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
>  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
>  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
>  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
>  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
>  * OF THE POSSIBILITY OF SUCH DAMAGE.
>  * ====================================================================
>  *
>  * This software consists of voluntary contributions made by many
>  * individuals on behalf of the Apache Group and was originally based
>  * on public domain software written at the National Center for
>  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
>  * For more information on the Apache Group and the Apache HTTP server
>  * project, please see <http://www.apache.org/>.
>  *
>  */
> 
> #include "httpd.h"
> 
> #ifndef NO_USE_SIGACTION
> /*
>  * Replace standard signal() with the more reliable sigaction equivalent
>  * from W. Richard Stevens' "Advanced Programming in the UNIX Environment"
>  * (the version that does not automatically restart system calls).
>  */
> Sigfunc *signal(int signo, Sigfunc * func)
> {
>     struct sigaction act, oact;
> 
>     act.sa_handler = func;
>     sigemptyset(&act.sa_mask);
>     act.sa_flags = 0;
> #ifdef  SA_INTERRUPT		/* SunOS */
>     act.sa_flags |= SA_INTERRUPT;
> #endif
>     if (sigaction(signo, &act, &oact) < 0)
> 	return SIG_ERR;
>     return oact.sa_handler;
> }
> #endif
> %<------ ap/.cvsignore
> Makefile
>