From 5048a815ead6e1b8199e298213087619296955a3 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Fri, 11 May 2012 22:47:09 -0400 Subject: [PATCH] fix select support. --- marignotti.h | 12 ++++++++++++ mattach.c | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/marignotti.h b/marignotti.h index 07d7c3b..89d8545 100644 --- a/marignotti.h +++ b/marignotti.h @@ -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; diff --git a/mattach.c b/mattach.c index 1701a61..e88c0ed 100644 --- a/mattach.c +++ b/mattach.c @@ -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;