UpgradeNotes: fix-capture_nested.patch

File fix-capture_nested.patch, 1.5 KB (added by Ted Faber, 12 years ago)

Move calloc

  • xmview/capture_nested.c

    Move a call to calloc to a place where it does not interfere with libc6's
    calloc searching for the number of processes in use.
    a b  
    11921192        int (*fn) (void *arg);
    11931193        void *arg;
    11941194        void *parentpcb;
     1195        struct npcb *npcb;
    11951196};
    11961197
    11971198/* create a new (reduced) pcb for a thread */
    1198 static struct npcb *new_npcb(struct pcb *old)
     1199static struct npcb *new_npcb(struct pcb *old, struct npcb *npcb)
    11991200{
     1201        /*
    12001202        struct npcb *npcb;
    12011203        npcb=calloc(1,sizeof(struct npcb));
     1204        npcb = tryit + alloced++ * sizeof(struct npcb);
     1205        */
    12021206        npcb->flags=PCB_ALLOCATED;
    12031207        /* inherit the treepoch path from the generating thread */
    12041208        npcb->tst=old->tst;
     
    12271231static int clonewrap(void *carg){
    12281232        int (*fn) (void *arg) = ((struct clonearg *)(carg))->fn;
    12291233        void *arg=((struct clonearg *)(carg))->arg;
     1234        struct npcb *npcb = ((struct clonearg *)(carg))->npcb; 
    12301235        /* create a new pcb for the new thread, and link the pcb with this new
    12311236         * thread */
    1232         set_pcb(new_npcb(((struct clonearg *)(carg))->parentpcb));     
     1237        set_pcb(new_npcb(((struct clonearg *)(carg))->parentpcb, npcb));       
    12331238        /* free the data structure used to keep the thread info */
    12341239        free(carg);
    12351240        /* start the real thread */
     
    12481253        carg->fn=fn;
    12491254        carg->arg=arg;
    12501255        carg->parentpcb=get_pcb();
     1256        /* Calloc inside the new thread after the libc__clone call dumps core */
     1257        carg->npcb = calloc(1, sizeof(struct npcb));
    12511258        /* start a wrapper to the real main function of the thread */
    12521259        rv= libc__clone(clonewrap,child_stack,flags,carg,arg2,arg3,arg4);
    12531260        return rv;