fix select support.

This commit is contained in:
Kelvin Sherlock 2012-05-11 22:47:09 -04:00
parent 6eebad7335
commit 5048a815ea
2 changed files with 16 additions and 0 deletions

View File

@ -12,6 +12,8 @@ enum {
kCommandAbortAndLogout
};
typedef void (*selwakeupfx)(int collision, int pid);
typedef struct Entry {
struct Entry *next;
@ -25,6 +27,16 @@ typedef struct Entry {
LongWord cookie;
LongWord timeout;
Word socket_type;
// select magic.
selwakeupfx select_fx;
int select_rd_pid;
int select_wr_pid;
unsigned select_rd_collision:1;
unsigned select_wr_collision:1;
// shutdown(2)
unsigned _SHUT_RD:1;
unsigned _SHUT_WR:1;

View File

@ -16,6 +16,7 @@ int mattach(int type, void *p1, void *p2, void *p3, void *p4, void *p5)
Entry *e;
// p2 = selwakeup.
selwakeupfx fx = (selwakeupfx)p2;
int protocol = *(int *)p3;
if (Debug > 0)
@ -42,6 +43,9 @@ int mattach(int type, void *p1, void *p2, void *p3, void *p4, void *p5)
TCPIPLogout(ipid);
return ENOMEM;
}
e->select_fx = fx;
e->socket_type = type;
*(Word *)p1 = ipid;
return 0;