Messages in this thread | | | Date | Tue, 26 Oct 2004 14:43:54 +0200 | From | Arne Henrichsen <> | Subject | Re: Problems with close() system call |
| |
On Tue, 26 Oct 2004 13:30:35 +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 function gets called, even though I have never called the close() system call from my user app.
I also print out the module counter, and it doesn't make sense who increments it:
open(0): f_count = 1 ioctl(0): f_count = 2 ioctl(0): f_count = 5 open(1)): f_count = 1 ioctl(1): f_count = 2 flush(0): f_count = 7 ioctl(1): f_count = 5 open(2): f_count = 1 ioctl(2): f_count = 2 flush(1): f_count = 7
My user app looks something like this: int fd[8];
for(i = 0; i < nr_dev; i) { sprintf(dev, "/dev/mydev_%c", '0' + i); fd[i] = open(dev, O_RDWR | O_SYNC); if(fd[i] < 0) { printf("Error opening device: %s - %s\n", dev, strerror(errno)); goto test_error; }
status = ioctl(fd[i], CMD1); if(status != 0) { printf("%s - %s\n", dev, strerror(errno)); }
status = ioctl(fd[i], CMD2); if(status != 0) { printf("%s - %s\n", dev, strerror(errno)); } } /* for(port_id = 0; port_id < nr_ports; port_id++) */ Arne - 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/
| |