Chris Wilson 7ac492aec2 scripts/who: Add the process id to the output
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 20:19:15 +00:00

14 lines
329 B
Bash
Executable File

#!/bin/bash
#
# usage: sudo who.sh
#
# Requires root permissions to both query who has the device open,
# and to read the mappings of likely root-owned processes
#
for i in `lsof -t /dev/dri/card0`; do
who=`readlink /proc/$i/exe`
count=`grep /dev/dri/card0 /proc/$i/maps | wc -l | cut -f1 -d\ `
echo "$who [$i]: $count"
done