httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/lib apr_pools.c
Date Wed, 08 Sep 1999 18:04:24 GMT
rbb         99/09/08 11:04:21

  Modified:    src/lib/apr/inc apr_pools.h
               src/lib/apr/include apr_lib.h
               src/lib/apr/lib apr_pools.c
  Log:
  Remove the "ap_popenf"-like calls.  These are basically the ones that were
  removed from Apache earlier today.  They are not portable, and they are
  only in APR because they were carried down from Apache, we don't want them
  anywhere.
  
  Revision  Changes    Path
  1.5       +0 -62     apache-2.0/src/lib/apr/inc/apr_pools.h
  
  Index: apr_pools.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/inc/apr_pools.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apr_pools.h	1999/09/06 03:23:44	1.4
  +++ apr_pools.h	1999/09/08 18:04:03	1.5
  @@ -248,68 +248,6 @@
   #define ap_table_elts(t) ((ap_array_header_t *)(t))
   #define ap_is_empty_table(t) (((t) == NULL)||(((ap_array_header_t *)(t))->nelts == 0))
   
  -/* routines to remember allocation of other sorts of things...
  - * generic interface first.  Note that we want to have two separate
  - * cleanup functions in the general case, one for exec() preparation,
  - * to keep CGI scripts and the like from inheriting access to things
  - * they shouldn't be able to touch, and one for actually cleaning up,
  - * when the actual server process wants to get rid of the thing,
  - * whatever it is.  
  - *
  - * kill_cleanup disarms a cleanup, presumably because the resource in
  - * question has been closed, freed, or whatever, and it's scarce
  - * enough to want to reclaim (e.g., descriptors).  It arranges for the
  - * resource not to be cleaned up a second time (it might have been
  - * reallocated).  run_cleanup does the same, but runs it first.
  - *
  - * Cleanups are identified for purposes of finding & running them off by the
  - * plain_cleanup and data, which should presumably be unique.
  - *
  - * NB any code which invokes register_cleanup or kill_cleanup directly
  - * is a critical section which should be guarded by block_alarms() and
  - * unblock_alarms() below...
  - */
  -
  -/* A "do-nothing" cleanup, for register_cleanup; it's faster to do
  - * things this way than to test for NULL. */
  -
  -/* The time between when a resource is actually allocated, and when
  - * its cleanup is registered is a critical section, during which the
  - * resource could leak if we got interrupted or timed out.  So, anything
  - * which registers cleanups should bracket resource allocation and the
  - * cleanup registry with these.  (This is done internally by run_cleanup).
  - *
  - * NB they are actually implemented in http_main.c, since they are bound
  - * up with timeout handling in general...
  - */
  -
  -/* Common cases which want utility support..
  - * the note_cleanups_for_foo routines are for 
  - */
  -
  -API_EXPORT(FILE *) ap_pfopen(ap_context_t *, const char *name, const char *fmode);
  -API_EXPORT(FILE *) ap_pfdopen(ap_context_t *, int fd, const char *fmode);
  -API_EXPORT(int) ap_popenf(ap_context_t *, const char *name, int flg, int mode);
  -
  -API_EXPORT(void) ap_note_cleanups_for_file(ap_context_t *, FILE *);
  -API_EXPORT(void) ap_note_cleanups_for_fd(ap_context_t *, int);
  -API_EXPORT(void) ap_kill_cleanups_for_fd(ap_context_t *p, int fd);
  -API_EXPORT(void) ap_note_cleanups_for_socket(ap_context_t *, int);
  -API_EXPORT(void) ap_kill_cleanups_for_socket(ap_context_t *p, int sock);
  -API_EXPORT(int) ap_psocket(ap_context_t *p, int, int, int);
  -API_EXPORT(int) ap_pclosesocket(ap_context_t *a, int sock);
  -
  -/* routines to note closes... file descriptors are constrained enough
  - * on some systems that we want to support this.
  - */
  -
  -API_EXPORT(int) ap_pfclose(ap_context_t *, FILE *);
  -API_EXPORT(int) ap_pclosef(ap_context_t *, int fd);
  -
  -/* routines to deal with directories */
  -/*API_EXPORT(DIR *) ap_popendir(ap_context_t *p, const char *name);
  -API_EXPORT(void) ap_pclosedir(ap_context_t *p, DIR * d);
  -*/
   /* ... even child processes (which we may want to wait for,
    * or to kill outright, on unexpected termination).
    *
  
  
  
  1.7       +0 -20     apache-2.0/src/lib/apr/include/apr_lib.h
  
  Index: apr_lib.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lib.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_lib.h	1999/09/01 14:38:37	1.6
  +++ apr_lib.h	1999/09/08 18:04:10	1.7
  @@ -372,22 +372,6 @@
   API_EXPORT(ap_status_t) ap_getpass(const char *prompt, char *pwbuf, size_t *bufsize);
   API_EXPORT_NONSTD(ap_status_t) ap_null_cleanup(void *data);
   
  -API_EXPORT(void) ap_note_cleanups_for_fd(ap_context_t *p, int fd);
  -API_EXPORT(void) ap_kill_cleanups_for_fd(ap_context_t *p, int fd);
  -API_EXPORT(int) ap_popenf(ap_context_t *a, const char *name, int flg, int mode);
  -API_EXPORT(int) ap_pclosef(ap_context_t *a, int fd);
  -API_EXPORT(void) ap_note_cleanups_for_file(ap_context_t *p, FILE *fp);
  -API_EXPORT(FILE *) ap_pfopen(ap_context_t *a, const char *name,
  -			      const char *mode);
  -API_EXPORT(FILE *) ap_pfdopen(ap_context_t *a, int fd, const char *mode);
  -API_EXPORT(int) ap_pfclose(ap_context_t *a, FILE *fd);
  -API_EXPORT(DIR *) ap_popendir(ap_context_t *p, const char *name);
  -API_EXPORT(void) ap_pclosedir(ap_context_t *p, DIR * d);
  -API_EXPORT(void) ap_note_cleanups_for_socket(ap_context_t *p, int fd);
  -API_EXPORT(void) ap_kill_cleanups_for_socket(ap_context_t *p, int sock);
  -API_EXPORT(int) ap_psocket(ap_context_t *p, int domain, int type, int protocol);
  -API_EXPORT(int) ap_pclosesocket(ap_context_t *a, int sock);
  -
   API_EXPORT(regex_t *) ap_pregcomp(ap_context_t *p, const char *pattern,
   				   int cflags);
   API_EXPORT(void) ap_pregfree(ap_context_t *p, regex_t *reg);
  @@ -413,10 +397,6 @@
   /*
    * Routine definitions that only work on Windows.
    */
  -#ifdef WIN32
  -API_EXPORT(void) ap_note_cleanups_for_h(ap_pool_t *p, HANDLE hDevice);
  -API_EXPORT(int) ap_pcloseh(ap_pool_t *a, HANDLE hDevice);
  -#endif /* WIN32 */
   
   /*#ifdef TPF*/
   #define ap_block_alarms() (0)
  
  
  
  1.6       +12 -265   apache-2.0/src/lib/apr/lib/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apr_pools.c	1999/09/07 21:24:42	1.5
  +++ apr_pools.c	1999/09/08 18:04:15	1.6
  @@ -1171,268 +1171,6 @@
       /* do nothing cleanup routine */
   }
   
  -/*****************************************************************
  - *
  - * Files and file descriptors; these are just an application of the
  - * generic cleanup interface.
  - */
  -static ap_status_t fd_cleanup(void *fdv)
  -{
  -    close((int) (long) fdv);
  -    return APR_SUCCESS;
  -}
  -
  -API_EXPORT(void) ap_note_cleanups_for_fd(ap_context_t *p, int fd)
  -{
  -    ap_register_cleanup(p, (void *) (long) fd, fd_cleanup, fd_cleanup);
  -}
  -
  -API_EXPORT(void) ap_kill_cleanups_for_fd(ap_context_t *p, int fd)
  -{
  -    ap_kill_cleanup(p, (void *) (long) fd, fd_cleanup);
  -}
  -
  -API_EXPORT(int) ap_popenf(ap_context_t *a, const char *name, int flg, int mode)
  -{
  -    int fd;
  -    int save_errno;
  -
  -    ap_block_alarms();
  -    fd = open(name, flg, mode);
  -    save_errno = errno;
  -    if (fd >= 0) {
  -	fd = ap_slack(fd, AP_SLACK_HIGH);
  -	ap_note_cleanups_for_fd(a, fd);
  -    }
  -    ap_unblock_alarms();
  -    errno = save_errno;
  -    return fd;
  -}
  -
  -API_EXPORT(int) ap_pclosef(ap_context_t *a, int fd)
  -{
  -    int res;
  -    int save_errno;
  -
  -    ap_block_alarms();
  -    res = close(fd);
  -    save_errno = errno;
  -    ap_kill_cleanup(a, (void *) (long) fd, fd_cleanup);
  -    ap_unblock_alarms();
  -    errno = save_errno;
  -    return res;
  -}
  -
  -#ifdef WIN32
  -static void h_cleanup(void *fdv)
  -{
  -    CloseHandle((HANDLE) fdv);
  -}
  -
  -API_EXPORT(void) ap_note_cleanups_for_h(ap_context_t *p, HANDLE hDevice)
  -{
  -    ap_register_cleanup(p, (void *) hDevice, h_cleanup, h_cleanup);
  -}
  -
  -API_EXPORT(int) ap_pcloseh(ap_context_t *a, HANDLE hDevice)
  -{
  -    int res=0;
  -    int save_errno;
  -
  -    ap_block_alarms();
  -    
  -    if (!CloseHandle(hDevice)) {
  -        res = GetLastError();
  -    }
  -    
  -    save_errno = errno;
  -    ap_kill_cleanup(a, (void *) hDevice, h_cleanup);
  -    ap_unblock_alarms();
  -    errno = save_errno;
  -    return res;
  -}
  -#endif
  -
  -/* Note that we have separate plain_ and child_ cleanups for FILE *s,
  - * since fclose() would flush I/O buffers, which is extremely undesirable;
  - * we just close the descriptor.
  - */
  -static ap_status_t file_cleanup(void *fpv)
  -{
  -    fclose((FILE *) fpv);
  -    return APR_SUCCESS;
  -}
  -static ap_status_t file_child_cleanup(void *fpv)
  -{
  -    close(fileno((FILE *) fpv));
  -    return APR_SUCCESS;
  -}
  -
  -API_EXPORT(void) ap_note_cleanups_for_file(ap_context_t *p, FILE *fp)
  -{
  -    ap_register_cleanup(p, (void *) fp, file_cleanup, file_child_cleanup);
  -}
  -
  -API_EXPORT(FILE *) ap_pfopen(ap_context_t *a, const char *name,
  -			      const char *mode)
  -{
  -    FILE *fd = NULL;
  -    int baseFlag, desc;
  -    int modeFlags = 0;
  -    int saved_errno;
  -
  -#ifdef WIN32
  -    modeFlags = _S_IREAD | _S_IWRITE;
  -#else 
  -    modeFlags = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
  -#endif
  -
  -    ap_block_alarms();
  -
  -    if (*mode == 'a') {
  -	/* Work around faulty implementations of fopen */ 
  -	baseFlag = (*(mode + 1) == '+') ? O_RDWR : O_WRONLY;
  -	desc = open(name, baseFlag | O_APPEND | O_CREAT,
  -		    modeFlags);
  -	if (desc >= 0) {
  -	    desc = ap_slack(desc, AP_SLACK_LOW);
  -	    fd = ap_fdopen(desc, mode);
  -	}
  -    }
  -    else {
  -	fd = fopen(name, mode);
  -    }
  -    saved_errno = errno;
  -    if (fd != NULL) {
  -	ap_note_cleanups_for_file(a, fd);
  -    }
  -    ap_unblock_alarms();
  -    errno = saved_errno;
  -    return fd;
  -}
  -
  -API_EXPORT(FILE *) ap_pfdopen(ap_context_t *a, int fd, const char *mode)
  -{
  -    FILE *f;
  -    int saved_errno;
  -
  -    ap_block_alarms();
  -    f = ap_fdopen(fd, mode);
  -    saved_errno = errno;
  -    if (f != NULL) {
  -	ap_note_cleanups_for_file(a, f);
  -    }
  -    ap_unblock_alarms();
  -    errno = saved_errno;
  -    return f;
  -}
  -
  -
  -API_EXPORT(int) ap_pfclose(ap_context_t *a, FILE *fd)
  -{
  -    int res;
  -
  -    ap_block_alarms();
  -    res = fclose(fd);
  -    ap_kill_cleanup(a, (void *) fd, file_cleanup);
  -    ap_unblock_alarms();
  -    return res;
  -}
  -
  -/*
  - * DIR * with cleanup
  - */
  -
  -static ap_status_t dir_cleanup(void *dv)
  -{
  -    closedir((DIR *) dv);
  -    return APR_SUCCESS;
  -}
  -
  -API_EXPORT(DIR *) ap_popendir(ap_context_t *p, const char *name)
  -{
  -    DIR *d;
  -    int save_errno;
  -
  -    ap_block_alarms();
  -    d = opendir(name);
  -    if (d == NULL) {
  -	save_errno = errno;
  -	ap_unblock_alarms();
  -	errno = save_errno;
  -	return NULL;
  -    }
  -    ap_register_cleanup(p, (void *) d, dir_cleanup, dir_cleanup);
  -    ap_unblock_alarms();
  -    return d;
  -}
  -
  -API_EXPORT(void) ap_pclosedir(ap_context_t *p, DIR * d)
  -{
  -    ap_block_alarms();
  -    ap_kill_cleanup(p, (void *) d, dir_cleanup);
  -    closedir(d);
  -    ap_unblock_alarms();
  -}
  -
  -/*****************************************************************
  - *
  - * Files and file descriptors; these are just an application of the
  - * generic cleanup interface.
  - */
  -
  -static ap_status_t socket_cleanup(void *fdv)
  -{
  -    closesocket((int) (long) fdv);
  -    return APR_SUCCESS;
  -}
  -
  -API_EXPORT(void) ap_note_cleanups_for_socket(ap_context_t *p, int fd)
  -{
  -    ap_register_cleanup(p, (void *) (long) fd, socket_cleanup,
  -			 socket_cleanup);
  -}
  -
  -API_EXPORT(void) ap_kill_cleanups_for_socket(ap_context_t *p, int sock)
  -{
  -    ap_kill_cleanup(p, (void *) (long) sock, socket_cleanup);
  -}
  -
  -API_EXPORT(int) ap_psocket(ap_context_t *p, int domain, int type, int protocol)
  -{
  -    int fd;
  -
  -    ap_block_alarms();
  -    fd = socket(domain, type, protocol);
  -    if (fd == -1) {
  -	int save_errno = errno;
  -	ap_unblock_alarms();
  -	errno = save_errno;
  -	return -1;
  -    }
  -    ap_note_cleanups_for_socket(p, fd);
  -    ap_unblock_alarms();
  -    return fd;
  -}
  -
  -API_EXPORT(int) ap_pclosesocket(ap_context_t *a, int sock)
  -{
  -    int res;
  -    int save_errno;
  -
  -    ap_block_alarms();
  -    res = closesocket(sock);
  -#ifdef WIN32
  -    errno = WSAGetLastError();
  -#endif 
  -    save_errno = errno;
  -    ap_kill_cleanup(a, (void *) (long) sock, socket_cleanup);
  -    ap_unblock_alarms();
  -    errno = save_errno;
  -    return res;
  -}
  -
  -
   /*
    * Here's a pool-based interface to POSIX regex's regcomp().
    * Note that we return regex_t instead of being passed one.
  @@ -1792,7 +1530,10 @@
       if (pipe_out) {
   	*pipe_out = ap_fdopen(fd_out, "r" BINMODE);
   	if (*pipe_out) {
  -	    ap_note_cleanups_for_file(p, *pipe_out);
  +	    /* remove for now.  These go away with the APR abstraction
  +             * for process spawning.
  +             * ap_note_cleanups_for_file(p, *pipe_out);
  +             */
   	}
   	else {
   	    close(fd_out);
  @@ -1802,7 +1543,10 @@
       if (pipe_in) {
   	*pipe_in = ap_fdopen(fd_in, "w" BINMODE);
   	if (*pipe_in) {
  -	    ap_note_cleanups_for_file(p, *pipe_in);
  +	    /* remove for now.  These go away with the APR abstraction
  +             * for process spawning.
  +             * ap_note_cleanups_for_file(p, *pipe_in);
  +             */
   	}
   	else {
   	    close(fd_in);
  @@ -1812,7 +1556,10 @@
       if (pipe_err) {
   	*pipe_err = ap_fdopen(fd_err, "r" BINMODE);
   	if (*pipe_err) {
  -	    ap_note_cleanups_for_file(p, *pipe_err);
  +	    /* remove for now.  These go away with the APR abstraction
  +             * for process spawning.
  +             * ap_note_cleanups_for_file(p, *pipe_err);
  +             */
   	}
   	else {
   	    close(fd_err);
  
  
  

Mime
View raw message