Re: Advice on mmap() "feature"

From: Alan Cox
Date: Mon Sep 17 2012 - 07:12:30 EST


> (a) Since all the mappings have been removed, so why don't the fd's get
> released ?

Because your code is buggy.

Firstly its files it keeps a reference to not file handles, so your close
closes the file handle. You do however end up with lots of file structs
pinned and that's because you've got a bug.

You map twice as much as you unmap, the kernel therefore keeps the second
half mapped for you. Fix your munmap and all will be happy.

You owe the oracle an ice cream

Alan
--
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/