You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/07/02 19:46:45 UTC

cvs commit: apache-apr/include apr_portable.h

rbb         99/07/02 10:46:45

  Modified:    apr/file_io/unix dir.c open.c
               apr/locks/unix locks.c
               apr/network_io/unix sockets.c
               apr/threadproc/unix proc.c thread.c threadpriv.c
               apr/time/unix time.c
  Added:       include  apr_portable.h
  Log:
  Added a group of functions to take the apr type and return the platfor specific
  type that is underneath it.  These are written in a portable manner, and
  are important because without them any APR program can only use code that
  is APR'ized.  with them, that is no longer true.
  
  Revision  Changes    Path
  1.15      +6 -0      apache-apr/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/dir.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- dir.c	1999/06/15 19:43:20	1.14
  +++ dir.c	1999/07/02 17:46:38	1.15
  @@ -61,6 +61,7 @@
   #include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_lib.h"
  +#include "apr_portable.h"
   
   ap_status_t dir_cleanup(void *thedir)
   {
  @@ -279,3 +280,8 @@
       return APR_SUCCESS;
   }
   
  +ap_os_dir_t *ap_get_os_dir(struct dir_t *dir)
  +{
  +    return dir->dirstruct;
  +}
  +  
  
  
  
  1.29      +6 -0      apache-apr/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- open.c	1999/06/02 18:44:33	1.28
  +++ open.c	1999/07/02 17:46:39	1.29
  @@ -56,6 +56,7 @@
   #include "fileio.h"
   #include "apr_file_io.h"
   #include "apr_general.h"
  +#include "apr_portable.h"
   #include "apr_lib.h"
   #include <errno.h>
   #include <string.h>
  @@ -188,5 +189,10 @@
       else {
           return errno;
       }
  +}
  +
  +ap_os_file_t *ap_get_os_file(struct file_t *file)
  +{
  +    return &(file->filedes);
   }
   
  
  
  
  1.11      +22 -0     apache-apr/apr/locks/unix/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/locks/unix/locks.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- locks.c	1999/06/22 16:57:29	1.10
  +++ locks.c	1999/07/02 17:46:40	1.11
  @@ -54,6 +54,7 @@
    */
   
   #include "apr_general.h"
  +#include "apr_portable.h"
   #include "locks.h"
   #include <string.h>
   
  @@ -174,6 +175,27 @@
           data = NULL;
           return APR_ENOLOCK;
       }
  +}
  +
  +ap_os_lock_t *ap_get_os_lock_t(struct lock_t *lock)
  +{
  +    ap_os_lock_t *oslock;
  +
  +    oslock = (ap_os_lock_t *)malloc(sizeof(ap_os_lock_t));
  +
  +    oslock->crossproc = lock->interproc;
  +#if defined (USE_SYSVSEM_SERIALIZE)
  +    oslock->op_on = lock->op_on;
  +    oslock->op_off = lock->op_off;
  +#elif defined (USE_FCNTL_SERIALIZE)
  +    oslock->lock_it = lock->lock_it;
  +    oslock->unlock_it = lock->unlock_it;
  +#endif
  +#if defined (USE_PTHREAD_SERIALIZE)
  +    oslock->intraproc = lock->intraproc;
  +#endif
  +
  +    return oslock;
   }
   
   
  
  
  
  1.21      +5 -0      apache-apr/apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/unix/sockets.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- sockets.c	1999/06/22 16:57:31	1.20
  +++ sockets.c	1999/07/02 17:46:42	1.21
  @@ -56,6 +56,7 @@
   #include "networkio.h"
   #include "apr_network_io.h"
   #include "apr_general.h"
  +#include "apr_portable.h"
   #include "apr_lib.h"
   #include <errno.h>
   #include <string.h>
  @@ -241,4 +242,8 @@
       }
   }
   
  +ap_os_sock_t *ap_get_os_sock(struct socket_t *sock)
  +{
  +    return &(sock->socketdes);
  +}
   
  
  
  
  1.19      +6 -0      apache-apr/apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/unix/proc.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- proc.c	1999/06/17 15:05:22	1.18
  +++ proc.c	1999/07/02 17:46:43	1.19
  @@ -60,6 +60,7 @@
   #include "apr_file_io.h"
   #include "apr_general.h"
   #include "apr_lib.h"
  +#include "apr_portable.h"
   #include <signal.h>
   #include <string.h>
   #include <sys/wait.h>
  @@ -280,4 +281,9 @@
           }
           return errno;
   } 
  +
  +ap_os_proc_t *ap_get_os_proc(ap_proc_t *proc)
  +{
  +    return &(proc->pid);
  +}
   
  
  
  
  1.10      +6 -1      apache-apr/apr/threadproc/unix/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/unix/thread.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- thread.c	1999/06/22 16:57:34	1.9
  +++ thread.c	1999/07/02 17:46:43	1.10
  @@ -56,8 +56,8 @@
   #include "threadproc.h"
   #include "apr_thread_proc.h"
   #include "apr_general.h"
  +#include "apr_portable.h"
   
  -
   ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t **new)
   {
       ap_status_t stat;
  @@ -202,5 +202,10 @@
           data = NULL;
           return APR_ENOTHREAD;
       }
  +}
  +
  +ap_os_thread_t *ap_get_os_thread(struct thread_t *thd)
  +{
  +    return thd->td;
   }
   
  
  
  
  1.8       +6 -0      apache-apr/apr/threadproc/unix/threadpriv.c
  
  Index: threadpriv.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/unix/threadpriv.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- threadpriv.c	1999/06/22 16:57:34	1.7
  +++ threadpriv.c	1999/07/02 17:46:43	1.8
  @@ -57,6 +57,7 @@
   #include "apr_thread_proc.h"
   #include "apr_general.h"
   #include "apr_errno.h"
  +#include "apr_portable.h"
   
   ap_status_t ap_create_thread_private(ap_context_t *cont, void (*dest)(void *),
                                        struct threadkey_t **key)
  @@ -134,5 +135,10 @@
           data = NULL;
           return APR_ENOTHDKEY;
       }
  +}
  +
  +ap_os_threadkey_t *ap_get_os_threadkey(ap_key_t *key)
  +{
  +    return key->key;
   }
   
  
  
  
  1.6       +10 -0     apache-apr/apr/time/unix/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/time/unix/time.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- time.c	1999/06/02 18:45:04	1.5
  +++ time.c	1999/07/02 17:46:44	1.6
  @@ -57,6 +57,7 @@
   #include "apr_time.h"
   #include "apr_general.h"
   #include "apr_lib.h"
  +#include "apr_portable.h"
   #include <time.h>
   #include <errno.h>
   #include <string.h>
  @@ -71,6 +72,7 @@
   
       (*new)->cntxt = cont;
       (*new)->explodedtime = NULL;
  +    (*new)->currtime = -1;
       return APR_SUCCESS;
   }
   
  @@ -130,5 +132,13 @@
       }
       time->currtime = days;            /* must be a valid time */
       return APR_SUCCESS;
  +}
  +
  +ap_os_time_t *ap_get_os_time(struct atime_t *thetime)
  +{
  +    if (thetime->currtime == -1) {
  +        ap_implode_time(thetime); 
  +    }
  +    return &(thetime->currtime);
   }
   
  
  
  
  1.1                  apache-apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===================================================================
  /* ====================================================================
   * 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/>.
   *
   */
  
  /* This header file is where you should put ANY platform specific information.
   * This should be the only header file that programs need to include that 
   * actually has platform dependant code which refers to the .
   */
  
  #include "apr_general.h"
  #include "apr_thread_proc.h"
  #include "apr_file_io.h"
  #include "apr_network_io.h"
  #include "apr_errno.h"
  #include "apr_lock.h"
  #include "apr_time.h"
  #ifdef HAVE_PTHREAD_H
  #include <pthread.h>
  #endif
  #ifdef HAVE_TIME_H
  #include <time.h>
  #endif
  
  #ifdef WIN32
  /* The primitives for Windows types */
  typedef HANDLE           ap_os_file_t;
  typedef HANDLE           ap_os_dir_t;
  typedef HANDLE           ap_os_sock_t;
  typedef HANDLE           ap_os_lock_t;
  typedef HANDLE           ap_os_thread_t;
  typedef HANDLE           ap_os_proc_t;
  typedef DWORD            ap_os_threadkey_t; 
  typedef SYSTEMTIME       ap_os_time_t;
  #else
  /* Any other OS should go above this one.  This is the lowest common
   * denominator typedefs for  all UNIX-like systems.  :)
   */
  
  #ifdef NEED_UNION_SEMUN
  /* it makes no sense, but this isn't defined on solaris */
  union semun {
      long val;
      struct semid_ds *buf;
      ushort *array;
  };
  #endif
  
  struct os_lock_t {
  #if defined USE_SYSVSEM_SERIALIZE
      int crossproc;
      struct sembuf op_on;
      struct sembuf op_off;
  #elif defined (USE_FCNTL_SERIALIZE)
      int crossproc;
      struct flock lock_it;
      struct flock unlock_it;
  #elif defined (USE_PROC_PTHREAD_SERIALIZE)
      pthread_mutex_t *crossproc; 
  #elif defined (USE_FLOCK_SERIALIZE)
      int crossproc;
  #else
      /* No Interprocess serialization, too bad. */
  #endif
  #if defined (USE_PTHREAD_SERIALIZE)
      pthread_mutex_t *intraproc;
  #endif
  };
  
  typedef int              ap_os_file_t;
  typedef DIR              ap_os_dir_t;
  typedef int              ap_os_sock_t;
  typedef struct os_lock_t ap_os_lock_t;
  typedef pthread_t        ap_os_thread_t;
  typedef pid_t            ap_os_proc_t;
  typedef pthread_key_t    ap_os_threadkey_t;
  typedef time_t           ap_os_time_t;
  #endif
  
  ap_os_file_t        *ap_get_os_file(ap_file_t *);
  ap_os_dir_t         *ap_get_os_dir(ap_dir_t *);
  ap_os_sock_t        *ap_get_os_sock(ap_socket_t *);
  ap_os_lock_t        *ap_get_os_lock(ap_lock_t *);
  ap_os_thread_t      *ap_get_os_thread(ap_thread_t *);
  ap_os_proc_t        *ap_get_os_proc(ap_proc_t *);
  ap_os_time_t        *ap_get_os_time(ap_time_t *);
  ap_os_threadkey_t   *ap_get_os_threadkey(ap_key_t *);