Skip to contentSkip to conversation

2.4 Q: list of open files per inode?

DISCUSSION Jacob A 3 participants 3 messages Jul 22, 2007

lore
Share & tools
lore

Jacob A

author
#0 lore raw

Al,

I'm using the open/close call as a way for processes to register/unregister with a watchdog driver that I'm writing. I thought that I can save the housekeeping within the driver, but it looks like It would be easier just to maintain my own list and be done with it.

Jacob

----- Original Message ----
From: Al Viro <[email protected]>
To: Jan Engelhardt <[email protected]>
Cc: Jacob A <[email protected]>; [email protected]
Sent: Thursday, July 19, 2007 7:38:10 PM
Subject: Re: 2.4 Q: list of open files per inode?

Quoted 8 lines · Jan Engelhardt
Quoted 3 lines · Jacob A

How can a device driver go over the list of all the files that are open on a specific inode instance?

pseudo-code:

Quoted 7 lines

task_list_lock;
for each process; do

    lock_fdtable;
    for each filedescriptor; do
        do_something(fd->file_ptr);
    unlock_fdtable;

task_list_unlock;

Not again...

There are other things that can keep file open. SCM_RIGHTS, references held by syscall in progress, etc., etc.

The real question is why does driver want to do that? Details, please...

#1 lore raw
Quoted 5 lines · Jacob A

I'm using the open/close call as a way for processes to register/unregister with a watchdog driver that I'm writing. I thought that I can save the housekeeping within the driver, but it looks like It would be easier just to maintain my own list and be done with it.

Sounds a bit wrong. _What_ exactly do you want to keep?

Jan

#2 lore raw
In reply to Jacob A
Quoted 5 lines · Jacob A

Al,

I'm using the open/close call as a way for processes to register/unregister with a watchdog driver that I'm writing. I thought that I can save the housekeeping within the driver, but it looks like It would be easier just to maintain my own list and be done with it.

What do you mean "register with a watchdog driver"? The process that had opened file might be long gone while the file remains open...

What kind of information do you keep for each struct file?

PS: stop top-posting