Problems with close() system call

From: Arne Henrichsen
Date: Mon Oct 25 2004 - 06:42:26 EST


Hi,

I have a question regarding the close() system call. I have written my
own character driver for a serial type card with 8 ports. Each port is
seen as a device by Linux. Everything works great, I can open, close,
write, read etc from/to the individual devices. But I also see some
strange things. When I for instance in my user application open and
configure each device (via ioctl) in a loop, somehow a close system
call has been initiated (not called by my user app). I can see this as
my drivers flush function get called. Who or why is this function
called without my user app even calling close()? Is it related to the
module count of each device? I print out the counter
(filp->f_count.counter), and I do not know how it gets
incremented/decremented. The release call is also supposed to get
called after the user is finished, but is never called which I guess
has something to do with the user count not being zero.

I will see in my driver:

open dev 0
ioctl dev 0
open dev 1
flush dev 0
ioctl dev 1
open dev 2
flush dev 1
etc

Could anybody shed some light on this issue please?

Thanks
Arne
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/