public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] how to find if a program is using a particular /dev device?
@ 2005-11-18  7:54 michael
  2005-11-18  8:19 ` John Myers
  0 siblings, 1 reply; 5+ messages in thread
From: michael @ 2005-11-18  7:54 UTC (permalink / raw
  To: gentoo-user

I have a custom device driver in /dev/ that can only be used by one
program at a time. Since the device is /dev/ttyUSB0, I can see if anyone
is using it by:

 	ls -l /proc/*/fd/* | grep ttyUSB0

Is there a utility or other better way I can discover which process, or
better, which program, is using a particular device?

Thanks,
Michael
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] how to find if a program is using a particular /dev device?
  2005-11-18  7:54 [gentoo-user] how to find if a program is using a particular /dev device? michael
@ 2005-11-18  8:19 ` John Myers
  2005-11-18  8:48   ` michael
  0 siblings, 1 reply; 5+ messages in thread
From: John Myers @ 2005-11-18  8:19 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

On Thursday 17 November 2005 23:54, michael@michaelshiloh.com wrote:
> I have a custom device driver in /dev/ that can only be used by one
> program at a time. Since the device is /dev/ttyUSB0, I can see if anyone
> is using it by:
>
>  	ls -l /proc/*/fd/* | grep ttyUSB0
>
> Is there a utility or other better way I can discover which process, or
> better, which program, is using a particular device?
>
> Thanks,
> Michael
try lsof

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] how to find if a program is using a particular /dev device?
  2005-11-18  8:19 ` John Myers
@ 2005-11-18  8:48   ` michael
  2005-11-18 21:32     ` Nick Rout
  0 siblings, 1 reply; 5+ messages in thread
From: michael @ 2005-11-18  8:48 UTC (permalink / raw
  To: gentoo-user

That was it. Thanks!
M


On Fri, 18 Nov 2005, John Myers wrote:

> On Thursday 17 November 2005 23:54, michael@michaelshiloh.com wrote:
>> I have a custom device driver in /dev/ that can only be used by one
>> program at a time. Since the device is /dev/ttyUSB0, I can see if anyone
>> is using it by:
>>
>>  	ls -l /proc/*/fd/* | grep ttyUSB0
>>
>> Is there a utility or other better way I can discover which process, or
>> better, which program, is using a particular device?
>>
>> Thanks,
>> Michael
> try lsof
>
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] how to find if a program is using a particular /dev device?
  2005-11-18  8:48   ` michael
@ 2005-11-18 21:32     ` Nick Rout
  2005-11-19 21:03       ` michael
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Rout @ 2005-11-18 21:32 UTC (permalink / raw
  To: gentoo-user

On Fri, 18 Nov 2005 00:48:19 -0800 (PST)
michael@michaelshiloh.com wrote:

> That was it. Thanks!
> M

you could also try 

strace -eopen programname

It will give a pretty verbose account of what files are opened by
programname. (and of course devices, like everything else, are files)

> 
> 
> On Fri, 18 Nov 2005, John Myers wrote:
> 
> > On Thursday 17 November 2005 23:54, michael@michaelshiloh.com wrote:
> >> I have a custom device driver in /dev/ that can only be used by one
> >> program at a time. Since the device is /dev/ttyUSB0, I can see if anyone
> >> is using it by:
> >>
> >>  	ls -l /proc/*/fd/* | grep ttyUSB0
> >>
> >> Is there a utility or other better way I can discover which process, or
> >> better, which program, is using a particular device?
> >>
> >> Thanks,
> >> Michael
> > try lsof
> >
> -- 
> gentoo-user@gentoo.org mailing list
> 
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-user] how to find if a program is using a particular /dev device?
  2005-11-18 21:32     ` Nick Rout
@ 2005-11-19 21:03       ` michael
  0 siblings, 0 replies; 5+ messages in thread
From: michael @ 2005-11-19 21:03 UTC (permalink / raw
  To: gentoo-user

Excellent. That's very helpful as well.

Michael


On Sat, 19 Nov 2005, Nick Rout wrote:

> On Fri, 18 Nov 2005 00:48:19 -0800 (PST)
> michael@michaelshiloh.com wrote:
>
>> That was it. Thanks!
>> M
>
> you could also try
>
> strace -eopen programname
>
> It will give a pretty verbose account of what files are opened by
> programname. (and of course devices, like everything else, are files)
>
>>
>>
>> On Fri, 18 Nov 2005, John Myers wrote:
>>
>>> On Thursday 17 November 2005 23:54, michael@michaelshiloh.com wrote:
>>>> I have a custom device driver in /dev/ that can only be used by one
>>>> program at a time. Since the device is /dev/ttyUSB0, I can see if anyone
>>>> is using it by:
>>>>
>>>>  	ls -l /proc/*/fd/* | grep ttyUSB0
>>>>
>>>> Is there a utility or other better way I can discover which process, or
>>>> better, which program, is using a particular device?
>>>>
>>>> Thanks,
>>>> Michael
>>> try lsof
>>>
>> --
>> gentoo-user@gentoo.org mailing list
>>
> -- 
> gentoo-user@gentoo.org mailing list
>
>
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-11-19 21:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-18  7:54 [gentoo-user] how to find if a program is using a particular /dev device? michael
2005-11-18  8:19 ` John Myers
2005-11-18  8:48   ` michael
2005-11-18 21:32     ` Nick Rout
2005-11-19 21:03       ` michael

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox