john@jwt.UUCP (John Temples) (02/01/91)
I'm trying to port TinyMUD to System V/386. This program was originally written on a BSD system and then ported to Xenix. Then Xenix version uses FIFOs in place of the BSD sockets. Everything seems to compile fine under System V, except I don't have sys/select.h and a group of macros I assume are in it: FD_SETSIZE, FD_ISSET, FD_SET, FD_CLR, and FD_ZERO. There's also a missing typedef for "fd_set". Has anyone already ported this program to System V, or can you point me to a System V equivalent for these Xenix functions? -- John W. Temples -- john@jwt.UUCP (uunet!jwt!john)
allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) (02/06/91)
As quoted from <1991Jan31.224424.27733@jwt.UUCP> by john@jwt.UUCP (John Temples): +--------------- | macros I assume are in it: FD_SETSIZE, FD_ISSET, FD_SET, FD_CLR, and | FD_ZERO. There's also a missing typedef for "fd_set". Has anyone | already ported this program to System V, or can you point me to a | System V equivalent for these Xenix functions? +--------------- They came from 4.3BSD, and as such are publicly available e.g. on uunet. But here's a simplistic version that will serve: #include <sys/param.h> #ifndef NBPL #define NBPL (sizeof (long) * 8) #endif #define FD_SETSIZE NOFILE typedef long fd_set[(FD_SETSIZE + NBPL - 1) / NBPL]; #define FD_SET(fd,p) ((p)[(fd) / NBPL] |= (1 << ((fd) % NBPL))) #define FD_CLR(fd,p) ((p)[(fd) / NBPL] &= ~(1 << ((fd) % NBPL))) #define FD_ISSET(fd,p) ((p)[(fd) / NBPL] & (1 << ((fd) % NBPL))) (Note: these are not necessarily the fastest way to do it.) BTW: they may be defined somewhere else on the system. But if they aren't, chances are the compile will eventually fail with a missing symbol "select". If so, you may be able to use poll (look for poll(S) or poll(2), depending on whether the manuals have been screwed with or not); it doesn't use these macros, but you may be able to write a select() based on poll(). If not, you're out of luck. Not all System Vs have networking built in. ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY