[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: [v2 PATCH] libpciaccess: close mtrr fd on pci_cleanup
From:       Jeremy Huddleston <jeremyhu () apple ! com>
Date:       2011-10-25 5:41:31
Message-ID: 159D6F92-FAD4-4F41-AB16-30762C4826AD () apple ! com
[Download RAW message or body]

Thanks,

I reviewed and pushed this with a small modification.

--Jeremy

On Oct 24, 2011, at 12:15 PM, Nithin Nayak Sujir wrote:

> Since the fd is not closed, calling pci_system_init and
> pci_system_cleanup more than 1024 times results in "too many files open"
> error.
> 
> v2: Modified the patch to use the destroy hook function instead of
> calling close in the common code based on Jeremy Huddleston's comments. It
> seemed appropriate to use the destroy hook since other implementations are
> doing clean ups here.
> 
> Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
> ---
> src/linux_sysfs.c |   12 +++++++++++-
> 1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/src/linux_sysfs.c b/src/linux_sysfs.c
> index d5ba66a..09e7138 100644
> --- a/src/linux_sysfs.c
> +++ b/src/linux_sysfs.c
> @@ -889,8 +889,18 @@ pci_device_linux_sysfs_unmap_legacy(struct pci_device *dev, void *addr, pciaddr_
>     return munmap(addr, size);
> }
> 
> +
> +static void
> +pci_system_linux_destroy(void)
> +{
> +#ifdef HAVE_MTRR
> +	if (pci_sys->mtrr_fd > 0)
> +		close(pci_sys->mtrr_fd);
> +#endif
> +}
> +
> static const struct pci_system_methods linux_sysfs_methods = {
> -    .destroy = NULL,
> +    .destroy = pci_system_linux_destroy,
>     .destroy_device = NULL,
>     .read_rom = pci_device_linux_sysfs_read_rom,
>     .probe = pci_device_linux_sysfs_probe,
> -- 
> 1.7.1
> 
> 

_______________________________________________
xorg@lists.freedesktop.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.freedesktop.org/mailman/listinfo/xorg
Your subscription address: freedesktop-xorg@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic