blob: b22163986b574d634c18c53ab2c7301e7c76ae03 [file] [log] [blame]
Chris Wilson61ff1302011-12-12 17:44:58 +00001#!/bin/bash
2#
3# usage: sudo who.sh
4#
5# Requires root permissions to both query who has the device open,
6# and to read the mappings of likely root-owned processes
7#
8
9for i in `lsof -t /dev/dri/card0`; do
10 who=`readlink /proc/$i/exe`
11 count=`grep /dev/dri/card0 /proc/$i/maps | wc -l | cut -f1 -d\ `
Chris Wilson7ac492a2011-12-12 20:19:03 +000012 echo "$who [$i]: $count"
Chris Wilson61ff1302011-12-12 17:44:58 +000013done