rogerson@PEDEV.Columbia.NCR.COM (Dale Rogerson) (04/08/89)
I have been trying to port an X-Window application to our Tower systems (Unix System V). The application (xpaint) uses the structure fd_set and fds_bits in one of the modules. How are these structures defined? I can not find a header file with them in it. Also, the program wants to link with LibXmu.a which we do not seem to have nor can I find it in any of our documentation. Any help would be nice. Danke Sehr -----Dale Rogerson-----
mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (04/08/89)
> I have been trying to port an X-Window application to our Tower > systems (Unix System V). The application (xpaint) uses the structure > fd_set and fds_bits in one of the modules. How are these structures > defined? I can not find a header file with them in it. If your system is a pure SysV, that's understandable: you don't have it. These are used on BSD with the select() syscall, which I understand doesn't exist on SV (though the functionality is useful enough that it's appearing in various forms, sometimes as select() on systems "with BSD extensions", sometimes as native things (the name "poll" comes to mind)). If you don't have a select() syscall, it isn't going to work even if you do paper over the missing fd_set definition. If you have select() but not fd_set, it's probably the 4.2 select() interface, which uses a simple int for the mask. Rather than describe how to modify the select() call, I'll simply give you this, which you include at the top of your file (but after most other includes): #! /bin/sh # # Shar: Shell Archiver # # This archive created Fri Apr 7 22:46:18 1989 # Run this through sh to create: # broken-select.h echo x - broken-select.h \(516 characters\) sed 's/^X//' > broken-select.h << \EOF X#ifndef FD_SETSIZE X X/* We presumably have a system without the 4.3 fd_set stuff. X This includes Suns which have a typedef for fd_set but none X of the associated baggage like FD_SET, FD_CLR, etc. */ X X#define fd_set fixed_fd_set Xtypedef struct { X int fds[1]; X } fixed_fd_set; X#define FD_SETSIZE (8*sizeof(int)) X#define FD_SET(fd,set) ((set)->fds[0]|=(1<<(fd))) X#define FD_CLR(fd,set) ((set)->fds[0]&=~(1<<(fd))) X#define FD_ISSET(fd,set) ((set)->fds[0]&(1<<(fd))) X#define FD_ZERO(set) ((set)->fds[0]=0) X X#endif EOF if test 516 -ne "`wc -c broken-select.h`" then echo shar: error transmitting broken-select.h \(should have been 516 characters\) fi exit 0 # end of shell archive This is slightly unclean, but it works. Lint probably won't like it, and it does assume that (a) pointer-to-int "looks the same as" pointer-to-structure-containing-array[1]-of-int and (b) the sizeof unit is 8 bits wide (things which are "traditionally" true, though I don't know whether your Tower fits the flat-address-space model, as most "traditional" machines do). I just include the above file and then write my select() calls as if I were on 4.3. > Also, the program wants to link with LibXmu.a which we do not seem to > have nor can I find it in any of our documentation. Can't help you there. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu (I hope you get this; the From: address looked slightly dubious. I'm sending a cc to xpert as well, so you may get two copies.)