c84264bb398c51438bb5230fc6b4a2a75a5bd923
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c  1) #include "cleaner.h"
liblwpttr/src/cleaner.c  2) #include "macros.h"
liblwpttr/src/cleaner.c  3) 
liblwpttr/src/cleaner.c  4) #include <stdlib.h>
liblwpttr/src/cleaner.c  5) 
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c   6) struct uptev_cleaner_s {
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c  7)   unsigned int free_ptr_cnt; /**< number of pointer to be freed */
Stefan Schuermans formatting

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c   8)   void *free_ptrs[64];       /**< pointers to be freed */
libuptev/src/cleaner.c   9)   uptev_cleaner_t *next;     /**< next cleaner object, linked list */
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 10) };
liblwpttr/src/cleaner.c 11) 
Stefan Schuermans formatting

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  12) uptev_cleaner_t *uptev_cleaner_new(void) {
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  13)   uptev_cleaner_t *cleaner = malloc(sizeof(uptev_cleaner_t));
Stefan Schuermans formatting

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  14)   if (!cleaner) {
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 15)     return NULL;
liblwpttr/src/cleaner.c 16)   }
liblwpttr/src/cleaner.c 17)   cleaner->free_ptr_cnt = 0;
liblwpttr/src/cleaner.c 18)   cleaner->next = NULL;
liblwpttr/src/cleaner.c 19)   return cleaner;
liblwpttr/src/cleaner.c 20) }
liblwpttr/src/cleaner.c 21) 
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  22) int uptev_cleaner_add_ptr(uptev_cleaner_t *cleaner, void *ptr) {
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 23)   /* find last cleaner in chain */
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  24)   uptev_cleaner_t *cl = cleaner;
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 25)   while (cl->next != NULL) {
liblwpttr/src/cleaner.c 26)     cl = cl->next;
liblwpttr/src/cleaner.c 27)   }
liblwpttr/src/cleaner.c 28)   /* last cleaner full? */
liblwpttr/src/cleaner.c 29)   if (cl->free_ptr_cnt >= countof(cl->free_ptrs)) {
liblwpttr/src/cleaner.c 30)     /* create new one */
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  31)     cl->next = uptev_cleaner_new();
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 32)     /* error ? */
Stefan Schuermans formatting

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  33)     if (!cl->next) {
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 34)       /* cleanup everything and reutrn error */
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  35)       uptev_cleaner_cleanup(cleaner);
Stefan Schuermans add exe and cwd to proc_begin

Stefan Schuermans authored 4 years ago

liblwpttr/src/cleaner.c 36)       return -1;
liblwpttr/src/cleaner.c 37)     }
liblwpttr/src/cleaner.c 38)     /* go to new cleaner */
liblwpttr/src/cleaner.c 39)     cl = cl->next;
liblwpttr/src/cleaner.c 40)   }
liblwpttr/src/cleaner.c 41)   /* add pointer */
liblwpttr/src/cleaner.c 42)   cl->free_ptrs[cl->free_ptr_cnt++] = ptr;
liblwpttr/src/cleaner.c 43)   return 0;
liblwpttr/src/cleaner.c 44) }
liblwpttr/src/cleaner.c 45) 
Stefan Schuermans rename: lwproctrace -> upro...

Stefan Schuermans authored 4 years ago

libuptev/src/cleaner.c  46) void uptev_cleaner_cleanup(uptev_cleaner_t *cleaner) {
libuptev/src/cleaner.c  47)   uptev_cleaner_t *cl = cleaner;