12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #define _GNU_SOURCE
- #include "gamemode.h"
- #include "helpers.h"
- #include <fcntl.h>
- #include <linux/limits.h>
- #include <unistd.h>
- procfd_t game_mode_open_proc(const pid_t pid)
- {
- char buffer[PATH_MAX];
- const char *proc_path = buffered_snprintf(buffer, "/proc/%d", pid);
- return proc_path ? open(proc_path, O_RDONLY | O_CLOEXEC) : INVALID_PROCFD;
- }
- int game_mode_close_proc(const procfd_t procfd)
- {
- return close(procfd);
- }
|