BlinkenArea - GitList
Repositories
Blog
Wiki
uproctrace
Code
Commits
Branches
Tags
Search
Tree:
d355298
Branches
Tags
master
uproctrace
liblwpttr
src
event.c
first incomplete begin_proc event
Stefan Schuermans
commited
d355298
at 2020-05-17 10:22:00
event.c
Blame
History
Raw
#include <liblwpttr/event.h> #include <lwproctrace.pb-c.h> #include <stdlib.h> #include <sys/types.h> #include <time.h> #include <unistd.h> int lwpttr_event_proc_begin(void **data, size_t *size) { struct timespec now; clock_gettime(CLOCK_REALTIME, &now); struct _Lwproctrace__Timespec timestamp = LWPROCTRACE__TIMESPEC__INIT; timestamp.sec = now.tv_sec; timestamp.has_nsec = 1; timestamp.nsec = now.tv_nsec; struct _Lwproctrace__ProcBegin proc_begin = LWPROCTRACE__PROC_BEGIN__INIT; proc_begin.pid = getpid(); proc_begin.has_ppid = 1; proc_begin.ppid = getppid(); struct _Lwproctrace__Event event = LWPROCTRACE__EVENT__INIT; event.timestamp = ×tamp; event.proc_begin = &proc_begin; *size = lwproctrace__event__get_packed_size(&event); *data = malloc(*size); if (! data) { *size = 0; return -1; } lwproctrace__event__pack(&event, *data); return 0; }