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

version» Context lines:

pike.git/src/modules/Pipe/pipe.c:23:   #endif   #endif   #endif      #ifdef HAVE_SYS_ID_H   #include <sys/id.h>   #endif /* HAVE_SYS_ID_H */      #include <fcntl.h>    - RCSID("$Id: pipe.c,v 1.42 2000/08/19 11:18:12 grubba Exp $"); + RCSID("$Id: pipe.c,v 1.43 2000/08/28 22:13:09 hubbe Exp $");      #include "threads.h"   #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:213:    THIS->lastinput->next=i;    else    THIS->firstinput=i;    THIS->lastinput=i;    return i;   }      /* Free an input struct and all that it stands for */   static INLINE void free_input(struct input *i)   { +  debug_malloc_touch(i); +     ninputs--;    switch (i->type)    {    case I_OBJ:    case I_BLOCKING_OBJ:    if (!i->u.obj) break;    if (i->u.obj->prog)    {   #ifdef BLOCKING_CLOSE    apply_low(i->u.obj,i->set_blocking_offset,0);
pike.git/src/modules/Pipe/pipe.c:293:      /* Allocate a new buffer and put it at the end of the chain of buffers    * scheduled for output. Return 1 if we have more bytes in buffers    * than allowed afterwards.    */   static INLINE int append_buffer(struct pike_string *s)    /* 1=buffer full */   {    struct buffer *b;    +  debug_malloc_touch(s); +     if(THIS->fd!= -1)    {    fd_lseek(THIS->fd, THIS->pos, SEEK_SET);    fd_write(THIS->fd, s->str, s->len);    THIS->pos+=s->len;    return 0;    }    else    {    nbuffers++;
pike.git/src/modules/Pipe/pipe.c:569:   /*    * close and free the contents of a struct output    * Note that the output struct is not freed or unlinked here,    * that is taken care of later.    */   static INLINE void output_finish(struct object *obj)   {    struct output *o, *oi;    struct object *obji;    +  debug_malloc_touch(obj); +     o=(struct output *)(obj->storage);       if (o->obj)    {    if(obj==THIS->firstoutput){    THIS->firstoutput=o->next;    } else    for(obji=THIS->firstoutput;obji;obji=oi->next)    {    oi=(struct output *)(obji->storage);
pike.git/src/modules/Pipe/pipe.c:622:   /*    * Try to write some data to our precious output    */   static INLINE void output_try_write_some(struct object *obj)   {    struct output *out;    struct pike_string *s;    size_t len;    INT_TYPE ret;    +  debug_malloc_touch(obj); +     out=(struct output*)(obj->storage);      #ifdef INSISTANT_WRITE    do    {   #endif    /* Get some data to write */    s=gimme_some_data(out->pos);    if (!s) /* out of data */    {
pike.git/src/modules/Pipe/pipe.c:937:    /* keep the file pointer of the duped fd    o->pos=0; */    /* allow start position as 2nd argument for additional outputs    o->pos=THIS->pos; */       if(args>=2)    o->pos=sp[1-args].u.integer;    else    o->pos=THIS->pos;    -  ref_push_object(obj); +  push_object(obj); /* Ok, David, this is probably correct, but I dare you to explain why :) */    apply(o->obj,"set_id",1);    pop_stack();       push_int(0);    push_callback(offset_output_write_callback);    push_callback(offset_output_close_callback);    apply_low(o->obj,o->set_nonblocking_offset,3);    pop_stack();       pop_n_elems(args-1);
pike.git/src/modules/Pipe/pipe.c:1025:   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)    error("Illegal argument to pipe->write_output_callback\n");    +  debug_malloc_touch(sp[-args].u.object);    output_try_write_some(sp[-args].u.object);    pop_n_elems(args-1);   }      static void pipe_close_output_callback(INT32 args)   {    struct output *o;    if (args<1 || sp[-args].type!=T_OBJECT)       if(!sp[-args].u.object->prog) return;
pike.git/src/modules/Pipe/pipe.c:1127:      /********** init/exit *******************************************************/      void close_and_free_everything(struct object *thisobj,struct pipe *p)   {    struct buffer *b;    struct input *i;    struct output *o;    struct object *obj;    +  debug_malloc_touch(thisobj); +  debug_malloc_touch(p); +     if(p->done){    return;    }    p->done=1;       if (thisobj)    add_ref(thisobj); /* don't kill object during this */       while (p->firstbuffer)    {
pike.git/src/modules/Pipe/pipe.c:1188:       p->done_callback.type=T_INT;    p->output_closed_callback.type=T_INT;    p->id.type=T_INT;       /* p->done=0; */   }      static void init_pipe_struct(struct object *o)   { +  debug_malloc_touch(o); +     THIS->firstbuffer=THIS->lastbuffer=NULL;    THIS->firstinput=THIS->lastinput=NULL;    THIS->firstoutput=NULL;    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;
pike.git/src/modules/Pipe/pipe.c:1213:      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;    +  debug_malloc_touch(obj);    o=(struct output *)(Pike_fp->current_storage); -  +     if (o->obj)    {    if(o->obj->prog)    {   #ifdef BLOCKING_CLOSE    apply_low(o->obj,o->set_blocking_offset,0);    pop_stack();   #endif    push_int(0);    apply(o->obj,"set_id",1);
pike.git/src/modules/Pipe/pipe.c:1242:    free_object(o->obj);    noutputs--;    o->obj=0;    o->fd=-1;    }   }      static void init_output_struct(struct object *ob)   {    struct output *o; +  debug_malloc_touch(ob);    o=(struct output *)(Pike_fp->current_storage);    o->obj=0;   }         /********** Pike init *******************************************************/      void port_setup_program(void);      void f__pipe_debug(INT32 args)