[PATCH 1/3] Cygwin: dll_list: drop FILE_BASIC_INFORMATION

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Apr 30 16:13:00 GMT 2019


On Apr 30 16:14, Michael Haubenwallner wrote:
> Querying FILE_BASIC_INFORMATION is needless since using win pid+threadid
> for forkables dirname rather than newest last write time.
> ---
>  winsup/cygwin/dll_init.cc | 1 -
>  winsup/cygwin/dll_init.h  | 1 -
>  winsup/cygwin/forkable.cc | 7 +++----
>  3 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
> index 4baa48dc1..28f4e53a8 100644
> --- a/winsup/cygwin/dll_init.cc
> +++ b/winsup/cygwin/dll_init.cc
> @@ -372,7 +372,6 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type)
>        d->image_size = ((pefile*)h)->optional_hdr ()->SizeOfImage;
>        d->preferred_base = (void*) ((pefile*)h)->optional_hdr()->ImageBase;
>        d->type = type;
> -      d->fbi.FileAttributes = INVALID_FILE_ATTRIBUTES;
>        d->fii.IndexNumber.QuadPart = -1LL;
>        if (!forkntsize)
>  	d->forkable_ntname = NULL;
> diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h
> index c4a133f01..0a9749638 100644
> --- a/winsup/cygwin/dll_init.h
> +++ b/winsup/cygwin/dll_init.h
> @@ -59,7 +59,6 @@ struct dll
>    DWORD image_size;
>    void* preferred_base;
>    PWCHAR modname;
> -  FILE_BASIC_INFORMATION fbi;
>    FILE_INTERNAL_INFORMATION fii;
>    PWCHAR forkable_ntname;
>    WCHAR ntname[1]; /* must be the last data member */
> diff --git a/winsup/cygwin/forkable.cc b/winsup/cygwin/forkable.cc
> index 4580610b1..30833c406 100644
> --- a/winsup/cygwin/forkable.cc
> +++ b/winsup/cygwin/forkable.cc
> @@ -158,7 +158,7 @@ rmdirs (WCHAR ntmaxpathbuf[NT_MAX_PATH])
>  static bool
>  stat_real_file_once (dll *d)
>  {
> -  if (d->fbi.FileAttributes != INVALID_FILE_ATTRIBUTES)
> +  if (d->fii.IndexNumber.QuadPart != -1LL)
>      return true;
>  
>    tmp_pathbuf tp;
> @@ -194,13 +194,12 @@ stat_real_file_once (dll *d)
>    if (fhandle == INVALID_HANDLE_VALUE)
>      return false;
>  
> -  if (!dll_list::read_fii (fhandle, &d->fii) ||
> -      !dll_list::read_fbi (fhandle, &d->fbi))

Given this is the only place calling dll_list::read_fbi, the method
and declaration should be removed, too.

> +  if (!dll_list::read_fii (fhandle, &d->fii))
>      system_printf ("WARNING: Unable to read real file attributes for %W",
>  		   pmsi1->SectionFileName.Buffer);
>  
>    NtClose (fhandle);
> -  return d->fbi.FileAttributes != INVALID_FILE_ATTRIBUTES;
> +  return d->fii.IndexNumber.QuadPart != -1LL;
>  }
>  
>  /* easy use of NtOpenFile */
> -- 
> 2.19.2

Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20190430/b5875164/attachment.sig>


More information about the Cygwin-patches mailing list