home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / sysv386 / 16274 < prev    next >
Encoding:
Internet Message Format  |  1992-11-06  |  2.0 KB

  1. Path: sparky!uunet!portal!lll-winken!cert!netnews.upenn.edu!cs.widener.edu!hela.iti.org!usc!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!munnari.oz.au!mel.dit.csiro.au!yarra!bacchus!matt
  2. From: matt@bacchus.esa.OZ.AU (Matthew Atterbury)
  3. Newsgroups: comp.unix.sysv386
  4. Subject: Re: Question about fd_set
  5. Message-ID: <MATT.92Nov5170055@raven.bacchus.esa.OZ.AU>
  6. Date: 5 Nov 92 07:00:55 GMT
  7. References: <1386@minya.UUCP>
  8. Sender: matt@bacchus.esa.oz.au (Matthew Atterbury)
  9. Organization: Expert Solutions Australia.
  10. Lines: 27
  11. In-Reply-To: jc@minya.UUCP's message of 3 Nov 92 20:02:01 GMT
  12.  
  13. In article <1386@minya.UUCP> jc@minya.UUCP (John Chambers) writes:
  14. > The obvious thing is a bcopy() from one fd_set  variable  to  another,
  15. > but it's not obvious that this would even work, or if it did, it might
  16. > not on the next release.  Putting on my language-lawyer hat, I observe
  17. > that  there  seems  to be no grounds to assume that an fd_set variable
  18. > isn't a pointer, for instance, and sizeof(fd_set) could very well be 4
  19. > in  some  implementations (with the FD_*() routines mallocing space as
  20. > needed).  Thus bcopy() might not copy  all  the  bits,  but  only  the
  21. > pointers  to  the  bits, with a disaster as select() indirects on them
  22. > and zaps the "real" bits.
  23.  
  24.     Theoretically yes, but select does take fd_set*'s not fd_set's so
  25.     it is a _reasonable_ assumption that an fd_set is a structure and
  26.     not a pointer. We always just use:
  27.         fd_set1 = fd_set2;
  28.     or
  29.         bcopy((char*) &fdset2, (char*) &fdset1, sizeof(fdset1));
  30.  
  31.     Since you would have to change if/when FD_COPY is defined, I would
  32.     suggest you go as far as you can now and use the FD_ macros and
  33.     direct assignment, possibly flagging it with a comment. cheers ...
  34. -- 
  35. -------------------------------------------------------------------------------
  36. Matt Atterbury [matt@bacchus.esa.oz.au]   Expert Solutions Australia, Melbourne
  37. UUCP: ...!uunet!munnari!matt@bacchus.esa.oz.au            "klaatu barada nikto"
  38. ARPA: ...!uunet!murtoa!bacchus.esa.oz.au!matt         "consider this a divorce"
  39.