Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,26 @@ See repository subdirectories for information on each component.
GameMode depends on `meson` for building and `systemd` for internal communication. This repo contains a `bootstrap.sh` script to allow for quick install to the user bus, but check `meson_options.txt` for custom settings.

#### Ubuntu/Debian (you may also need `dbus-user-session`)

```bash
apt install meson libsystemd-dev pkg-config ninja-build git libdbus-1-dev libinih-dev build-essential
```

On Ubuntu 18.04, you'll need to install `python3` package and install the latest meson version from `pip`.

```bash
python3 -m venv .venv
source .venv/bin/activate
pip install meson
```

Later you can deactivate the virtual environment and remove it.

```bash
deactivate
rm -rf .venv
```

#### Arch
```bash
pacman -S meson systemd git dbus libinih
Expand Down
32 changes: 32 additions & 0 deletions data/gamemodelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# Created by Sam Gleske
# Created Sat Jan 1 16:56:54 EST 2022
# MIT License - https://github.com/samrocketman/home

# DESCRIPTION
# Find all running processes which have loaded Feral Interactive gamemode
# via libgamemodeauto.so. This script will not detect processes which load
# gamemode without libgamemodeauto.so.

# DEVELOPMENT ENVIRONMENT
# Ubuntu 18.04.6 LTS
# Linux 5.4.0-91-generic x86_64
# GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
# find (GNU findutils) 4.7.0-git
# GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)
# xargs (GNU findutils) 4.7.0-git
# ps from procps-ng 3.3.12

if [ -z "${USER:-}" ]; then
echo '$USER variable not defined.' >&2
exit 1
fi

if [ ! -d /proc ]; then
echo 'ERROR: /proc filesystem missing. We do not appear to be running on Linux.' >&2
exit 1
fi

find /proc -maxdepth 2 -type f -user "${USER}" -readable -name maps -exec \
awk -- '$0 ~ /libgamemodeauto\.so\.0/ {pid=FILENAME; gsub("[^0-9]", "", pid); print pid;nextfile}' {} + \
| xargs | xargs -I{} -- ps -o pid,ppid,user,ni,psr,comm --pid '{}'
68 changes: 68 additions & 0 deletions data/gamemodelist.1.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.\" Manpage for gamemoderun.
.\" Contact [email protected] to correct errors or typos.
.TH gamemodelist 1 "4 May 2020" "@GAMEMODE_VERSION@" "gamemodelist man page"
.SH NAME
gamemodelist \- search for processes running with gamemode
.SH SYNOPSIS
\fBgamemodelist\fR
.SH DESCRIPTION
\fBgamemodelist\fR will search the runtime of all processes running which started \fBGameMode\fR via \fBlibgamemodeauto.so\fR and print them with
.BR ps (1)
command output. This helper script makes it easy to find which processes are utilizing \fBGameMode\fR via \fBlibgamemodeauto.so\fR when troubleshooting potential game issues.

.SH USAGE
\fBlibgamemodeauto.so.0\fR will be found in the shared object maps of running processes utilizing \fBGameMode\fR. Run the following command to print processes loaded with \fBlibgamemodeauto.so.0\fR. \fBGameMode\fR can be started other ways but this script will only detect processes utilizing \fBGameMode\fR via \fBlibgamemodeauto.so\fR.

.RS 4
gamemodelist
.RE

.SH OUTPUT
The output is a process table from
.BR ps (1)
command.

.RS 4
PID PPID USER NI PSR COMMAND
.RE

Where each of these fields are defined in
.BR ps (1)
manual. For your convenience here's a definition for each field.

.RS 4
.TS
l lw(3i).
\fBCOLUMN DESCRIPTION\fR
PID Process ID
PPID Parent process ID
USER User name owning the process.
NI T{
Nice value. This ranges from 19 (nicest) to \-20 (not nice to others),
See
.IR nice (1).
T}
PSR T{
Processor that process is currently assigned to. Useful when setting process affinity using
.IR taskset (1)
utility.
T}
COMMAND Command name (only the executable name).
.TE
.RE

.SH SEE ALSO
.BR gamemodrun (1),
.BR nice (1),
.BR ps (1),
.BR taskset (1).

.SH ABOUT
GameMode source can be found at \fIhttps://github.com/FeralInteractive/gamemode.git\fR

.SH AUTHOR
.BR gamemodelist
was authored by Sam Gleske (https://github.com/samrocketman/)

.BR GameMode
was authored by Feral Interactive ([email protected])
18 changes: 18 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ install_data(
install_mode: 'rwxr-xr-x',
)

# Install script to find processes with gamemode lib in runtime
install_data(
files('gamemodelist'),
install_dir: path_bindir,
install_mode: 'rwxr-xr-x',
)

# Configure and install man pages
gamemoded_manpage = configure_file(
input: files('gamemoded.8.in'),
Expand All @@ -74,6 +81,17 @@ install_man(
install_dir: join_paths(path_mandir, 'man1')
)

gamemodelist_manpage = configure_file(
input: files('gamemodelist.1.in'),
output: 'gamemodelist.1',
configuration: data_conf,
)

install_man(
gamemodelist_manpage,
install_dir: join_paths(path_mandir, 'man1')
)

if with_examples
example_manpage = configure_file(
input: files('gamemode-simulate-game.1.in'),
Expand Down