Stat devfs and SCSI optical drives

Discussion in 'Perl Misc' started by Chris Johnson, Apr 3, 2005.

  1. I'm working on a program that needs to stat devices and pick out
    optical drives. I've run the following code on my computer and my
    roommates:

    opendir DEV, "/dev";
    for(readdir(DEV)){
    my @stats = stat "/dev/$_";
    print "$_: $stats[5]\n";
    }
    closedir DEV;

    And I found that all optical drives have a $gid ($stats[5]) of 93.

    However, we both have IDE optical drives and udev, so rather than write
    a program with the same configuration, I'd appreciate it if I could get
    some confirmation from people with SCSI optical drives and/or devfs.

    Thanks,
    Chris
    Chris Johnson, Apr 3, 2005
    #1
    1. Advertising

  2. Chris Johnson

    Guest

    Chris Johnson <> wrote:
    > I'm working on a program that needs to stat devices and pick out
    > optical drives. I've run the following code on my computer and my
    > roommates:


    > And I found that all optical drives have a $gid ($stats[5]) of 93.


    > However, we both have IDE optical drives and udev, so rather than write
    > a program with the same configuration, I'd appreciate it if I could get
    > some confirmation from people with SCSI optical drives and/or devfs.


    It's not a relevent question to this newsgroup.

    Also any answers that you receive will be a bit pointless unless
    they concern the same OS that you are using, which you do not specify.

    Axel
    , Apr 3, 2005
    #2
    1. Advertising

  3. Chris Johnson

    Joe Smith Guest

    Chris Johnson wrote:

    > And I found that all optical drives have a $gid ($stats[5]) of 93.


    I expect that you will get more reliable results by using $stats[6].

    my $major = $stats[6] >> 8;
    my $minor = $stats[6] & 0xFF;
    print "$_: $major,$minor\n";

    The bits stored in $stats[6] is operating system dependent.
    -Joe
    Joe Smith, Apr 3, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=

    Enumerate all the drives including Mapped network drives on a serv

    =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=, Feb 25, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    1,017
    =?Utf-8?B?UHJhZGVlcCBTdW5kYXJhbShNU0ZUKQ==?=
    Feb 26, 2005
  2. Steven T. Hatton
    Replies:
    3
    Views:
    9,691
    Pete Becker
    Jun 2, 2005
  3. Patrick Useldinger

    os.stat('<filename>')[stat.ST_INO] on Windows

    Patrick Useldinger, Feb 27, 2005, in forum: Python
    Replies:
    6
    Views:
    1,153
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Mar 3, 2005
  4. Magesh
    Replies:
    3
    Views:
    429
    Gordon Burditt
    Oct 5, 2007
  5. Rolf Krüger
    Replies:
    2
    Views:
    606
    Ian Collins
    Mar 12, 2008
Loading...

Share This Page