Re: Problems with close() system call

From: Raj (inguva_at_gmail.com)
Date: 10/27/04

  • Next message: Rik van Riel: "Re: lowmem_reserve (replaces protection)"
    Date:	Wed, 27 Oct 2004 10:18:10 +0530
    To: Jan Engelhardt <jengelh@linux01.gwdg.de>
    
    

    On Tue, 26 Oct 2004 17:43:36 +0200 (MEST), Jan Engelhardt
    <jengelh@linux01.gwdg.de> 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@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Rik van Riel: "Re: lowmem_reserve (replaces protection)"

    Relevant Pages

    • Re: [RFC] Splitting kernel headers and deprecating __KERNEL__
      ... Copy the util-linux sources. ... > between known kernel versions. ... Here the struct has not changed, but the names for the types have changed. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [2.6 patch] pm3fb: remove kernel 2.2 code
      ... This patch removes kernel 2.2 code from pm3fb.. ... /* the struct that hold them together */ ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH][2.6.11-mm4] perfctr cleanups 2/3: ppc32
      ... PERFCTR_CPU_VERSION unused in the kernel, ... struct perfctr_cpu_control_header { ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: struct task_struct -> task_t
      ... > It has come to my attention that in some places in the kernel, 'struct task_struct' ... > I made a small script to change around as much as I could so that everything uses ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [RFC] Splitting kernel headers and deprecating __KERNEL__
      ... Why is losetup considering the kernel at compile time? ... Should it not be determining the kernel version at runtime and using the ... >Here the struct has not changed, but the names for the types have changed. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)