You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dr...@locus.apache.org on 2000/03/08 00:29:23 UTC

cvs commit: apache-2.0/src/lib/apr/threadproc/beos proc.c

dreid       00/03/07 15:29:23

  Modified:    src/lib/apr/file_io/unix filestat.c
               src/lib/apr/test testmmap.c
               src/lib/apr/threadproc/beos proc.c
  Log:
  A few minor changes to tidy things up a bit. Also rewrote ap_wait_proc
  to work correctly on BeOS.  testmmap now works again.
  
  Revision  Changes    Path
  1.13      +8 -7      apache-2.0/src/lib/apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filestat.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- filestat.c	2000/01/17 19:12:30	1.12
  +++ filestat.c	2000/03/07 23:29:21	1.13
  @@ -84,7 +84,8 @@
   /* ***APRDOC********************************************************
    * ap_status_t ap_getfileinfo(ap_file_t *)
    *    get the specified file's stats..
  - * arg 1) The file to get information about. 
  + * arg 1) Where to store the information about the file.
  + * arg 2) The file to get information about. 
    */ 
   ap_status_t ap_getfileinfo(ap_finfo_t *finfo, struct file_t *thefile)
   {
  @@ -99,9 +100,9 @@
           finfo->group = info.st_gid;
           finfo->size = info.st_size;
           finfo->inode = info.st_ino;
  -	ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
  -	ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
  -	ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
  +        ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
  +        ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
  +        ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
           return APR_SUCCESS;
       }
       else {
  @@ -129,9 +130,9 @@
           finfo->group = info.st_gid;
           finfo->size = info.st_size;
           finfo->inode = info.st_ino;
  -	ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
  -	ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
  -	ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
  +        ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
  +        ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
  +        ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
           return APR_SUCCESS;
       }
       else {
  
  
  
  1.7       +4 -5      apache-2.0/src/lib/apr/test/testmmap.c
  
  Index: testmmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testmmap.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- testmmap.c	2000/01/06 14:43:22	1.6
  +++ testmmap.c	2000/03/07 23:29:22	1.7
  @@ -74,7 +74,6 @@
       ap_finfo_t finfo;
       ap_int32_t flag = APR_READ;
       char *file1;
  -    ap_ssize_t filesize;
       
       fprintf (stdout,"APR MMAP Test\n*************\n\n");
       
  @@ -100,15 +99,15 @@
       
       fprintf(stderr, "Getting file size...................");
       if (ap_getfileinfo(&finfo, thefile) != APR_SUCCESS) {
  -        perror("Didn't open file");
  +        perror("Didn't get file information!");
           exit(-1);
       }
       else {
           fprintf(stdout, "%d bytes\n", finfo.size);
       }  
  -
  -    fprintf(stdout,"Trying to mmap the open file........");
  -    if (ap_mmap_create(&themmap, thefile, 0, filesize, context) != APR_SUCCESS) {
  +    
  +    fprintf(stdout,"Trying to mmap the file..............");
  +    if (ap_mmap_create(&themmap, thefile, 0, finfo.size, context) != APR_SUCCESS) {
           fprintf(stderr,"Failed!\n");
           exit(-1);
       }
  
  
  
  1.15      +14 -12    apache-2.0/src/lib/apr/threadproc/beos/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/beos/proc.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- proc.c	1999/12/15 13:07:30	1.14
  +++ proc.c	2000/03/07 23:29:22	1.15
  @@ -288,25 +288,27 @@
   ap_status_t ap_wait_proc(struct proc_t *proc, 
                              ap_wait_how_e wait)
   {
  -    pid_t stat;
  +    status_t exitval;
  +    thread_info tinfo;
  +    
       if (!proc)
           return APR_ENOPROC;
  +    /* when we run processes we are actually running threads, so here
  +       we'll wait on the thread dying... */
       if (wait == APR_WAIT) {
  -        if ((stat = waitpid(proc->pid, NULL, WUNTRACED)) > 0) {
  +        if (wait_for_thread(proc->tid, &exitval) == B_OK) {
               return APR_CHILD_DONE;
           }
  -        else if (stat == 0) {
  -            return APR_CHILD_NOTDONE;
  -        }
           return errno;
       }
  -    if ((stat = waitpid(proc->pid, NULL, WUNTRACED | WNOHANG)) > 0) {
  -            return APR_CHILD_DONE;
  -        }
  -        else if (stat == 0) {
  -            return APR_CHILD_NOTDONE;
  -        }
  -        return errno;
  +    /* if the thread is still alive then it's not done...
  +       this won't hang or holdup the thread checking... */
  +    if (get_thread_info(proc->tid, &tinfo) == B_BAD_VALUE) {
  +        return APR_CHILD_DONE;
  +    }
  +    else {
  +        return APR_CHILD_NOTDONE;
  +    }
   } 
   
   ap_status_t ap_setprocattr_childin(struct procattr_t *attr, ap_file_t *child_in,