Professional Web Applications Themes

sysread failing on raw character device - PERL Beginners

Hi! The following code works fine on regular files (reading its first byte), but fails on character raw device (HP-UX): sysopen (FH, "/dev/somevg/rdev1", O_RDONLY) or die "open"; sysseek (FH, 0, SEEK_SET) or die "seek"; sysread (FH, $s, 1) or die "read"; read at test.pl line 3. At the same time dd is processing this correctly: dd bs=1 if=/dev/somevg/rdev1 count=1 | od -v -Ad displays the contents correctly 0000000 3 crw-r----- 1 me mygroup 64 0x090018 Jun 20 2002 /dev/somevg/rdev1 The same code works fine on regular files. What am I doing wrong that dd is doing right? Thank you. Kirill...

  1. #1

    Default sysread failing on raw character device

    Hi!

    The following code works fine on regular files (reading its first
    byte), but fails on character raw device (HP-UX):

    sysopen (FH, "/dev/somevg/rdev1", O_RDONLY) or die "open";
    sysseek (FH, 0, SEEK_SET) or die "seek";
    sysread (FH, $s, 1) or die "read";

    read at test.pl line 3.

    At the same time dd is processing this correctly:

    dd bs=1 if=/dev/somevg/rdev1 count=1 | od -v -Ad

    displays the contents correctly
    0000000 3

    crw-r----- 1 me mygroup 64 0x090018 Jun 20 2002 /dev/somevg/rdev1

    The same code works fine on regular files.

    What am I doing wrong that dd is doing right?

    Thank you.
    Kirill
    Kirill Richine Guest

  2. #2

    Default Re: sysread failing on raw character device

    I figured it out.

    Need to read at least 1024 bytes at a time from raw device.

    Thank you.
    Kirill

    [email]krichinejuno.com[/email] (Kirill Richine) wrote in message news:<c9872686.0310301121.1c1d51c0posting.google. com>...
    > Hi!
    >
    > The following code works fine on regular files (reading its first
    > byte), but fails on character raw device (HP-UX):
    >
    > sysopen (FH, "/dev/somevg/rdev1", O_RDONLY) or die "open";
    > sysseek (FH, 0, SEEK_SET) or die "seek";
    > sysread (FH, $s, 1) or die "read";
    >
    > read at test.pl line 3.
    >
    > At the same time dd is processing this correctly:
    >
    > dd bs=1 if=/dev/somevg/rdev1 count=1 | od -v -Ad
    >
    > displays the contents correctly
    > 0000000 3
    >
    > crw-r----- 1 me mygroup 64 0x090018 Jun 20 2002 /dev/somevg/rdev1
    >
    > The same code works fine on regular files.
    >
    > What am I doing wrong that dd is doing right?
    >
    > Thank you.
    > Kirill
    Kirill Richine Guest

Similar Threads

  1. Extract Character By Character in PDF
    By s.r.krish@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 14
    Last Post: March 14th, 12:14 PM
  2. cf7 failing on os 10.4.6
    By bucktown in forum Coldfusion Server Administration
    Replies: 9
    Last Post: May 8th, 10:26 PM
  3. Device name changes.
    By Toby Newman in forum Ubuntu
    Replies: 0
    Last Post: February 10th, 11:03 AM
  4. CF 7.0.1 download failing
    By blurry_gb in forum Coldfusion Server Administration
    Replies: 0
    Last Post: November 15th, 09:51 AM
  5. InDesign ME Character Problem! Character-Change by Printing or saving *.PS!
    By gree@adobeforums.com in forum Adobe Indesign Windows
    Replies: 48
    Last Post: May 25th, 02:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139