Thread: ioctl fails due t bad descriptor from a hllc call

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    3

    ioctl fails due t bad descriptor from a hllc call

    I pass the stream descriptor from a hllc call on a FC_CPTS function code, to an ioctl call [with IFLUSH and FLUSHR attributes]

    <call_made>

    ret_code = ioctl(stream_function_descriptor from hllc ,
    I_FLUSH,
    FLUSHR )

    </call_made>


    This works most of the time, but sporadically results in a typewriter error.

    Can somebody suggest why hllc might return a 'bad' file descriptor that results in a typewriter error?

    Thanks

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    You're going to have to provide more information than that!!!

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Hey, Salem, I thought you were banned.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User
    Join Date
    Nov 2005
    Posts
    3

    More Info

    Sorry I was so terse with the data..... here is the exact situation..

    I have traced the problem to this scenario:
    1. I get a file descriptor after some event stream creation.
    2. I flush the stream and then pass the filedescriptor to an ioctl function.
    3. When all is well, the ioctl isnt even called coz the stream is out there performing other functions, but when something makes the system go down, the filedescriptor in question becomes bad and throws the following error:

    <error>.....event stream, error 25: Not a typewriter</error>

    Now, can any of u suggest how to detect a sudden corruption of file/stream descriptors under spurious conditions [like system unexpectedly going down] or another solution?

    Thanks

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    ferror?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Registered User
    Join Date
    Nov 2005
    Posts
    3
    not ferror.... errno from the display message. What i get is the typewriter error for event stream failure.... and the corresponding error number from errno.h is 25

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Try perror().
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple types in lists, vectors or arrays.
    By megatron09 in forum C++ Programming
    Replies: 20
    Last Post: 08-31-2006, 01:54 PM
  2. Bad System Call
    By osal in forum C++ Programming
    Replies: 1
    Last Post: 03-07-2005, 05:21 PM
  3. c++ ISAPI fails to call VB dll
    By froque in forum Windows Programming
    Replies: 0
    Last Post: 08-22-2003, 02:06 AM
  4. Assembly example
    By Lynux-Penguin in forum C Programming
    Replies: 6
    Last Post: 04-24-2002, 07:45 PM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM