pike.git / src / modules / Pipe / pipe.c

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:15: Inside #if defined(HAVE_MMAP)
  #ifdef HAVE_MMAP   /* sys/mman.h is _probably_ there anyway. */   #include <sys/mman.h>   #endif   #endif   #endif      #include <fcntl.h>      #include "global.h" - RCSID("$Id: pipe.c,v 1.9 1997/05/22 16:17:20 grubba Exp $"); + RCSID("$Id: pipe.c,v 1.10 1997/08/29 17:54:05 marcus Exp $");      #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "error.h"   #include "builtin_functions.h"   
pike.git/src/modules/Pipe/pipe.c:128:       unsigned long bytes_in_buffer;    unsigned long pos;    /* fd: size of buffer file */    /* current position of first element (buffer or mmap) */    struct buffer *firstbuffer,*lastbuffer;    short sleeping; /* sleeping; buffer is full */    short done;    struct input *firstinput,*lastinput;    struct object *firstoutput; +  unsigned long sent;   };      static int offset_input_read_callback;   static int offset_input_close_callback;   static int offset_output_write_callback;   static int offset_output_close_callback;   static int mmapped, nobjects, nstrings, noutputs, ninputs, nbuffers, sbuffers;      static char static_buffer[READ_BUFFER_SIZE];   
pike.git/src/modules/Pipe/pipe.c:552:    ret=-1;    if(sp[-1].type == T_INT) ret=sp[-1].u.integer;    pop_stack();       if (ret==-1) /* error, byebye */    {    output_finish(obj);    return;    }    out->pos+=ret; +  THIS->sent+=ret;      #ifdef INSISTANT_WRITE    } while(ret == len);   #endif   }      /********** methods *********************************************************/      /* Add an input to this pipe */   static void pipe_input(INT32 args)
pike.git/src/modules/Pipe/pipe.c:844:    pipe_done();   }      static void pipe_start(INT32 args) /* force start */   {    low_start();    if(args)    pop_n_elems(args-1);   }    + static void f_bytes_sent(INT32 args) + { +  pop_n_elems(args); +  push_int(THIS->sent); + } +    /********** callbacks *******************************************************/      static void pipe_write_output_callback(INT32 args)   {    if (args<1 || sp[-args].type!=T_OBJECT)    error("Illegal argument to pipe->write_output_callback\n");       if(!sp[-args].u.object->prog) return;       if(sp[-args].u.object->prog != output_program)
pike.git/src/modules/Pipe/pipe.c:1029:    THIS->bytes_in_buffer=0;    THIS->pos=0;    THIS->sleeping=0;    THIS->done=0;    THIS->fd=-1;    THIS->done_callback.type=T_INT;    THIS->output_closed_callback.type=T_INT;    THIS->id.type=T_INT;    THIS->id.u.integer=0;    THIS->living_outputs=0; +  THIS->sent=0;   }      static void exit_pipe_struct(struct object *o)   {    close_and_free_everything(NULL,THIS);   }      static void exit_output_struct(struct object *obj)   {    struct output *o;
pike.git/src/modules/Pipe/pipe.c:1118:    "function(int:void)",0);    add_function("_input_close_callback",pipe_close_input_callback,    "function(int:void)",0);    add_function("_output_write_callback",pipe_write_output_callback,    "function(int:void)",0);    add_function("_input_read_callback",pipe_read_input_callback,    "function(int,string:void)",0);       add_function("version",pipe_version,"function(:string)",0);    +  add_function("bytes_sent",f_bytes_sent,"function(:int)",0); +     set_init_callback(init_pipe_struct);    set_exit_callback(exit_pipe_struct);       pipe_program=end_program();    add_program_constant("pipe",pipe_program, 0);       offset_output_close_callback=find_identifier("_output_close_callback",    pipe_program);    offset_input_close_callback=find_identifier("_input_close_callback",    pipe_program);