Duplicates in /proc/partitions

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Aug 18 15:01:47 GMT 2021


On Aug 18 14:18, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > On second thought, I have a vague idea...  Could you please just add
> > something to the output, i.e, change lines 124/125 from
> > 
> >     printf ("%5d %5d %9llu sd%c\n",
> >             8, (dev_name - 'a') * 16, size >> 10, dev_name);
> > 
> > to
> > 
> >     printf ("%5d %5d %9llu sd%c (%lu)\n",
> >             8, (dev_name - 'a') * 16, size >> 10, dev_name,
> >             (unsigned long) context);
> > 
> > and just compile and run the testcase again?
> 
> Here's the output (and /proc/partitions for comparison) from today:
> [...]
>     8    16 1000204632 sdb (301)
                              ^^^
>     8    17 1000202240 sdb1    D:\
>     8    32 1000204632 sdc (302)
                              ^^^
>     8    33 1000202240 sdc1    D:\

>     8    48 1000204632 sdd (314)
                              ^^^
>     8    49 1000202240 sdd1    G:\
>     8    64 1000204632 sde (315)
                              ^^^
>    i 8    65 1000202240 sde1    G:\


>     8    80 1000204632 sdf (329)
                              ^^^
>     8    81 1000202240 sdf1    I:\
>     8    96 1000204632 sdg (330)
                              ^^^
>     8    97 1000202240 sdg1    I:\

>     8   112 234431064 sdh (340)
                             ^^^
>     8   113 234428416 sdh1    F:\
>     8   128 234431064 sdi (341)
                             ^^^
>     8   129 234428416 sdi1    F:\

Thanks!

These context numbers indicate that either of these harddisk entries is
actually returned twice by the NtQueryDirectoryObject call, just next to
each other.

Just for kicks, can you please change the affected printf to

      printf ("%5d %5d %9llu sd%c (%lu, %ls)\n",
              8, (dev_name - 'a') * 16, size >> 10, dev_name,
              (unsigned long) context, dbi->ObjectName.Buffer);

This also prints the device name as returned by NtQueryDirectoryObject.

So, the duplicates are actually created by the OS itself.  Why... I have
no idea so far...


Corinna


More information about the Cygwin mailing list