You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bj...@locus.apache.org on 2000/06/14 18:10:46 UTC

cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

bjh         00/06/14 09:10:45

  Modified:    src/lib/apr/file_io/win32 readwrite.c
  Log:
  Win32: use ap_read() in ap_getc() so that it benefits from & doesn't mess
  with buffering.
  
  Revision  Changes    Path
  1.35      +9 -3      apache-2.0/src/lib/apr/file_io/win32/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- readwrite.c	2000/05/26 16:23:10	1.34
  +++ readwrite.c	2000/06/14 16:10:45	1.35
  @@ -245,10 +245,16 @@
   
   ap_status_t ap_getc(char *ch, ap_file_t *thefile)
   {
  -    DWORD bread;
  -    if (!ReadFile(thefile->filehand, ch, 1, &bread, NULL)) {
  -        return GetLastError();
  +    ap_status_t rc;
  +    int bread;
  +
  +    bread = 1;
  +    rc = ap_read(thefile, ch, &bread);
  +
  +    if (rc) {
  +        return rc;
       }
  +    
       if (bread == 0) {
           thefile->eof_hit = TRUE;
           return APR_EOF;
  
  
  

Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by Manoj Kasichainula <ma...@io.com>.
On Thu, Jun 15, 2000 at 02:53:31AM +1000, Brian Havard wrote:
> If you dig through the archives you should find me arguing that
> ap_read() _should_ return APR_EOF. However, posix read() doesn't
> work this way and unixheads are the majority around here.....

Well, I'm a unixhead, and while I do think APR should be more like
POSIX, I like APR_EOF. I don't remember seeing any major objections to
it either, though I was iffier on the concept originally than I am
now.


Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by James Sutherland <ja...@cam.ac.uk>.
On Thu, 15 Jun 2000, Brian Havard wrote:

> On Wed, 14 Jun 2000 10:03:23 -0700 (PDT), rbb@covalent.net wrote:
> 
> [...]
> 
> >> Exactly, and that's a whole other argument. If you dig through the archives
> >> you should find me arguing that ap_read() _should_ return APR_EOF. However,
> >> posix read() doesn't work this way and unixheads are the majority around
> >> here.....
> >
> >Don't lump us all in together.  I was and am on your side about
> >APR_EOF.  I would like to see APR return the information that you have hit
> >the enf of the file.  Some Unixheads are just still looking at POSIX and
> >not seeing where changing things could help.  :-)
> 
> Yes, I remembered you agreed with me but I think you were the only one
> (might have been one other person, I forget).

I agree on that too, but I don't think I said so at the time...


James.


RE: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by "William A. Rowe, Jr." <wr...@lnd.com>.
Sorry I haven't chimed in, but yes, under Win32 we certainly
need this...

however, you need to be sure the spec is clear on partial read
results!!!

> -----Original Message-----
> From: Brian Havard [mailto:brianh@kheldar.apana.org.au]
> Sent: Wednesday, June 14, 2000 12:14 PM
> To: Apache Developers Mailing List
> Subject: Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32
> readwrite.c
> 
> 
> On Wed, 14 Jun 2000 10:03:23 -0700 (PDT), rbb@covalent.net wrote:
> 
> [...]
> 
> >> Exactly, and that's a whole other argument. If you dig 
> through the archives
> >> you should find me arguing that ap_read() _should_ return 
> APR_EOF. However,
> >> posix read() doesn't work this way and unixheads are the 
> majority around
> >> here.....
> >
> >Don't lump us all in together.  I was and am on your side about
> >APR_EOF.  I would like to see APR return the information 
> that you have hit
> >the enf of the file.  Some Unixheads are just still looking 
> at POSIX and
> >not seeing where changing things could help.  :-)
> 
> Yes, I remembered you agreed with me but I think you were the only one
> (might have been one other person, I forget).
> 
> -- 
>  
> ______________________________________________________________
> ________________
>  |  Brian Havard                 |  "He is not the messiah!   
>                 |
>  |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" 
> - Life of Brian |
>  
> --------------------------------------------------------------
> ----------------
> 

Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Wed, 14 Jun 2000 10:03:23 -0700 (PDT), rbb@covalent.net wrote:

[...]

>> Exactly, and that's a whole other argument. If you dig through the archives
>> you should find me arguing that ap_read() _should_ return APR_EOF. However,
>> posix read() doesn't work this way and unixheads are the majority around
>> here.....
>
>Don't lump us all in together.  I was and am on your side about
>APR_EOF.  I would like to see APR return the information that you have hit
>the enf of the file.  Some Unixheads are just still looking at POSIX and
>not seeing where changing things could help.  :-)

Yes, I remembered you agreed with me but I think you were the only one
(might have been one other person, I forget).

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by rb...@covalent.net.
> >I would think that you *should* be able to make it as simple as
> >
> >ap_status_t ap_getc(char *ch, ap_file_t *thefile)
> >{
> >    ap_ssize_t bread = 1;
> >    return ap_read(thefile, ch, &bread);
> >}
> >
> >However, while the Win32 ap_read() handles eof_hit, it doesn't return
> >APR_EOF.  Instead, it returns the GetLastError() code (which is zero).
> 
> Exactly, and that's a whole other argument. If you dig through the archives
> you should find me arguing that ap_read() _should_ return APR_EOF. However,
> posix read() doesn't work this way and unixheads are the majority around
> here.....

Don't lump us all in together.  I was and am on your side about
APR_EOF.  I would like to see APR return the information that you have hit
the enf of the file.  Some Unixheads are just still looking at POSIX and
not seeing where changing things could help.  :-)

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------



Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On Wed, 14 Jun 2000 12:39:22 -0400, Jeff Trawick wrote:

[...]

>I would think that you *should* be able to make it as simple as
>
>ap_status_t ap_getc(char *ch, ap_file_t *thefile)
>{
>    ap_ssize_t bread = 1;
>    return ap_read(thefile, ch, &bread);
>}
>
>However, while the Win32 ap_read() handles eof_hit, it doesn't return
>APR_EOF.  Instead, it returns the GetLastError() code (which is zero).

Exactly, and that's a whole other argument. If you dig through the archives
you should find me arguing that ap_read() _should_ return APR_EOF. However,
posix read() doesn't work this way and unixheads are the majority around
here.....

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by Jeff Trawick <tr...@bellsouth.net>.
> From: bjh@locus.apache.org
> Date: 14 Jun 2000 16:10:46 -0000
> 
> bjh         00/06/14 09:10:45
> 
>   Modified:    src/lib/apr/file_io/win32 readwrite.c
>   Log:
>   Win32: use ap_read() in ap_getc() so that it benefits from & doesn't mess
>   with buffering.
>   
>   Revision  Changes    Path
>   1.35      +9 -3      apache-2.0/src/lib/apr/file_io/win32/readwrite.c
>   
>   Index: readwrite.c
>   ===================================================================
>   RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v
>   retrieving revision 1.34
>   retrieving revision 1.35
>   diff -u -r1.34 -r1.35
>   --- readwrite.c	2000/05/26 16:23:10	1.34
>   +++ readwrite.c	2000/06/14 16:10:45	1.35
>   @@ -245,10 +245,16 @@
>    
>    ap_status_t ap_getc(char *ch, ap_file_t *thefile)
>    {
>   -    DWORD bread;
>   -    if (!ReadFile(thefile->filehand, ch, 1, &bread, NULL)) {
>   -        return GetLastError();
>   +    ap_status_t rc;
>   +    int bread;
>   +
>   +    bread = 1;
>   +    rc = ap_read(thefile, ch, &bread);
>   +
>   +    if (rc) {
>   +        return rc;
>        }
>   +    
>        if (bread == 0) {
>            thefile->eof_hit = TRUE;
>            return APR_EOF;

I would think that you *should* be able to make it as simple as

ap_status_t ap_getc(char *ch, ap_file_t *thefile)
{
    ap_ssize_t bread = 1;
    return ap_read(thefile, ch, &bread);
}

However, while the Win32 ap_read() handles eof_hit, it doesn't return
APR_EOF.  Instead, it returns the GetLastError() code (which is zero).

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c

Posted by Brian Havard <br...@kheldar.apana.org.au>.
On 14 Jun 2000 16:10:46 -0000, bjh@locus.apache.org wrote:

>bjh         00/06/14 09:10:45
>
>  Modified:    src/lib/apr/file_io/win32 readwrite.c
>  Log:
>  Win32: use ap_read() in ap_getc() so that it benefits from & doesn't mess
>  with buffering.

Well, that's one I missed. ap_fgets() also needs redoing.

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------