Skip to contentSkip to conversation

2.4 Q: list of open files per inode?

DISCUSSION Jacob A 3 participants 3 messages Jul 19, 2007

lore
Share & tools
lore

Jacob A

author
#0 lore raw

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

I'd like to avoid doing my own housekeeping.

The question is about 2.4 kernel.

Thanks,

Jacob

#1 lore raw
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:

task_list_lock;
for each process; do

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

task_list_unlock;

Though, you really don't want to do that.

Jan

#2 lore raw
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...