rbb         99/05/27 12:02:45

  Modified:    apr      configure.in
               apr/file_io/beos dir.c fileacc.c filedup.c fileio.h
                        filestat.c open.c pipe.c readwrite.c seek.c
               apr/file_io/unix open.c
               apr/lib  apr_pools.c
               apr/locks/beos crossproc.c intraproc.c locks.c locks.h
               apr/misc/beos start.c
               apr/network_io/beos networkio.h poll.c sendrecv.c sockets.c
                        sockopt.c
               apr/test Makefile.in testfile.c testproc.c
               apr/threadproc/beos Makefile.in proc.c signals.c thread.c
                        threadcancel.c threadpriv.c threadproc.h
               apr/time/beos access.c atime.h time.c
  Log:
  BeOS is up to date with UNIX once again.
  Submitted by:  David Reid
  
  Revision  Changes    Path
  1.16      +1 -1      apache-apr/apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/configure.in,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- configure.in      1999/05/27 15:28:08     1.15
  +++ configure.in      1999/05/27 19:02:19     1.16
  @@ -21,7 +21,7 @@
   
   if (echo "$SYS_SW" | grep -qi 'Linux'); then
       SYS_KV=`echo $SYS_REL | awk -F. '{printf "%s%s", $1, $2}'`
  -    LDLIBS="$LDLIBS -ldl"
  +    LDLIBS="$LDLIBS -ldl -lpthread"
       CFLAGS="$CFLAGS -DUSE_PTHREAD_SERIALIZE -DUSE_FCNTL_SERIALIZE"
       PLATFORM="-DLINUX=$SYS_KV"
       OSDIR="unix"
  
  
  
  1.5       +94 -91    apache-apr/apr/file_io/beos/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/dir.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- dir.c     1999/05/24 02:03:56     1.4
  +++ dir.c     1999/05/27 19:02:20     1.5
  @@ -68,36 +68,37 @@
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   } 
   
  -struct dir_t *ap_opendir(ap_context_t *cont, const char *dirname)
  +ap_status_t ap_opendir(ap_context_t *cont, const char *dirname, ap_dir_t ** 
new)
   {
  -    struct dir_t *thedir = (ap_dir_t 
*)ap_palloc(cont->pool,sizeof(ap_dir_t));
  +    (*new) = (struct dir_t *)ap_palloc(cont->pool,sizeof(struct dir_t));
   
  -    thedir->dirname = strdup(dirname);
  -    thedir->dirstruct = opendir(dirname);
  -    thedir->entry = NULL;
  +    (*new)->cntxt = cont;
  +    (*new)->dirname = strdup(dirname);
  +    (*new)->dirstruct = opendir(dirname);
  +    (*new)->entry = NULL;
   
  -    if (thedir->dirstruct == NULL) {
  -        free(thedir);
  -        return NULL;
  +    if ((*new)->dirstruct == NULL) {
  +        (*new)->dirstruct = NULL;
  +        return errno;
       }    
       else {
  -     ap_register_cleanup(cont->pool, (void*)thedir, dir_cleanup, NULL);
  -        return thedir;
  +     ap_register_cleanup(cont->pool, (void*)(*new), dir_cleanup, NULL);
  +        return APR_SUCCESS;
       }
   }
   
   ap_status_t ap_closedir(struct dir_t *thedir)
   {
       if (dir_cleanup(thedir) == APR_SUCCESS) {
  -        ap_kill_cleanup(cont->pool, thedir, dir_cleanup);
  +        ap_kill_cleanup(thedir->cntxt->pool, thedir, dir_cleanup);
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   } 
   
  @@ -105,7 +106,7 @@
   {
       thedir->entry = readdir(thedir->dirstruct);
        if (thedir->entry == NULL){
  -             return APR_FAILURE;
  +             return errno;
       }
       return APR_SUCCESS;
   }
  @@ -122,7 +123,7 @@
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   }
   
  @@ -132,86 +133,88 @@
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   }
   
  -ap_ssize_t ap_dir_entry_size(ap_context_t *context, ap_dir_t *thedir) 
  -{ 
  -    struct stat filestat; 
  +ap_status_t ap_dir_entry_size(struct dir_t *thedir, ap_ssize_t *size)
  +{
  +    struct stat filestat;
       char *fname = NULL;    
  - 
  -    if (thedir->entry == NULL) { 
  -        errno = ENOFILE; 
  -        return -1; 
  -    } 
  -    fname = ap_pstrcat(context->pool, thedir->dirname, "/", 
  -                       thedir->entry->d_name, NULL); 
  -    if (stat(fname, &filestat) == -1) { 
  -        errno = ENOSTAT; 
  -        return -1; 
  -    } 
  +
  +    if (thedir->entry == NULL) {
  +        *size = -1;
  +        return APR_ENOFILE;
  +    }
  +    fname = ap_pstrcat(thedir->cntxt->pool, thedir->dirname, "/", 
  +                       thedir->entry->d_name, NULL);
  +    if (stat(fname, &filestat) == -1) {
  +        *size = -1;
  +        return APR_ENOSTAT;
  +    }
       
  -    return filestat.st_size; 
  -} 
  - 
  -time_t ap_dir_entry_mtime(ap_context_t *context, ap_dir_t *thedir) 
  -{ 
  -    struct stat filestat; 
  -    char *fname = NULL; 
  - 
  -    if (thedir->entry == NULL) { 
  -        errno = ENOFILE; 
  -        return -1; 
  -    } 
  - 
  -    fname = ap_pstrcat(context->pool, thedir->dirname, "/", 
  -                       thedir->entry->d_name, NULL); 
  -    if (stat(fname, &filestat) == -1) { 
  -        errno = ENOSTAT; 
  -        return -1; 
  -    } 
  +    *size = filestat.st_size;
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_dir_entry_mtime(struct dir_t *thedir, time_t *time)
  +{
  +    struct stat filestat;
  +    char *fname = NULL;
  +
  +    if (thedir->entry == NULL) {
  +        *time = -1;
  +        return APR_ENOFILE;
  +    }
  +
  +    fname = ap_pstrcat(thedir->cntxt->pool, thedir->dirname, "/", 
  +                       thedir->entry->d_name, NULL);
  +    if (stat(fname, &filestat) == -1) {
  +        *time = -1;
  +        return APR_ENOSTAT;
  +    }
       
  -    return filestat.st_mtime; 
  -} 
  - 
  -ap_filetype_e ap_dir_entry_ftype(ap_context_t *context, ap_dir_t *thedir) 
  -{ 
  -    struct stat filestat; 
  -    char *fname = NULL; 
  - 
  -    if (thedir->entry == NULL) { 
  -        errno = ENOFILE; 
  -        return -1; 
  -    } 
  - 
  -    fname = ap_pstrcat(context->pool, thedir->dirname, "/", 
  -                       thedir->entry->d_name, NULL); 
  -    if (stat(fname, &filestat) == -1) { 
  -        errno = ENOSTAT; 
  -        return -1; 
  -    } 
  - 
  -    if (S_ISREG(filestat.st_mode)) 
  -        return APR_REG;    
  -    if (S_ISDIR(filestat.st_mode)) 
  -        return APR_DIR;    
  -    if (S_ISCHR(filestat.st_mode)) 
  -        return APR_CHR;    
  -    if (S_ISBLK(filestat.st_mode)) 
  -        return APR_BLK;    
  -    if (S_ISFIFO(filestat.st_mode)) 
  -        return APR_PIPE;    
  -    if (S_ISLNK(filestat.st_mode)) 
  -        return APR_LNK;    
  -    /*if (S_ISSOCK(filestat.st_mode)) 
  -        return APR_SOCK;*/    
  -} 
  - 
  -char * ap_get_dir_filename(ap_context_t * context, ap_dir_t *thedir) 
  -{ 
  -    char *name = (char *)ap_palloc(context->pool, 
strlen(thedir->entry->d_name)); 
  -    name = ap_pstrdup(context->pool, thedir->entry->d_name); 
  -    return name; 
  -} 
  +    *time = filestat.st_mtime;
  +    return APR_SUCCESS;
  +}
    
  +ap_status_t ap_dir_entry_ftype(struct dir_t *thedir, ap_filetype_e *type)
  +{
  +    struct stat filestat;
  +    char *fname = NULL;
  +
  +    if (thedir->entry == NULL) {
  +        *type = APR_REG;
  +        return APR_ENOFILE;
  +    }
  +
  +    fname = ap_pstrcat(thedir->cntxt->pool, thedir->dirname, "/", 
  +                       thedir->entry->d_name, NULL);
  +    if (stat(fname, &filestat) == -1) {
  +        *type = APR_REG;
  +        return APR_ENOSTAT;
  +    }
  +
  +    if (S_ISREG(filestat.st_mode))
  +        *type = APR_REG;    
  +    if (S_ISDIR(filestat.st_mode))
  +        *type = APR_DIR;    
  +    if (S_ISCHR(filestat.st_mode))
  +        *type = APR_CHR;    
  +    if (S_ISBLK(filestat.st_mode))
  +        *type = APR_BLK;    
  +    if (S_ISFIFO(filestat.st_mode))
  +        *type = APR_PIPE;    
  +    if (S_ISLNK(filestat.st_mode))
  +        *type = APR_LNK;    
  +    /*if (S_ISSOCK(filestat.st_mode))
  +        *type = APR_SOCK; */   
  +    return APR_SUCCESS;
  +}
  +
  +ap_status_t ap_get_dir_filename(struct dir_t *thedir, char **new)
  +{
  +    (*new) = ap_pstrdup(thedir->cntxt->pool, thedir->entry->d_name);
  +    return APR_SUCCESS;
  +}
  +
  
  
  
  1.5       +66 -3     apache-apr/apr/file_io/beos/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/fileacc.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- fileacc.c 1999/05/24 02:03:56     1.4
  +++ fileacc.c 1999/05/27 19:02:21     1.5
  @@ -61,13 +61,15 @@
   
   /* A file to put ALL of the accessor functions for struct file_t types. */
   
  -char * ap_get_filename(struct file_t *thefile)
  +ap_status_t ap_get_filename(struct file_t *thefile, char **new)
   {
       if (thefile != NULL) {
  -        return thefile->fname;
  +        *new = (char*)ap_pstrdup(thefile->cntxt->pool, thefile->fname);
  +        return APR_SUCCESS;
       }
       else {
  -        return NULL;
  +        *new = NULL;
  +        return APR_ENOFILE;
       }
   }
   
  @@ -98,4 +100,65 @@
    
       return rv; 
   } 
  +
  +
  +ap_status_t ap_get_filesize(struct file_t *file, ap_ssize_t *size)
  +{
  +    if (file != NULL) {
  +        *size = file->size;
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        *size = -1;
  +        return APR_ENOFILE;
  +    }
  +}
  +
  +ap_status_t ap_get_fileperms(struct file_t *file, ap_fileperms_t *perm)
  +{
  +    if (file != NULL) {
  +        *perm = file->protection;
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        *perm = -1;
  +        return APR_ENOFILE;
  +    }
  +}
  +
  +ap_status_t ap_get_fileatime(struct file_t *file, time_t *time)
  +{    
  +    if (file != NULL) {
  +        *time = file->atime;
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        *time = -1;
  +        return APR_ENOFILE;
  +    }
  +}
  +
  +ap_status_t ap_get_filectime(struct file_t *file, time_t *time)
  +{    
  +    if (file != NULL) {
  +        *time = file->ctime;
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        *time = -1;
  +        return APR_ENOFILE;
  +    }
  +}
  +
  +ap_status_t ap_get_filemtime(struct file_t *file, time_t *time)
  +{    
  +    if (file != NULL) {
  +        *time = file->mtime;
  +        return APR_SUCCESS;
  +    }
  +    else {
  +        *time = -1;
  +        return APR_ENOFILE;
  +    }
  +}
   
  
  
  
  1.5       +19 -18    apache-apr/apr/file_io/beos/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/filedup.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- filedup.c 1999/05/24 02:03:56     1.4
  +++ filedup.c 1999/05/27 19:02:21     1.5
  @@ -58,24 +58,25 @@
   #include "apr_file_io.h"
   #include "apr_general.h"
   
  -struct file_t *ap_dupfile(struct file_t *old_file)
  +ap_status_t ap_dupfile(struct file_t *old_file, struct file_t **new_file)
   {
  -    struct file_t * new_file = (struct file_t 
*)ap_palloc(cont->pool,sizeof(struct file_t));
  +    (*new_file) = (struct file_t *)ap_palloc(old_file->cntxt->pool,
  +                               sizeof(struct file_t));
       
  -    if (new_file == NULL) {
  -        errno = ENOMEM;
  -        return NULL;
  -    } 
  -    old_file->filedes = new_file->filedes; 
  -    old_file->fname = new_file->fname;
  -    old_file->buffered = new_file->buffered;
  -    old_file->protection = new_file->protection;
  -    old_file->user = new_file->user;
  -    old_file->group = new_file->group;
  -    old_file->size = new_file->size;
  -    old_file->atime = new_file->atime;    
  -    old_file->mtime = new_file->mtime;
  -    old_file->ctime = new_file->ctime;
  -    ap_register_cleanup(cont->pool, (void *)new_file, file_cleanup, NULL);
  +    if ((*new_file) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +    (*new_file)->cntxt = old_file->cntxt; 
  +    (*new_file)->filedes = dup(old_file->filedes); 
  +    (*new_file)->fname = (char*)ap_pstrdup(old_file->cntxt->pool, 
old_file->fname);
  +    (*new_file)->buffered = old_file->buffered;
  +    (*new_file)->protection = old_file->protection;
  +    (*new_file)->user = old_file->user;
  +    (*new_file)->group = old_file->group;
  +    (*new_file)->size = old_file->size;
  +    (*new_file)->atime = old_file->atime;    
  +    (*new_file)->mtime = old_file->mtime;
  +    (*new_file)->ctime = old_file->ctime;
  +    ap_register_cleanup((*new_file)->cntxt->pool, (void *)(*new_file), 
file_cleanup, NULL);
  +    return APR_SUCCESS;
   }
  -
  
  
  
  1.3       +3 -1      apache-apr/apr/file_io/beos/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/fileio.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- fileio.h  1999/05/17 18:31:30     1.2
  +++ fileio.h  1999/05/27 19:02:21     1.3
  @@ -69,6 +69,7 @@
   #define ENOFILE B_ENTRY_NOT_FOUND
   
   struct file_t {
  +    ap_context_t *cntxt;
       int filedes;
       char * fname;
       int buffered;
  @@ -82,13 +83,14 @@
   };
   
   struct dir_t {
  +    ap_context_t *cntxt;
       char *dirname;
       DIR *dirstruct;
       struct dirent *entry;
   };
   
  -typedef mode_t                       fileperms_t;
   struct iovec_t {
  +    ap_context_t *cntxt;
        struct iovec *iovec;
   };
   
  
  
  
  1.5       +3 -5      apache-apr/apr/file_io/beos/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/filestat.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- filestat.c        1999/05/24 02:03:56     1.4
  +++ filestat.c        1999/05/27 19:02:22     1.5
  @@ -61,7 +61,7 @@
   ap_status_t ap_getfileinfo(struct file_t *thefile)
   {
       struct stat info;
  -    int rv = stat(fname, &info);
  +    int rv = stat(thefile->fname, &info);
   
       if (rv == 0) {
           thefile->protection = info.st_mode;
  @@ -74,8 +74,7 @@
           return APR_SUCCESS;
       }
       else {
  -        errno = ENOSTAT;
  -        return APR_FAILURE;
  +        return APR_ENOSTAT;
       }
   }
   
  @@ -95,7 +94,6 @@
           return APR_SUCCESS;
       }
       else {
  -        errno = ENOSTAT;
  -        return APR_FAILURE;
  +        return APR_ENOSTAT;
       }
   }
  
  
  
  1.6       +31 -27    apache-apr/apr/file_io/beos/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/open.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- open.c    1999/05/24 02:03:57     1.5
  +++ open.c    1999/05/27 19:02:22     1.6
  @@ -75,17 +75,21 @@
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
        /* Are there any error conditions other than EINTR or EBADF? */
       }
   }
   
  -ap_file_t *ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,  
ap_fileperms_t mode)
  +ap_status_t ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,  
ap_fileperms_t perm, struct file_t **new)
   {
       int oflags = 0;
  -    struct file_t *dafile = (struct file_t *)ap_palloc(cont->pool, 
sizeof(struct file_t));
       struct stat info;
  +    mode_t mode = get_fileperms(perm);
   
  +    (*new) = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
  +    
  +    (*new)->cntxt = cont;
  +    
       if ((flag & APR_READ) && (flag & APR_WRITE)) {
           oflags = B_READ_WRITE;
       }
  @@ -96,11 +100,14 @@
           oflags = B_WRITE_ONLY;
       }
       else {
  -        errno = EACCES;
  -             free (dafile);
  -             return NULL;
  +        (*new)->filedes = -1;
  +             return APR_EACCES;
       }
  -    dafile->fname = (char*)strdup(fname);
  +    if (flag & APR_BUFFERED) {
  +       (*new)->buffered = TRUE;
  +    }
  +
  +    (*new)->fname = (char*)strdup(fname);
       if (flag & APR_CREATE) {
           oflags |= B_CREATE_FILE; 
                if (flag & APR_EXCL) {
  @@ -108,10 +115,8 @@
                }
       }
       if ((flag & APR_EXCL) && !(flag & APR_CREATE)) {
  -        errno = EACCES;
  -        free(dafile->fname);
  -             free (dafile);
  -             return NULL;
  +        (*new)->filedes = -1;
  +             return APR_EACCES;
       }   
   
       if (flag & APR_APPEND) {
  @@ -120,33 +125,32 @@
       if (flag & APR_TRUNCATE) {
           oflags |= B_ERASE_FILE;
       }
  -    dafile->filedes = open(fname, oflags, mode);
  -    
  -    if (dafile->filedes < 0) {
  -        dafile->filedes = -1;
  -        return NULL;
  -    }
   
  -    if (ap_updatefileinfo(cont, dafile) == APR_SUCCESS) {
  -             ap_register_cleanup(cont->pool, (void *)dafile, file_cleanup, 
NULL);
  -             return dafile;
  +    (*new)->filedes = open(fname, oflags, mode);
  +    
  +    if ((*new)->filedes < 0) {
  +        (*new)->filedes = -1;
  +        return errno;
  +    }
  +    if (ap_updatefileinfo(*new) == APR_SUCCESS) {
  +             ap_register_cleanup((*new)->cntxt->pool, (void *)(*new),
  +                                 file_cleanup, NULL);
  +             return APR_SUCCESS;
       }
       else {
  -        errno = ENOSTAT;
  -        free(dafile->fname);
  -             free (dafile);
  -             return NULL;
  +        (*new)->filedes = -1;
  +             return APR_ENOSTAT;
       }
   }
   
   ap_status_t ap_close(struct file_t * file)
   {
       if (file_cleanup(file) == APR_SUCCESS) {
  -        ap_kill_cleanup(cont->pool, file, file_cleanup);
  +        ap_kill_cleanup(file->cntxt->pool, file, file_cleanup);
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
        /* Are there any error conditions other than EINTR or EBADF? */
       }
   }
  @@ -157,6 +161,6 @@
           return APR_SUCCESS; 
       } 
       else { 
  -        return APR_FAILURE; 
  +        return errno; 
       } 
   } 
  
  
  
  1.3       +17 -13    apache-apr/apr/file_io/beos/pipe.c
  
  Index: pipe.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/pipe.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- pipe.c    1999/05/24 02:03:57     1.2
  +++ pipe.c    1999/05/27 19:02:22     1.3
  @@ -62,30 +62,34 @@
   #include "apr_file_io.h"
   #include "apr_general.h"
   
  -ap_status_t ap_create_pipe(struct file_t *out)
  +ap_status_t ap_create_pipe(ap_context_t *cont, struct file_t **in, struct 
file_t **out)
   {
       int filedes[2];
  +
       if (pipe(filedes) == -1) {
  -        return APR_FAILURE;
  +        return errno;
       }
       
  -    in->filedes = filedes[0];
  -    in->fname = strdup("PIPE");
  +    (*in) = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
  +    (*in)->cntxt = cont;
  +    (*in)->filedes = filedes[0];
  +    (*in)->fname = (char*)ap_pstrdup(cont->pool, "PIPE");
   
  -    out->filedes = filedes[1];
  -    out->fname = strdup("PIPE");
  +    (*out) = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
  +    (*out)->cntxt = cont;
  +    (*out)->filedes = filedes[1];
  +    (*out)->fname = (char*)ap_pstrdup(cont->pool, "PIPE");
   
       return APR_SUCCESS;
   }
   
  -char *ap_create_namedpipe(ap_context_t *cont, char *dirpath, ap_fileperms_t 
perm)
  +ap_status_t ap_create_namedpipe(ap_context_t *cont, char *dirpath, 
ap_fileperms_t perm, char **new)
   {
  -    char *tmp;
       mode_t mode = get_fileperms(perm);
  -    tmp = tempnam(dirpath, NULL);
  -    if (mkfifo(tmp, mode) == -1) {
  -        free(tmp);
  -        return NULL;
  +
  +    *new = tempnam(dirpath, NULL);
  +    if (mkfifo((*new), mode) == -1) {
  +        return errno;
       }
  -    return tmp;
  +    return APR_SUCCESS;
   } 
  
  
  
  1.6       +19 -14    apache-apr/apr/file_io/beos/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/readwrite.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- readwrite.c       1999/05/24 02:03:57     1.5
  +++ readwrite.c       1999/05/27 19:02:22     1.6
  @@ -60,31 +60,32 @@
   #include "apr_general.h"
   #include "apr_errno.h"
   
  -ap_ssize_t ap_read(struct file_t *thefile, void *buf, ap_ssize_t nbytes)
  +ap_status_t ap_read(const struct file_t *thefile, void *buf, ap_ssize_t 
*nbytes)
   {
       ap_size_t rv;
   
       if (thefile->filedes < 0) {
  -        errno = EBADF;
  -        return -1;
  +        *nbytes = -1;
  +        return APR_EBADF;
       }
   
  -    rv = read(thefile->filedes, buf, nbytes);
  +    rv = read(thefile->filedes, buf, *nbytes);
   
  -    return rv;
  +    *nbytes = rv;
  +    return APR_SUCCESS;
   }
   
  -ap_ssize_t ap_write(struct file_t *thefile, void * buf, ap_ssize_t nbytes)
  +ap_status_t ap_write(struct file_t *thefile, void * buf, ap_ssize_t *nbytes)
   {
       ap_size_t rv;
       struct stat info;
   
       if (thefile->filedes < 0) {
  -        errno = EBADF;
  -        return APR_FAILURE;
  +        *nbytes = -1;
  +        return APR_EBADF;
       }
   
  -    rv = write(thefile->filedes, buf, nbytes);
  +    rv = write(thefile->filedes, buf, *nbytes);
   
       if (stat(thefile->fname, &info) == 0) {
           thefile->size = info.st_size;
  @@ -92,16 +93,20 @@
           thefile->mtime = info.st_mtime;
           thefile->ctime = info.st_ctime;
       }
  -    return rv;
  +
  +    *nbytes = rv;
  +    return APR_SUCCESS;
   }    
   
  -ap_ssize_t ap_writev(struct iovec_t *vec, ap_ssize_t iocnt)
  +ap_status_t ap_writev(struct file_t *thefile, const struct iovec_t *vec, 
ap_ssize_t *iocnt)
   {
        ap_ssize_t bytes;
  -     if ((bytes = writev(thefile->filedes, vec->iovec, iocnt)) < 0){
  -             return APR_FAILURE;
  +     if ((bytes = writev(thefile->filedes, vec->iovec, *iocnt)) < 0){
  +             *iocnt = bytes;
  +             return errno;
        }
        else {
  -             return bytes;
  +         *iocnt = bytes;
  +             return APR_SUCCESS;
        }
   }
  
  
  
  1.5       +12 -2     apache-apr/apr/file_io/beos/seek.c
  
  Index: seek.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/file_io/beos/seek.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- seek.c    1999/05/24 02:03:57     1.4
  +++ seek.c    1999/05/27 19:02:23     1.5
  @@ -58,7 +58,17 @@
   #include "fileio.h"
   #include "apr_file_io.h"
   
  -ap_off_t ap_seek(struct file_t *thefile, ap_off_t offset, ap_seek_where_t 
where)
  +ap_status_t ap_seek(struct file_t *thefile, ap_seek_where_t where, ap_off_t 
*offset)
   {
  -    return lseek(thefile->filedes, offset, where);
  +    ap_off_t rv;
  +    rv = lseek(thefile->filedes, *offset, where);
  +    if (rv == -1) {
  +        *offset = -1;
  +        return errno;
  +    }
  +    else {
  +        *offset = rv;
  +        return APR_SUCCESS;
  +    }
  +
   }
  
  
  
  1.25      +2 -1      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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- open.c    1999/05/25 03:14:15     1.24
  +++ open.c    1999/05/27 19:02:25     1.25
  @@ -59,6 +59,7 @@
   #include "apr_lib.h"
   #include <errno.h>
   #include <string.h>
  +#include <stdio.h>
   
   ap_status_t file_cleanup(void *thefile)
   {
  @@ -79,7 +80,7 @@
       struct stat info;
       mode_t mode = get_fileperms(perm);    
   
  -   (*new) = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
  +    (*new) = (struct file_t *)ap_palloc(cont->pool, sizeof(struct file_t));
   
       (*new)->cntxt = cont;
   
  
  
  
  1.4       +0 -1      apache-apr/apr/lib/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/lib/apr_pools.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- apr_pools.c       1999/05/10 17:46:21     1.3
  +++ apr_pools.c       1999/05/27 19:02:29     1.4
  @@ -1720,7 +1720,6 @@
                                      ap_status_t (*child_cleanup) (void *))
   {
       struct cleanup *c;
  -
       c = (struct cleanup *) ap_palloc(p, sizeof(struct cleanup));
       c->data = data;
       c->plain_cleanup = plain_cleanup;
  
  
  
  1.2       +16 -17    apache-apr/apr/locks/beos/crossproc.c
  
  Index: crossproc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/locks/beos/crossproc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- crossproc.c       1999/05/17 18:41:15     1.1
  +++ crossproc.c       1999/05/27 19:02:31     1.2
  @@ -57,61 +57,60 @@
   #include "apr_general.h"
   #include "locks.h"
   
  -ap_status_t lock_inter_cleanup(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t lock_inter_cleanup(ap_lock_t *lock)
   {
       if (lock->curr_locked == 1) {
        if (atomic_add(&lock->ben_interproc , -1) > 1){
                release_sem (lock->sem_interproc);
  -     } else {
  -             return APR_FAILURE;
        }
       }
       return APR_SUCCESS;
   }    
   
  -ap_status_t create_inter_lock(ap_context_t *cont, ap_lock_t *new)
  +ap_status_t create_inter_lock(ap_lock_t *new)
   {
  -    new->sem_interproc = (sem_id)ap_palloc(cont->pool, sizeof(sem_id));
  -    new->ben_interproc = (int32)ap_palloc(cont->pool, sizeof(int32));
  +    new->sem_interproc = (sem_id)ap_palloc(new->cntxt->pool, sizeof(sem_id));
  +    new->ben_interproc = (int32)ap_palloc(new->cntxt->pool, sizeof(int32));
       
       new->ben_interproc = 0;
       new->sem_interproc = create_sem(0, "ap_intraproc");
       if (new->sem_interproc < B_NO_ERROR){
  -     lock_inter_cleanup(cont, new);
  -        return APR_FAILURE;
  +     lock_inter_cleanup(new);
  +        return errno;
       }
       new->curr_locked == 0;
  -    ap_register_cleanup(cont->pool, (void *)new, lock_inter_cleanup, NULL);
  +    ap_register_cleanup(new->cntxt->pool, (void *)new, lock_inter_cleanup, 
NULL);
       return APR_SUCCESS;
   }
   
  -ap_status_t lock_inter(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t lock_inter(ap_lock_t *lock)
   {
        if (atomic_add(&lock->ben_interproc, 1) > 0){
                acquire_sem(lock->sem_interproc);
        } else {
  -             return APR_FAILURE;
  +             return errno;
        }
       lock->curr_locked == 1;
       return APR_SUCCESS;
   }
   
  -ap_status_t unlock_inter(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t unlock_inter(ap_lock_t *lock)
   {
        if (atomic_add(&lock->ben_interproc, -1) > 1){
                release_sem(lock->sem_interproc);
       } else {
  -     return APR_FAILURE;
  +     return errno;
       }
       lock->curr_locked == 0;
       return APR_SUCCESS;
   }
   
  -ap_status_t destroy_inter_lock(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t destroy_inter_lock(ap_lock_t *lock)
   {
  -    if (lock_inter_cleanup(cont, lock) == APR_SUCCESS) {
  -        ap_kill_cleanup(cont->pool, lock, lock_inter_cleanup);
  +    ap_status_t stat;
  +    if ((stat = lock_inter_cleanup(lock)) == APR_SUCCESS) {
  +        ap_kill_cleanup(lock->cntxt->pool, lock, lock_inter_cleanup);
           return APR_SUCCESS;
       }
  -    return APR_FAILURE;
  +    return stat;
   }
  
  
  
  1.2       +22 -17    apache-apr/apr/locks/beos/intraproc.c
  
  Index: intraproc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/locks/beos/intraproc.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- intraproc.c       1999/05/17 18:41:16     1.1
  +++ intraproc.c       1999/05/27 19:02:31     1.2
  @@ -57,48 +57,52 @@
   #include "apr_general.h"
   #include "locks.h"
   #include <kernel/OS.h>
  +#include <stdio.h>
   
  -ap_status_t lock_intra_cleanup(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t lock_intra_cleanup(ap_lock_t *lock)
   {
  +printf ("lock_intra_cleanup\n");
       if (lock->curr_locked == 1) {
        if (atomic_add(&lock->ben_intraproc , -1) > 1){
                release_sem (lock->sem_intraproc);
        } else {
  -             return APR_FAILURE;
  +             return errno;
        }
       }
       return APR_SUCCESS;
   }    
   
  -ap_status_t create_intra_lock(ap_context_t *cont, ap_lock_t *new)
  +ap_status_t create_intra_lock(struct lock_t *new)
   {
  -    new->sem_intraproc = (sem_id)ap_palloc(cont->pool, sizeof(sem_id));
  -    new->ben_intraproc = (int32)ap_palloc(cont->pool, sizeof(int32));
  +    int32 stat;
  +    new->sem_intraproc = (sem_id)ap_palloc(new->cntxt->pool, sizeof(sem_id));
  +    new->ben_intraproc = (int32)ap_palloc(new->cntxt->pool, sizeof(int32));
       
       new->ben_intraproc = 0;
  -    new->sem_intraproc = create_sem(0, "ap_intraproc");
  -    if (new->sem_intraproc < B_NO_ERROR){
  -     lock_intra_cleanup(cont, new);
  -        return APR_FAILURE;
  +    stat = create_sem(0, "ap_intraproc");
  +    if (stat < B_NO_ERROR){
  +     lock_intra_cleanup(new);
  +        return stat;
       }
  +    new->sem_intraproc = stat;
       new->curr_locked == 0;
  -    ap_register_cleanup(cont->pool, (void *)new, lock_intra_cleanup, NULL);
  +    ap_register_cleanup(new->cntxt->pool, (void *)new, lock_intra_cleanup, 
NULL);
       return APR_SUCCESS;
   }
   
  -ap_status_t lock_intra(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t lock_intra(ap_lock_t *lock)
   {
       lock->curr_locked == 1;
        if (atomic_add (&lock->ben_intraproc, 1) >0){
                if (acquire_sem(lock->sem_intraproc) != B_NO_ERROR){
                        atomic_add(&lock->ben_intraproc,-1);
  -             return(APR_FAILURE);
  +             return errno;
        }
       }
       return APR_SUCCESS;
   }
   
  -ap_status_t unlock_intra(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t unlock_intra(ap_lock_t *lock)
   {
        if (atomic_add(&lock->ben_intraproc, -1) > 1){
                release_sem(lock->sem_intraproc);
  @@ -107,11 +111,12 @@
       return APR_SUCCESS;
   }
   
  -ap_status_t destroy_intra_lock(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t destroy_intra_lock(ap_lock_t *lock)
   {
  -    if (lock_intra_cleanup(cont, lock) == APR_SUCCESS) {
  -        ap_kill_cleanup(cont->pool, lock, lock_intra_cleanup);
  +    ap_status_t stat;
  +    if ((stat = lock_intra_cleanup(lock)) == APR_SUCCESS) {
  +        ap_kill_cleanup(lock->cntxt->pool, lock, lock_intra_cleanup);
           return APR_SUCCESS;
       }
  -    return APR_FAILURE;
  +    return stat;
   }
  
  
  
  1.2       +40 -25    apache-apr/apr/locks/beos/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/locks/beos/locks.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- locks.c   1999/05/17 18:41:16     1.1
  +++ locks.c   1999/05/27 19:02:31     1.2
  @@ -57,69 +57,84 @@
   #include "apr_general.h"
   #include "locks.h"
   #include <strings.h>
  +#include <stdio.h>
   
  -ap_lock_t *ap_create_lock(ap_context_t *cont, ap_locktype_e type, char 
*fname)
  +ap_status_t ap_create_lock(ap_context_t *cont, ap_locktype_e type, char 
*fname, struct lock_t **lock)
   {
  -    ap_lock_t *new;
  -
  -    new = (ap_lock_t *)ap_palloc(cont->pool, sizeof(ap_lock_t));
  -
  +    struct lock_t *new;
  +    ap_status_t stat;
  +    
  +    new = (struct lock_t *)ap_palloc(cont->pool, sizeof(struct lock_t));
  +    if (new == NULL){
  +        return APR_ENOMEM;
  +    }
  +    
  +    new->cntxt = cont;
  +    if (new->cntxt->pool == NULL){
  +        printf ("null pool\n");
  +        return APR_ENOMEM;
  +    }
       new->type = type;
       new->fname = strdup(fname);
   
       if (type != APR_CROSS_PROCESS) {
  -        if (create_intra_lock(cont, new) == APR_FAILURE) {
  -            return NULL;
  +        if ((stat = create_intra_lock(new)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       if (type != APR_INTRAPROCESS) {
  -        if (create_inter_lock(cont, new) == APR_FAILURE) {
  -            return NULL;
  +        if ((stat = create_inter_lock(new)) != APR_SUCCESS) {
  +            return stat;
           }
       }
  -    return new;
  +    (*lock) = new;
  +    return APR_SUCCESS;
   }
   
  -ap_status_t ap_lock(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t ap_lock(ap_lock_t *lock)
   {
  +    ap_status_t stat;
  +    
       if (lock->type != APR_CROSS_PROCESS) {
  -        if (lock_intra(cont, lock) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = lock_intra(lock)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       if (lock->type != APR_INTRAPROCESS) {
  -        if (lock_inter(cont, lock) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = lock_inter(lock)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       return APR_SUCCESS;
   }
   
  -ap_status_t ap_unlock(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t ap_unlock(ap_lock_t *lock)
   {
  +    ap_status_t stat;
       if (lock->type != APR_CROSS_PROCESS) {
  -        if (unlock_intra(cont, lock) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = unlock_intra(lock)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       if (lock->type != APR_INTRAPROCESS) {
  -        if (unlock_inter(cont, lock) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = unlock_inter(lock)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       return APR_SUCCESS;
   }
   
  -ap_status_t ap_destroy_lock(ap_context_t *cont, ap_lock_t *lock)
  +ap_status_t ap_destroy_lock(ap_lock_t *lock)
   {
  +    ap_status_t stat; 
       if (lock->type != APR_CROSS_PROCESS) {
  -        if (destroy_intra_lock(cont, lock) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = destroy_intra_lock(lock)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       if (lock->type != APR_INTRAPROCESS) {
  -        if (destroy_inter_lock(cont, lock) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = destroy_inter_lock(lock)) != APR_SUCCESS) {
  +            return stat;
           }
       }
       return APR_SUCCESS;
  
  
  
  1.2       +1 -0      apache-apr/apr/locks/beos/locks.h
  
  Index: locks.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/locks/beos/locks.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- locks.h   1999/05/17 18:41:16     1.1
  +++ locks.h   1999/05/27 19:02:32     1.2
  @@ -60,6 +60,7 @@
   #include "apr_file_io.h"
   
   struct lock_t {
  +    ap_context_t *cntxt;
       ap_locktype_e type;
       int curr_locked;
       char *fname;
  
  
  
  1.2       +35 -37    apache-apr/apr/misc/beos/start.c
  
  Index: start.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/misc/beos/start.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- start.c   1999/05/17 18:43:35     1.1
  +++ start.c   1999/05/27 19:02:33     1.2
  @@ -62,60 +62,58 @@
   #include <errno.h>
   #include <string.h>
   
  -ap_context_t *ap_initialize(void *data)
  +ap_status_t ap_create_context(ap_context_t *cont, void *data, ap_context_t 
**newcont)
   {
       ap_context_t *new;
       ap_pool_t *pool;
   
  -    pool = ap_init_alloc();
  -
  +    if (cont) {
  +        pool = ap_make_sub_pool(cont->pool);
  +    }
  +    else {
  +        pool = ap_init_alloc();;
  +    }
  +        
       if (pool == NULL) {
  -        errno = ENOPOOL;
  -        return NULL;
  +        return APR_ENOPOOL;
       }    
       new = (ap_context_t *)ap_palloc(pool, sizeof(ap_context_t));
       new->pool = pool;
  -    new->prog_data = data;
  -    new->signal_safe = 0;
  -    new->cancel_safe = 0;
  -
  -    return new;
  +    if (data == NULL && cont) {
  +        new->prog_data = cont->prog_data;
  +    }
  +    else {
  +        new->prog_data = data;
  +    }
  +    if (cont) { 
  +        new->signal_safe = cont->signal_safe;
  +        new->cancel_safe = cont->cancel_safe;
  +    }
  +    else {
  +        new->signal_safe = 0;
  +        new->cancel_safe = 0;
  +    }
  + 
  +    *newcont = new;
  +    return APR_SUCCESS;
   }
   
   ap_status_t ap_set_signal_safe(ap_context_t *cont, ap_int16_t safe)
   {
  -    cont->signal_safe = safe;
  -    return APR_SUCCESS;
  +    if (cont) { 
  +        cont->signal_safe = safe;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOCONT;
   }
   
   ap_status_t ap_set_cancel_safe(ap_context_t *cont, ap_int16_t safe)
   {
  -    cont->cancel_safe = safe;
  -    return APR_SUCCESS;
  -}
  -
  -ap_context_t *ap_create_sub_context(ap_context_t *cont, void *data)
  -{
  -    ap_context_t *new;
  -    ap_pool_t *pool;
  -
  -    pool = ap_make_sub_pool(cont->pool);
  -    if (pool == NULL) {
  -        errno = ENOPOOL;
  -        return NULL;
  -    }    
  -    new = (ap_context_t *)ap_palloc(pool, sizeof(ap_context_t));
  -    new->pool = pool;
  -    if (data == NULL) {
  -        cont->prog_data = cont->prog_data;
  +    if (cont) { 
  +        cont->cancel_safe = safe;
  +        return APR_SUCCESS;
       }
  -    else {
  -        cont->prog_data = data;
  -    }
  -    cont->signal_safe = cont->signal_safe;
  -    cont->cancel_safe = cont->cancel_safe;
  -
  -    return new;
  +    return APR_ENOCONT;
   }
   
   ap_status_t ap_destroy_context(ap_context_t *cont)
  
  
  
  1.3       +2 -0      apache-apr/apr/network_io/beos/networkio.h
  
  Index: networkio.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/beos/networkio.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- networkio.h       1999/05/17 18:37:43     1.2
  +++ networkio.h       1999/05/27 19:02:34     1.3
  @@ -68,6 +68,7 @@
   #define POLLNVAL 32
   
   struct socket_t {
  +    ap_context_t *cntxt;
       int socketdes;
       char *remote_hostname;
       struct sockaddr_in * addr;
  @@ -75,6 +76,7 @@
   };
   
   struct pollfd_t {
  +    ap_context_t *cntxt;
       struct socket_t *sock;
       int16 events;
       int16 revents;
  
  
  
  1.3       +47 -25    apache-apr/apr/network_io/beos/poll.c
  
  Index: poll.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/beos/poll.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- poll.c    1999/05/24 02:04:05     1.2
  +++ poll.c    1999/05/27 19:02:34     1.3
  @@ -54,8 +54,6 @@
    */
   
   
  -#include <errno.h>
  -#include <stdio.h>
   #include "networkio.h"
   #include "apr_network_io.h"
   #include "networkio.h"
  @@ -66,11 +64,14 @@
   /*  uses select.  However, select on beos isn't that hot either, so */
   /*  until R5 we have to live with a less than perfect implementation */
    
  -struct pollfd_t *ap_setup_poll(ap_context_t *context, ap_int32_t num) 
  +ap_status_t ap_setup_poll(ap_context_t *cont, ap_int32_t num, struct 
pollfd_t **new) 
   { 
  -    struct pollfd_t *new; 
  -    new = (struct pollfd_t *)ap_palloc(context->pool, sizeof(struct 
pollfd_t) * num); 
  -    return new; 
  +    (*new) = (struct pollfd_t *)ap_palloc(cont->pool, sizeof(struct 
pollfd_t) * num); 
  +    if ((*new) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +    (*new)->cntxt = cont;
  +    return APR_SUCCESS;
   } 
    
   ap_int16_t get_event(ap_int16_t event) 
  @@ -92,37 +93,57 @@
    
       return rv; 
   } 
  +
  +ap_int16_t get_revent(ap_int16_t event)
  +{
  +    ap_int16_t rv = 0;
  +
  +    if (event & POLLIN)
  +        rv |= APR_POLLIN;        
  +    if (event & POLLPRI)
  +        rv |= APR_POLLPRI;        
  +    if (event & POLLOUT)
  +        rv |= APR_POLLOUT;       
  +    if (event & POLLERR)
  +        rv |= APR_POLLERR;        
  +    if (event & POLLHUP)
  +        rv |= APR_POLLHUP;        
  +    if (event & POLLNVAL)
  +        rv |= APR_POLLNVAL;        
  +
  +    return rv;
  +}
    
  -void ap_add_poll_socket(struct pollfd_t *aprset, 
  +ap_status_t ap_add_poll_socket(struct pollfd_t *aprset, 
                                 struct socket_t *sock, ap_int16_t event, 
                                  ap_int32_t pos) 
   { 
       aprset[pos].sock = sock; 
  -    aprset[pos].events = get_event(event); 
  +    aprset[pos].events = get_event(event);
  +    return APR_SUCCESS; 
   } 
   
  -ap_int32_t ap_poll(struct pollfd_t *aprset, ap_int32_t nsds, ap_int32_t 
timeout)
  +ap_status_t ap_poll(struct pollfd_t *aprset, ap_int32_t *nsds, ap_int32_t 
timeout)
   {
       int i;
  -    int rv,maxfd;
  +    int rv = 0, maxfd = 0;
       uint32 starttime;
        char test = 'T';
       struct timeval tv;
        fd_set rd;
       struct beos_pollfd_t *pollset;
   
  -    pollset = (struct beos_pollfd_t *)ap_palloc(cont->pool, sizeof(struct 
beos_pollfd_t *) * nsds);;
  +    pollset = (struct beos_pollfd_t *)ap_palloc(aprset->cntxt->pool, 
sizeof(struct beos_pollfd_t *) * *nsds);;
   
        FD_ZERO(&rd);
        
        /* try to build the fd_set mask for the read sockets... */
  -    for (i = 0; i < nsds; i++) {
  +    for (i = 0; i < *nsds; i++) {
        pollset[i].fd = aprset[i].sock->socketdes;
                pollset[i].events = aprset[i].events;
                if (pollset[i].fd > maxfd)
                        maxfd=pollset[i].fd;
                if (aprset[i].events & POLLIN)  {
  -                     printf ("Setting socket %d to POLLIN - maxfd is 
%d...\n",pollset[i].fd, maxfd);
                FD_SET(pollset[i].fd, &rd); 
           }
        }
  @@ -140,7 +161,6 @@
        /* if rv == -1 then it's an error */
        /* if the errno == EINTR then we need to go again... */
        if (rv == -1 && errno == EINTR){
  -             printf ("EINTR\n");
                if (timeout == -1){ /* i.e. no timeout */
                        goto tryselectagain;
                } else {
  @@ -163,20 +183,12 @@
        if (rv >= 0){
                /* i.e. we have a read socket to set the revents for */
                rv = 0; /* we reset for an independant check ! */
  -             for (i = 0; i < nsds; i++){
  +             for (i = 0; i < *nsds; i++){
                        int ret = 0;
  -                     printf ("Looking at pollset %d for ",i);
  -                     if (pollset[i].events & POLLIN)
  -                             printf ("POLLIN");
  -                     if (pollset[i].events & POLLOUT)
  -                             printf ("POLLOUT");
  -                     printf ("\n");
                if ((pollset[i].events & POLLIN) && FD_ISSET(pollset[i].fd, 
&rd)){
  -                     printf ("socket %d is OK to read from.\n", 
pollset[i].fd);
                        ret |= POLLIN;
                }
                if (pollset[i].events & POLLOUT) {
  -                             printf ("Trying POLLOUT for %d...\n",i);
                        /* we asked if we could send... */
                        if (send(pollset[i].fd, &test, 0, 0)!=0){
                        if (errno == EWOULDBLOCK){
  @@ -186,7 +198,6 @@
                                                goto tryselectagain;
                                        } else {
                                        /* an error has occurred... */
  -                                     perror("********* POLLOUT in poll");
                                        ret |= POLLERR;
                                }
                        } else {
  @@ -205,5 +216,16 @@
        if (rv == 0 && ((real_time_clock() - starttime) < timeout))
                goto tryselectagain;
   
  -     return rv;
  +    (*nsds) = rv;
  +    if ((*nsds) < 0) {
  +        return errno;
  +    }
  +    return APR_SUCCESS;
   }
  +
  +ap_status_t ap_get_revents(struct pollfd_t *aprset, ap_int32_t pos, 
ap_int16_t *event)
  +{
  +    (*event) = aprset[pos].revents;
  +    return APR_SUCCESS;
  +}
  +
  
  
  
  1.4       +19 -12    apache-apr/apr/network_io/beos/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/beos/sendrecv.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sendrecv.c        1999/05/17 18:37:44     1.3
  +++ sendrecv.c        1999/05/27 19:02:35     1.4
  @@ -63,12 +63,13 @@
   #include "apr_general.h"
   #include "apr_network_io.h"
   
  -ap_ssize_t ap_send(ap_context_t *cont, ap_socket_t *sock, const char *buf, 
int len, time_t sec)
  +ap_status_t ap_send(struct socket_t *sock, const char *buf, ap_ssize_t *len, 
time_t sec)
   {
  -    ap_ssize_t rv;
  -
  +    ssize_t rv;
  +     int sendlen = *len;
  +     
       do {
  -        rv = send(sock->socketdes, buf, len,0);
  +        rv = send(sock->socketdes, buf, sendlen,0);
       } while (rv == -1 && errno == EINTR);
   
       if (rv == -1 && errno == EAGAIN && sec > 0) {
  @@ -86,22 +87,26 @@
           } while (srv == -1 && errno == EINTR);
   
           if (srv < 1) {
  -            return (ap_ssize_t) -1;
  +            (*len) = -1;
  +            return errno;
           }
           else {
               do {
  -                rv = send(sock->socketdes, buf, len,0);
  +                rv = send(sock->socketdes, buf, sendlen,0);
               } while (rv == -1 && errno == EINTR);
           }
       }
  -    return (ap_ssize_t) rv;
  +    (*len) = rv;
  +    return APR_SUCCESS;
   }
   
  -ap_ssize_t ap_recv(ap_context_t *cont, ap_socket_t *sock, char *buf, int 
len, time_t sec)
  +ap_status_t ap_recv(struct socket_t *sock, char *buf, ap_ssize_t *len, 
time_t sec)
   {
       ap_ssize_t rv;
  +    int recvlen = *len;
  +    
       do {
  -        rv = recv(sock->socketdes, buf, len,0);
  +        rv = recv(sock->socketdes, buf, recvlen,0);
       } while (rv == -1 && errno == EINTR);
   
       if (rv == -1 && errno == EAGAIN && sec > 0) {
  @@ -119,14 +124,16 @@
           } while (srv == -1 && errno == EINTR);
   
           if (srv < 1) {
  -            return (ap_ssize_t) -1;
  +            (*len) = -1;
  +            return errno;
           }
           else {
               do {
  -                rv = recv(sock->socketdes, buf, len,0);
  +                rv = recv(sock->socketdes, buf, recvlen,0);
               } while (rv == -1 && errno == EINTR);
           }
       }
  -    return (ap_ssize_t) rv;
  +    (*len) = rv;
  +    return APR_SUCCESS;
   }
   
  
  
  
  1.5       +57 -35    apache-apr/apr/network_io/beos/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/beos/sockets.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sockets.c 1999/05/24 02:04:06     1.4
  +++ sockets.c 1999/05/27 19:02:35     1.5
  @@ -69,27 +69,40 @@
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   }
   
  -struct socket_t *ap_create_tcp_socket(ap_context_t *cont)
  +ap_status_t ap_create_tcp_socket(ap_context_t *cont, struct socket_t **new)
   {
  -    struct socket_t *thesocket = (ap_socket_t 
*)ap_palloc(cont->pool,sizeof(ap_socket_t));
  +    (*new) = (struct socket_t *)ap_palloc(cont->pool,sizeof(struct 
socket_t));
  +    
  +    if ((*new) == NULL){
  +        return APR_ENOMEM;
  +    }
  +    
  +    (*new)->cntxt = cont;
  +     (*new)->addr = (struct sockaddr_in *) ap_palloc((*new)->cntxt->pool,
  +                         sizeof (struct sockaddr_in));
  +    if ((*new)->addr == NULL){
  +        return APR_ENOMEM;
  +    }
  +    
  +    (*new)->socketdes = socket(AF_INET ,SOCK_STREAM, 0);
  +     (*new)->remote_hostname=NULL;
  +     
  +     (*new)->addr->sin_family = AF_INET;
       
  -    thesocket->socketdes = socket(AF_INET ,SOCK_STREAM, 0);
  -     thesocket->remote_hostname=NULL;
  -     thesocket->addr = (struct sockaddr_in *) ap_palloc(cont->pool,sizeof 
(struct sockaddr_in));
  -     thesocket->addr->sin_family = AF_INET;
  -    thesocket->addr_len = sizeof(*thesocket->addr);
  -     memset(&thesocket->addr->sin_zero, 0, 
sizeof(thesocket->addr->sin_zero));
  +    (*new)->addr_len = sizeof(*(*new)->addr);
  +     memset(&(*new)->addr->sin_zero, 0, sizeof((*new)->addr->sin_zero));
   
  -    if (thesocket->socketdes < 0) {
  -        return NULL;
  +    if ((*new)->socketdes < 0) {
  +        return errno;
       }
       else {
  -        ap_register_cleanup(cont->pool, (void *)thesocket, socket_cleanup, 
NULL);
  -        return thesocket;
  +        ap_register_cleanup((*new)->cntxt->pool, (void *)(*new),
  +                            socket_cleanup, NULL);
  +        return APR_SUCCESS;
       }
   } 
   
  @@ -105,8 +118,8 @@
   
   ap_status_t ap_close_socket(struct socket_t *thesocket)
   {
  -     socket_cleanup(thesocket);
  -     ap_kill_cleanup(cont->pool,thesocket,socket_cleanup);
  +     ap_kill_cleanup(thesocket->cntxt->pool,thesocket,socket_cleanup);
  +     return socket_cleanup(thesocket);
   }
   
   ap_status_t ap_setport(struct socket_t *sock, ap_uint32_t port) 
  @@ -119,7 +132,7 @@
   { 
       sock->addr->sin_addr.s_addr = INADDR_ANY;
       if (bind(sock->socketdes, (struct sockaddr *)sock->addr, sock->addr_len) 
== -1) 
  -        return APR_FAILURE; 
  +        return errno; 
       else 
           return APR_SUCCESS; 
   } 
  @@ -127,31 +140,39 @@
   ap_status_t ap_listen(struct socket_t *sock, ap_int32_t backlog) 
   { 
       if (listen(sock->socketdes, backlog) == -1) 
  -        return APR_FAILURE; 
  +        return errno; 
       else 
           return APR_SUCCESS; 
   } 
   
  -struct socket_t *ap_accept(struct socket_t *sock) 
  +ap_status_t ap_accept(const struct socket_t *sock, struct socket_t **new) 
   { 
  -    struct socket_t *new = (ap_socket_t 
*)ap_palloc(cont->pool,sizeof(ap_socket_t)); 
        struct hostent *hptr;
  -     new->addr = (struct sockaddr_in *)ap_palloc(cont->pool, sizeof(struct 
sockaddr_in));
  -     new->addr_len = sizeof(struct sockaddr_in);
  -
  -    new->socketdes = accept(sock->socketdes, (struct sockaddr *)new->addr, 
&new->addr_len); 
        
  -     if (new->socketdes <0){
  -             return NULL;
  +     (*new) = (struct socket_t *)ap_palloc(sock->cntxt->pool,
  +                             sizeof(ap_socket_t)); 
  +
  +    (*new)->cntxt = sock->cntxt;
  +    (*new)->addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt->pool, 
  +                 sizeof(struct sockaddr_in));
  +    (*new)->addr_len = sizeof(struct sockaddr_in);
  +
  +    (*new)->socketdes = accept(sock->socketdes, (struct sockaddr 
*)(*new)->addr,
  +                        &(*new)->addr_len);
  +
  +     if ((*new)->socketdes <0){
  +             return errno;
        }
   
  -     hptr = gethostbyaddr((char*)&new->addr->sin_addr, sizeof(struct 
in_addr), AF_INET);
  +     hptr = gethostbyaddr((char*)&(*new)->addr->sin_addr, 
  +                         sizeof(struct in_addr), AF_INET);
        if (hptr != NULL){
  -             new->remote_hostname = strdup(hptr->h_name);
  +             (*new)->remote_hostname = strdup(hptr->h_name);
        }
            
  -    ap_register_cleanup(cont->pool, (void *)new, socket_cleanup, NULL);
  -    return new;
  +    ap_register_cleanup((*new)->cntxt->pool, (void *)new, 
  +                        socket_cleanup, NULL);
  +    return APR_SUCCESS;
   } 
    
   ap_status_t ap_connect(struct socket_t *sock, char *hostname) 
  @@ -159,20 +180,21 @@
       struct hostent *hp; 
   
       hp = gethostbyname(hostname); 
  -    if ((sock->socketdes < 0) || (!hp) || (!sock->addr)) { 
  -        return APR_FAILURE; 
  +    if ((sock->socketdes < 0) || (!sock->addr)) { 
  +        return APR_ENOTSOCK; 
       } 
   
        memcpy((char *)&sock->addr->sin_addr, hp->h_addr , hp->h_length);
   
  -    sock->addr->sin_family = AF_INET; 
  +    sock->addr->sin_family = AF_INET;
  +     
       memset(sock->addr->sin_zero, 0, sizeof(sock->addr->sin_zero));
  +    
       sock->addr_len = sizeof(sock->addr);
  +    
       while ((connect(sock->socketdes, (const struct sockaddr *)sock->addr, 
sock->addr_len) < 0)){
        if (errno != EALREADY && errno != EINPROGRESS)
  -            return APR_FAILURE; 
  -     if (errno == EINPROGRESS)
  -             printf ("EINPROGRESS ");
  +            return errno; 
       }
        
       sock->remote_hostname = strdup(hostname);
  
  
  
  1.5       +10 -6     apache-apr/apr/network_io/beos/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/network_io/beos/sockopt.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sockopt.c 1999/05/24 02:04:06     1.4
  +++ sockopt.c 1999/05/27 19:02:35     1.5
  @@ -72,17 +72,17 @@
        }
       if (opt & APR_SO_DEBUG) {
           if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, &one, 
sizeof(one)) == -1) {
  -            return APR_FAILURE;
  +            return errno;
           }
       }
       if (opt & APR_SO_REUSEADDR) {
           if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, &one, 
sizeof(one)) == -1) {
  -            return APR_FAILURE;
  +            return errno;
           }
       }
       if (opt & APR_SO_NONBLOCK) {
        if (setsockopt(sock->socketdes, SOL_SOCKET, SO_NONBLOCK, &one, 
sizeof(one)) == -1){
  -             return APR_FAILURE;
  +             return errno;
        }
       } 
       return APR_SUCCESS;
  @@ -91,13 +91,17 @@
   ap_status_t ap_gethostname(ap_context_t *cont, char * buf, int len)
   {
        if (gethostname(buf, len) == -1){
  -             return APR_FAILURE;
  +             return errno;
        } else {
                return APR_SUCCESS;
        }
   }
   
  -char *ap_get_remote_hostname(struct socket_t *sock)
  +ap_status_t ap_get_remote_hostname(struct socket_t *sock, char **name)
   {
  -     return sock->remote_hostname;
  +    (*name) = (char*)ap_pstrdup(sock->cntxt->pool, sock->remote_hostname);
  +    if (*name) {
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOMEM;
   }
  
  
  
  1.8       +1 -1      apache-apr/apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/Makefile.in,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Makefile.in       1999/05/26 20:41:58     1.7
  +++ Makefile.in       1999/05/27 19:02:37     1.8
  @@ -7,7 +7,7 @@
   [EMAIL PROTECTED]@
   [EMAIL PROTECTED]@
   [EMAIL PROTECTED]@ @CFLAGS@ @OPTIM@ 
  [EMAIL PROTECTED]@ -lpthread -L../network_io -lnetwork -L../threadproc 
-lthreadproc -L../file_io -lfile -L../misc -lmisc -L../lib -lapr -L../time 
-ltime -L../locks -llock
  [EMAIL PROTECTED]@ -L../network_io -lnetwork -L../threadproc -lthreadproc 
-L../file_io -lfile -L../misc -lmisc -L../lib -lapr -L../time -ltime -L../locks 
-llock
   [EMAIL PROTECTED]@ $(LDLIBS)
   INCDIR=../include
   INCDIR1=../../include
  
  
  
  1.23      +0 -1      apache-apr/apr/test/testfile.c
  
  Index: testfile.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/testfile.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- testfile.c        1999/05/26 13:46:58     1.22
  +++ testfile.c        1999/05/27 19:02:38     1.23
  @@ -76,7 +76,6 @@
       char *buf;
       char *str;
       char *filename = "test.fil";
  -
       if (ap_create_context(NULL, NULL, &context) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't allocate context.");
           exit(-1);
  
  
  
  1.8       +1 -1      apache-apr/apr/test/testproc.c
  
  Index: testproc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/test/testproc.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- testproc.c        1999/05/26 13:46:58     1.7
  +++ testproc.c        1999/05/27 19:02:38     1.8
  @@ -118,7 +118,7 @@
       args[1] = ap_pstrdup(context->pool, "-X");
       args[2] = NULL;
       
  -    fprintf(stdout, "Createing a new process.......");
  +    fprintf(stdout, "Creating a new process.......");
       if (ap_create_process(context, "../testproc", args, NULL, attr, 
&newproc) != APR_SUCCESS) {
           fprintf(stderr, "Could not create the new process\n");
           exit(-1);
  
  
  
  1.2       +8 -7      apache-apr/apr/threadproc/beos/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/Makefile.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Makefile.in       1999/05/18 13:40:20     1.1
  +++ Makefile.in       1999/05/27 19:02:39     1.2
  @@ -54,19 +54,20 @@
            && rm Makefile.new
   
   # DO NOT REMOVE
  -proc.o: proc.c ../../file_io/beos/fileio.h \
  - ../../../include/apr_general.h ../../../include/apr_errno.h \
  - ../../../include/apr_file_io.h threadproc.h \
  - ../../../include/apr_thread_proc.h
  +proc.o: proc.c threadproc.h ../../../include/apr_thread_proc.h \
  + ../../../include/apr_file_io.h ../../../include/apr_general.h \
  + ../../../include/apr_errno.h ../../file_io/beos/fileio.h
   signals.o: signals.c threadproc.h ../../../include/apr_thread_proc.h \
    ../../../include/apr_file_io.h ../../../include/apr_general.h \
    ../../../include/apr_errno.h ../../file_io/beos/fileio.h
   thread.o: thread.c threadproc.h ../../../include/apr_thread_proc.h \
    ../../../include/apr_file_io.h ../../../include/apr_general.h \
  - ../../../include/apr_errno.h
  + ../../../include/apr_errno.h ../../file_io/beos/fileio.h
   threadcancel.o: threadcancel.c threadproc.h \
    ../../../include/apr_thread_proc.h ../../../include/apr_file_io.h \
  - ../../../include/apr_general.h ../../../include/apr_errno.h
  + ../../../include/apr_general.h ../../../include/apr_errno.h \
  + ../../file_io/beos/fileio.h
   threadpriv.o: threadpriv.c threadproc.h \
    ../../../include/apr_thread_proc.h ../../../include/apr_file_io.h \
  - ../../../include/apr_general.h ../../../include/apr_errno.h
  + ../../../include/apr_general.h ../../../include/apr_errno.h \
  + ../../file_io/beos/fileio.h
  
  
  
  1.3       +80 -69    apache-apr/apr/threadproc/beos/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/proc.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- proc.c    1999/05/24 02:04:17     1.2
  +++ proc.c    1999/05/27 19:02:40     1.3
  @@ -62,112 +62,120 @@
   #include "apr_file_io.h"
   #include "apr_general.h"
   
  -ap_procattr_t *ap_createprocattr_init(ap_context_t *cont)
  +ap_status_t ap_createprocattr_init(ap_context_t *cont, struct procattr_t 
**new)
   {
  -    ap_procattr_t *new = (ap_procattr_t *)ap_palloc(cont->pool, 
sizeof(ap_procattr_t));
  +    (*new) = (struct procattr_t *)ap_palloc(cont->pool, 
  +              sizeof(struct procattr_t));
   
  -    new->parent_in = NULL;
  -    new->child_in = NULL;
  -    new->parent_out = NULL;
  -    new->child_out = NULL;
  -    new->parent_err = NULL;
  -    new->child_err = NULL;
  -    new->currdir = NULL; 
  -    new->cmdtype = APR_PROGRAM;
  -    return new;
  +    if ((*new) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +    (*new)->cntxt = cont;
  +    (*new)->parent_in = NULL;
  +    (*new)->child_in = NULL;
  +    (*new)->parent_out = NULL;
  +    (*new)->child_out = NULL;
  +    (*new)->parent_err = NULL;
  +    (*new)->child_err = NULL;
  +    (*new)->currdir = NULL; 
  +    (*new)->cmdtype = APR_PROGRAM;
  +    return APR_SUCCESS;
   }
   
   ap_status_t ap_setprocattr_io(struct procattr_t *attr, ap_int32_t in, 
                                    ap_int32_t out, ap_int32_t err)
   {
  +    ap_status_t stat;
       if (in) {
  -        attr->parent_in = (ap_file_t *)ap_palloc(cont->pool, 
  -                                                   sizeof(ap_file_t));
  -        attr->child_in = (ap_file_t *)ap_palloc(cont->pool, 
  -                                                  sizeof(ap_file_t));
  -        if (ap_create_pipe(cont, attr->child_in, 
  -                            attr->parent_in) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = ap_create_pipe(attr->cntxt, &attr->child_in, 
  +                            &attr->parent_in)) != APR_SUCCESS) {
  +            return stat;
           }
       } 
       if (out) {
  -        attr->parent_out = (ap_file_t *)ap_palloc(cont->pool, 
  -                                                    sizeof(ap_file_t));
  -        attr->child_out = (ap_file_t *)ap_palloc(cont->pool, 
  -                                                   sizeof(ap_file_t));
  -        if (ap_create_pipe(cont, attr->parent_out, 
  -                            attr->child_out) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = ap_create_pipe(attr->cntxt, &attr->parent_out, 
  +                            &attr->child_out)) != APR_SUCCESS) {
  +            return stat;
           }
       } 
       if (err) {
  -        attr->parent_err = (ap_file_t *)ap_palloc(cont->pool, 
  -                                                    sizeof(ap_file_t));
  -        attr->child_err = (ap_file_t *)ap_palloc(cont->pool, 
  -                                                   sizeof(ap_file_t));
  -        if (ap_create_pipe(cont, attr->parent_err, 
  -                            attr->child_err) == APR_FAILURE) {
  -            return APR_FAILURE;
  +        if ((stat = ap_create_pipe(attr->cntxt, &attr->parent_err, 
  +                            &attr->child_err)) != APR_SUCCESS) {
  +            return stat;
           }
       } 
  +     return APR_SUCCESS;
   }
   
   ap_status_t ap_setprocattr_dir(struct procattr_t *attr, 
                                    char *dir) 
   {
  -    attr->currdir = strdup(dir);
  +    attr->currdir = (char*)ap_pstrdup(attr->cntxt->pool, dir);
  +    if (attr->currdir) {
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOMEM;
   }
   
   ap_status_t ap_setprocattr_cmdtype(struct procattr_t *attr,
                                        ap_cmdtype_e cmd) 
   {
       attr->cmdtype = cmd;
  +    return APR_SUCCESS;
   }
   
  -ap_int32_t ap_fork(struct proc_t *proc)
  +ap_status_t ap_fork(ap_context_t *cont, struct proc_t **proc)
   {
       int pid;
  +    
  +    (*proc) = (struct proc_t *)ap_palloc(cont->pool, sizeof(struct proc_t));
   
       if ((pid = fork()) < 0) {
  -        return -1;
  +        return errno;
       }
       else if (pid == 0) {
  -        proc->pid = pid;
  -        proc->attr = NULL;
  -        return pid;
  +        (*proc)->pid = pid;
  +        (*proc)->attr = NULL;
  +        return APR_INCHILD;
       }
  -    proc->pid = pid;
  -    proc->attr = NULL;
  -    return 1;
  +    (*proc)->pid = pid;
  +    (*proc)->attr = NULL;
  +    return APR_INPARENT;
   }
   
  -ap_proc_t *ap_create_process(ap_context_t *cont, char *progname, 
  +ap_status_t ap_create_process(ap_context_t *cont, char *progname, 
                                  char *const args[], char **env, 
  -                               struct procattr_t *attr)
  +                               struct procattr_t *attr, struct proc_t **new)
   {
  -    struct proc_t *new = (struct proc_t *)ap_palloc(cont->pool, 
sizeof(struct proc_t));
       int i;
       char **newargs;
  +    (*new) = (struct proc_t *)ap_palloc(cont->pool, sizeof(struct proc_t));
   
  -    if ((new->pid = fork()) < 0) {
  -        return NULL;
  +    if ((*new) == NULL){
  +     return APR_ENOMEM;
       }
  -    else if (new->pid == 0) { 
  +    
  +    (*new)->cntxt = cont;
  +    
  +    if (((*new)->pid = fork()) < 0) {
  +        return errno;
  +    }
  +    else if ((*new)->pid == 0) { 
           /* child process */
           if (attr->child_in) {
  -            ap_close(cont, attr->parent_in);
  +            ap_close(attr->parent_in);
               dup2(attr->child_in->filedes, STDIN_FILENO);
  -            ap_close(cont, attr->child_in);
  +            ap_close(attr->child_in);
           }
           if (attr->child_out) {
  -            ap_close(cont, attr->parent_out);
  +            ap_close(attr->parent_out);
               dup2(attr->child_out->filedes, STDOUT_FILENO);
  -            ap_close(cont, attr->child_out);
  +            ap_close(attr->child_out);
           }
           if (attr->child_err) {
  -            ap_close(cont, attr->parent_err);
  +            ap_close(attr->parent_err);
               dup2(attr->child_err->filedes, STDERR_FILENO);
  -            ap_close(cont, attr->child_err);
  +            ap_close(attr->child_err);
           }
           
           signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */
  @@ -202,47 +210,50 @@
       }
       /* Parent process */
       if (attr->child_in) {
  -        ap_close(cont, attr->child_in);
  +        ap_close(attr->child_in);
       }
       if (attr->child_out) {
  -        ap_close(cont, attr->child_out);
  +        ap_close(attr->child_out);
       }
       if (attr->child_err) {
  -        ap_close(cont, attr->child_err);
  +        ap_close(attr->child_err);
       }
       
  -    new->attr = attr;
  -    return new;
  +    (*new)->attr = attr;
  +    return APR_SUCCESS;
   }
   
  -ap_file_t *ap_get_childin(struct proc_t *proc)
  +ap_status_t ap_get_childin(struct proc_t *proc, ap_file_t **new)
   {
  -    return proc->attr->parent_in; 
  +    (*new) = proc->attr->parent_in; 
  +    return APR_SUCCESS;
   }
   
  -ap_file_t *ap_get_childout(struct proc_t *proc)
  +ap_status_t ap_get_childout(struct proc_t *proc, ap_file_t **new)
   {
  -    return proc->attr->parent_out; 
  +    (*new) = proc->attr->parent_out; 
  +    return APR_SUCCESS;
   }
   
  -ap_file_t *ap_get_childerr(struct proc_t *proc)
  +ap_status_t ap_get_childerr(struct proc_t *proc, ap_file_t **new)
   {
  -    return proc->attr->parent_err; 
  +    (*new) = proc->attr->parent_err; 
  +    return APR_SUCCESS;
   }    
   
   ap_status_t ap_wait_proc(struct proc_t *proc, 
                              ap_wait_how_e wait)
   {
       if (!proc)
  -        return APR_FAILURE;
  +        return APR_ENOPROC;
       if (wait == APR_WAIT) {
           if (waitpid(proc->pid, NULL, WUNTRACED) > 0)
  -            return APR_SUCCESS;
  -        return APR_FAILURE;
  +            return APR_CHILD_DONE;
  +        return APR_CHILD_NOTDONE;
       }
       if (waitpid(proc->pid, NULL, WUNTRACED | WNOHANG) > 0)
  -        return APR_SUCCESS;
  -    return APR_FAILURE;
  +        return APR_CHILD_DONE;
  +    return APR_CHILD_NOTDONE;
   } 
   
   void ap_exit_proc(ap_context_t *cont)
  
  
  
  1.2       +5 -2      apache-apr/apr/threadproc/beos/signals.c
  
  Index: signals.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/signals.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- signals.c 1999/05/17 18:46:46     1.1
  +++ signals.c 1999/05/27 19:02:40     1.2
  @@ -62,8 +62,11 @@
   #include <string.h>
   #include <sys/wait.h>
   
  -void ap_kill(struct proc_t *proc, int signal)
  +ap_status_t ap_kill(struct proc_t *proc, int signal)
   {
  -    kill(proc->pid, signal);
  +    if (kill(proc->pid, signal) == -1){
  +        return errno;
  +    }
  +    return APR_SUCCESS;
   }
   
  
  
  
  1.3       +56 -24    apache-apr/apr/threadproc/beos/thread.c
  
  Index: thread.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/thread.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- thread.c  1999/05/24 02:04:17     1.2
  +++ thread.c  1999/05/27 19:02:41     1.3
  @@ -58,21 +58,31 @@
   #include "apr_general.h"
   
   
  -struct threadattr_t *ap_create_threadattr(ap_context_t *cont)
  +ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t 
**new)
   {
  -    struct threadattr_t *new;
  +    ap_status_t stat;
     
  -    new = (struct threadattr_t *)ap_palloc(cont->pool, sizeof(struct 
threadattr_t));
  -     new->attr = (int32)ap_palloc(cont->pool, sizeof(int32));
  -     new->attr = (int32)B_NORMAL_PRIORITY;
  +    (*new) = (struct threadattr_t *)ap_palloc(cont->pool, 
  +              sizeof(struct threadattr_t));
  +    (*new)->attr = (int32)ap_palloc(cont->pool, 
  +                    sizeof(int32));
  +
  +    if ((*new) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +
  +    (*new)->cntxt = cont;
  +     (*new)->attr = (int32)B_NORMAL_PRIORITY;
  +
  +    return APR_SUCCESS;
   }
   
   ap_status_t ap_setthreadattr_detach(struct threadattr_t *attr, ap_int32_t on)
   {
        if (on == 1){
  -             attr -> detached = 1;
  +             attr->detached = 1;
        } else {
  -             attr -> detached = 0;
  +             attr->detached = 0;
        }    
       return APR_SUCCESS;
   }
  @@ -80,51 +90,73 @@
   ap_status_t ap_getthreadattr_detach(struct threadattr_t *attr)
   {
        if (attr->detached == 1){
  -             return APR_SUCCESS;
  +             return APR_DETACH;
        }
  -     return APR_FAILURE;
  +     return APR_NOTDETACH;
   }
   
  -struct thread_t *ap_create_thread(struct threadattr_t *attr, 
ap_thread_start_t func, void *data)
  -{
  -    struct thread_t *new;
  +ap_status_t ap_create_thread(ap_context_t *cont, struct threadattr_t *attr,
  +                                ap_thread_start_t func, void *data,
  +                                struct thread_t **new)
  +{
  +    int32 temp;
  +    ap_status_t stat;
  +    
  +    (*new) = (struct thread_t *)ap_palloc(cont->pool, sizeof(struct 
thread_t));
  +    if ((*new) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +
  +     (*new)->td = (thread_id) ap_palloc(cont->pool, sizeof(thread_id));
  +    if ((*new)->td == (thread_id)NULL) {
  +        return APR_ENOMEM;
  +    }
   
  -    new = (struct thread_t *)ap_palloc(cont->pool, sizeof(struct thread_t));
  +    (*new)->cntxt = cont;
  +
       /* First we create the new thread...*/
  -    if (attr == NULL){
  -     attr = ap_create_threadattr(cont);
  +     if (attr)
  +         temp = attr->attr;
  +     else
  +         temp = B_NORMAL_PRIORITY;
  +
  +    stat = ap_create_context(cont, NULL, &(*new)->cntxt);
  +    if (stat != APR_SUCCESS) {
  +        return stat;
       }
  -    new->td = spawn_thread((thread_func)func, "apr thread", attr->attr, 
data);
  +
  +    (*new)->td = spawn_thread((thread_func)func, "apr thread", temp, data);
       /* Now we try to run it...*/
  -    if (resume_thread((thread_id)new->td) == B_NO_ERROR) {
  -        return new;
  +    if (resume_thread((*new)->td) == B_NO_ERROR) {
  +        return APR_SUCCESS;
       }
       else {
  -        return NULL;
  +        return errno;
       } 
   }
   
  -void ap_thread_exit(ap_context_t *cont, ap_status_t *retval)
  +ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval)
   {
  +    ap_destroy_pool(thd->cntxt->pool);
        exit_thread ((status_t)retval);
   }
   
  -ap_status_t ap_thread_join(ap_context_t *cont, ap_thread_t *thd, ap_status_t 
*retval)
  +ap_status_t ap_thread_join(ap_thread_t *thd, ap_status_t *retval)
   {
       if (wait_for_thread(thd->td,(void *)&retval) == B_NO_ERROR) {
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   }
   
  -ap_status_t ap_thread_detach(ap_context_t *cont, ap_thread_t *thd)
  +ap_status_t ap_thread_detach(ap_thread_t *thd)
   {
        if (suspend_thread(thd->td) == B_NO_ERROR){
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   }
  
  
  
  1.3       +1 -1      apache-apr/apr/threadproc/beos/threadcancel.c
  
  Index: threadcancel.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/threadcancel.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- threadcancel.c    1999/05/24 02:04:18     1.2
  +++ threadcancel.c    1999/05/27 19:02:41     1.3
  @@ -64,7 +64,7 @@
           return APR_SUCCESS;
       }
       else {
  -        return APR_FAILURE;
  +        return errno;
       }
   }
   
  
  
  
  1.3       +24 -20    apache-apr/apr/threadproc/beos/threadpriv.c
  
  Index: threadpriv.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/threadpriv.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- threadpriv.c      1999/05/24 02:04:18     1.2
  +++ threadpriv.c      1999/05/27 19:02:41     1.3
  @@ -62,28 +62,32 @@
   static struct beos_private_data *beos_data[BEOS_MAX_DATAKEYS];
   static sem_id lock;
   
  -struct threadkey_t *ap_create_thread_private(ap_context_t *cont, void 
(*dest)(void *))
  +ap_status_t ap_create_thread_private(ap_context_t *cont,
  +                                void (*dest)(void *), struct threadkey_t 
**key)
   {
  -    struct threadkey_t *key;
  - 
  -    key = (struct threadkey_t *)ap_palloc(cont->pool, sizeof(struct 
threadkey_t));
  +    (*key) = (struct threadkey_t *)ap_palloc(cont->pool, sizeof(struct 
threadkey_t));
  +    if ((*key) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +
  +    (*key)->cntxt = cont;
  +     
        acquire_sem(lock);
  -     for (key->key=0; key->key < BEOS_MAX_DATAKEYS; key->key++){
  -             if (key_table[key->key].assigned == 0){
  -                     key_table[key->key].assigned = 1;
  -                     key_table[key->key].destructor = dest;
  +     for ((*key)->key=0; (*key)->key < BEOS_MAX_DATAKEYS; (*key)->key++){
  +             if (key_table[(*key)->key].assigned == 0){
  +                     key_table[(*key)->key].assigned = 1;
  +                     key_table[(*key)->key].destructor = dest;
                        release_sem(lock);
  -                     return key;
  +                     return APR_SUCCESS;
                }                               
   
        }
        release_sem(lock);
  -    return NULL;
  +    return APR_ENOMEM;
   }
   
  -void *ap_get_thread_private(struct threadkey_t *key)
  +ap_status_t ap_get_thread_private(struct threadkey_t *key, void **new)
   {
  -     void * data;
        thread_id tid;
        int i, index=0;
        tid = find_thread(NULL);
  @@ -97,21 +101,21 @@
        }
        if (index == 0){
                /* no storage for thread so we can't get anything... */
  -             return NULL;
  +             return APR_ENOMEM;
        }
   
        if ((key->key < BEOS_MAX_DATAKEYS) && (key_table)){
                acquire_sem(key_table[key->key].lock);
                if (key_table[key->key].count){
  -                     data = (void*)beos_data[index]->data[key->key];
  +                     (*new) = (void*)beos_data[index]->data[key->key];
                } else {
  -                     data = NULL;
  +                     (*new) = NULL;
                }
                release_sem(key_table[key->key].lock);
        } else {
  -             data = NULL;
  +             (*new) = NULL;
        }
  -     return data;
  +     return APR_SUCCESS;
   }
   
   ap_status_t ap_set_thread_private(struct threadkey_t *key, void *priv)
  @@ -141,7 +145,7 @@
        }
        if (index == 0){
                /* we're out of luck.. */
  -             return APR_FAILURE;
  +             return APR_ENOMEM;
        }
        if ((key->key < BEOS_MAX_DATAKEYS) && (key_table)){
                acquire_sem(key_table[key->key].lock);
  @@ -166,7 +170,7 @@
        }
        if (ret)
        return APR_SUCCESS;
  -     return APR_FAILURE;
  +     return APR_ENOMEM;
   }
   
   ap_status_t ap_delete_thread_private(struct threadkey_t *key)
  @@ -179,7 +183,7 @@
                }
                release_sem(key_table[key->key].lock);
        } else {
  -             return APR_FAILURE;
  +             return APR_ENOMEM;
        }
        return APR_SUCCESS;
   }
  
  
  
  1.2       +5 -0      apache-apr/apr/threadproc/beos/threadproc.h
  
  Index: threadproc.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/threadproc/beos/threadproc.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- threadproc.h      1999/05/17 18:46:47     1.1
  +++ threadproc.h      1999/05/27 19:02:42     1.2
  @@ -72,16 +72,19 @@
   #define BEOS_MAX_DATAKEYS    128
   
   struct thread_t {
  +    ap_context_t *cntxt;
       thread_id td;
   };
   
   struct threadattr_t {
  +    ap_context_t *cntxt;
       int32 attr;
       int detached;
       int joinable;
   };
   
   struct threadkey_t {
  +    ap_context_t *cntxt;
        int32  key;
   };
   
  @@ -100,6 +103,7 @@
   };
   
   struct procattr_t {
  +    ap_context_t *cntxt;
       ap_file_t *parent_in;
       ap_file_t *child_in;
       ap_file_t *parent_out;
  @@ -111,6 +115,7 @@
   };
   
   struct proc_t {
  +    ap_context_t *cntxt;
       pid_t pid;
       struct procattr_t *attr;
   };
  
  
  
  1.2       +118 -32   apache-apr/apr/time/beos/access.c
  
  Index: access.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/time/beos/access.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- access.c  1999/05/17 18:49:47     1.1
  +++ access.c  1999/05/27 19:02:44     1.2
  @@ -60,100 +60,186 @@
   #include <errno.h>
   #include <string.h>
   
  -ap_int64_t ap_get_curtime(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_curtime(struct atime_t *time, ap_int64_t *rv)
   {
  -    return time->currtime;
  +    if (time) {
  +        (*rv) = time->currtime;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;    
   }
   
  -ap_int32_t ap_get_sec(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_sec(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_sec;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_sec;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -ap_int32_t ap_get_min(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_min(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_min;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_min;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -ap_int32_t ap_get_hour(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_hour(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_hour;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_hour;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -ap_int32_t ap_get_mday(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_mday(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_mday;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_mday;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -ap_int32_t ap_get_mon(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_mon(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_mon;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_mon;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -ap_int32_t ap_get_year(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_year(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_year;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_year;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -ap_int32_t ap_get_wday(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_get_wday(struct atime_t *time, ap_int32_t *rv)
   {
  -    return time->explodedtime->tm_wday;
  +    if (time) {
  +        (*rv) = time->explodedtime->tm_wday;
  +        return APR_SUCCESS;
  +    }
  +    return APR_ENOTIME;
   }
   
  -void ap_set_sec(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_sec(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
  +    if (time->explodedtime == NULL) {
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        return APR_ENOMEM;
       }
       time->explodedtime->tm_sec = value;
  +    return APR_SUCCESS;
   }
   
  -void ap_set_min(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_min(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
       }
  +    if (time->explodedtime == NULL) {
  +        return APR_ENOMEM;
  +    }
       time->explodedtime->tm_min = value;
  +    return APR_SUCCESS;
   }
   
  -void ap_set_hour(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_hour(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
       }
  +    if (time->explodedtime == NULL) {
  +        return APR_ENOMEM;
  +    }
       time->explodedtime->tm_hour = value;
  +    return APR_SUCCESS;
   }
   
  -void ap_set_mday(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_mday(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
  +    if (time->explodedtime == NULL) {
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        return APR_ENOMEM;
       }
       time->explodedtime->tm_mday = value;
  +    return APR_SUCCESS;
   }
   
  -void ap_set_mon(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_mon(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
  +    if (time->explodedtime == NULL) {
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        return APR_ENOMEM;
       }
       time->explodedtime->tm_mon = value;
  +    return APR_SUCCESS;
   }
   
  -void ap_set_year(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_year(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
       }
  +    if (time->explodedtime == NULL) {
  +        return APR_ENOMEM;
  +    }
       time->explodedtime->tm_year = value;
  +    return APR_SUCCESS;
   }
   
  -void ap_set_wday(ap_context_t *context, struct atime_t *time, ap_int32_t 
value)
  +ap_status_t ap_set_wday(struct atime_t *time, ap_int32_t value)
   {
  +    if (!time) {
  +        return APR_ENOTIME;
  +    }
       if (time->explodedtime == NULL) {
  -        time->explodedtime = (struct tm *)ap_palloc(context->pool, 
sizeof(struct tm));
  +        time->explodedtime = (struct tm *)ap_palloc(time->cntxt->pool, 
  +                              sizeof(struct tm));
       }
  +    if (time->explodedtime == NULL) {
  +        return APR_ENOMEM;
  +    }
       time->explodedtime->tm_wday = value;
  +    return APR_SUCCESS;
   }
  -
  -
  
  
  
  1.2       +1 -0      apache-apr/apr/time/beos/atime.h
  
  Index: atime.h
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/time/beos/atime.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- atime.h   1999/05/17 18:49:47     1.1
  +++ atime.h   1999/05/27 19:02:44     1.2
  @@ -60,6 +60,7 @@
   #include <time.h>
   
   struct atime_t {
  +    ap_context_t *cntxt;
       time_t currtime;
       struct tm *explodedtime;
   };
  
  
  
  1.2       +15 -15    apache-apr/apr/time/beos/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/apr/time/beos/time.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- time.c    1999/05/17 18:49:47     1.1
  +++ time.c    1999/05/27 19:02:44     1.2
  @@ -60,25 +60,28 @@
   #include <time.h>
   #include <errno.h>
   #include <string.h>
  -
  -struct atime_t *ap_make_time(ap_context_t *context)
  +ap_status_t ap_make_time(ap_context_t *cont, struct atime_t **new)
   {
  -    struct atime_t *new;
  -    new = (struct atime_t *)ap_palloc(context->pool, sizeof(struct atime_t));
  +    (*new) = (struct atime_t *)ap_palloc(cont->pool, sizeof(struct atime_t));
  +
  +    if ((*new) == NULL) {
  +        return APR_ENOMEM;
  +    }
   
  -    new->explodedtime = NULL;
  -    return new;
  +    (*new)->cntxt = cont;
  +    (*new)->explodedtime = NULL;
  +    return APR_SUCCESS;
   }
   
  -ap_status_t ap_current_time(ap_context_t *context, struct atime_t *new)
  +ap_status_t ap_current_time(struct atime_t *new)
   {
       if (time(&new->currtime) == -1) {
  -        return APR_FAILURE;
  +        return errno;
       }
       return APR_SUCCESS; 
   }       
   
  -ap_status_t ap_explode_time(ap_context_t *context, struct atime_t *time, 
ap_timetype_e type)
  +ap_status_t ap_explode_time(struct atime_t *time, ap_timetype_e type)
   {
       switch (type) {
       case APR_LOCALTIME: {
  @@ -93,7 +96,7 @@
       return APR_SUCCESS;
   }
   
  -ap_status_t ap_implode_time(ap_context_t *context, struct atime_t *time)
  +ap_status_t ap_implode_time(struct atime_t *time)
   {
       int year;
       time_t days;
  @@ -103,8 +106,7 @@
       year = time->explodedtime->tm_year;
   
       if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) {
  -        /* errno = EBAD_DATE; */
  -        return APR_FAILURE;
  +        return APR_EBADDATE;
       }
   
       /* shift new year to 1st March in order to make leap year calc easy */
  @@ -123,10 +125,8 @@
                time->explodedtime->tm_min) * 60 + time->explodedtime->tm_sec;
   
       if (days < 0) {
  -        /* errno = EBAD_DATE; */      /* must have overflowed */
  -        return APR_FAILURE;
  +        return APR_EBADDATE;
       }
       time->currtime = days;            /* must be a valid time */
       return APR_SUCCESS;
   }
  -
  
  
  

Reply via email to