• DosRead - access denied?

    From Vitus Jensen@2:2474/424.1 to all on Mon Jun 12 13:05:13 2000
    Hi!

    Could someone name any reason why a DosRead() from a serial port will return error code 5 (access denied)? It's listed as possible error code but i would connect it with DosOpen().

    The error occurs in a small program i wrote for production tests. It does serial communication with several ports/threads. Quite simple and it worked on
    my desk and on all machines produced. Now i gave it to the developer of the serial driver and he reports "error 5" back to me...

    I just have no clue why DosRead could fail with the error (except when the driver is buggy (which it is anyway :-)),
    Vitus

    --- Sqed/rexx 209:
    * Origin: I program like a MAN. I use COPY CON PROGRAM.EXE (2:2474/424.1)
  • From Rob Basler@1:153/290 to Vitus Jensen on Mon Jun 12 15:45:00 2000
    Could someone name any reason why a DosRead() from a serial
    port will return error code 5 (access denied)? It's listed
    as possible error code but i would connect it with
    DosOpen().

    This can fail if the port's assigned IRQ is in use by something else,
    for example, with the default installation, COM1 and COM3 share the same interrupt, so if you have a mouse on COM1, you can't open COM3. Same
    for COM2 and COM4.

    Rob.
    ___
    X SLMR 2.1a X Stop Plate Tectonics!

    --- Maximus/2 3.01
    * Origin: Frog Hollow Port Moody BC 604-469-0264/0284 (1:153/290)
  • From Francois Thunus@1:1/0 to Vitus Jensen on Tue Jun 13 00:27:00 2000
    Hello Vitus!

    12 Jun 00 20:05, Vitus Jensen wrote to all:

    Could someone name any reason why a DosRead() from a serial port will return error code 5 (access denied) ? It's listed as possible error
    code but i would connect it with DosOpen().

    The only reason I could imagine is that some other program is accessing the port at the same time and that for some reason OS/2 cannot handle the priorities between the two programs fighting for the com port.

    If you did not have access to the com port at all (for example my dos boxes by default do not have access to all com ports), the DosOpen() would fail first, so you would never reach the DosRead() stage (if my understanding is correct).

    It would be helpful if the person who has the problem can give you a list of all other programs running at the same time, specially those susceptible of accessing the com port.

    -= Francois =-
    Francois(at)telematique(dot)org
    http://www.telematique.org/ft

    Disclaimer - These opiini^H^H damn! ^H^H ^Q ^[ .... :w
    :q :wq :wq! ^d X ^? exit X Q ^C ^? :quitbye CtrlAltDel ~~q
    :~q logout save/quit :!QUIT ^[zz ^[ZZZZZZ ^H man vi ^ ^L
    ^[c ^# ^E ^X ^I ^T ? help helpquit ^D ^d man help ^C
    ^c help ?Quit ?q CtrlShftDel"Hey, what does this button d...

    --- GoldED 3.0.1
    * Origin: Xara Sto Pragma ! Gasperich - Luxembourg -> (FidoNet 2:270/25.2)
  • From Vitus Jensen@2:2474/424.1 to Rob Basler on Tue Jun 13 16:57:10 2000
    Moin Rob,

    12.06.00 22:45, Rob Basler wrote a message to Vitus Jensen:

    Could someone name any reason why a DosRead() from a serial port
    will return error code 5 (access denied)? It's listed as
    possible error code but i would connect it with DosOpen().

    This can fail if the port's assigned IRQ is in use by something
    else, for example, with the default installation, COM1 and COM3
    share the same interrupt, so if you have a mouse on COM1, you
    can't open COM3. Same for COM2 and COM4.

    You said "you can't open COM3". This would be OK but I *can* open the port successfully. It's the read which fails!


    Tschüß,
    Vitus

    PS: it's a rockt port board from comtrol.
    ---
    * Origin: Request VRAID - Software RAID for OS/2! (2:2474/424.1)
  • From Eddy Thilleman@2:280/5143.7 to Vitus Jensen on Tue Jun 13 05:07:08 2000
    Hello Vitus,

    I hope you get my reply, because I don't seem to receive any replies to my messages in any of the international OS/2 areas lately. :-(

    Monday 12 June 2000 20:05, Vitus Jensen wrote to all:

    Could someone name any reason why a DosRead() from a serial port will return error code 5 (access denied)? It's listed as possible error
    code but i would connect it with DosOpen().

    Has the driver or another process exclusively opened the serial port at the time your code tries to get access to the serial port, or does your code exclusively (try to) open the serial port?

    I just have no clue why DosRead could fail with the error (except when
    the driver is buggy (which it is anyway :-)),

    Is the developer of the serial driver capable to realise the possibility he made a mistake in his code?


    Greetings -=Eddy=- email: eddy.thilleman@net.hcc.nl

    ... Know what I like about Windows? Not a damned thing.
    --- GoldED/2 3.0.1
    * Origin: Beware of programmers who carry screwdrivers. (2:280/5143.7)
  • From Vitus Jensen@2:2474/424.1 to Francois Thunus on Tue Jun 13 18:50:34 2000
    Moin Francois,

    13.06.00 07:27, Francois Thunus wrote a message to Vitus Jensen:

    Could someone name any reason why a DosRead() from a serial port
    will return error code 5 (access denied) ? It's listed as
    possible error code but i would connect it with DosOpen().

    The only reason I could imagine is that some other program is
    accessing the port at the same time and that for some reason OS/2
    cannot handle the priorities between the two programs fighting
    for the com port.

    I'm doing DosOpen() with OPEN_SHARE_DENYREADWRITE so there *should* be no other
    process acessing the port. Theoretically.


    If you did not have access to the com port at all (for example my
    dos boxes by default do not have access to all com ports), the
    DosOpen() would fail first, so you would never reach the
    DosRead() stage (if my understanding is correct).

    That's the same understanding I have about this matter. But in real life we have:
    1. error 5 is listed in DosRead() docu and
    2. there is at least one machine where it is returned.


    It would be helpful if the person who has the problem can give
    you a list of all other programs running at the same time,
    specially those susceptible of accessing the com port.

    In the meantime he fixed the error in his driver w/o running the testprogram. So I'm happy with the result even if I wonder. But it's an idea to ask him for
    a pstat /C result. We will see what this gives...



    Disclaimer - These opiini^H^H damn! ^H^H ^Q ^[ .... :w
    :q :wq :wq! ^d X ^? exit X Q ^C ^? :quitbye CtrlAltDel ~~q
    :~q logout save/quit :!QUIT ^[zz ^[ZZZZZZ ^H man vi ^ ^L
    ^[c ^# ^E ^X ^I ^T ? help helpquit ^D ^d man help ^C
    ^c help ?Quit ?q CtrlShftDel"Hey, what does this button d...

    Great!

    C-x C-s,
    Vitus

    --- Sqed/rexx 489:
    * Origin: See the Future; See OS/2. Be the Future; Run OS/2. (2:2474/424.1)
  • From Vitus Jensen@2:2474/424 to Eddy Thilleman on Wed Jun 14 17:57:49 2000
    Moin Eddy,

    13.06.00 12:07, Eddy Thilleman wrote a message to Vitus Jensen:

    I hope you get my reply, because I don't seem to receive any
    replies to my messages in any of the international OS/2 areas
    lately. :-(
    Mhmm, OS2PROG is the only internation fidonet echo i read regulary. And i think i got all msgs.


    Monday 12 June 2000 20:05, Vitus Jensen wrote to all:

    Could someone name any reason why a DosRead() from a serial port
    will return error code 5 (access denied)? It's listed as
    possible error code but i would connect it with DosOpen().

    Has the driver or another process exclusively opened the serial
    port at the time your code tries to get access to the serial
    port, or does your code exclusively (try to) open the serial port?

    My testprogram opens with OPEN_SHARE_DENYREADWRITE so there should be no possibility that other processes interfer. But as i noticed today (got strange
    behavour on one of our terminals) it is possible to open the port from several processes concurrently. exclusive (well, at least they tried).

    A quick look to the device driver header revealed the attribute work 0x8880 which has bit 12 reset (don't apply filesystem sharing rules) and bit 11 set (open/close supported). This means that OS/2 is requested to ignore OPEN_SHARE_DENYREADWRITE and calls the driver's open routine for each DosOpen.
    And the driver happily returns OK (i guess).


    I just have no clue why DosRead could fail with the error (except
    when the driver is buggy (which it is anyway :-)),

    Is the developer of the serial driver capable to realise the
    possibility he made a mistake in his code?

    He is quite responsive.

    And I reported the above findings to him. Lets see whether the next release will have bit 12 set (preferred) or return error on all opens after the first (this is OK to me).

    Bye,
    Vitus

    --- Sqed/rexx 33:
    * Origin: The road to success is always under construction. (2:2474/424)