home *** CD-ROM | disk | FTP | other *** search
- 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
- From: matt@bacchus.esa.OZ.AU (Matthew Atterbury)
- Newsgroups: comp.unix.sysv386
- Subject: Re: Question about fd_set
- Message-ID: <MATT.92Nov5170055@raven.bacchus.esa.OZ.AU>
- Date: 5 Nov 92 07:00:55 GMT
- References: <1386@minya.UUCP>
- Sender: matt@bacchus.esa.oz.au (Matthew Atterbury)
- Organization: Expert Solutions Australia.
- Lines: 27
- In-Reply-To: jc@minya.UUCP's message of 3 Nov 92 20:02:01 GMT
-
- In article <1386@minya.UUCP> jc@minya.UUCP (John Chambers) writes:
- >
- > The obvious thing is a bcopy() from one fd_set variable to another,
- > but it's not obvious that this would even work, or if it did, it might
- > not on the next release. Putting on my language-lawyer hat, I observe
- > that there seems to be no grounds to assume that an fd_set variable
- > isn't a pointer, for instance, and sizeof(fd_set) could very well be 4
- > in some implementations (with the FD_*() routines mallocing space as
- > needed). Thus bcopy() might not copy all the bits, but only the
- > pointers to the bits, with a disaster as select() indirects on them
- > and zaps the "real" bits.
-
- Theoretically yes, but select does take fd_set*'s not fd_set's so
- it is a _reasonable_ assumption that an fd_set is a structure and
- not a pointer. We always just use:
- fd_set1 = fd_set2;
- or
- bcopy((char*) &fdset2, (char*) &fdset1, sizeof(fdset1));
-
- Since you would have to change if/when FD_COPY is defined, I would
- suggest you go as far as you can now and use the FD_ macros and
- direct assignment, possibly flagging it with a comment. cheers ...
- --
- -------------------------------------------------------------------------------
- Matt Atterbury [matt@bacchus.esa.oz.au] Expert Solutions Australia, Melbourne
- UUCP: ...!uunet!munnari!matt@bacchus.esa.oz.au "klaatu barada nikto"
- ARPA: ...!uunet!murtoa!bacchus.esa.oz.au!matt "consider this a divorce"
-