open RDR: seems to have a problem.

Post Reply
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

open RDR: seems to have a problem.

Post by jacotton »

Phys_in = open("RDR:",O_RDONLY,'r');
if(Phys_in < 0){
printf("Can't open phys_in %d\n",Phys_in);
return 1;
}

My test code always returns -1.
Reading the open code in libsrc, it looks like it can fail at setfcb
and from there cascade. This is another issue (maybe), in setfcb the
fc->use flag is set to I+U_CON in the read code we are checking for
U_RDR. Does that get changed somewhere behind the curtains.

N0% stat dev:
CON: is CRT:
RDR: is TTY:
PUN: is TTY:
LST: is TTY:

and pip con:=rdr:
seems to working fine.
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Post by jacotton »

Additional note: I see that #DEVICES needs to defined for any of this to work. Is that a standard flag for the library build ?
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Post by jacotton »

Solved the open problem by -DDEVICES in Makefile in z88dk/libsrc/fcntl/cpm

Have not figured out the read yet.
jacotton
Member
Posts: 89
Joined: Fri Nov 24, 2017 1:35 am

Post by jacotton »

adding this snip of code to my program, got the read working.
I think there is a bug in the fc->use flag management.

fc = &_fcb[Phys_in];
fc->use = U_RDR;
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Thanks for the investigation. DEVICES was disabled because it caused all sorts of problems with zxcc.

Having poked around in the CPM fcntl a few weeks ago I'm not happy with it at all and can feel a rewrite coming on.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

jacotton wrote:This is another issue (maybe), in setfcb the
fc->use flag is set to I+U_CON in the read code we are checking for
U_RDR. Does that get changed somewhere behind the curtains.
This looks okay, i = 1 for RDR:, so that should be 1 + 4 = 5 = U_RDR
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

To make things easier, I've created a separate library for fileio with devices - just link with -lcpmdevice and that version of fileio will be used in preference to the simple version. I'm can't remember what the issue with zxcc was, but it seems to have disappeared now.

I'll test RDR etc with yaze in the next few days.
Post Reply