11 Commits

Author SHA1 Message Date
Niels Thykier
3fcff0d75f Align open_fdinfo_dir with pidfds_to_pids
The function `pidfds_to_pids` expected `-1` if `open_fdinfo_dir` failed but the latter returned `errno` which is hard to distinguish from a valid file handle.  Correct that by making `open_fdinfo_dir` a wrapper around `open`.
2020-08-12 09:41:28 +01:00
Ahsan Fayaz
510a0a6ae2 Fix issues found by Coverity, closes #206. 2020-07-17 18:55:00 +01:00
Jason Ekstrand
c1646ecdd9 Add helpers for getting RAPL power data from Intel CPUs 2020-01-09 10:49:19 -06:00
Christian Kellner
cd6c2ee612 common: create another lib tailored for the client
Use a small subset of the existing common files to create another
static library to be used from the client library.
2019-10-18 13:19:30 +02:00
Christian Kellner
5398dd1d19 common: add pidfd related methods
Add functions to open pidfds, i.e. file descriptors representing
processes, for process ids and vice versa. Both functions work
an array of fds/pids, stop on error and return the number of
successfully handled items.
2019-10-18 13:19:30 +02:00
Christian Kellner
4b59818fd4 common: add autofree helper
Much like the auto-closing helper for file descriptors, add a new
auto-free helper that is meant to be used with dynamically allocated
memory, a la:
  autofree char *data = NULL;
  ...
  data = malloc(size);
When data goes out of scope, cleanup_free will be called with &data,
i.e. cleanup_free(&data), which in turn will call free(3) data. In
order to work with all types, e.g. 'char *' (resulting in char **
being passed to cleanup_free) or 'int *' (resulting in int ** being
passed to cleanup_free), cleanup_free is defined to work with void *,
hence the odd-looking cast: void *target = *(void **) ptr.
2019-10-18 13:19:30 +02:00
Christian Kellner
35fb7f5baf meson: include dir in daemon_common dependency
Specify the include directory in the link_daemon_common dependency
and thus everything that includes that as a dependency will get
the proper include directory automatically.
2019-10-18 13:19:30 +02:00
Jonathan Carter
8182edc048 Fix typo s/Coudn't/Couldn't/g 2019-08-05 09:50:32 +00:00
Marc Di Luzio
702407595a Rename duplicate CONFIG_VALUE_MAX
Leave a static assert to ensure they're in sync when relevant in gamemode-gpu
2019-06-01 11:12:10 +01:00
Marc Di Luzio
2e67906402 Remove unneeded includes 2019-06-01 10:57:27 +01:00
Marc Di Luzio
1b78d0dcf7 Restructure files and libraries
Rename a bunch of files to make the consistent
	Create two new subdirectories for common code, and utilities
2019-06-01 10:54:22 +01:00