cvs commit: apache-2.0/src/main http_log.c

2000-02-18 Thread stoddard
stoddard00/02/18 06:18:11

  Modified:src/main http_log.c
  Log:
  Ahh, found ap_flush()!
  
  Revision  ChangesPath
  1.31  +1 -8  apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- http_log.c2000/02/17 19:03:52 1.30
  +++ http_log.c2000/02/18 14:18:11 1.31
  @@ -265,14 +265,7 @@
   replace_stderr = 1;
   if (s_main-error_log) {
   /* replace stderr with this new log */
  -#ifdef WIN32
  -/* ToDo: Create ap_fflush() */
  -HANDLE hFile;
  -ap_get_os_file(hFile, s_main-error_log);
  -FlushFileBuffers(hFile);
  -#else
  -fflush(stderr);
  -#endif
  +ap_flush(s_main-error_log);
   ap_open_stderr(errfile, p);
   if ((rc = ap_dupfile(errfile, s_main-error_log)) != APR_SUCCESS) {
   ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s_main,
  
  
  


cvs commit: apache-2.0/src/main http_log.c

2000-02-15 Thread stoddard
stoddard00/02/14 16:54:18

  Modified:src/main http_log.c
  Log:
  First step to get piped logs working on Windows (and Unix as well).
  There are still all kinds of problems in http_log.c. This patch just
  barely scratches the surface.
  
  Revision  ChangesPath
  1.28  +11 -12apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- http_log.c2000/01/31 23:14:41 1.27
  +++ http_log.c2000/02/15 00:54:06 1.28
  @@ -176,12 +176,11 @@
   signal(SIGHUP, SIG_IGN);
   #endif /* ndef SIGHUP */
   
  -if ((ap_createprocattr_init(procattr, p)  != APR_SUCCESS) ||
  +if ((ap_createprocattr_init(procattr, p) != APR_SUCCESS) ||
   (ap_setprocattr_io(procattr,
  -   APR_NO_PIPE,
  APR_FULL_BLOCK,
  -   APR_NO_PIPE) != APR_SUCCESS) ||
  -(ap_setprocattr_dir(procattr, progname)!= APR_SUCCESS)) {
  +   APR_NO_PIPE,
  +   APR_NO_PIPE) != APR_SUCCESS)) {
   /* Something bad happened, give up and go away. */
   rc = -1;
   }
  @@ -264,15 +263,15 @@
   
   replace_stderr = 1;
   if (s_main-error_log) {
  - /* replace stderr with this new log */
  - fflush(stderr);
  +/* replace stderr with this new log */
  +fflush(stderr); /* ToDo: replace this with an APR call... */
   ap_open_stderr(errfile, p);
  - if (ap_dupfile(errfile, s_main-error_log) != APR_SUCCESS) {
  - ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main,
  - unable to replace stderr with error_log);
  - } else {
  - replace_stderr = 0;
  - }
  +if (ap_dupfile(errfile, s_main-error_log) != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main,
  + unable to replace stderr with error_log);
  +} else {
  +replace_stderr = 0;
  +}
   }
   /* note that stderr may still need to be replaced with something
* because it points to the old error log, or back to the tty
  
  
  



cvs commit: apache-2.0/src/main http_log.c

2000-02-15 Thread stoddard
stoddard00/02/15 14:51:27

  Modified:src/main http_log.c
  Log:
  ap_dupfile (specifically dup2) is not available in a general form under 
Windows.
  So use SetStdHandle directly. A single call to ap_dup2stderr() (or similar) 
could
  replace the entire chunk of code in the #ifdef #else #endif block.  Ryan 
didn't
  want to put this speciality function into APR, but we could put it into os.c
  if folks are interested.
  
  Revision  ChangesPath
  1.29  +15 -3 apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- http_log.c2000/02/15 00:54:06 1.28
  +++ http_log.c2000/02/15 22:51:23 1.29
  @@ -255,6 +255,7 @@
   
   void ap_open_logs(server_rec *s_main, ap_context_t *p)
   {
  +ap_status_t rc = APR_SUCCESS;
   server_rec *virt, *q;
   int replace_stderr;
   ap_file_t *errfile = NULL;
  @@ -263,15 +264,26 @@
   
   replace_stderr = 1;
   if (s_main-error_log) {
  +#ifdef WIN32
  +HANDLE hFile;
  +ap_get_os_file(hFile, s_main-error_log);
  +FlushFileBuffers(hFile);
  +if (!SetStdHandle(STD_ERROR_HANDLE, hFile)) {
  +ap_log_error(APLOG_MARK, APLOG_CRIT, GetLastError(), s_main,
  + unable to replace stderr with error_log);
  +}
  +replace_stderr = 0;
  +#else
   /* replace stderr with this new log */
   fflush(stderr); /* ToDo: replace this with an APR call... */
   ap_open_stderr(errfile, p);
  -if (ap_dupfile(errfile, s_main-error_log) != APR_SUCCESS) {
  -ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s_main,
  +if ((rc = ap_dupfile(errfile, s_main-error_log)) != APR_SUCCESS) {
  +ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s_main,
unable to replace stderr with error_log);
   } else {
   replace_stderr = 0;
   }
  +#endif
   }
   /* note that stderr may still need to be replaced with something
* because it points to the old error log, or back to the tty
  @@ -302,7 +314,7 @@
   ap_file_t *errfile = NULL;
   
   ap_open_stderr(errfile, s-process-pool);
  -if (   s-error_log != NULL) {
  +if (s-error_log != NULL) {
   ap_dupfile((s-error_log), errfile);
   }
   }
  
  
  


cvs commit: apache-2.0/src/main http_log.c

1999-11-05 Thread manoj
manoj   99/11/05 13:01:46

  Modified:src/main http_log.c
  Log:
  Stop using APR_BUFFERED for the error log and httpd.pid file. The error
  logging code has been tweaked a bit so that we still have one write per
  log entry.
  
  Revision  ChangesPath
  1.15  +17 -15apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -d -u -r1.14 -r1.15
  --- http_log.c1999/10/23 21:27:38 1.14
  +++ http_log.c1999/11/05 21:01:44 1.15
  @@ -260,7 +260,7 @@
   else {
fname = ap_server_root_relative(p, s-error_fname);
/*  Change to AP funcs. */
  -if (ap_open(s-error_log, fname, APR_BUFFERED | APR_APPEND | 
  +if (ap_open(s-error_log, fname, APR_APPEND | 
   APR_READ | APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != 
APR_SUCCESS) {
   perror(fopen);
   fprintf(stderr, %s: could not open error log file %s.\n,
  @@ -328,7 +328,7 @@
  ap_status_t status, const server_rec *s, 
  const request_rec *r, const char *fmt, va_list 
args)
   {
  -char errstr[MAX_STRING_LEN];
  +char errstr[MAX_STRING_LEN + 1];/* + 1 to have room for '\n' */
   size_t len;
   ap_file_t *logf = NULL;
   int errfileno = STDERR_FILENO;
  @@ -377,12 +377,12 @@
   }
   
   if (logf) {
  - len = ap_snprintf(errstr, sizeof(errstr), [%s] , ap_get_time());
  + len = ap_snprintf(errstr, MAX_STRING_LEN, [%s] , ap_get_time());
   } else {
len = 0;
   }
   
  -len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  +len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
[%s] , priorities[level  APLOG_LEVELMASK].t_name);
   
   #ifndef TPF
  @@ -405,7 +405,7 @@
file = tmp;
}
   #endif /*_OSD_POSIX*/
  - len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
%s(%d): , file, line);
   }
   #endif /* TPF */
  @@ -415,7 +415,7 @@
 * quad is the most secure, which is why I'm implementing it
 * first. -djg
 */
  - len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
[client %s] , r-connection-remote_ip);
   }
   if (!(level  APLOG_NOERRNO)
  @@ -424,7 +424,7 @@
 !(level  APLOG_WIN32ERROR)
   #endif
) {
  - len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
(%d)%s: , status, strerror(status));
   }
   #ifdef WIN32
  @@ -433,7 +433,7 @@
int nErrorCode;
   
nErrorCode = GetLastError();
  - len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
(%d), nErrorCode);
   
nChars = FormatMessage( 
  @@ -442,7 +442,7 @@
nErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* // Default language */
(LPTSTR) errstr + len,
  - sizeof(errstr) - len,
  + MAX_STRING_LEN - len,
NULL 
);
len += nChars;
  @@ -452,7 +452,7 @@
 * log the numeric value.
 */
nErrorCode = GetLastError();
  - len += ap_snprintf(errstr + len, sizeof(errstr) - len,
  + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len,
   (FormatMessage failed with code %d): ,
   nErrorCode);
}
  @@ -472,14 +472,16 @@
   }
   #endif
   
  -len += ap_vsnprintf(errstr + len, sizeof(errstr) - len, fmt, args);
  +len += ap_vsnprintf(errstr + len, MAX_STRING_LEN - len, fmt, args);
   
   /* NULL if we are logging to syslog */
   if (logf) {
  -  /* ZZZ let's just use AP funcs to Write to the error log.  If failure,
  -  can we output a message to the console??? */
  +/* We know that we have one more character of space available because
  + * the array is sized that way */
  +/* ap_assert(len  MAX_STRING_LEN) */
  +errstr[len++] = '\n';
  +errstr[len] = '\0';
ap_puts(errstr, logf);
  - ap_putc('\n', logf);
ap_flush(logf);
   }
   #ifdef HAVE_SYSLOG
  @@ -553,7 +555,7 @@
   );
   }
   
  -if(ap_open(pid_file, fname, APR_WRITE | APR_BUFFERED | APR_CREATE, 
APR_OS_DEFAULT, p) != APR_SUCCESS) {
  +if(ap_open(pid_file, fname, APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) 
!= APR_SUCCESS) {
perror(fopen);
   fprintf(stderr, %s: could not log pid to file %s\n,
ap_server_argv0, fname);
  
  
  


cvs commit: apache-2.0/src/main http_log.c

1999-10-23 Thread martin
martin  99/10/23 14:27:39

  Modified:src/main http_log.c
  Log:
  Be on the safe side
  
  Revision  ChangesPath
  1.14  +1 -1  apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===
  RCS file: /export/home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- http_log.c1999/10/20 12:49:55 1.13
  +++ http_log.c1999/10/23 21:27:38 1.14
  @@ -409,7 +409,7 @@
%s(%d): , file, line);
   }
   #endif /* TPF */
  -if (r) {
  +if (r  r-connection) {
/* XXX: TODO: add a method of selecting whether logged client
 * addresses are in dotted quad or resolved form... dotted
 * quad is the most secure, which is why I'm implementing it
  
  
  


cvs commit: apache-2.0/src/main http_log.c

1999-10-11 Thread rbb
rbb 99/10/11 10:52:29

  Modified:src/lib/apr/include apr_portable.h apr_thread_proc.h
   src/lib/apr/locks/unix locks.c
   src/lib/apr/test testproc.c testsig.c testsock.c
testthread.c
   src/lib/apr/threadproc/beos proc.c procsup.c thread.c
threadcancel.c threadpriv.c
   src/lib/apr/threadproc/os2 proc.c thread.c threadcancel.c
threadpriv.c
   src/lib/apr/threadproc/unix proc.c procsup.c thread.c
threadcancel.c threadpriv.c
   src/lib/apr/threadproc/win32 proc.c thread.c threadcancel.c
threadpriv.c
   src/lib/apr/time/unix time.c
   src/main http_log.c
  Log:
  This finishes the argument swaps.  The docs haven't been updated, and
  probably won't be for a while yet.  These argument orders have been
  documented in the APR Design doc committed earlier today.
  
  Revision  ChangesPath
  1.8   +4 -4  apache-2.0/src/lib/apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_portable.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_portable.h1999/10/10 20:34:54 1.7
  +++ apr_portable.h1999/10/11 17:51:47 1.8
  @@ -183,11 +183,11 @@
   ap_status_t ap_get_os_file(ap_os_file_t *, ap_file_t *); 
   ap_status_t ap_get_os_dir(ap_os_dir_t *, ap_dir_t *);  
   ap_status_t ap_get_os_sock(ap_os_sock_t *, ap_socket_t *);
  -ap_status_t ap_get_os_lock(ap_lock_t *, ap_os_lock_t *); 
  -ap_status_t ap_get_os_thread(ap_thread_t *, ap_os_thread_t *);
  -ap_status_t ap_get_os_proc(ap_proc_t *, ap_os_proc_t *); 
  +ap_status_t ap_get_os_lock(ap_os_lock_t *, ap_lock_t *); 
  +ap_status_t ap_get_os_thread(ap_os_thread_t *, ap_thread_t *);
  +ap_status_t ap_get_os_proc(ap_os_proc_t *, ap_proc_t *); 
   ap_status_t ap_get_os_time(ap_os_time_t **, ap_time_t *); 
  -ap_status_t ap_get_os_threadkey(ap_key_t *, ap_os_threadkey_t *);
  +ap_status_t ap_get_os_threadkey(ap_os_threadkey_t *, ap_key_t *);
   
   ap_status_t ap_put_os_file(ap_file_t **, ap_os_file_t *, ap_context_t *); 
   ap_status_t ap_put_os_dir(ap_dir_t **, ap_os_dir_t *, ap_context_t *); 
  
  
  
  1.8   +19 -19apache-2.0/src/lib/apr/include/apr_thread_proc.h
  
  Index: apr_thread_proc.h
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_thread_proc.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_thread_proc.h 1999/10/11 14:20:39 1.7
  +++ apr_thread_proc.h 1999/10/11 17:51:48 1.8
  @@ -86,27 +86,27 @@
   ap_status_t ap_create_threadattr(ap_threadattr_t **, ap_context_t *);
   ap_status_t ap_setthreadattr_detach(ap_threadattr_t *, ap_int32_t);
   ap_status_t ap_getthreadattr_detach(ap_threadattr_t *);
  -ap_status_t ap_create_thread(ap_context_t *, ap_threadattr_t *, 
  - ap_thread_start_t, void *, ap_thread_t **);
  +ap_status_t ap_create_thread(ap_thread_t **, ap_threadattr_t *, 
  + ap_thread_start_t, void *, ap_context_t *);
   ap_status_t ap_thread_exit(ap_thread_t *, ap_status_t *);
  -ap_status_t ap_thread_join(ap_thread_t *thd, ap_status_t *); 
  +ap_status_t ap_thread_join(ap_status_t *, ap_thread_t *thd); 
   ap_status_t ap_thread_detach(ap_thread_t *);
   
   ap_status_t ap_cancel_thread(ap_thread_t *);
  -ap_status_t ap_setcanceltype(ap_context_t *, ap_int32_t);
  -ap_status_t ap_setcancelstate(ap_context_t *, ap_int32_t);
  -ap_status_t ap_get_threaddata(ap_thread_t *, char *, void *);
  -ap_status_t ap_set_threaddata(ap_thread_t *, void *, char *,
  -  ap_status_t (*cleanup) (void *));
  +ap_status_t ap_setcanceltype(ap_int32_t, ap_context_t *);
  +ap_status_t ap_setcancelstate(ap_int32_t, ap_context_t *);
  +ap_status_t ap_get_threaddata(void *, char *, ap_thread_t *);
  +ap_status_t ap_set_threaddata(void *, char *,
  +  ap_status_t (*cleanup) (void *), ap_thread_t 
*);
   
  -ap_status_t ap_create_thread_private(ap_context_t *, void (*dest)(void *), 
  - ap_key_t **);
  +ap_status_t ap_create_thread_private(ap_key_t **, void (*dest)(void *), 
  + ap_context_t *);
   ap_status_t ap_get_thread_private(void **, ap_key_t *);
  -ap_status_t ap_set_thread_private(ap_key_t *, void *);
  +ap_status_t ap_set_thread_private(void *, ap_key_t *);
   ap_status_t ap_delete_thread_private(ap_key_t *);
  -ap_status_t ap_get_threadkeydata(ap_key_t *, char *, void *);
  -ap_status_t ap_set_threadkeydata(ap_key_t *, void *, char *,
  - ap_status_t (*cleanup) (void *));
  +ap_status_t