#linux-kernel #events #process #linux

app copes

A tool that identifies executable files used in automatic CoreCtrl profiles

2 stable releases

new 1.1.1 May 24, 2025

#142 in Unix APIs

GPL-3.0-or-later

62KB
834 lines

CoreCtrl Process Executable Solver CLI tool

copes is a command line utility that identifies executable files used in automatic CoreCtrl profiles.

Compilation

To compile the application, the following software must be installed in your system:

  • A Rust compiler and associated tools (Rust 1.77 or later). You can easily install them using rustup.rs.
  • clang compiler and a linker (ld, lld... your choice).

To build the program, run cargo build -r on the project directory. The program executable will be placed in the target/release directory.

Runtime dependencies

Under the hood, this program uses the process events connector kernel interface. Therefore, a Linux kernel compiled with CONFIG_PROC_EVENTS option enabled is required.

Usage

If you are using Linux 6.5 or earlier versions, you must run this program with root privileges. Otherwise, you can skip the sudo part on the following commands if you only want to monitor non-privileged processes.

sudo target/release/copes

By default, this utility shows the process event (either Exec or Exit), the process PID and the executable file for which the process was started. Executable file names are resolved in a similar way CoreCtrl does.

Use the c option to show the process command line. This option can be useful to see how the process was started.

sudo target/release/copes -c

Press Control + c to quit the program.

To get a list with all the available options, run target/release/copes -h.

Finding the right executable file for an automatic CoreCtrl profile

Suppose that you have created an automatic profile, but for some reason, it's not activated when you start the program for which you created the profile.

The following list outlines the common causes of this issue:

  • The program only runs for a short period of time. This behaviour is very common on games, where a launcher is used to starts the game. For example, game.exe is a launcher that starts a process for game_dx11.exe and then exits.
  • The program executable name differs from the name you used as the executable name on the profile. Be aware that file names are case sensitive.
  • The program is written using an interpreted language (like bash script or python), which currently is not handled by CoreCtrl.

Another cause could be the kernel you are running was compiled with the CONFIG_PROC_EVENTS option disabled. If you run this utility and see no output after launching some programs, then it's probable that this is the cause of the issue. You can verify it by searching for such option on the kernel configuration file. Please, refer to your distribution documentation to locate such file on your file system.

You can check any of the aforementioned causes by starting this utility before launching the application associated to the profile.

Example

Running sudo target/release/copes produces the following output when launching the popular game Control:

...
Exec(24138) tabtip.exe
Exec(24141) Control.exe
Exec(24147) Control_DX12.exe
Exit(24141) Control.exe

At this point the game is running. Notice that Control.exe is just a launcher whose only purpose is to start the true game executable (Control_DX12.exe) and that its process (24141) exits just after starting the other one (24147).

When the game is quit:

...
Exit(24147) Control_DX12.exe
Exit(24138) tabtip.exe
Exit(24133) explorer.exe
Exit(24062) winedevice.exe
Exit(24071) winedevice.exe
Exit(24084) plugplay.exe
Exit(24090) svchost.exe
Exit(24107) rpcss.exe
Exit(24053) steam.exe
...

Notice how the game process (24147), started for the executable Control_DX12.exe exits at this point.

In this case, Control_DX12.exe must be used as the executable name on the CoreCtrl profile. Otherwise, the profile won't be active while playing the game.

License

copes is licensed under the GNU General Public License v3.0. Permissions of this copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.

Contribution

Please, read the ../CONTRIBUTING guide for more information about how to get started.

Any contribution intentionally submitted for inclusion in the work by you shall be licensed under the GNU General Public License v3.0 (GPL-3.0). It is required to add a boilerplate copyright notice to the top of each file:

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright {year} {person OR org} <{email}>

Dependencies

~3–15MB
~138K SLoC