LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-05-2007, 05:31 AM   #1
asahlot
Member
 
Registered: Sep 2005
Location: india
Distribution: Fedora Core 2
Posts: 62

Rep: Reputation: 15
How to know whether a dev file has been opened or not?


Hi All

Inside my driver init code I want to know whether a dev file like /dev/video has been opened by some application or not?
How can I do that?
Could any body please help? I need to know urgently.
Thanks in advance.

ASAHLOT
 
Old 03-05-2007, 05:59 AM   #2
akudewan
Member
 
Registered: Apr 2004
Location: India
Distribution: Ubuntu
Posts: 364

Rep: Reputation: 31
I think the "lsof" bash command can do this.

For instance, when I run: lsof /dev/snd/* I get this output:
Code:
akudewan@ranjan404:~ $ lsof /dev/snd/*
COMMAND  PID     USER   FD   TYPE DEVICE SIZE NODE NAME
kicker  5660 akudewan   13u   CHR  116,8      7874 /dev/snd/controlC0
gkrellm 5701 akudewan    9u   CHR  116,8      7874 /dev/snd/controlC0
Edit: Note that kicker and gkrellm have volume control applets

Last edited by akudewan; 03-05-2007 at 06:01 AM.
 
Old 03-05-2007, 11:02 PM   #3
asahlot
Member
 
Registered: Sep 2005
Location: india
Distribution: Fedora Core 2
Posts: 62

Original Poster
Rep: Reputation: 15
But I cannot run any command inside module init code.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
device /dev/dsp can't be opened Benedictus Linux - Hardware 13 08-08-2004 04:40 PM
/dev/dsp cannot be opened blanks Linux - Hardware 4 06-16-2004 10:59 PM
device /dev/dsp can't be opened kalif Linux - Software 26 08-31-2003 06:38 PM
dev/dsp can't be opened cijunet Linux - General 3 12-03-2002 09:12 PM
dev/dsp can't be opened cijunet Linux - Newbie 1 12-03-2002 03:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration