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/include apr_portable.h
Date Tue, 06 Jul 1999 17:01:44 GMT
rbb         99/07/06 10:01:44

  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
               include  apr_portable.h
  Log:
  Change the routines to go from APR to platform specific types to mimic the
  rest of the APR calls.  Add routines to go the other direction.
  
  Revision  Changes    Path
  1.16      +21 -2     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- dir.c	1999/07/02 17:46:38	1.15
  +++ dir.c	1999/07/06 17:01:38	1.16
  @@ -280,8 +280,27 @@
       return APR_SUCCESS;
   }
   
  -ap_os_dir_t *ap_get_os_dir(struct dir_t *dir)
  +ap_status_t ap_get_os_dir(struct dir_t *dir, ap_os_dir_t *thedir)
   {
  -    return dir->dirstruct;
  +    if (dir == NULL) {
  +        return APR_ENODIR;
  +    }
  +    thedir = dir->dirstruct;
  +    return APR_SUCCESS;
   }
  +
  +ap_status_t ap_put_os_dir(ap_context_t *cont, struct dir_t **dir,
  +                            ap_os_dir_t *thedir)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*dir) == NULL) {
  +        (*dir) = (struct dir_t *)ap_palloc(cont, sizeof(struct dir_t));
  +        (*dir)->cntxt = cont;
  +    }
  +    (*dir)->dirstruct = thedir;
  +    return APR_SUCCESS;
  +}
  +
     
  
  
  
  1.30      +20 -2     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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- open.c	1999/07/02 17:46:39	1.29
  +++ open.c	1999/07/06 17:01:39	1.30
  @@ -191,8 +191,26 @@
       }
   }
   
  -ap_os_file_t *ap_get_os_file(struct file_t *file)
  +ap_status_t ap_get_os_file(struct file_t *file, ap_os_file_t *thefile)
   {
  -    return &(file->filedes);
  +    if (file == NULL) {
  +        return APR_ENOFILE;
  +    }
  +    thefile = &(file->filedes);
  +    return APR_SUCCESS;
   }
  +
  +ap_status_t ap_put_os_file(ap_context_t *cont, struct file_t **file, 
  +                            ap_os_file_t *thefile)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*file) == NULL) {
  +        (*file) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t));
  +        (*file)->cntxt = cont;
  +    }
  +    (*file)->filedes = *thefile;
  +    return APR_SUCCESS;
  +}    
   
  
  
  
  1.12      +29 -7     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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- locks.c	1999/07/02 17:46:40	1.11
  +++ locks.c	1999/07/06 17:01:39	1.12
  @@ -177,12 +177,11 @@
       }
   }
   
  -ap_os_lock_t *ap_get_os_lock_t(struct lock_t *lock)
  +ap_status_t ap_get_os_lock(struct lock_t *lock, ap_os_lock_t *oslock)
   {
  -    ap_os_lock_t *oslock;
  -
  -    oslock = (ap_os_lock_t *)malloc(sizeof(ap_os_lock_t));
  -
  +    if (lock == NULL) {
  +        return APR_ENOLOCK;
  +    }
       oslock->crossproc = lock->interproc;
   #if defined (USE_SYSVSEM_SERIALIZE)
       oslock->op_on = lock->op_on;
  @@ -195,7 +194,30 @@
       oslock->intraproc = lock->intraproc;
   #endif
   
  -    return oslock;
  +    return APR_SUCCESS;
   }
  -
   
  +ap_status_t ap_put_os_lock(ap_context_t *cont, struct lock_t **lock, 
  +                           ap_os_lock_t *thelock)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*lock) == NULL) {
  +        (*lock) = (struct lock_t *)ap_palloc(cont, sizeof(struct lock_t));
  +        (*lock)->cntxt = cont;
  +    }
  +    (*lock)->interproc = thelock->crossproc;
  +#if defined (USE_SYSVSEM_SERIALIZE)
  +    (*lock)->op_on = thelock->op_on;
  +    (*lock)->op_off = thelock->op_off;
  +#elif defined (USE_FCNTL_SERIALIZE)
  +    (*lock)->lock_it = thelock->lock_it;
  +    (*lock)->unlock_it = thelock->unlock_it;
  +#endif
  +#if defined (USE_PTHREAD_SERIALIZE)
  +    (*lock)->intraproc = thelock->intraproc;
  +#endif
  +    return APR_SUCCESS;
  +}
  +    
  
  
  
  1.22      +20 -2     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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- sockets.c	1999/07/02 17:46:42	1.21
  +++ sockets.c	1999/07/06 17:01:40	1.22
  @@ -242,8 +242,26 @@
       }
   }
   
  -ap_os_sock_t *ap_get_os_sock(struct socket_t *sock)
  +ap_status_t ap_get_os_sock(struct socket_t *sock, ap_os_sock_t *thesock)
   {
  -    return &(sock->socketdes);
  +    if (sock == NULL) {
  +        return APR_ENOSOCKET;
  +    }
  +    thesock = &(sock->socketdes);
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_put_os_sock(ap_context_t *cont, struct socket_t **sock,
  +                            ap_os_sock_t *thesock)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*sock) == NULL) {
  +        (*sock) = (struct socket_t *)ap_palloc(cont, sizeof(struct socket_t));
  +        (*sock)->cntxt = cont;
  +    }
  +    (*sock)->socketdes = *thesock;
  +    return APR_SUCCESS;
   }
   
  
  
  
  1.20      +20 -2     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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- proc.c	1999/07/02 17:46:43	1.19
  +++ proc.c	1999/07/06 17:01:41	1.20
  @@ -282,8 +282,26 @@
           return errno;
   } 
   
  -ap_os_proc_t *ap_get_os_proc(ap_proc_t *proc)
  +ap_status_t ap_get_os_proc(ap_proc_t *proc, ap_os_proc_t *theproc)
   {
  -    return &(proc->pid);
  +    if (proc == NULL) {
  +        return APR_ENOPROC;
  +    }
  +    theproc = &(proc->pid);
  +    return APR_SUCCESS;
   }
  +
  +ap_status_t ap_put_os_proc(ap_context_t *cont, struct proc_t **proc,
  +                           ap_os_proc_t *theproc)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*proc) == NULL) {
  +        (*proc) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t));
  +        (*proc)->cntxt = cont;
  +    }
  +    (*proc)->pid = *theproc;
  +    return APR_SUCCESS;
  +}              
   
  
  
  
  1.11      +20 -2     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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- thread.c	1999/07/02 17:46:43	1.10
  +++ thread.c	1999/07/06 17:01:41	1.11
  @@ -204,8 +204,26 @@
       }
   }
   
  -ap_os_thread_t *ap_get_os_thread(struct thread_t *thd)
  +ap_status_t ap_get_os_thread(struct thread_t *thd, ap_os_thread_t *thethd)
   {
  -    return thd->td;
  +    if (thd == NULL) {
  +        return APR_ENOTHREAD;
  +    }
  +    thethd = thd->td;
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_put_os_thread(ap_context_t *cont, struct thread_t **thd,
  +                             ap_os_thread_t *thethd)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*thd) == NULL) {
  +        (*thd) = (struct thread_t *)ap_palloc(cont, sizeof(struct thread_t));
  +        (*thd)->cntxt = cont;
  +    }
  +    (*thd)->td = thethd;
  +    return APR_SUCCESS;
   }
   
  
  
  
  1.9       +20 -2     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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- threadpriv.c	1999/07/02 17:46:43	1.8
  +++ threadpriv.c	1999/07/06 17:01:41	1.9
  @@ -137,8 +137,26 @@
       }
   }
   
  -ap_os_threadkey_t *ap_get_os_threadkey(ap_key_t *key)
  +ap_status_t ap_get_os_threadkey(struct threadkey_t *key, ap_os_threadkey_t *thekey)
   {
  -    return key->key;
  +    if (key == NULL) {
  +        return APR_ENOFILE;
  +    }
  +    thekey = &(key->key);
  +    return APR_SUCCESS;
   }
  +
  +ap_status_t ap_put_os_threadkey(ap_context_t *cont, struct threadkey_t **key,
  +                                ap_os_threadkey_t *thekey)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if ((*key) == NULL) {
  +        (*key) = (struct threadkey_t *)ap_palloc(cont, sizeof(struct threadkey_t));
  +        (*key)->cntxt = cont;
  +    }
  +    (*key)->key = *thekey;
  +    return APR_SUCCESS;
  +}           
   
  
  
  
  1.7       +20 -2     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- time.c	1999/07/02 17:46:44	1.6
  +++ time.c	1999/07/06 17:01:42	1.7
  @@ -134,11 +134,29 @@
       return APR_SUCCESS;
   }
   
  -ap_os_time_t *ap_get_os_time(struct atime_t *thetime)
  +ap_status_t ap_get_os_time(struct atime_t *thetime, ap_os_time_t *atime)
   {
  +    if (thetime == NULL) {
  +        return APR_ENOTIME;
  +    }
       if (thetime->currtime == -1) {
           ap_implode_time(thetime); 
  +    }
  +    atime = &(thetime->currtime);
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_put_os_time(ap_context_t *cont, struct atime_t **thetime, 
  +                           ap_os_time_t *atime)
  +{
  +    if (cont == NULL) {
  +        return APR_ENOCONT;
  +    }
  +    if (thetime == NULL) {
  +        (*thetime) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t));
  +        (*thetime)->cntxt = cont;
       }
  -    return &(thetime->currtime);
  +    (*thetime)->currtime = *atime;
  +    return APR_SUCCESS;
   }
   
  
  
  
  1.3       +20 -8     apache-apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/include/apr_portable.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_portable.h	1999/07/02 19:09:29	1.2
  +++ apr_portable.h	1999/07/06 17:01:43	1.3
  @@ -65,6 +65,9 @@
   #include "apr_errno.h"
   #include "apr_lock.h"
   #include "apr_time.h"
  +#ifdef HAVE_DIR_H
  +#include <dir.h>
  +#endif
   #ifdef HAVE_PTHREAD_H
   #include <pthread.h>
   #endif
  @@ -126,13 +129,22 @@
   typedef pthread_key_t         ap_os_threadkey_t;
   typedef time_t                ap_os_time_t;
   #endif
  +
  +ap_status_t ap_get_os_file(ap_file_t *, ap_os_file_t *);     
  +ap_status_t ap_get_os_dir(ap_dir_t *, ap_os_dir_t *);      
  +ap_status_t ap_get_os_sock(ap_socket_t *, ap_os_sock_t *);
  +ap_status_t ap_get_os_lock(ap_lock_t *, ap_os_lock_t *);     
  +ap_status_t ap_get_os_thread(ap_thread_t *, ap_os_thread_t *);
  +ap_status_t ap_get_os_proc(ap_proc_t *, ap_os_proc_t *);     
  +ap_status_t ap_get_os_time(ap_time_t *, ap_os_time_t *);     
  +ap_status_t ap_get_os_threadkey(ap_key_t *, ap_os_threadkey_t *);
   
  -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 *);
  +ap_status_t ap_put_os_file(ap_context_t *, ap_file_t **, ap_os_file_t *); 
  +ap_status_t ap_put_os_dir(ap_context_t *, ap_dir_t **, ap_os_dir_t *); 
  +ap_status_t ap_put_os_sock(ap_context_t *, ap_socket_t **, ap_os_sock_t *);
  +ap_status_t ap_put_os_lock(ap_context_t *, ap_lock_t **, ap_os_lock_t *); 
  +ap_status_t ap_put_os_thread(ap_context_t *, ap_thread_t **, ap_os_thread_t *);
  +ap_status_t ap_put_os_proc(ap_context_t *, ap_proc_t **, ap_os_proc_t *); 
  +ap_status_t ap_put_os_time(ap_context_t *, ap_time_t **, ap_os_time_t *); 
  +ap_status_t ap_put_os_threadkey(ap_context_t *, ap_key_t **, ap_os_threadkey_t *);
   
  
  
  

Mime
View raw message