Re: Problems with close() system call

From: Raj
Date: Tue Oct 26 2004 - 23:51:32 EST


On Tue, 26 Oct 2004 17:43:36 +0200 (MEST), Jan Engelhardt
<jengelh@xxxxxxxxxxxxxxx> wrote:
> >> Best is to put a printk("i'm in ioctl()") in the ioctl() function and a
> >> printk("i'm in close()") in the close() one, to be really sure whether the
> >> close() function of your module is called.
> >
> >Yes, that is exactly what I am doing. I basically implement the
> >flush() call (for close) as the release() call was never called on
> >close. So my release call does nothing. What I see is that the flush
>
> Uh, then something's wrong. Your device fops should look like this:
> {
> .release = my_close, // which is called upon close(2)
> }
>
> Anything else is of course, never working.

iirc, once i faced this problem. I compiled a sample device driver
against kernel version
'X'. and tried to insmod the binary into kernel version 'Y' which had
it's fop's struct
modified. The structure offsets took a beating and all hell broke
loose. Calling open()
called something else etc.... Ever since, i started using the above notation to
initialize struct members. Hard learned lesson ;-)

--
######
raj
######
-
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/