pass in Entry instead of ipid.

This commit is contained in:
Kelvin Sherlock 2012-05-05 01:08:06 -04:00
parent 12c3d22853
commit 94c54160d8
2 changed files with 6 additions and 22 deletions

16
mread.c
View File

@ -8,11 +8,10 @@
#pragma optimize 79
// called through GSOS.
int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
int mread(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
{
rrBuff rr;
Entry *e;
int xerrno = 0;
LongWord count;
LongWord timeout;
@ -24,19 +23,12 @@ int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
*(LongWord *)p2 = 0;
e = find_entry(ipid);
if (!e)
{
return EBADF;
}
count = e->_RCVLOWAT;
if (count > nbytes) count = nbytes;
// call immediately if possible, otherwise queue it up.
IncBusy();
terr = TCPIPStatusTCP(ipid, &e->sr);
terr = TCPIPStatusTCP(e->ipid, &e->sr);
t = _toolErr;
DecBusy();
if (t) terr = t;
@ -56,7 +48,7 @@ int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
if (count)
{
IncBusy();
terr = TCPIPReadTCP(ipid, 0, (Ref)buffer, count, &rr);
terr = TCPIPReadTCP(e->ipid, 0, (Ref)buffer, count, &rr);
t = _toolErr;
DecBusy();
if (t) terr = t;
@ -103,7 +95,7 @@ int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
if (count)
{
IncBusy();
terr = TCPIPReadTCP(ipid, 0, (Ref)buffer, count, &rr);
terr = TCPIPReadTCP(e->ipid, 0, (Ref)buffer, count, &rr);
t = _toolErr;
DecBusy();

View File

@ -8,9 +8,8 @@
#pragma optimize 79
// called through GSOS.
int mwrite(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
int mwrite(Entry *e, void *p1, void *p2, void *p3, void *p4, void *p5)
{
Entry *e;
Word terr;
Word t;
int xerrno;
@ -20,21 +19,14 @@ int mwrite(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
*(LongWord *)p2 = 0;
e = find_entry(ipid);
if (!e)
{
return EBADF;
}
// todo -- queue up if pending >= _SNDLOWAT?
// todo -- push?
IncBusy();
terr = TCPIPWriteTCP(ipid, buffer, nbytes, 0, 0);
terr = TCPIPWriteTCP(e->ipid, buffer, nbytes, 0, 0);
t = _toolErr;
DecBusy();
if (t) terr = t;
if (t || terr == tcperrBadConnection)