mirror of
https://github.com/ksherlock/marignotti.git
synced 2024-12-11 17:51:04 +00:00
pass in Entry instead of ipid.
This commit is contained in:
parent
12c3d22853
commit
94c54160d8
16
mread.c
16
mread.c
@ -8,11 +8,10 @@
|
|||||||
#pragma optimize 79
|
#pragma optimize 79
|
||||||
|
|
||||||
// called through GSOS.
|
// 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;
|
rrBuff rr;
|
||||||
|
|
||||||
Entry *e;
|
|
||||||
int xerrno = 0;
|
int xerrno = 0;
|
||||||
LongWord count;
|
LongWord count;
|
||||||
LongWord timeout;
|
LongWord timeout;
|
||||||
@ -24,19 +23,12 @@ int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
|
|||||||
*(LongWord *)p2 = 0;
|
*(LongWord *)p2 = 0;
|
||||||
|
|
||||||
|
|
||||||
e = find_entry(ipid);
|
|
||||||
|
|
||||||
if (!e)
|
|
||||||
{
|
|
||||||
return EBADF;
|
|
||||||
}
|
|
||||||
|
|
||||||
count = e->_RCVLOWAT;
|
count = e->_RCVLOWAT;
|
||||||
if (count > nbytes) count = nbytes;
|
if (count > nbytes) count = nbytes;
|
||||||
|
|
||||||
// call immediately if possible, otherwise queue it up.
|
// call immediately if possible, otherwise queue it up.
|
||||||
IncBusy();
|
IncBusy();
|
||||||
terr = TCPIPStatusTCP(ipid, &e->sr);
|
terr = TCPIPStatusTCP(e->ipid, &e->sr);
|
||||||
t = _toolErr;
|
t = _toolErr;
|
||||||
DecBusy();
|
DecBusy();
|
||||||
if (t) terr = t;
|
if (t) terr = t;
|
||||||
@ -56,7 +48,7 @@ int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
|
|||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
IncBusy();
|
IncBusy();
|
||||||
terr = TCPIPReadTCP(ipid, 0, (Ref)buffer, count, &rr);
|
terr = TCPIPReadTCP(e->ipid, 0, (Ref)buffer, count, &rr);
|
||||||
t = _toolErr;
|
t = _toolErr;
|
||||||
DecBusy();
|
DecBusy();
|
||||||
if (t) terr = t;
|
if (t) terr = t;
|
||||||
@ -103,7 +95,7 @@ int mread(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
|
|||||||
if (count)
|
if (count)
|
||||||
{
|
{
|
||||||
IncBusy();
|
IncBusy();
|
||||||
terr = TCPIPReadTCP(ipid, 0, (Ref)buffer, count, &rr);
|
terr = TCPIPReadTCP(e->ipid, 0, (Ref)buffer, count, &rr);
|
||||||
t = _toolErr;
|
t = _toolErr;
|
||||||
DecBusy();
|
DecBusy();
|
||||||
|
|
||||||
|
12
mwrite.c
12
mwrite.c
@ -8,9 +8,8 @@
|
|||||||
#pragma optimize 79
|
#pragma optimize 79
|
||||||
|
|
||||||
// called through GSOS.
|
// 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 terr;
|
||||||
Word t;
|
Word t;
|
||||||
int xerrno;
|
int xerrno;
|
||||||
@ -20,21 +19,14 @@ int mwrite(int ipid, void *p1, void *p2, void *p3, void *p4, void *p5)
|
|||||||
|
|
||||||
*(LongWord *)p2 = 0;
|
*(LongWord *)p2 = 0;
|
||||||
|
|
||||||
e = find_entry(ipid);
|
|
||||||
|
|
||||||
if (!e)
|
|
||||||
{
|
|
||||||
return EBADF;
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo -- queue up if pending >= _SNDLOWAT?
|
// todo -- queue up if pending >= _SNDLOWAT?
|
||||||
// todo -- push?
|
// todo -- push?
|
||||||
|
|
||||||
IncBusy();
|
IncBusy();
|
||||||
terr = TCPIPWriteTCP(ipid, buffer, nbytes, 0, 0);
|
terr = TCPIPWriteTCP(e->ipid, buffer, nbytes, 0, 0);
|
||||||
t = _toolErr;
|
t = _toolErr;
|
||||||
DecBusy();
|
DecBusy();
|
||||||
|
|
||||||
if (t) terr = t;
|
if (t) terr = t;
|
||||||
|
|
||||||
if (t || terr == tcperrBadConnection)
|
if (t || terr == tcperrBadConnection)
|
||||||
|
Loading…
Reference in New Issue
Block a user