httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@hyperreal.org
Subject cvs commit: apache-apr/docs misc.txt threadproc.txt
Date Thu, 29 Apr 1999 20:20:47 GMT
rbb         99/04/29 13:20:46

  Modified:    apr/threadproc/unix threadproc.h
               include  apr_errno.h apr_general.h apr_thread_proc.h
               docs     threadproc.txt
  Added:       apr/misc/unix Makefile start.c
               docs     misc.txt
  Log:
  Added context types to APR.  I will be making each apr function use context
  types in the next few days.  This context includes pools, so APR will soon
  no longer rely on malloc/free to work properly, which should be good.
  
  Revision  Changes    Path
  1.1                  apache-apr/apr/misc/unix/Makefile
  
  Index: Makefile
  ===================================================================
  ##
  ##  Apache Makefile, automatically generated by Configure script.
  ##  Hand-edited changes will be lost if the Configure script is re-run.
  ##  Sources: - ../Makefile.config (via Configuration.apaci)
  ##           - ./Makefile.tmpl
  ##
  
  ##
  ##  Inherited Makefile options from Configure script
  ##  (Begin of automatically generated section)
  ##
  SRCDIR=..
  EXTRA_CFLAGS=-g 
  EXTRA_LDFLAGS=
  EXTRA_LIBS=
  EXTRA_INCLUDES=
  EXTRA_DEPS=
  OSDIR=
  INCDIR=../../../include
  INCLUDES0=-I . -I ../../include -I $(INCDIR)
  SHELL=/bin/sh
  CC=gcc
  CPP=gcc -E
  TARGET=
  OPTIM=
  CFLAGS_SHLIB=-fpic -DSHARED_MODULE
  LD_SHLIB=ld
  LDFLAGS_SHLIB=-Bshareable
  LDFLAGS_SHLIB_EXPORT=-rdynamic
  CFLAGS1= -DLINUX=2 -pthread -DUSE_HSREGEX
  INCLUDES1=
  LIBS_SHLIB=
  LDFLAGS1=
  MFLAGS_STATIC=--no-print-directory
  REGLIB=regex/libregex.a
  RANLIB=ranlib
  LIBS1= -lm -lcrypt -lndbm -ldl
  ##
  ##  (End of automatically generated section)
  ##
  
  
  CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
  LIBS=$(EXTRA_LIBS) $(LIBS1)
  INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
  LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
  
  LIB=  libfile.a
  
  OBJS= start.o 
  
  .c.o:
  	$(CC) -c $(INCLUDES) $(CFLAGS) $<
  
  all: $(HEADERS) $(LIB)
  
  $(LIB): $(OBJS)
  	rm -f $@
  	ar cr $@ $(OBJS)
  	$(RANLIB) $@
  	cp $@ ../
  clean:
  	rm -f *.o $(LIB)
  
  distclean: clean
  	-rm -f Makefile
  
  # We really don't expect end users to use this rule.  It works only with
  # gcc, and rebuilds Makefile.tmpl.  You have to re-run Configure after
  # using it.
  depend:
  	cp Makefile.tmpl Makefile.tmpl.bak \
  	    && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
  	    && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
  	    && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
  	           -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
  		> Makefile.tmpl \
  	    && rm Makefile.new
  
  #Dependencies
  
  $(OBJS): Makefile
  
  # DO NOT REMOVE
  start.o: start.c
  
  
  
  1.1                  apache-apr/apr/misc/unix/start.c
  
  Index: start.c
  ===================================================================
  /* ====================================================================
   * Copyright (c) 1999 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. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 6. 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.
   * For more information on the Apache Group and the Apache HTTP server
   * project, please see <http://www.apache.org/>.
   *
   */
  
  #include "apr_general.h"
  #include "apr_errno.h"
  #include "apr_pools.h"
  #include <errno.h>
  #include <string.h>
  
  apr_context_t *apr_initialize(void *data)
  {
      apr_context_t *new;
      apr_pool_t *pool;
  
      pool = apr_init_alloc();
  
      if (pool == NULL) {
          errno = ENOPOOL;
          return NULL;
      }    
      new = (apr_context_t *)apr_palloc(pool, sizeof(apr_context_t));
      new->pool = pool;
      new->prog_data = data;
      new->signal_safe = 0;
      new->cancel_safe = 0;
  
      return new;
  }
  
  apr_status_t apr_set_signal_safe(apr_context_t *cont, apr_int16_t safe)
  {
      cont->signal_safe = safe;
      return APR_SUCCESS;
  }
  
  apr_status_t apr_set_cancel_safe(apr_context_t *cont, apr_int16_t safe)
  {
      cont->cancel_safe = safe;
      return APR_SUCCESS;
  }
  
  apr_context_t *apr_create_sub_context(apr_context_t *cont, void *data)
  {
      apr_context_t *new;
      apr_pool_t *pool;
  
      pool = apr_make_sub_pool(cont->pool);
      if (pool == NULL) {
          errno = ENOPOOL;
          return NULL;
      }    
      new = (apr_context_t *)apr_palloc(pool, sizeof(apr_context_t));
      new->pool = pool;
      if (data == NULL) {
          cont->prog_data = cont->prog_data;
      }
      else {
          cont->prog_data = data;
      }
      cont->signal_safe = cont->signal_safe;
      cont->cancel_safe = cont->cancel_safe;
  
      return new;
  }
  
  apr_status_t apr_destroy_context(apr_context_t *cont)
  {
      apr_destroy_pool(cont->pool);
      return APR_SUCCESS;
  }
  
  
  
  
  1.2       +3 -0      apache-apr/apr/threadproc/unix/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/unix/threadproc.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- threadproc.h	1999/04/23 17:59:58	1.1
  +++ threadproc.h	1999/04/29 20:20:36	1.2
  @@ -64,6 +64,9 @@
   
   struct thread_t {
       pthread_t *td;
  +};
  +
  +struct threadattr_t {
       pthread_attr_t *attr;
   };
   
  
  
  
  1.6       +1 -0      apache-apr/include/apr_errno.h
  
  Index: apr_errno.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_errno.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apr_errno.h	1999/02/23 21:23:45	1.5
  +++ apr_errno.h	1999/04/29 20:20:38	1.6
  @@ -67,5 +67,6 @@
   #define APR_FAILURE -1 
   
   #define ENOSTAT 4001
  +#define ENOPOOL 4002
   
   #endif  /* ! APR_ERRNO_H */
  
  
  
  1.9       +16 -0     apache-apr/include/apr_general.h
  
  Index: apr_general.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_general.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- apr_general.h	1999/04/13 11:51:48	1.8
  +++ apr_general.h	1999/04/29 20:20:38	1.9
  @@ -56,6 +56,7 @@
   #include <malloc.h>
   #include <unistd.h>
   #include <sys/types.h>
  +#include "apr_errno.h"
   
   #ifndef APR_GENERAL_H
   #define APR_GENERAL_H
  @@ -74,5 +75,20 @@
   typedef ssize_t           apr_ssize_t; 
   
   typedef off_t             apr_off_t;
  +
  +typedef struct context_t {
  +    struct apr_pool_t *pool;
  +    apr_int16_t signal_safe;
  +    apr_int16_t cancel_safe;
  +    void *prog_data;
  +} apr_context_t;   
  +
  +/* Context functions */
  +apr_context_t *apr_initialize(void *);
  +apr_status_t apr_set_signal_safe(apr_context_t *, apr_int16_t );
  +apr_status_t apr_set_cancel_safe(apr_context_t *, apr_int16_t); 
  +apr_context_t *apr_create_sub_context(apr_context_t *, void *);
  +apr_status_t apr_destroy_context(apr_context_t *);
  +
   
   #endif  /* ! APR_GENERAL_H */
  
  
  
  1.5       +6 -1      apache-apr/include/apr_thread_proc.h
  
  Index: apr_thread_proc.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_thread_proc.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apr_thread_proc.h	1999/04/28 14:30:28	1.4
  +++ apr_thread_proc.h	1999/04/29 20:20:39	1.5
  @@ -64,10 +64,15 @@
   typedef enum {APR_WAIT, APR_NOWAIT} apr_wait_how_e;
   
   typedef struct thread_t           apr_thread_t;
  +typedef struct threadattr_t       apr_threadattr_t;
   typedef struct proc_t		  apr_proc_t;
   typedef struct procattr_t         apr_procattr_t;
   
  -/*   Function definitions */
  +/* Thread Function definitions */
  +
  +
  +
  +/* Process Function definitions */
   apr_procattr_t *apr_createprocattr_init(void);
   apr_status_t apr_setprocattr_io(apr_procattr_t *, apr_int32_t, apr_int32_t, apr_int32_t);
   apr_status_t apr_setprocattr_dir(apr_procattr_t *, char *);
  
  
  
  1.8       +15 -12    apache-apr/docs/threadproc.txt
  
  Index: threadproc.txt
  ===================================================================
  RCS file: /home/cvs/apache-apr/docs/threadproc.txt,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- threadproc.txt	1999/04/26 18:16:44	1.7
  +++ threadproc.txt	1999/04/29 20:20:45	1.8
  @@ -3,18 +3,6 @@
   NOTE:  There is a one-to-one mapping between process and process_attr's.  This
          relationship does not exist with threads and thread_attr's.
   
  - apr_thread_t *apr_create_thread(void * (void *), void *,
  -	      APRUInt32)
  -	Create a new thread
  -     Arguments:
  -	arg 1)	pointer to the root function of the new thread.  This function
  -		is called when the thread is created.  Returning from this
  -		function is the only way to terminate the thread.
  -	arg 2)	parameter to pass to thread's root func.
  -	arg 3)	size of the stack in bytes.  IF zero, APR chooses the machine
  -		specific default size.
  -	return) The thread created.
  -
    apr_int32_t apr_fork(apr_proc_t *)
           create a new process with a copy of the currently executing address space.
        Arguments:
  @@ -99,6 +87,21 @@
                   APR_WAIT
                   APR_NOWAIT
           return) APR_SUCCESS or APR_fAILURE
  +
  + apr_threadattr_t *apr_create_threadattr(void);
  +        create a new thread attr type with OS dependant defaults
  +     Arguments:
  +        return) New thread attribute type.
  +
  + apr_thread_t *apr_create_thread(apr_threadattr_t *, void * (void *), void *)
  +	Create a new thread
  +     Arguments:
  +        arg 1)  The attributes to use when creating the thread.
  +	arg 2)	pointer to the root function of the new thread.  This function
  +		is called when the thread is created.  Returning from this
  +		function is the only way to terminate the thread.
  +	arg 3)	parameter to pass to thread's root func.
  +	return) The thread created.
   
    APRStatus  apr_get_thread_private(APRUInt32, APThdPriv)
           Get the thread private data for the current thread
  
  
  
  1.1                  apache-apr/docs/misc.txt
  
  Index: misc.txt
  ===================================================================
  <h2>Misc Functions</h2>
  
   apr_context_t *apr_initialize(void *)
        Initialize apr so it can be used by the program.
      Arguments:
        arg 1)  A pointer to any program specific data
        return) An apr context type.  The first field in this is ALWAYS an 
                apr_pool.  NULL on failure.
  NOTE:  This is NOT an abstract type.  This is apr specific, and the pools may
         be abstract, but the context is constant acrosee platforms, so programs
         can access the internals of this structure.  The default is that this
         context is neither thread-safe nor cancel-safe (see below).
         The prog_data field is basically thread-local storage, so there will be
         no OS specific TLS within APR.
  
   apr_status_t apr_set_signal_safe(apr_context_t *, apr_int16_t)
        Should the apr functions using this context be signal-safe?
      Arguments:
        arg 1)  The context in question.
        arg 2)  Bool value.  1 means signal-safe, 0 means non-signal-safe.
        return) APR_SUCCESS
   
   apr_status_t apr_set_cancel_safe(apr_context_t *, apr_int16_t)
        Should the apr functions using this context be safe for asynch
        thread cancelation?
      Arguments:
        arg 1)  The context in question.
        arg 2)  Bool value.  1 means cancel-safe, 0 means non-cancel-safe.
        return) APR_SUCCESS
  
   apr_create_sub_context(apr_context_t *, void *)
        Create a sub context.  (Includes creating a sub pool.
      Arguments:
        arg 1)  The context to be the parent.
        arg 2)  New program specific data for the child context.  If NULL,
                it will inherit the data from the parent.
        return) a new context, complete with new sub_pool.  Inherits safeness
                features from the parent.
   
   apr_destroy_context(apr_context_t *)
        Destroy a context and all sub_contexts.
      Arguments:
        arg 1)  The context to destroy
        return) APR_SUCCESS
  
  
  

Mime
View raw message