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...@decus.org> on 1997/11/30 19:40:05 UTC

[PATCH] Part 2 of src/ap migration

    This is the next step toward moving the ap_* functions into the
    src/ap directory: ap_slack().  The patch moves the function into its
    own src/ap/ap_slack.c file (not included below).

    I wanted to do ap_snprintf(), but that's reference in a lot of the
    Win32 project files that I don't yet know how to frob.  So that can
    wait.

    #ken    P-)}

Index: src/ap/Makefile.tmpl
===================================================================
RCS file: /export/home/cvs/apachen/src/ap/Makefile.tmpl,v
retrieving revision 1.2
diff -u -r1.2 Makefile.tmpl
--- Makefile.tmpl	1997/11/16 16:23:21	1.2
+++ Makefile.tmpl	1997/11/30 18:35:32
@@ -6,7 +6,7 @@
 
 LIB=libap.a
 
-OBJS=ap_signal.o
+OBJS=ap_signal.o ap_slack.o
 
 .c.o:
 	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
@@ -25,3 +25,4 @@
 
 # dependencies
 ap_signal.o: $(INCDIR)/httpd.h
+ap_slack.o: $(INCDIR)/httpd.h $(INCDIR)/http_log.h
Index: src/main/util.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/util.c,v
retrieving revision 1.77
diff -u -r1.77 util.c
--- util.c	1997/11/13 17:05:15	1.77
+++ util.c	1997/11/30 18:35:57
@@ -1618,52 +1618,6 @@
 }
 #endif
 
-#ifndef NO_SLACK
-int ap_slack(int fd, int line)
-{
-#if !defined(F_DUPFD)
-    return fd;
-#else
-    static int low_warned;
-    int new_fd;
-
-#ifdef HIGH_SLACK_LINE
-    if (line == AP_SLACK_HIGH && fd < HIGH_SLACK_LINE) {
-	new_fd = fcntl(fd, F_DUPFD, HIGH_SLACK_LINE);
-	if (new_fd != -1) {
-	    close(fd);
-	    return new_fd;
-	}
-    }
-#endif
-    /* otherwise just assume line == AP_SLACK_LOW */
-    if (fd >= LOW_SLACK_LINE) {
-	return fd;
-    }
-    new_fd = fcntl(fd, F_DUPFD, LOW_SLACK_LINE);
-    if (new_fd == -1) {
-	if (!low_warned) {
-	    /* Give them a warning here, because we really can't predict
-	     * how libraries and such are going to fail.  If we can't
-	     * do this F_DUPFD there's a good chance that apache has too
-	     * few descriptors available to it.  Note we don't warn on
-	     * the high line, because if it fails we'll eventually try
-	     * the low line...
-	     */
-	    aplog_error(APLOG_MARK, APLOG_ERR, NULL,
-		"unable to open a file descriptor above %u, "
-		"you may need to increase the number of descriptors",
-		LOW_SLACK_LINE);
-	    low_warned = 1;
-	}
-	return fd;
-    }
-    close(fd);
-    return new_fd;
-#endif
-}
-#endif /* NO_SLACK */
-
 #if defined(NEED_DIFFTIME)
 double difftime(time_t time1, time_t time0)
 {

Re: [PATCH] Part 2 of src/ap migration

Posted by Dean Gaudet <dg...@arctic.org>.
+1 on this ... along with part 1 of course.

Dean

On Sun, 30 Nov 1997, Rodent of Unusual Size wrote:

>     This is the next step toward moving the ap_* functions into the
>     src/ap directory: ap_slack().  The patch moves the function into its
>     own src/ap/ap_slack.c file (not included below).
> 
>     I wanted to do ap_snprintf(), but that's reference in a lot of the
>     Win32 project files that I don't yet know how to frob.  So that can
>     wait.
> 
>     #ken    P-)}
> 
> Index: src/ap/Makefile.tmpl
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/ap/Makefile.tmpl,v
> retrieving revision 1.2
> diff -u -r1.2 Makefile.tmpl
> --- Makefile.tmpl	1997/11/16 16:23:21	1.2
> +++ Makefile.tmpl	1997/11/30 18:35:32
> @@ -6,7 +6,7 @@
>  
>  LIB=libap.a
>  
> -OBJS=ap_signal.o
> +OBJS=ap_signal.o ap_slack.o
>  
>  .c.o:
>  	$(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
> @@ -25,3 +25,4 @@
>  
>  # dependencies
>  ap_signal.o: $(INCDIR)/httpd.h
> +ap_slack.o: $(INCDIR)/httpd.h $(INCDIR)/http_log.h
> Index: src/main/util.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/util.c,v
> retrieving revision 1.77
> diff -u -r1.77 util.c
> --- util.c	1997/11/13 17:05:15	1.77
> +++ util.c	1997/11/30 18:35:57
> @@ -1618,52 +1618,6 @@
>  }
>  #endif
>  
> -#ifndef NO_SLACK
> -int ap_slack(int fd, int line)
> -{
> -#if !defined(F_DUPFD)
> -    return fd;
> -#else
> -    static int low_warned;
> -    int new_fd;
> -
> -#ifdef HIGH_SLACK_LINE
> -    if (line == AP_SLACK_HIGH && fd < HIGH_SLACK_LINE) {
> -	new_fd = fcntl(fd, F_DUPFD, HIGH_SLACK_LINE);
> -	if (new_fd != -1) {
> -	    close(fd);
> -	    return new_fd;
> -	}
> -    }
> -#endif
> -    /* otherwise just assume line == AP_SLACK_LOW */
> -    if (fd >= LOW_SLACK_LINE) {
> -	return fd;
> -    }
> -    new_fd = fcntl(fd, F_DUPFD, LOW_SLACK_LINE);
> -    if (new_fd == -1) {
> -	if (!low_warned) {
> -	    /* Give them a warning here, because we really can't predict
> -	     * how libraries and such are going to fail.  If we can't
> -	     * do this F_DUPFD there's a good chance that apache has too
> -	     * few descriptors available to it.  Note we don't warn on
> -	     * the high line, because if it fails we'll eventually try
> -	     * the low line...
> -	     */
> -	    aplog_error(APLOG_MARK, APLOG_ERR, NULL,
> -		"unable to open a file descriptor above %u, "
> -		"you may need to increase the number of descriptors",
> -		LOW_SLACK_LINE);
> -	    low_warned = 1;
> -	}
> -	return fd;
> -    }
> -    close(fd);
> -    return new_fd;
> -#endif
> -}
> -#endif /* NO_SLACK */
> -
>  #if defined(NEED_DIFFTIME)
>  double difftime(time_t time1, time_t time0)
>  {
>