httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject APR file i/o questions
Date Wed, 14 Jun 2000 21:25:05 GMT
Should the read-type functions return APR_EOF at end-of-file on all
platforms?

  (Plenty of folks seem to agree: Ryan, Jeff, Brian, James)

Should ap_ungetc() work on all files, buffered or not?

  (Jeff thinks so.)

Should ap_fgets() on Unix have to check for '\r' *and* '\n' (i.e.,
think about '\r' at all)?

  (Jeff thinks not.  fgets() has managed without it forever)

same question for OS/2 and Win32..

  (Jeff thinks it should deal with '\r' and '\n' specially.)

*If* ap_fgets() on a platform checks for '\r' *and* '\n', what should
it do?

  (Jeff thinks "\r\n" should collapse to "\n".  The current Unix
  ap_fgets() in CVS is weird.  If the file has "Mary\r\n", subsequent
  calls to ap_fgets() will return "Mary\r" and "\n".  Not cool.)

What about locking within the buffered I/O support?

  (Jeff thinks that by default there should be no locking, but that a
  flag on ap_open() (APR_MT) can turn it on.  This flag would be
  ignored (not failed) if !APR_HAS_THREADS.  Even in a multithreaded
  app it seems uncommon for more than one thread to access the same
  file at once, so this is a reasonable default.

  Something like the following defined internal to readwrite.c should
  suffice for locking when needed:

   #ifdef APR_HAS_THREADS
   #define lock_buffer(f) \
       if ((f)->mt) ap_lock((f)->thlock);
   #define unlock_buffer(f) \
       if ((f)->mt) ap_unlock((f)->thlock);
   #else
   #define lock_buffer(f)
   #define unlock_buffer(f)
   #endif

What about Jeff's patch to Unix readwrite.c he posted earlier?

  (Jeff is 70% sure he should change it to call ap_read() from
  ap_fgets() but he will wait until there is a chance for some answers
  to these questions before playing more in the code.  Hopefully the
  next time he is coding there he can handle the resolution of more of
  the questions above.)

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

Mime
View raw message