limited usability of the library libprocps from an external software

Davide Madrisan <[email protected]>
Newsgroups gmane.linux.procps.devel
Message-ID <CAFjCWUOqp8e4sDV3+qyAhPZJ_feeiNOx=saSfijr9XB+DDcrPQ@mail.gmail.com>
Hello Craig,

the library libprocps exports a limited set of symbols and this, in my
opinion, limits a lot its usability.
A simple PoC follows:

    $ cat procpsng_poc.c
    #include <stdio.h>
    #include <proc/sysinfo.h>

    int
    main ()
    {
      meminfo ();
      printf ("kb_dirty: %lu\n", kb_dirty);
      return 0;
    }

    $ gcc -Wall procpsng_poc.c -o procpsng_poc -lprocps
    /usr/bin/ld: /tmp/cc7MZSOM.o: in function `main':
    procpsng_poc.c:(.text+0x25): undefined reference to `kb_dirty'
    collect2: error: ld returned 1 exit status

Why for instance "kb_main_total" is listed in proc/libprocps.sym but not
"kb_dirty"?

I think several objects declared as extern in proc/sysinfo.h should be
exported too:
  * all the missing kb_* ones,
  * vminfo
  * the vm_nr_* variables.

And maybe other interesting variables declared in the other pubic headers,

What do you think?
Should I open an issue on GitLab? Create a patch?

Take care.
---
Davide Madrisan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.