Close never called. (Open same device file from 2 Apps.)

hide_yama hide_yama at jcom.home.ne.jp
Tue Dec 20 05:37:24 PST 2005


I am most grateful to you.

I add flag like as follows.

static struct cdevsw mypci_cdevsw = {
	.d_version	= D_VERSION,
	.d_flags	= D_NEEDGIANT|D_TRACKCLOSE,
				     ^^^^^^^^^^^^^^
	.d_open		= mypci_open,
	.d_close	= mypci_close,
	.d_read		= mypci_read,
	.d_write	= mypci_write,
	.d_ioctl	= mypci_ioctl,
	.d_name		= "mypci",
};

Then the program runs as I expected.
Close routine has called!!!

Thanks a lot!!!!!
---
Chaki


> : Why isn't the close routine called?
> 
> Because close is only called on the last close.
> 
> : And are there any avoidance for this problem?
> 
> D_TRACKCLOSE in d_flags will change the behavior.
> 
> Warner


More information about the freebsd-drivers mailing list