From 94c54160d8761e9195c228325d253b2dd1fbd869 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Sat, 5 May 2012 01:08:06 -0400 Subject: [PATCH] pass in Entry instead of ipid. --- mread.c | 16 ++++------------ mwrite.c | 12 ++---------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/mread.c b/mread.c index 4a21bb7..4e3d28c 100644 --- a/mread.c +++ b/mread.c @@ -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(); diff --git a/mwrite.c b/mwrite.c index 78ea502..81714fa 100644 --- a/mwrite.c +++ b/mwrite.c @@ -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)