Show
Ignore:
Timestamp:
02/03/09 01:29:49 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1233624589 +0000
git-parent:

[87de1cfcf05cd971deb05d13c0d1be988ac9d801]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1233624589 +0000
Message:

closes #78

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/utils/noit_log.c

    rc8af4b3 r84d6f13  
    6161  return close(fd); 
    6262} 
     63static size_t 
     64posix_logio_size(noit_log_stream_t ls) { 
     65  int fd; 
     66  struct stat sb; 
     67  fd = (int)ls->op_ctx; 
     68  if(fstat(fd, &sb) == 0) { 
     69    return (size_t)sb.st_size; 
     70  } 
     71  return -1; 
     72} 
    6373static logops_t posix_logio_ops = { 
    6474  posix_logio_open, 
     
    6676  posix_logio_write, 
    6777  posix_logio_close, 
     78  posix_logio_size 
    6879}; 
    6980 
     
    135146  return 0; 
    136147} 
     148static size_t 
     149jlog_logio_size(noit_log_stream_t ls) { 
     150  if(!ls->op_ctx) return -1; 
     151  return jlog_raw_size((jlog_ctx *)ls->op_ctx); 
     152} 
    137153static logops_t jlog_logio_ops = { 
    138154  jlog_logio_open, 
     
    140156  jlog_logio_write, 
    141157  jlog_logio_close, 
     158  jlog_logio_size 
    142159}; 
    143160 
     
    297314noit_log_stream_close(noit_log_stream_t ls) { 
    298315  if(ls->ops) ls->ops->closeop(ls); 
     316} 
     317 
     318size_t 
     319noit_log_stream_size(noit_log_stream_t ls) { 
     320  if(ls->ops && ls->ops->sizeop) return ls->ops->sizeop(ls); 
     321  return -1; 
    299322} 
    300323 
  • src/utils/noit_log.h

    rc8af4b3 r84d6f13  
    2222  int (*writeop)(struct _noit_log_stream *, const void *, size_t); 
    2323  int (*closeop)(struct _noit_log_stream *); 
     24  size_t (*sizeop)(struct _noit_log_stream *); 
    2425} logops_t; 
    2526 
     
    5859API_EXPORT(void) noit_log_stream_reopen(noit_log_stream_t ls); 
    5960API_EXPORT(void) noit_log_stream_close(noit_log_stream_t ls); 
     61API_EXPORT(size_t) noit_log_stream_size(noit_log_stream_t ls); 
    6062API_EXPORT(void) noit_log_stream_free(noit_log_stream_t ls); 
    6163API_EXPORT(int) noit_vlog(noit_log_stream_t ls, struct timeval *,