Skip to content

Commit

Permalink
gamemodelist: Fix unreadable process maps
Browse files Browse the repository at this point in the history
Systemd commit [bf1b9ae487b65b1cb1639b222724fab95e508cf5](systemd/systemd@bf1b9ae) (present in Systemd v254 and later) effectively broke gamemodelist as the process map for the `systemd --user` process became unreadable. After this change gamemodelist would exit with an error like the following:

```
awk: fatal: cannot open file `/proc/2281/maps' for reading: Permission denied
```

To work around this let's add a hook to the awk statement to skip any files that can't be read.

Closes #456
  • Loading branch information
ReillyBrogan authored and afayaz-feral committed Mar 27, 2024
1 parent 8e0a71a commit 9646f2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion data/gamemodelist
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ if [ ! -d /proc ]; then
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}' {} + \
awk -- 'BEGINFILE { if (ERRNO) nextfile } $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 '{}'

0 comments on commit 9646f2b

Please sign in to comment.