readproc segmantation fault in case proc_t is not static
running this code: proc_t proc_info; memset(&proc_info, 0, sizeof(proc_info)); PROCTAB* proc = openproc(PROC_FILLMEM | PROC_FILLSTAT); readproc(proc, &proc_info);
on ubuntu 14.04 (uses libprocps3-dev-procps_3.3.9.orig.tar.xz) this sample code works fine. on ubuntu 16.04 (uses libprocps4-dev-procps_3.3.10.orig.tar.xz) this sample code throws segmentation fault in the readproc method .
A considerable workaround for me was to declare proc_t as static (same as in the code of psproc). static proc_t proc_info; memset(&proc_info, 0, sizeof(proc_info)); PROCTAB* proc = openproc(PROC_FILLMEM | PROC_FILLSTAT); readproc(proc, &proc_info);
Edited by Craig Small