rbb 99/07/06 10:37:09
Modified: apr/file_io/win32 dir.c open.c apr/locks/win32 locks.c apr/network_io/win32 sockets.c apr/threadproc/win32 proc.c thread.c threadpriv.c apr/time/win32 time.c Log: Bring Windows APR->platform types routines up to same level as unix. And add platform-> APR routines. Revision Changes Path 1.3 +21 -3 apache-apr/apr/file_io/win32/dir.c Index: dir.c =================================================================== RCS file: /home/cvs/apache-apr/apr/file_io/win32/dir.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- dir.c 1999/07/02 19:09:15 1.2 +++ dir.c 1999/07/06 17:36:59 1.3 @@ -209,7 +209,25 @@ 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->dirhand); -} \ No newline at end of file + if (dir == NULL) { + return APR_ENODIR; + } + thedir = dir->dirhand; + 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)->dirhand = thedir; + return APR_SUCCESS; +} 1.4 +20 -2 apache-apr/apr/file_io/win32/open.c Index: open.c =================================================================== RCS file: /home/cvs/apache-apr/apr/file_io/win32/open.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- open.c 1999/07/02 19:09:15 1.3 +++ open.c 1999/07/06 17:36:59 1.4 @@ -168,7 +168,25 @@ } } -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->filehand); + if (file == NULL) { + return APR_ENOFILE; + } + thefile = &(file->filehand); + 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)->filehand = *thefile; + return APR_SUCCESS; +} 1.4 +19 -2 apache-apr/apr/locks/win32/locks.c Index: locks.c =================================================================== RCS file: /home/cvs/apache-apr/apr/locks/win32/locks.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- locks.c 1999/07/02 19:09:17 1.3 +++ locks.c 1999/07/06 17:37:01 1.4 @@ -154,8 +154,25 @@ } } -ap_os_lock_t *ap_get_os_lock(struct lock_t *lock) +ap_status_t ap_get_os_lock(struct lock_t *lock, ap_os_lock_t *thelock) { - return &(lock->mutex); + if (lock == NULL) { + return APR_ENOFILE; + } + thelock = &(lock->mutex); + 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)->mutex = *thelock; + return APR_SUCCESS; +} 1.5 +21 -3 apache-apr/apr/network_io/win32/sockets.c Index: sockets.c =================================================================== RCS file: /home/cvs/apache-apr/apr/network_io/win32/sockets.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- sockets.c 1999/07/02 19:09:22 1.4 +++ sockets.c 1999/07/06 17:37:03 1.5 @@ -264,7 +264,25 @@ } } -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->sock); -} \ No newline at end of file + if (sock == NULL) { + return APR_ENOSOCKET; + } + thesock = &(sock->sock); + 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)->sock = *thesock; + return APR_SUCCESS; +} 1.7 +21 -3 apache-apr/apr/threadproc/win32/proc.c Index: proc.c =================================================================== RCS file: /home/cvs/apache-apr/apr/threadproc/win32/proc.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- proc.c 1999/07/02 19:09:25 1.6 +++ proc.c 1999/07/06 17:37:05 1.7 @@ -360,7 +360,25 @@ } } -ap_os_proc_t *ap_get_os_proc(struct proc_t *process) +ap_status_t ap_get_os_proc(ap_proc_t *proc, ap_os_proc_t *theproc) { - return &(process->pi); -} \ No newline at end of file + if (proc == NULL) { + return APR_ENOPROC; + } + theproc = &(proc->pi); + 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)->pi = *theproc; + return APR_SUCCESS; +} 1.5 +19 -2 apache-apr/apr/threadproc/win32/thread.c Index: thread.c =================================================================== RCS file: /home/cvs/apache-apr/apr/threadproc/win32/thread.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- thread.c 1999/07/02 19:09:26 1.4 +++ thread.c 1999/07/06 17:37:05 1.5 @@ -178,9 +178,26 @@ } } -ap_os_thread_t *ap_get_os_thread(ap_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.4 +23 -3 apache-apr/apr/threadproc/win32/threadpriv.c Index: threadpriv.c =================================================================== RCS file: /home/cvs/apache-apr/apr/threadproc/win32/threadpriv.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- threadpriv.c 1999/07/02 19:09:26 1.3 +++ threadpriv.c 1999/07/06 17:37:05 1.4 @@ -56,6 +56,7 @@ #include "threadproc.h" #include "apr_thread_proc.h" #include "apr_general.h" +#include "apr_lib.h" #include "apr_errno.h" #include "apr_portable.h" @@ -112,7 +113,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); -} \ No newline at end of file + 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.3 +24 -5 apache-apr/apr/time/win32/time.c Index: time.c =================================================================== RCS file: /home/cvs/apache-apr/apr/time/win32/time.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- time.c 1999/07/02 19:09:28 1.2 +++ time.c 1999/07/06 17:37:08 1.3 @@ -111,10 +111,29 @@ return APR_SUCCESS; } -ap_os_time_t *ap_get_os_time(ap_time_t *atime) +ap_status_t ap_get_os_time(struct atime_t *thetime, ap_os_time_t *atime) { - if (atime->explodedtime == NULL) { - ap_implode_time(atime); + if (thetime == NULL) { + return APR_ENOTIME; } - return atime->explodedtime; -} \ No newline at end of file + if (thetime->explodedtime == NULL) { + ap_explode_time(thetime, APR_LOCALTIME); + } + atime = thetime->explodedtime; + 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; + } + (*thetime)->explodedtime = atime; + return APR_SUCCESS; +} +